Skip to content

Commit

Permalink
[EXP][Command-Buffer] Add kernel command update
Browse files Browse the repository at this point in the history
This change introduces a new API that allows the
kernel commands of a command-buffer to be updated
with a new configuration. For example, modified
arguments or ND-Range. The only implemented adapter
is CUDA.

See
[cl_khr_command_buffer_mutable_dispatch](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#cl_khr_command_buffer_mutable_dispatch)
as prior art. The differences between the proposed API and the above
are:

* Only the append kernel entry-point returns a command handle. I imagine
  this will be changed in future to enable other commands to do update.
* Only USM and buffer arguments can be updated, there is not equivalent
  update struct for `urKernelSetArgLocal`, `urKernelSetArgValue`, or
  `urKernelSetArgSampler`
* There is no granularity of optional support for update, an implementer
  must either implement all the ways to update a kernel configuration,
  or none of them.
  • Loading branch information
EwanC committed Dec 19, 2023
1 parent c90c8be commit ee4c23d
Show file tree
Hide file tree
Showing 21 changed files with 1,720 additions and 592 deletions.
338 changes: 232 additions & 106 deletions include/ur_api.h

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendKernelLaunchExp_t)(
const size_t *,
uint32_t,
const ur_exp_command_buffer_sync_point_t *,
ur_exp_command_buffer_sync_point_t *);
ur_exp_command_buffer_sync_point_t *,
ur_exp_command_buffer_command_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urCommandBufferAppendUSMMemcpyExp
Expand Down Expand Up @@ -2010,6 +2011,12 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferEnqueueExp_t)(
const ur_event_handle_t *,
ur_event_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urCommandBufferUpdateKernelLaunchExp
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateKernelLaunchExp_t)(
ur_exp_command_buffer_command_handle_t,
const ur_exp_command_buffer_update_kernel_launch_desc_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Table of CommandBufferExp functions pointers
typedef struct ur_command_buffer_exp_dditable_t {
Expand All @@ -2030,6 +2037,7 @@ typedef struct ur_command_buffer_exp_dditable_t {
ur_pfnCommandBufferAppendUSMPrefetchExp_t pfnAppendUSMPrefetchExp;
ur_pfnCommandBufferAppendUSMAdviseExp_t pfnAppendUSMAdviseExp;
ur_pfnCommandBufferEnqueueExp_t pfnEnqueueExp;
ur_pfnCommandBufferUpdateKernelLaunchExp_t pfnUpdateKernelLaunchExp;
} ur_command_buffer_exp_dditable_t;

///////////////////////////////////////////////////////////////////////////////
Expand Down
Loading

0 comments on commit ee4c23d

Please sign in to comment.