@@ -156,15 +156,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
156
156
cl_mutable_command_khr *OutCommandHandle =
157
157
hCommandBuffer->IsUpdatable ? &CommandHandle : nullptr ;
158
158
159
- cl_ndrange_kernel_command_properties_khr UpdateProperties[] = {
159
+ cl_command_properties_khr UpdateProperties[] = {
160
160
CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR,
161
161
CL_MUTABLE_DISPATCH_GLOBAL_OFFSET_KHR |
162
162
CL_MUTABLE_DISPATCH_GLOBAL_SIZE_KHR |
163
163
CL_MUTABLE_DISPATCH_LOCAL_SIZE_KHR |
164
164
CL_MUTABLE_DISPATCH_ARGUMENTS_KHR | CL_MUTABLE_DISPATCH_EXEC_INFO_KHR,
165
165
0 };
166
166
167
- cl_ndrange_kernel_command_properties_khr *Properties =
167
+ cl_command_properties_khr *Properties =
168
168
hCommandBuffer->IsUpdatable ? UpdateProperties : nullptr ;
169
169
CL_RETURN_ON_FAILURE (clCommandNDRangeKernelKHR (
170
170
hCommandBuffer->CLCommandBuffer , nullptr , Properties,
@@ -176,8 +176,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
176
176
auto URCommandHandle =
177
177
std::make_unique<ur_exp_command_buffer_command_handle_t_>(
178
178
hCommandBuffer, CommandHandle, workDim, pLocalWorkSize != nullptr );
179
- *phCommandHandle = URCommandHandle.release ();
180
- hCommandBuffer->CommandHandles .push_back (*phCommandHandle);
179
+ ur_exp_command_buffer_command_handle_t Handle = URCommandHandle.release ();
180
+ hCommandBuffer->CommandHandles .push_back (Handle);
181
+ if (phCommandHandle) {
182
+ *phCommandHandle = Handle;
183
+ }
181
184
} catch (...) {
182
185
return UR_RESULT_ERROR_OUT_OF_RESOURCES;
183
186
}
@@ -222,7 +225,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp(
222
225
cl_ext::CommandCopyBufferName, &clCommandCopyBufferKHR));
223
226
224
227
CL_RETURN_ON_FAILURE (clCommandCopyBufferKHR (
225
- hCommandBuffer->CLCommandBuffer , nullptr ,
228
+ hCommandBuffer->CLCommandBuffer , nullptr , nullptr ,
226
229
cl_adapter::cast<cl_mem>(hSrcMem), cl_adapter::cast<cl_mem>(hDstMem),
227
230
srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList,
228
231
pSyncPoint, nullptr ));
@@ -256,7 +259,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp(
256
259
cl_ext::CommandCopyBufferRectName, &clCommandCopyBufferRectKHR));
257
260
258
261
CL_RETURN_ON_FAILURE (clCommandCopyBufferRectKHR (
259
- hCommandBuffer->CLCommandBuffer , nullptr ,
262
+ hCommandBuffer->CLCommandBuffer , nullptr , nullptr ,
260
263
cl_adapter::cast<cl_mem>(hSrcMem), cl_adapter::cast<cl_mem>(hDstMem),
261
264
OpenCLOriginRect, OpenCLDstRect, OpenCLRegion, srcRowPitch, srcSlicePitch,
262
265
dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList,
@@ -274,9 +277,6 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp(
274
277
[[maybe_unused]] const ur_exp_command_buffer_sync_point_t
275
278
*pSyncPointWaitList,
276
279
[[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) {
277
-
278
- cl_adapter::die (" Experimental Command-buffer feature is not "
279
- " implemented for OpenCL adapter." );
280
280
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
281
281
}
282
282
@@ -343,7 +343,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp(
343
343
cl_ext::CommandFillBufferName, &clCommandFillBufferKHR));
344
344
345
345
CL_RETURN_ON_FAILURE (clCommandFillBufferKHR (
346
- hCommandBuffer->CLCommandBuffer , nullptr ,
346
+ hCommandBuffer->CLCommandBuffer , nullptr , nullptr ,
347
347
cl_adapter::cast<cl_mem>(hBuffer), pPattern, patternSize, offset, size,
348
348
numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint, nullptr ));
349
349
@@ -556,8 +556,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
556
556
cl_mutable_command_khr command =
557
557
cl_adapter::cast<cl_mutable_command_khr>(hCommand->CLMutableCommand );
558
558
cl_mutable_dispatch_config_khr dispatch_config = {
559
- CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR,
560
- nullptr ,
561
559
command,
562
560
static_cast <cl_uint>(CLArgs.size ()), // num_args
563
561
static_cast <cl_uint>(CLUSMArgs.size ()), // num_svm_args
@@ -570,10 +568,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
570
568
CLGlobalWorkSize.data (), // global_work_size
571
569
CLLocalWorkSize.data (), // local_work_size
572
570
};
573
- cl_mutable_base_config_khr config = {
574
- CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr , 1 , &dispatch_config};
575
- CL_RETURN_ON_FAILURE (
576
- clUpdateMutableCommandsKHR (hCommandBuffer->CLCommandBuffer , &config));
571
+ cl_uint num_configs = 1 ;
572
+ cl_command_buffer_update_type_khr config_types[1 ] = {
573
+ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR};
574
+ const void *configs[1 ] = {&dispatch_config};
575
+ CL_RETURN_ON_FAILURE (clUpdateMutableCommandsKHR (
576
+ hCommandBuffer->CLCommandBuffer , num_configs, config_types, configs));
577
577
578
578
return UR_RESULT_SUCCESS;
579
579
}
0 commit comments