@@ -45,9 +45,11 @@ ur_exp_command_buffer_handle_t_::getWaitListView(
45
45
46
46
ur_exp_command_buffer_handle_t_::ur_exp_command_buffer_handle_t_ (
47
47
ur_context_handle_t context, ur_device_handle_t device,
48
- ze_command_list_handle_t commandList,
48
+ v2::raii::command_list_unique_handle && commandList,
49
49
const ur_exp_command_buffer_desc_t *desc)
50
- : context(context), device(device), zeCommandList(commandList),
50
+ : context(context), device(device),
51
+ zeCommandList(
52
+ std::forward<v2::raii::command_list_unique_handle>(commandList)),
51
53
isUpdatable(desc ? desc->isUpdatable : false ) {
52
54
UR_CALL_THROWS (ur::level_zero::urContextRetain (context));
53
55
UR_CALL_THROWS (ur::level_zero::urDeviceRetain (device));
@@ -115,10 +117,16 @@ urCommandBufferCreateExp(ur_context_handle_t context, ur_device_handle_t device,
115
117
UR_RESULT_ERROR_UNSUPPORTED_FEATURE);
116
118
}
117
119
118
- ze_command_list_handle_t zeCommandList = nullptr ;
119
- UR_CALL (createMainCommandList (context, device, isUpdatable, zeCommandList));
120
+ using queue_group_type = ur_device_handle_t_::queue_group_info_t ::type;
121
+ uint32_t queueGroupOrdinal =
122
+ device->QueueGroup [queue_group_type::Compute].ZeOrdinal ;
123
+ v2::raii::command_list_unique_handle zeCommandList =
124
+ context->commandListCache .getRegularCommandList (
125
+ device->ZeDevice , true , queueGroupOrdinal, true );
126
+
120
127
*commandBuffer = new ur_exp_command_buffer_handle_t_ (
121
- context, device, zeCommandList, commandBufferDesc);
128
+ context, device, std::move (zeCommandList), commandBufferDesc);
129
+
122
130
} catch (const std::bad_alloc &) {
123
131
return exceptionToResult (std::current_exception ());
124
132
}
0 commit comments