Skip to content

Commit 4c3389f

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 658393f commit 4c3389f

34 files changed

+4182
-410
lines changed

include/ur_api.h

Lines changed: 337 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
@@ -1921,7 +1921,10 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendKernelLaunchExp_t)(
19211921
const size_t *,
19221922
uint32_t,
19231923
const ur_exp_command_buffer_sync_point_t *,
1924+
uint32_t,
1925+
const ur_event_handle_t *,
19241926
ur_exp_command_buffer_sync_point_t *,
1927+
ur_event_handle_t *,
19251928
ur_exp_command_buffer_command_handle_t *);
19261929

19271930
///////////////////////////////////////////////////////////////////////////////
@@ -1933,7 +1936,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMMemcpyExp_t)(
19331936
size_t,
19341937
uint32_t,
19351938
const ur_exp_command_buffer_sync_point_t *,
1936-
ur_exp_command_buffer_sync_point_t *);
1939+
uint32_t,
1940+
const ur_event_handle_t *,
1941+
ur_exp_command_buffer_sync_point_t *,
1942+
ur_event_handle_t *,
1943+
ur_exp_command_buffer_command_handle_t *);
19371944

19381945
///////////////////////////////////////////////////////////////////////////////
19391946
/// @brief Function-pointer for urCommandBufferAppendUSMFillExp
@@ -1945,7 +1952,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMFillExp_t)(
19451952
size_t,
19461953
uint32_t,
19471954
const ur_exp_command_buffer_sync_point_t *,
1948-
ur_exp_command_buffer_sync_point_t *);
1955+
uint32_t,
1956+
const ur_event_handle_t *,
1957+
ur_exp_command_buffer_sync_point_t *,
1958+
ur_event_handle_t *,
1959+
ur_exp_command_buffer_command_handle_t *);
19491960

19501961
///////////////////////////////////////////////////////////////////////////////
19511962
/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyExp
@@ -1958,7 +1969,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyExp_t)(
19581969
size_t,
19591970
uint32_t,
19601971
const ur_exp_command_buffer_sync_point_t *,
1961-
ur_exp_command_buffer_sync_point_t *);
1972+
uint32_t,
1973+
const ur_event_handle_t *,
1974+
ur_exp_command_buffer_sync_point_t *,
1975+
ur_event_handle_t *,
1976+
ur_exp_command_buffer_command_handle_t *);
19621977

19631978
///////////////////////////////////////////////////////////////////////////////
19641979
/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteExp
@@ -1970,7 +1985,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteExp_t)(
19701985
const void *,
19711986
uint32_t,
19721987
const ur_exp_command_buffer_sync_point_t *,
1973-
ur_exp_command_buffer_sync_point_t *);
1988+
uint32_t,
1989+
const ur_event_handle_t *,
1990+
ur_exp_command_buffer_sync_point_t *,
1991+
ur_event_handle_t *,
1992+
ur_exp_command_buffer_command_handle_t *);
19741993

19751994
///////////////////////////////////////////////////////////////////////////////
19761995
/// @brief Function-pointer for urCommandBufferAppendMemBufferReadExp
@@ -1982,7 +2001,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadExp_t)(
19822001
void *,
19832002
uint32_t,
19842003
const ur_exp_command_buffer_sync_point_t *,
1985-
ur_exp_command_buffer_sync_point_t *);
2004+
uint32_t,
2005+
const ur_event_handle_t *,
2006+
ur_exp_command_buffer_sync_point_t *,
2007+
ur_event_handle_t *,
2008+
ur_exp_command_buffer_command_handle_t *);
19862009

19872010
///////////////////////////////////////////////////////////////////////////////
19882011
/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyRectExp
@@ -1999,7 +2022,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyRectExp_t)
19992022
size_t,
20002023
uint32_t,
20012024
const ur_exp_command_buffer_sync_point_t *,
2002-
ur_exp_command_buffer_sync_point_t *);
2025+
uint32_t,
2026+
const ur_event_handle_t *,
2027+
ur_exp_command_buffer_sync_point_t *,
2028+
ur_event_handle_t *,
2029+
ur_exp_command_buffer_command_handle_t *);
20032030

20042031
///////////////////////////////////////////////////////////////////////////////
20052032
/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteRectExp
@@ -2016,7 +2043,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteRectExp_t
20162043
void *,
20172044
uint32_t,
20182045
const ur_exp_command_buffer_sync_point_t *,
2019-
ur_exp_command_buffer_sync_point_t *);
2046+
uint32_t,
2047+
const ur_event_handle_t *,
2048+
ur_exp_command_buffer_sync_point_t *,
2049+
ur_event_handle_t *,
2050+
ur_exp_command_buffer_command_handle_t *);
20202051

20212052
///////////////////////////////////////////////////////////////////////////////
20222053
/// @brief Function-pointer for urCommandBufferAppendMemBufferReadRectExp
@@ -2033,7 +2064,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadRectExp_t)
20332064
void *,
20342065
uint32_t,
20352066
const ur_exp_command_buffer_sync_point_t *,
2036-
ur_exp_command_buffer_sync_point_t *);
2067+
uint32_t,
2068+
const ur_event_handle_t *,
2069+
ur_exp_command_buffer_sync_point_t *,
2070+
ur_event_handle_t *,
2071+
ur_exp_command_buffer_command_handle_t *);
20372072

20382073
///////////////////////////////////////////////////////////////////////////////
20392074
/// @brief Function-pointer for urCommandBufferAppendMemBufferFillExp
@@ -2046,7 +2081,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)(
20462081
size_t,
20472082
uint32_t,
20482083
const ur_exp_command_buffer_sync_point_t *,
2049-
ur_exp_command_buffer_sync_point_t *);
2084+
uint32_t,
2085+
const ur_event_handle_t *,
2086+
ur_exp_command_buffer_sync_point_t *,
2087+
ur_event_handle_t *,
2088+
ur_exp_command_buffer_command_handle_t *);
20502089

20512090
///////////////////////////////////////////////////////////////////////////////
20522091
/// @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp
@@ -2057,7 +2096,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)(
20572096
ur_usm_migration_flags_t,
20582097
uint32_t,
20592098
const ur_exp_command_buffer_sync_point_t *,
2060-
ur_exp_command_buffer_sync_point_t *);
2099+
uint32_t,
2100+
const ur_event_handle_t *,
2101+
ur_exp_command_buffer_sync_point_t *,
2102+
ur_event_handle_t *,
2103+
ur_exp_command_buffer_command_handle_t *);
20612104

20622105
///////////////////////////////////////////////////////////////////////////////
20632106
/// @brief Function-pointer for urCommandBufferAppendUSMAdviseExp
@@ -2068,7 +2111,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)(
20682111
ur_usm_advice_flags_t,
20692112
uint32_t,
20702113
const ur_exp_command_buffer_sync_point_t *,
2071-
ur_exp_command_buffer_sync_point_t *);
2114+
uint32_t,
2115+
const ur_event_handle_t *,
2116+
ur_exp_command_buffer_sync_point_t *,
2117+
ur_event_handle_t *,
2118+
ur_exp_command_buffer_command_handle_t *);
20722119

20732120
///////////////////////////////////////////////////////////////////////////////
20742121
/// @brief Function-pointer for urCommandBufferEnqueueExp
@@ -2095,6 +2142,19 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateKernelLaunchExp_t)(
20952142
ur_exp_command_buffer_command_handle_t,
20962143
const ur_exp_command_buffer_update_kernel_launch_desc_t *);
20972144

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

include/ur_print.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,6 +2426,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferReleaseCommandExpParams(
24262426
/// - `buff_size < out_size`
24272427
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);
24282428

2429+
///////////////////////////////////////////////////////////////////////////////
2430+
/// @brief Print ur_command_buffer_update_signal_event_exp_params_t struct
2431+
/// @returns
2432+
/// - ::UR_RESULT_SUCCESS
2433+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
2434+
/// - `buff_size < out_size`
2435+
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);
2436+
2437+
///////////////////////////////////////////////////////////////////////////////
2438+
/// @brief Print ur_command_buffer_update_wait_events_exp_params_t struct
2439+
/// @returns
2440+
/// - ::UR_RESULT_SUCCESS
2441+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
2442+
/// - `buff_size < out_size`
2443+
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);
2444+
24292445
///////////////////////////////////////////////////////////////////////////////
24302446
/// @brief Print ur_command_buffer_get_info_exp_params_t struct
24312447
/// @returns

0 commit comments

Comments
 (0)