Skip to content

Commit b12b606

Browse files
[SYCL][Graph] Adds dependencies to the Advise function
1 parent 267c89f commit b12b606

File tree

11 files changed

+68
-11
lines changed

11 files changed

+68
-11
lines changed

include/ur.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3628,9 +3628,9 @@ class ur_usm_exp_dditable_t(Structure):
36283628
###############################################################################
36293629
## @brief Function-pointer for urCommandBufferAppendUSMAdviseExp
36303630
if __use_win_types:
3631-
_urCommandBufferAppendUSMAdviseExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) )
3631+
_urCommandBufferAppendUSMAdviseExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) )
36323632
else:
3633-
_urCommandBufferAppendUSMAdviseExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) )
3633+
_urCommandBufferAppendUSMAdviseExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) )
36343634

36353635
###############################################################################
36363636
## @brief Function-pointer for urCommandBufferEnqueueExp

include/ur_api.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8231,11 +8231,13 @@ urCommandBufferAppendUSMPrefetchExp(
82318231
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
82328232
UR_APIEXPORT ur_result_t UR_APICALL
82338233
urCommandBufferAppendUSMAdviseExp(
8234-
ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object.
8235-
void *pMemory, ///< [in] pointer to the USM memory object.
8236-
size_t size, ///< [in] size in bytes to be advised.
8237-
ur_usm_advice_flags_t advice, ///< [in] USM memory advice
8238-
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command.
8234+
ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object.
8235+
void *pMemory, ///< [in] pointer to the USM memory object.
8236+
size_t size, ///< [in] size in bytes to be advised.
8237+
ur_usm_advice_flags_t advice, ///< [in] USM memory advice
8238+
uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
8239+
const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
8240+
ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command.
82398241
);
82408242

82418243
///////////////////////////////////////////////////////////////////////////////
@@ -10434,6 +10436,8 @@ typedef struct ur_command_buffer_append_usm_advise_exp_params_t {
1043410436
void **ppMemory;
1043510437
size_t *psize;
1043610438
ur_usm_advice_flags_t *padvice;
10439+
uint32_t *pnumSyncPointsInWaitList;
10440+
const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList;
1043710441
ur_exp_command_buffer_sync_point_t **ppSyncPoint;
1043810442
} ur_command_buffer_append_usm_advise_exp_params_t;
1043910443

include/ur_ddi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,6 +1941,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)(
19411941
void *,
19421942
size_t,
19431943
ur_usm_advice_flags_t,
1944+
uint32_t,
1945+
const ur_exp_command_buffer_sync_point_t *,
19441946
ur_exp_command_buffer_sync_point_t *);
19451947

19461948
///////////////////////////////////////////////////////////////////////////////

scripts/core/exp-command-buffer.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,12 @@ params:
649649
- type: $x_usm_advice_flags_t
650650
name: advice
651651
desc: "[in] USM memory advice"
652+
- type: uint32_t
653+
name: numSyncPointsInWaitList
654+
desc: "[in] The number of sync points in the provided dependency list."
655+
- type: "const $x_exp_command_buffer_sync_point_t*"
656+
name: pSyncPointWaitList
657+
desc: "[in][optional] A list of sync points that this command depends on."
652658
- type: "$x_exp_command_buffer_sync_point_t*"
653659
name: pSyncPoint
654660
desc: "[out][optional] sync point associated with this command."

source/adapters/null/ur_nullddi.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4934,6 +4934,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
49344934
void *pMemory, ///< [in] pointer to the USM memory object.
49354935
size_t size, ///< [in] size in bytes to be advised.
49364936
ur_usm_advice_flags_t advice, ///< [in] USM memory advice
4937+
uint32_t
4938+
numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
4939+
const ur_exp_command_buffer_sync_point_t *
4940+
pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
49374941
ur_exp_command_buffer_sync_point_t *
49384942
pSyncPoint ///< [out][optional] sync point associated with this command.
49394943
) try {
@@ -4944,7 +4948,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
49444948
d_context.urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp;
49454949
if (nullptr != pfnAppendUSMAdviseExp) {
49464950
result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice,
4947-
pSyncPoint);
4951+
numSyncPointsInWaitList,
4952+
pSyncPointWaitList, pSyncPoint);
49484953
} else {
49494954
// generic implementation
49504955
}

source/common/ur_params.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11424,6 +11424,16 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct
1142411424

1142511425
ur_params::serializeFlag<ur_usm_advice_flag_t>(os, *(params->padvice));
1142611426

11427+
os << ", ";
11428+
os << ".numSyncPointsInWaitList = ";
11429+
11430+
os << *(params->pnumSyncPointsInWaitList);
11431+
11432+
os << ", ";
11433+
os << ".pSyncPointWaitList = ";
11434+
11435+
ur_params::serializePtr(os, *(params->ppSyncPointWaitList));
11436+
1142711437
os << ", ";
1142811438
os << ".pSyncPoint = ";
1142911439

source/loader/layers/tracing/ur_trcddi.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5709,6 +5709,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
57095709
void *pMemory, ///< [in] pointer to the USM memory object.
57105710
size_t size, ///< [in] size in bytes to be advised.
57115711
ur_usm_advice_flags_t advice, ///< [in] USM memory advice
5712+
uint32_t
5713+
numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
5714+
const ur_exp_command_buffer_sync_point_t *
5715+
pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
57125716
ur_exp_command_buffer_sync_point_t *
57135717
pSyncPoint ///< [out][optional] sync point associated with this command.
57145718
) {
@@ -5720,13 +5724,20 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
57205724
}
57215725

57225726
ur_command_buffer_append_usm_advise_exp_params_t params = {
5723-
&hCommandBuffer, &pMemory, &size, &advice, &pSyncPoint};
5727+
&hCommandBuffer,
5728+
&pMemory,
5729+
&size,
5730+
&advice,
5731+
&numSyncPointsInWaitList,
5732+
&pSyncPointWaitList,
5733+
&pSyncPoint};
57245734
uint64_t instance =
57255735
context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP,
57265736
"urCommandBufferAppendUSMAdviseExp", &params);
57275737

57285738
ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size,
5729-
advice, pSyncPoint);
5739+
advice, numSyncPointsInWaitList,
5740+
pSyncPointWaitList, pSyncPoint);
57305741

57315742
context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP,
57325743
"urCommandBufferAppendUSMAdviseExp", &params, &result,

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7162,6 +7162,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
71627162
void *pMemory, ///< [in] pointer to the USM memory object.
71637163
size_t size, ///< [in] size in bytes to be advised.
71647164
ur_usm_advice_flags_t advice, ///< [in] USM memory advice
7165+
uint32_t
7166+
numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
7167+
const ur_exp_command_buffer_sync_point_t *
7168+
pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
71657169
ur_exp_command_buffer_sync_point_t *
71667170
pSyncPoint ///< [out][optional] sync point associated with this command.
71677171
) {
@@ -7191,7 +7195,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
71917195
}
71927196

71937197
ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size,
7194-
advice, pSyncPoint);
7198+
advice, numSyncPointsInWaitList,
7199+
pSyncPointWaitList, pSyncPoint);
71957200

71967201
return result;
71977202
}

source/loader/ur_ldrddi.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6831,6 +6831,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
68316831
void *pMemory, ///< [in] pointer to the USM memory object.
68326832
size_t size, ///< [in] size in bytes to be advised.
68336833
ur_usm_advice_flags_t advice, ///< [in] USM memory advice
6834+
uint32_t
6835+
numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
6836+
const ur_exp_command_buffer_sync_point_t *
6837+
pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
68346838
ur_exp_command_buffer_sync_point_t *
68356839
pSyncPoint ///< [out][optional] sync point associated with this command.
68366840
) {
@@ -6853,6 +6857,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
68536857

68546858
// forward to device-platform
68556859
result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice,
6860+
numSyncPointsInWaitList, pSyncPointWaitList,
68566861
pSyncPoint);
68576862

68586863
return result;

source/loader/ur_libapi.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7700,6 +7700,10 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
77007700
void *pMemory, ///< [in] pointer to the USM memory object.
77017701
size_t size, ///< [in] size in bytes to be advised.
77027702
ur_usm_advice_flags_t advice, ///< [in] USM memory advice
7703+
uint32_t
7704+
numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list.
7705+
const ur_exp_command_buffer_sync_point_t *
7706+
pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on.
77037707
ur_exp_command_buffer_sync_point_t *
77047708
pSyncPoint ///< [out][optional] sync point associated with this command.
77057709
) try {
@@ -7710,6 +7714,7 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp(
77107714
}
77117715

77127716
return pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice,
7717+
numSyncPointsInWaitList, pSyncPointWaitList,
77137718
pSyncPoint);
77147719
} catch (...) {
77157720
return exceptionToResult(std::current_exception());

0 commit comments

Comments
 (0)