Skip to content

Commit 6550981

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 7aba70b commit 6550981

Some content is hidden

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

53 files changed

+7163
-551
lines changed

include/ur_api.h

Lines changed: 346 additions & 29 deletions
Large diffs are not rendered by default.

include/ur_api_funcs.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ _UR_API(urCommandBufferEnqueueExp)
180180
_UR_API(urCommandBufferRetainCommandExp)
181181
_UR_API(urCommandBufferReleaseCommandExp)
182182
_UR_API(urCommandBufferUpdateKernelLaunchExp)
183+
_UR_API(urCommandBufferUpdateSignalEventExp)
184+
_UR_API(urCommandBufferUpdateWaitEventsExp)
183185
_UR_API(urCommandBufferGetInfoExp)
184186
_UR_API(urCommandBufferCommandGetInfoExp)
185187
_UR_API(urUsmP2PEnablePeerAccessExp)

include/ur_ddi.h

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,10 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendKernelLaunchExp_t)(
19351935
ur_kernel_handle_t *,
19361936
uint32_t,
19371937
const ur_exp_command_buffer_sync_point_t *,
1938+
uint32_t,
1939+
const ur_event_handle_t *,
19381940
ur_exp_command_buffer_sync_point_t *,
1941+
ur_event_handle_t *,
19391942
ur_exp_command_buffer_command_handle_t *);
19401943

19411944
///////////////////////////////////////////////////////////////////////////////
@@ -1947,7 +1950,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMMemcpyExp_t)(
19471950
size_t,
19481951
uint32_t,
19491952
const ur_exp_command_buffer_sync_point_t *,
1950-
ur_exp_command_buffer_sync_point_t *);
1953+
uint32_t,
1954+
const ur_event_handle_t *,
1955+
ur_exp_command_buffer_sync_point_t *,
1956+
ur_event_handle_t *,
1957+
ur_exp_command_buffer_command_handle_t *);
19511958

19521959
///////////////////////////////////////////////////////////////////////////////
19531960
/// @brief Function-pointer for urCommandBufferAppendUSMFillExp
@@ -1959,7 +1966,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMFillExp_t)(
19591966
size_t,
19601967
uint32_t,
19611968
const ur_exp_command_buffer_sync_point_t *,
1962-
ur_exp_command_buffer_sync_point_t *);
1969+
uint32_t,
1970+
const ur_event_handle_t *,
1971+
ur_exp_command_buffer_sync_point_t *,
1972+
ur_event_handle_t *,
1973+
ur_exp_command_buffer_command_handle_t *);
19631974

19641975
///////////////////////////////////////////////////////////////////////////////
19651976
/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyExp
@@ -1972,7 +1983,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyExp_t)(
19721983
size_t,
19731984
uint32_t,
19741985
const ur_exp_command_buffer_sync_point_t *,
1975-
ur_exp_command_buffer_sync_point_t *);
1986+
uint32_t,
1987+
const ur_event_handle_t *,
1988+
ur_exp_command_buffer_sync_point_t *,
1989+
ur_event_handle_t *,
1990+
ur_exp_command_buffer_command_handle_t *);
19761991

19771992
///////////////////////////////////////////////////////////////////////////////
19781993
/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteExp
@@ -1984,7 +1999,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteExp_t)(
19841999
const void *,
19852000
uint32_t,
19862001
const ur_exp_command_buffer_sync_point_t *,
1987-
ur_exp_command_buffer_sync_point_t *);
2002+
uint32_t,
2003+
const ur_event_handle_t *,
2004+
ur_exp_command_buffer_sync_point_t *,
2005+
ur_event_handle_t *,
2006+
ur_exp_command_buffer_command_handle_t *);
19882007

19892008
///////////////////////////////////////////////////////////////////////////////
19902009
/// @brief Function-pointer for urCommandBufferAppendMemBufferReadExp
@@ -1996,7 +2015,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadExp_t)(
19962015
void *,
19972016
uint32_t,
19982017
const ur_exp_command_buffer_sync_point_t *,
1999-
ur_exp_command_buffer_sync_point_t *);
2018+
uint32_t,
2019+
const ur_event_handle_t *,
2020+
ur_exp_command_buffer_sync_point_t *,
2021+
ur_event_handle_t *,
2022+
ur_exp_command_buffer_command_handle_t *);
20002023

20012024
///////////////////////////////////////////////////////////////////////////////
20022025
/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyRectExp
@@ -2013,7 +2036,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyRectExp_t)
20132036
size_t,
20142037
uint32_t,
20152038
const ur_exp_command_buffer_sync_point_t *,
2016-
ur_exp_command_buffer_sync_point_t *);
2039+
uint32_t,
2040+
const ur_event_handle_t *,
2041+
ur_exp_command_buffer_sync_point_t *,
2042+
ur_event_handle_t *,
2043+
ur_exp_command_buffer_command_handle_t *);
20172044

20182045
///////////////////////////////////////////////////////////////////////////////
20192046
/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteRectExp
@@ -2030,7 +2057,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteRectExp_t
20302057
void *,
20312058
uint32_t,
20322059
const ur_exp_command_buffer_sync_point_t *,
2033-
ur_exp_command_buffer_sync_point_t *);
2060+
uint32_t,
2061+
const ur_event_handle_t *,
2062+
ur_exp_command_buffer_sync_point_t *,
2063+
ur_event_handle_t *,
2064+
ur_exp_command_buffer_command_handle_t *);
20342065

20352066
///////////////////////////////////////////////////////////////////////////////
20362067
/// @brief Function-pointer for urCommandBufferAppendMemBufferReadRectExp
@@ -2047,7 +2078,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadRectExp_t)
20472078
void *,
20482079
uint32_t,
20492080
const ur_exp_command_buffer_sync_point_t *,
2050-
ur_exp_command_buffer_sync_point_t *);
2081+
uint32_t,
2082+
const ur_event_handle_t *,
2083+
ur_exp_command_buffer_sync_point_t *,
2084+
ur_event_handle_t *,
2085+
ur_exp_command_buffer_command_handle_t *);
20512086

20522087
///////////////////////////////////////////////////////////////////////////////
20532088
/// @brief Function-pointer for urCommandBufferAppendMemBufferFillExp
@@ -2060,7 +2095,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)(
20602095
size_t,
20612096
uint32_t,
20622097
const ur_exp_command_buffer_sync_point_t *,
2063-
ur_exp_command_buffer_sync_point_t *);
2098+
uint32_t,
2099+
const ur_event_handle_t *,
2100+
ur_exp_command_buffer_sync_point_t *,
2101+
ur_event_handle_t *,
2102+
ur_exp_command_buffer_command_handle_t *);
20642103

20652104
///////////////////////////////////////////////////////////////////////////////
20662105
/// @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp
@@ -2071,7 +2110,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)(
20712110
ur_usm_migration_flags_t,
20722111
uint32_t,
20732112
const ur_exp_command_buffer_sync_point_t *,
2074-
ur_exp_command_buffer_sync_point_t *);
2113+
uint32_t,
2114+
const ur_event_handle_t *,
2115+
ur_exp_command_buffer_sync_point_t *,
2116+
ur_event_handle_t *,
2117+
ur_exp_command_buffer_command_handle_t *);
20752118

20762119
///////////////////////////////////////////////////////////////////////////////
20772120
/// @brief Function-pointer for urCommandBufferAppendUSMAdviseExp
@@ -2082,7 +2125,11 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)(
20822125
ur_usm_advice_flags_t,
20832126
uint32_t,
20842127
const ur_exp_command_buffer_sync_point_t *,
2085-
ur_exp_command_buffer_sync_point_t *);
2128+
uint32_t,
2129+
const ur_event_handle_t *,
2130+
ur_exp_command_buffer_sync_point_t *,
2131+
ur_event_handle_t *,
2132+
ur_exp_command_buffer_command_handle_t *);
20862133

20872134
///////////////////////////////////////////////////////////////////////////////
20882135
/// @brief Function-pointer for urCommandBufferEnqueueExp
@@ -2109,6 +2156,19 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateKernelLaunchExp_t)(
21092156
ur_exp_command_buffer_command_handle_t,
21102157
const ur_exp_command_buffer_update_kernel_launch_desc_t *);
21112158

2159+
///////////////////////////////////////////////////////////////////////////////
2160+
/// @brief Function-pointer for urCommandBufferUpdateSignalEventExp
2161+
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateSignalEventExp_t)(
2162+
ur_exp_command_buffer_command_handle_t,
2163+
ur_event_handle_t *);
2164+
2165+
///////////////////////////////////////////////////////////////////////////////
2166+
/// @brief Function-pointer for urCommandBufferUpdateWaitEventsExp
2167+
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateWaitEventsExp_t)(
2168+
ur_exp_command_buffer_command_handle_t,
2169+
uint32_t,
2170+
const ur_event_handle_t *);
2171+
21122172
///////////////////////////////////////////////////////////////////////////////
21132173
/// @brief Function-pointer for urCommandBufferGetInfoExp
21142174
typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferGetInfoExp_t)(
@@ -2150,6 +2210,8 @@ typedef struct ur_command_buffer_exp_dditable_t {
21502210
ur_pfnCommandBufferRetainCommandExp_t pfnRetainCommandExp;
21512211
ur_pfnCommandBufferReleaseCommandExp_t pfnReleaseCommandExp;
21522212
ur_pfnCommandBufferUpdateKernelLaunchExp_t pfnUpdateKernelLaunchExp;
2213+
ur_pfnCommandBufferUpdateSignalEventExp_t pfnUpdateSignalEventExp;
2214+
ur_pfnCommandBufferUpdateWaitEventsExp_t pfnUpdateWaitEventsExp;
21532215
ur_pfnCommandBufferGetInfoExp_t pfnGetInfoExp;
21542216
ur_pfnCommandBufferCommandGetInfoExp_t pfnCommandGetInfoExp;
21552217
} ur_command_buffer_exp_dditable_t;

include/ur_print.h

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

2461+
///////////////////////////////////////////////////////////////////////////////
2462+
/// @brief Print ur_command_buffer_update_signal_event_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 urPrintCommandBufferUpdateSignalEventExpParams(const struct ur_command_buffer_update_signal_event_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
2468+
2469+
///////////////////////////////////////////////////////////////////////////////
2470+
/// @brief Print ur_command_buffer_update_wait_events_exp_params_t struct
2471+
/// @returns
2472+
/// - ::UR_RESULT_SUCCESS
2473+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
2474+
/// - `buff_size < out_size`
2475+
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);
2476+
24612477
///////////////////////////////////////////////////////////////////////////////
24622478
/// @brief Print ur_command_buffer_get_info_exp_params_t struct
24632479
/// @returns

0 commit comments

Comments
 (0)