Skip to content

Commit f5d5b1f

Browse files
committed
[EXP][Command-Buffer] Add kernel command update
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 new API is defined in the following files and then source generated using scripts, so reviewers should look at: * `scripts/core/EXP-COMMAND-BUFFER.rst` * `scripts/core/exp-command-buffer.yml` 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. * USM, buffer, and scalar arguments can be updated, there is not equivalent update struct for `urKernelSetArgLocal` 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. The CUDA adapter is the only adapter that currently implements this new feature, other adapters don't report support. This is because CUDA is already an adapter supported by UR command-buffers, and the CUDA API for updating nodes already exists as a non-optional feature. Reviewers should review the changes in `source/adapters/cuda/` to evaluate this, CTS tests are written to verify implementation, as there is not yet a DPC++ feature with testing to stress the code path (see reble/llvm#340 for how that feature could look). A new test directory has been created to test the command-buffer experimental feature, `test/conformance/exp_command_buffer`, which contains tests to stress using the feature defined by this extension so that it has code coverage. Reviewers should look at the new tests added here, and new device kernels in `test/conformance/device_code` to evaluate these changes.
1 parent 5d58871 commit f5d5b1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3513
-592
lines changed

include/ur_api.h

Lines changed: 244 additions & 106 deletions
Large diffs are not rendered by default.

include/ur_ddi.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendKernelLaunchExp_t)(
18531853
const size_t *,
18541854
uint32_t,
18551855
const ur_exp_command_buffer_sync_point_t *,
1856-
ur_exp_command_buffer_sync_point_t *);
1856+
ur_exp_command_buffer_sync_point_t *,
1857+
ur_exp_command_buffer_command_handle_t *);
18571858

18581859
///////////////////////////////////////////////////////////////////////////////
18591860
/// @brief Function-pointer for urCommandBufferAppendUSMMemcpyExp
@@ -2010,6 +2011,12 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferEnqueueExp_t)(
20102011
const ur_event_handle_t *,
20112012
ur_event_handle_t *);
20122013

2014+
///////////////////////////////////////////////////////////////////////////////
2015+
/// @brief Function-pointer for urCommandBufferUpdateKernelLaunchExp
2016+
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateKernelLaunchExp_t)(
2017+
ur_exp_command_buffer_command_handle_t,
2018+
const ur_exp_command_buffer_update_kernel_launch_desc_t *);
2019+
20132020
///////////////////////////////////////////////////////////////////////////////
20142021
/// @brief Table of CommandBufferExp functions pointers
20152022
typedef struct ur_command_buffer_exp_dditable_t {
@@ -2030,6 +2037,7 @@ typedef struct ur_command_buffer_exp_dditable_t {
20302037
ur_pfnCommandBufferAppendUSMPrefetchExp_t pfnAppendUSMPrefetchExp;
20312038
ur_pfnCommandBufferAppendUSMAdviseExp_t pfnAppendUSMAdviseExp;
20322039
ur_pfnCommandBufferEnqueueExp_t pfnEnqueueExp;
2040+
ur_pfnCommandBufferUpdateKernelLaunchExp_t pfnUpdateKernelLaunchExp;
20332041
} ur_command_buffer_exp_dditable_t;
20342042

20352043
///////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)