Skip to content

Commit bcb101b

Browse files
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` APIs implemented for CUDA adapter with CTS tests.
1 parent 70e4cdc commit bcb101b

Some content is hidden

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

48 files changed

+7122
-577
lines changed

include/ur_api.h

Lines changed: 348 additions & 33 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
@@ -1933,7 +1933,10 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendKernelLaunchExp_t)(
19331933
const size_t *,
19341934
uint32_t,
19351935
const ur_exp_command_buffer_sync_point_t *,
1936+
uint32_t,
1937+
const ur_event_handle_t *,
19361938
ur_exp_command_buffer_sync_point_t *,
1939+
ur_event_handle_t *,
19371940
ur_exp_command_buffer_command_handle_t *);
19381941

19391942
///////////////////////////////////////////////////////////////////////////////
@@ -1945,7 +1948,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMMemcpyExp_t)(
19451948
size_t,
19461949
uint32_t,
19471950
const ur_exp_command_buffer_sync_point_t *,
1948-
ur_exp_command_buffer_sync_point_t *);
1951+
uint32_t,
1952+
const ur_event_handle_t *,
1953+
ur_exp_command_buffer_sync_point_t *,
1954+
ur_event_handle_t *,
1955+
ur_exp_command_buffer_command_handle_t *);
19491956

19501957
///////////////////////////////////////////////////////////////////////////////
19511958
/// @brief Function-pointer for urCommandBufferAppendUSMFillExp
@@ -1957,7 +1964,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMFillExp_t)(
19571964
size_t,
19581965
uint32_t,
19591966
const ur_exp_command_buffer_sync_point_t *,
1960-
ur_exp_command_buffer_sync_point_t *);
1967+
uint32_t,
1968+
const ur_event_handle_t *,
1969+
ur_exp_command_buffer_sync_point_t *,
1970+
ur_event_handle_t *,
1971+
ur_exp_command_buffer_command_handle_t *);
19611972

19621973
///////////////////////////////////////////////////////////////////////////////
19631974
/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyExp
@@ -1970,7 +1981,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyExp_t)(
19701981
size_t,
19711982
uint32_t,
19721983
const ur_exp_command_buffer_sync_point_t *,
1973-
ur_exp_command_buffer_sync_point_t *);
1984+
uint32_t,
1985+
const ur_event_handle_t *,
1986+
ur_exp_command_buffer_sync_point_t *,
1987+
ur_event_handle_t *,
1988+
ur_exp_command_buffer_command_handle_t *);
19741989

19751990
///////////////////////////////////////////////////////////////////////////////
19761991
/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteExp
@@ -1982,7 +1997,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteExp_t)(
19821997
const void *,
19831998
uint32_t,
19841999
const ur_exp_command_buffer_sync_point_t *,
1985-
ur_exp_command_buffer_sync_point_t *);
2000+
uint32_t,
2001+
const ur_event_handle_t *,
2002+
ur_exp_command_buffer_sync_point_t *,
2003+
ur_event_handle_t *,
2004+
ur_exp_command_buffer_command_handle_t *);
19862005

19872006
///////////////////////////////////////////////////////////////////////////////
19882007
/// @brief Function-pointer for urCommandBufferAppendMemBufferReadExp
@@ -1994,7 +2013,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadExp_t)(
19942013
void *,
19952014
uint32_t,
19962015
const ur_exp_command_buffer_sync_point_t *,
1997-
ur_exp_command_buffer_sync_point_t *);
2016+
uint32_t,
2017+
const ur_event_handle_t *,
2018+
ur_exp_command_buffer_sync_point_t *,
2019+
ur_event_handle_t *,
2020+
ur_exp_command_buffer_command_handle_t *);
19982021

19992022
///////////////////////////////////////////////////////////////////////////////
20002023
/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyRectExp
@@ -2011,7 +2034,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyRectExp_t)
20112034
size_t,
20122035
uint32_t,
20132036
const ur_exp_command_buffer_sync_point_t *,
2014-
ur_exp_command_buffer_sync_point_t *);
2037+
uint32_t,
2038+
const ur_event_handle_t *,
2039+
ur_exp_command_buffer_sync_point_t *,
2040+
ur_event_handle_t *,
2041+
ur_exp_command_buffer_command_handle_t *);
20152042

20162043
///////////////////////////////////////////////////////////////////////////////
20172044
/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteRectExp
@@ -2028,7 +2055,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteRectExp_t
20282055
void *,
20292056
uint32_t,
20302057
const ur_exp_command_buffer_sync_point_t *,
2031-
ur_exp_command_buffer_sync_point_t *);
2058+
uint32_t,
2059+
const ur_event_handle_t *,
2060+
ur_exp_command_buffer_sync_point_t *,
2061+
ur_event_handle_t *,
2062+
ur_exp_command_buffer_command_handle_t *);
20322063

20332064
///////////////////////////////////////////////////////////////////////////////
20342065
/// @brief Function-pointer for urCommandBufferAppendMemBufferReadRectExp
@@ -2045,7 +2076,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadRectExp_t)
20452076
void *,
20462077
uint32_t,
20472078
const ur_exp_command_buffer_sync_point_t *,
2048-
ur_exp_command_buffer_sync_point_t *);
2079+
uint32_t,
2080+
const ur_event_handle_t *,
2081+
ur_exp_command_buffer_sync_point_t *,
2082+
ur_event_handle_t *,
2083+
ur_exp_command_buffer_command_handle_t *);
20492084

20502085
///////////////////////////////////////////////////////////////////////////////
20512086
/// @brief Function-pointer for urCommandBufferAppendMemBufferFillExp
@@ -2058,7 +2093,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)(
20582093
size_t,
20592094
uint32_t,
20602095
const ur_exp_command_buffer_sync_point_t *,
2061-
ur_exp_command_buffer_sync_point_t *);
2096+
uint32_t,
2097+
const ur_event_handle_t *,
2098+
ur_exp_command_buffer_sync_point_t *,
2099+
ur_event_handle_t *,
2100+
ur_exp_command_buffer_command_handle_t *);
20622101

20632102
///////////////////////////////////////////////////////////////////////////////
20642103
/// @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp
@@ -2069,7 +2108,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)(
20692108
ur_usm_migration_flags_t,
20702109
uint32_t,
20712110
const ur_exp_command_buffer_sync_point_t *,
2072-
ur_exp_command_buffer_sync_point_t *);
2111+
uint32_t,
2112+
const ur_event_handle_t *,
2113+
ur_exp_command_buffer_sync_point_t *,
2114+
ur_event_handle_t *,
2115+
ur_exp_command_buffer_command_handle_t *);
20732116

20742117
///////////////////////////////////////////////////////////////////////////////
20752118
/// @brief Function-pointer for urCommandBufferAppendUSMAdviseExp
@@ -2080,7 +2123,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)(
20802123
ur_usm_advice_flags_t,
20812124
uint32_t,
20822125
const ur_exp_command_buffer_sync_point_t *,
2083-
ur_exp_command_buffer_sync_point_t *);
2126+
uint32_t,
2127+
const ur_event_handle_t *,
2128+
ur_exp_command_buffer_sync_point_t *,
2129+
ur_event_handle_t *,
2130+
ur_exp_command_buffer_command_handle_t *);
20842131

20852132
///////////////////////////////////////////////////////////////////////////////
20862133
/// @brief Function-pointer for urCommandBufferEnqueueExp
@@ -2107,6 +2154,19 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateKernelLaunchExp_t)(
21072154
ur_exp_command_buffer_command_handle_t,
21082155
const ur_exp_command_buffer_update_kernel_launch_desc_t *);
21092156

2157+
///////////////////////////////////////////////////////////////////////////////
2158+
/// @brief Function-pointer for urCommandBufferUpdateSignalEventExp
2159+
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateSignalEventExp_t)(
2160+
ur_exp_command_buffer_command_handle_t,
2161+
ur_event_handle_t *);
2162+
2163+
///////////////////////////////////////////////////////////////////////////////
2164+
/// @brief Function-pointer for urCommandBufferUpdateWaitEventsExp
2165+
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateWaitEventsExp_t)(
2166+
ur_exp_command_buffer_command_handle_t,
2167+
uint32_t,
2168+
const ur_event_handle_t *);
2169+
21102170
///////////////////////////////////////////////////////////////////////////////
21112171
/// @brief Function-pointer for urCommandBufferGetInfoExp
21122172
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferGetInfoExp_t)(
@@ -2148,6 +2208,8 @@ typedef struct ur_command_buffer_exp_dditable_t {
21482208
ur_pfnCommandBufferRetainCommandExp_t pfnRetainCommandExp;
21492209
ur_pfnCommandBufferReleaseCommandExp_t pfnReleaseCommandExp;
21502210
ur_pfnCommandBufferUpdateKernelLaunchExp_t pfnUpdateKernelLaunchExp;
2211+
ur_pfnCommandBufferUpdateSignalEventExp_t pfnUpdateSignalEventExp;
2212+
ur_pfnCommandBufferUpdateWaitEventsExp_t pfnUpdateWaitEventsExp;
21512213
ur_pfnCommandBufferGetInfoExp_t pfnGetInfoExp;
21522214
ur_pfnCommandBufferCommandGetInfoExp_t pfnCommandGetInfoExp;
21532215
} ur_command_buffer_exp_dditable_t;

include/ur_print.h

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

2453+
///////////////////////////////////////////////////////////////////////////////
2454+
/// @brief Print ur_command_buffer_update_signal_event_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 urPrintCommandBufferUpdateSignalEventExpParams(const struct ur_command_buffer_update_signal_event_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
2460+
2461+
///////////////////////////////////////////////////////////////////////////////
2462+
/// @brief Print ur_command_buffer_update_wait_events_exp_params_t struct
2463+
/// @returns
2464+
/// - ::UR_RESULT_SUCCESS
2465+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
2466+
/// - `buff_size < out_size`
2467+
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);
2468+
24532469
///////////////////////////////////////////////////////////////////////////////
24542470
/// @brief Print ur_command_buffer_get_info_exp_params_t struct
24552471
/// @returns

0 commit comments

Comments
 (0)