Skip to content

Commit 90d1d7d

Browse files
author
Ewan Crawford
committed
Add event update to command-buffers.
Expand the command-buffer experimental feature API so that it can be used to implement [SYCL-Graph dynamic events](reble/llvm#372). This involves extending each command append entry-point to include the following extra parameters: * An output `ur_exp_command_buffer_command_handle_t`. * An Input `ur_event_handle_t` event wait-list of dependent events. * An output `ur_event_handle_t` event that is signaled when the command completes its next execution. New entry-points are also added to update the wait-list and signal event parameters of commands: * `urCommandBufferUpdateSignalEventExp` * `urCommandBufferUpdateWaitEventsExp` For this commit the implementation of these new APIs is stubbed out. Implementing the APIs for at least one adapter and adding new UR CTS tests will be follow-on work.
1 parent a985a81 commit 90d1d7d

34 files changed

+4285
-404
lines changed

include/ur_api.h

Lines changed: 336 additions & 32 deletions
Large diffs are not rendered by default.

include/ur_ddi.h

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,10 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendKernelLaunchExp_t)(
19221922
const size_t *,
19231923
uint32_t,
19241924
const ur_exp_command_buffer_sync_point_t *,
1925+
uint32_t,
1926+
const ur_event_handle_t *,
19251927
ur_exp_command_buffer_sync_point_t *,
1928+
ur_event_handle_t *,
19261929
ur_exp_command_buffer_command_handle_t *);
19271930

19281931
///////////////////////////////////////////////////////////////////////////////
@@ -1934,7 +1937,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMMemcpyExp_t)(
19341937
size_t,
19351938
uint32_t,
19361939
const ur_exp_command_buffer_sync_point_t *,
1937-
ur_exp_command_buffer_sync_point_t *);
1940+
uint32_t,
1941+
const ur_event_handle_t *,
1942+
ur_exp_command_buffer_sync_point_t *,
1943+
ur_event_handle_t *,
1944+
ur_exp_command_buffer_command_handle_t *);
19381945

19391946
///////////////////////////////////////////////////////////////////////////////
19401947
/// @brief Function-pointer for urCommandBufferAppendUSMFillExp
@@ -1946,7 +1953,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMFillExp_t)(
19461953
size_t,
19471954
uint32_t,
19481955
const ur_exp_command_buffer_sync_point_t *,
1949-
ur_exp_command_buffer_sync_point_t *);
1956+
uint32_t,
1957+
const ur_event_handle_t *,
1958+
ur_exp_command_buffer_sync_point_t *,
1959+
ur_event_handle_t *,
1960+
ur_exp_command_buffer_command_handle_t *);
19501961

19511962
///////////////////////////////////////////////////////////////////////////////
19521963
/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyExp
@@ -1959,7 +1970,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyExp_t)(
19591970
size_t,
19601971
uint32_t,
19611972
const ur_exp_command_buffer_sync_point_t *,
1962-
ur_exp_command_buffer_sync_point_t *);
1973+
uint32_t,
1974+
const ur_event_handle_t *,
1975+
ur_exp_command_buffer_sync_point_t *,
1976+
ur_event_handle_t *,
1977+
ur_exp_command_buffer_command_handle_t *);
19631978

19641979
///////////////////////////////////////////////////////////////////////////////
19651980
/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteExp
@@ -1971,7 +1986,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteExp_t)(
19711986
const void *,
19721987
uint32_t,
19731988
const ur_exp_command_buffer_sync_point_t *,
1974-
ur_exp_command_buffer_sync_point_t *);
1989+
uint32_t,
1990+
const ur_event_handle_t *,
1991+
ur_exp_command_buffer_sync_point_t *,
1992+
ur_event_handle_t *,
1993+
ur_exp_command_buffer_command_handle_t *);
19751994

19761995
///////////////////////////////////////////////////////////////////////////////
19771996
/// @brief Function-pointer for urCommandBufferAppendMemBufferReadExp
@@ -1983,7 +2002,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadExp_t)(
19832002
void *,
19842003
uint32_t,
19852004
const ur_exp_command_buffer_sync_point_t *,
1986-
ur_exp_command_buffer_sync_point_t *);
2005+
uint32_t,
2006+
const ur_event_handle_t *,
2007+
ur_exp_command_buffer_sync_point_t *,
2008+
ur_event_handle_t *,
2009+
ur_exp_command_buffer_command_handle_t *);
19872010

19882011
///////////////////////////////////////////////////////////////////////////////
19892012
/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyRectExp
@@ -2000,7 +2023,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyRectExp_t)
20002023
size_t,
20012024
uint32_t,
20022025
const ur_exp_command_buffer_sync_point_t *,
2003-
ur_exp_command_buffer_sync_point_t *);
2026+
uint32_t,
2027+
const ur_event_handle_t *,
2028+
ur_exp_command_buffer_sync_point_t *,
2029+
ur_event_handle_t *,
2030+
ur_exp_command_buffer_command_handle_t *);
20042031

20052032
///////////////////////////////////////////////////////////////////////////////
20062033
/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteRectExp
@@ -2017,7 +2044,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteRectExp_t
20172044
void *,
20182045
uint32_t,
20192046
const ur_exp_command_buffer_sync_point_t *,
2020-
ur_exp_command_buffer_sync_point_t *);
2047+
uint32_t,
2048+
const ur_event_handle_t *,
2049+
ur_exp_command_buffer_sync_point_t *,
2050+
ur_event_handle_t *,
2051+
ur_exp_command_buffer_command_handle_t *);
20212052

20222053
///////////////////////////////////////////////////////////////////////////////
20232054
/// @brief Function-pointer for urCommandBufferAppendMemBufferReadRectExp
@@ -2034,7 +2065,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadRectExp_t)
20342065
void *,
20352066
uint32_t,
20362067
const ur_exp_command_buffer_sync_point_t *,
2037-
ur_exp_command_buffer_sync_point_t *);
2068+
uint32_t,
2069+
const ur_event_handle_t *,
2070+
ur_exp_command_buffer_sync_point_t *,
2071+
ur_event_handle_t *,
2072+
ur_exp_command_buffer_command_handle_t *);
20382073

20392074
///////////////////////////////////////////////////////////////////////////////
20402075
/// @brief Function-pointer for urCommandBufferAppendMemBufferFillExp
@@ -2047,7 +2082,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)(
20472082
size_t,
20482083
uint32_t,
20492084
const ur_exp_command_buffer_sync_point_t *,
2050-
ur_exp_command_buffer_sync_point_t *);
2085+
uint32_t,
2086+
const ur_event_handle_t *,
2087+
ur_exp_command_buffer_sync_point_t *,
2088+
ur_event_handle_t *,
2089+
ur_exp_command_buffer_command_handle_t *);
20512090

20522091
///////////////////////////////////////////////////////////////////////////////
20532092
/// @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp
@@ -2058,7 +2097,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)(
20582097
ur_usm_migration_flags_t,
20592098
uint32_t,
20602099
const ur_exp_command_buffer_sync_point_t *,
2061-
ur_exp_command_buffer_sync_point_t *);
2100+
uint32_t,
2101+
const ur_event_handle_t *,
2102+
ur_exp_command_buffer_sync_point_t *,
2103+
ur_event_handle_t *,
2104+
ur_exp_command_buffer_command_handle_t *);
20622105

20632106
///////////////////////////////////////////////////////////////////////////////
20642107
/// @brief Function-pointer for urCommandBufferAppendUSMAdviseExp
@@ -2069,7 +2112,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)(
20692112
ur_usm_advice_flags_t,
20702113
uint32_t,
20712114
const ur_exp_command_buffer_sync_point_t *,
2072-
ur_exp_command_buffer_sync_point_t *);
2115+
uint32_t,
2116+
const ur_event_handle_t *,
2117+
ur_exp_command_buffer_sync_point_t *,
2118+
ur_event_handle_t *,
2119+
ur_exp_command_buffer_command_handle_t *);
20732120

20742121
///////////////////////////////////////////////////////////////////////////////
20752122
/// @brief Function-pointer for urCommandBufferEnqueueExp
@@ -2096,6 +2143,19 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateKernelLaunchExp_t)(
20962143
ur_exp_command_buffer_command_handle_t,
20972144
const ur_exp_command_buffer_update_kernel_launch_desc_t *);
20982145

2146+
///////////////////////////////////////////////////////////////////////////////
2147+
/// @brief Function-pointer for urCommandBufferUpdateSignalEventExp
2148+
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateSignalEventExp_t)(
2149+
ur_exp_command_buffer_command_handle_t,
2150+
ur_event_handle_t *);
2151+
2152+
///////////////////////////////////////////////////////////////////////////////
2153+
/// @brief Function-pointer for urCommandBufferUpdateWaitEventsExp
2154+
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateWaitEventsExp_t)(
2155+
ur_exp_command_buffer_command_handle_t,
2156+
uint32_t,
2157+
const ur_event_handle_t *);
2158+
20992159
///////////////////////////////////////////////////////////////////////////////
21002160
/// @brief Function-pointer for urCommandBufferGetInfoExp
21012161
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferGetInfoExp_t)(
@@ -2137,6 +2197,8 @@ typedef struct ur_command_buffer_exp_dditable_t {
21372197
ur_pfnCommandBufferRetainCommandExp_t pfnRetainCommandExp;
21382198
ur_pfnCommandBufferReleaseCommandExp_t pfnReleaseCommandExp;
21392199
ur_pfnCommandBufferUpdateKernelLaunchExp_t pfnUpdateKernelLaunchExp;
2200+
ur_pfnCommandBufferUpdateSignalEventExp_t pfnUpdateSignalEventExp;
2201+
ur_pfnCommandBufferUpdateWaitEventsExp_t pfnUpdateWaitEventsExp;
21402202
ur_pfnCommandBufferGetInfoExp_t pfnGetInfoExp;
21412203
ur_pfnCommandBufferCommandGetInfoExp_t pfnCommandGetInfoExp;
21422204
} ur_command_buffer_exp_dditable_t;

include/ur_print.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,6 +2442,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferReleaseCommandExpParams(
24422442
/// - `buff_size < out_size`
24432443
UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferUpdateKernelLaunchExpParams(const struct ur_command_buffer_update_kernel_launch_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
24442444

2445+
///////////////////////////////////////////////////////////////////////////////
2446+
/// @brief Print ur_command_buffer_update_signal_event_exp_params_t struct
2447+
/// @returns
2448+
/// - ::UR_RESULT_SUCCESS
2449+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
2450+
/// - `buff_size < out_size`
2451+
UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferUpdateSignalEventExpParams(const struct ur_command_buffer_update_signal_event_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
2452+
2453+
///////////////////////////////////////////////////////////////////////////////
2454+
/// @brief Print ur_command_buffer_update_wait_events_exp_params_t struct
2455+
/// @returns
2456+
/// - ::UR_RESULT_SUCCESS
2457+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
2458+
/// - `buff_size < out_size`
2459+
UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferUpdateWaitEventsExpParams(const struct ur_command_buffer_update_wait_events_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
2460+
24452461
///////////////////////////////////////////////////////////////////////////////
24462462
/// @brief Print ur_command_buffer_get_info_exp_params_t struct
24472463
/// @returns

0 commit comments

Comments
 (0)