@@ -173,7 +173,14 @@ ${X}_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP query.
173173Updating kernel commands is done by passing the new kernel configuration
174174to ${x}CommandBufferUpdateKernelLaunchExp along with the command handle of
175175the kernel command to update. Configurations that can be changed are the
176- parameters to the kernel and the execution ND-Range.
176+ kernel handle, the parameters to the kernel and the execution ND-Range.
177+
178+ To update the kernel handle, it is necessary to first register the new
179+ kernel handle before the command-buffer is finalized. This can be done
180+ using the ``phKernelAlternatives `` parameter of
181+ ${x}CommandBufferUpdateKernelLaunchExp. The command-buffer can then
182+ be updated to use the new kernel handle by passing it to
183+ ${x}CommandBufferUpdateKernelLaunchExp.
177184
178185.. parsed-literal ::
179186
@@ -187,12 +194,14 @@ parameters to the kernel and the execution ND-Range.
187194 ${x}CommandBufferCreateExp(hContext, hDevice, &desc, &hCommandBuffer);
188195
189196 // Append a kernel command which has two buffer parameters, an input
190- // and an output.
197+ // and an output. Register hNewKernel as an alternative kernel handle
198+ // which can later be used to change the kernel handle associated
199+ // with this command.
191200 ${x}_exp_command_buffer_command_handle_t hCommand;
192201 ${x}CommandBufferAppendKernelLaunchExp(hCommandBuffer, hKernel, workDim,
193202 pGlobalWorkOffset, pGlobalWorkSize,
194- pLocalWorkSize, 0, nullptr, 0, nullptr ,
195- nullptr, &hCommand);
203+ pLocalWorkSize, 1, &hNewKernel ,
204+ 0, nullptr, nullptr, &hCommand);
196205
197206 // Close the command-buffer before updating
198207 ${x}CommandBufferFinalizeExp(hCommandBuffer);
@@ -220,7 +229,7 @@ parameters to the kernel and the execution ND-Range.
220229 ${x}_exp_command_buffer_update_kernel_launch_desc_t update {
221230 UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype
222231 nullptr, // pNext
223- hKernel //hNewKernel
232+ hNewKernel // hNewKernel
224233 2, // numNewMemobjArgs
225234 0, // numNewPointerArgs
226235 0, // numNewValueArgs
0 commit comments