Skip to content

Commit 6b33a1b

Browse files
authored
Merge pull request #1846 from kbenzie/benie/fix-native-command-phevent
Make phEvent optional in urEnqueueNativeCommandExp
2 parents 4bfde4a + 8f2cc02 commit 6b33a1b

File tree

10 files changed

+31
-33
lines changed

10 files changed

+31
-33
lines changed

include/ur_api.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9578,7 +9578,6 @@ typedef void (*ur_exp_enqueue_native_command_function_t)(
95789578
/// + `NULL == hQueue`
95799579
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
95809580
/// + `NULL == pfnNativeEnqueue`
9581-
/// + `NULL == phEvent`
95829581
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
95839582
/// + `NULL != pProperties && ::UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK & pProperties->flags`
95849583
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
@@ -9598,7 +9597,7 @@ urEnqueueNativeCommandExp(
95989597
const ur_event_handle_t *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of
95999598
///< events that must be complete before the kernel execution.
96009599
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
9601-
ur_event_handle_t *phEvent ///< [in,out] return an event object that identifies the work that has
9600+
ur_event_handle_t *phEvent ///< [out][optional] return an event object that identifies the work that has
96029601
///< been enqueued in nativeEnqueueFunc.
96039602
);
96049603

scripts/core/EXP-NATIVE-ENQUEUE.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ Functions
6565
Changelog
6666
--------------------------------------------------------------------------------
6767

68-
+-----------+------------------------+
69-
| Revision | Changes |
70-
+===========+========================+
71-
| 1.0 | Initial Draft |
72-
+-----------+------------------------+
68+
+-----------+-------------------------+
69+
| Revision | Changes |
70+
+===========+=========================+
71+
| 1.0 | Initial Draft |
72+
+-----------+-------------------------+
73+
| 1.1 | Make `phEvent` optional |
74+
+-----------+-------------------------+
7375

7476

7577
Support
@@ -83,3 +85,4 @@ Contributors
8385
--------------------------------------------------------------------------------
8486

8587
* Hugh Delaney `hugh.delaney@codeplay.com <hugh.delaney@codeplay.com>`_
88+
* Kenneth Benzie (Benie) `k.benzie@codeplay.com <k.benzie@codeplay.com>`_

scripts/core/enqueue.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,8 +1128,7 @@ class: $xEnqueue
11281128
name: USMPrefetch
11291129
ordinal: "0"
11301130
details:
1131-
- "Prefetching may not be supported for all devices or allocation types. If memory prefetching
1132-
is not supported, the prefetch hint will be ignored."
1131+
- "Prefetching may not be supported for all devices or allocation types. If memory prefetching is not supported, the prefetch hint will be ignored."
11331132
params:
11341133
- type: $x_queue_handle_t
11351134
name: hQueue
@@ -1177,8 +1176,7 @@ class: $xEnqueue
11771176
name: USMAdvise
11781177
ordinal: "0"
11791178
details:
1180-
- "Not all memory advice hints may be supported for all devices or allocation types.
1181-
If a memory advice hint is not supported, it will be ignored."
1179+
- "Not all memory advice hints may be supported for all devices or allocation types. If a memory advice hint is not supported, it will be ignored."
11821180
params:
11831181
- type: $x_queue_handle_t
11841182
name: hQueue

scripts/core/exp-native-enqueue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ params:
111111
- type: $x_event_handle_t*
112112
name: phEvent
113113
desc: |
114-
[in,out] return an event object that identifies the work that has
114+
[out][optional] return an event object that identifies the work that has
115115
been enqueued in nativeEnqueueFunc.
116116
returns:
117117
- $X_RESULT_ERROR_INVALID_NULL_HANDLE

source/adapters/null/ur_nullddi.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5896,8 +5896,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp(
58965896
///< events that must be complete before the kernel execution.
58975897
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
58985898
ur_event_handle_t *
5899-
phEvent ///< [in,out] return an event object that identifies the work that has
5900-
///< been enqueued in nativeEnqueueFunc.
5899+
phEvent ///< [out][optional] return an event object that identifies the work that has
5900+
///< been enqueued in nativeEnqueueFunc.
59015901
) try {
59025902
ur_result_t result = UR_RESULT_SUCCESS;
59035903

@@ -5910,7 +5910,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp(
59105910
pProperties, numEventsInWaitList, phEventWaitList, phEvent);
59115911
} else {
59125912
// generic implementation
5913-
*phEvent = reinterpret_cast<ur_event_handle_t>(d_context.get());
5913+
if (nullptr != phEvent) {
5914+
*phEvent = reinterpret_cast<ur_event_handle_t>(d_context.get());
5915+
}
59145916
}
59155917

59165918
return result;

source/loader/layers/tracing/ur_trcddi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7880,8 +7880,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp(
78807880
///< events that must be complete before the kernel execution.
78817881
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
78827882
ur_event_handle_t *
7883-
phEvent ///< [in,out] return an event object that identifies the work that has
7884-
///< been enqueued in nativeEnqueueFunc.
7883+
phEvent ///< [out][optional] return an event object that identifies the work that has
7884+
///< been enqueued in nativeEnqueueFunc.
78857885
) {
78867886
auto pfnNativeCommandExp =
78877887
context.urDdiTable.EnqueueExp.pfnNativeCommandExp;

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9555,8 +9555,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp(
95559555
///< events that must be complete before the kernel execution.
95569556
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
95579557
ur_event_handle_t *
9558-
phEvent ///< [in,out] return an event object that identifies the work that has
9559-
///< been enqueued in nativeEnqueueFunc.
9558+
phEvent ///< [out][optional] return an event object that identifies the work that has
9559+
///< been enqueued in nativeEnqueueFunc.
95609560
) {
95619561
auto pfnNativeCommandExp =
95629562
context.urDdiTable.EnqueueExp.pfnNativeCommandExp;
@@ -9574,10 +9574,6 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp(
95749574
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
95759575
}
95769576

9577-
if (NULL == phEvent) {
9578-
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
9579-
}
9580-
95819577
if (NULL != pProperties &&
95829578
UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK & pProperties->flags) {
95839579
return UR_RESULT_ERROR_INVALID_ENUMERATION;

source/loader/ur_ldrddi.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8130,8 +8130,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp(
81308130
///< events that must be complete before the kernel execution.
81318131
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
81328132
ur_event_handle_t *
8133-
phEvent ///< [in,out] return an event object that identifies the work that has
8134-
///< been enqueued in nativeEnqueueFunc.
8133+
phEvent ///< [out][optional] return an event object that identifies the work that has
8134+
///< been enqueued in nativeEnqueueFunc.
81358135
) {
81368136
ur_result_t result = UR_RESULT_SUCCESS;
81378137

@@ -8171,8 +8171,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp(
81718171

81728172
try {
81738173
// convert platform handle to loader handle
8174-
*phEvent = reinterpret_cast<ur_event_handle_t>(
8175-
ur_event_factory.getInstance(*phEvent, dditable));
8174+
if (nullptr != phEvent) {
8175+
*phEvent = reinterpret_cast<ur_event_handle_t>(
8176+
ur_event_factory.getInstance(*phEvent, dditable));
8177+
}
81768178
} catch (std::bad_alloc &) {
81778179
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
81788180
}

source/loader/ur_libapi.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8965,7 +8965,6 @@ ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp(
89658965
/// + `NULL == hQueue`
89668966
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
89678967
/// + `NULL == pfnNativeEnqueue`
8968-
/// + `NULL == phEvent`
89698968
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
89708969
/// + `NULL != pProperties && ::UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK & pProperties->flags`
89718970
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
@@ -8989,8 +8988,8 @@ ur_result_t UR_APICALL urEnqueueNativeCommandExp(
89898988
///< events that must be complete before the kernel execution.
89908989
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
89918990
ur_event_handle_t *
8992-
phEvent ///< [in,out] return an event object that identifies the work that has
8993-
///< been enqueued in nativeEnqueueFunc.
8991+
phEvent ///< [out][optional] return an event object that identifies the work that has
8992+
///< been enqueued in nativeEnqueueFunc.
89948993
) try {
89958994
auto pfnNativeCommandExp =
89968995
ur_lib::context->urDdiTable.EnqueueExp.pfnNativeCommandExp;

source/ur_api.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7593,7 +7593,6 @@ ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp(
75937593
/// + `NULL == hQueue`
75947594
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
75957595
/// + `NULL == pfnNativeEnqueue`
7596-
/// + `NULL == phEvent`
75977596
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
75987597
/// + `NULL != pProperties && ::UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK & pProperties->flags`
75997598
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
@@ -7617,8 +7616,8 @@ ur_result_t UR_APICALL urEnqueueNativeCommandExp(
76177616
///< events that must be complete before the kernel execution.
76187617
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
76197618
ur_event_handle_t *
7620-
phEvent ///< [in,out] return an event object that identifies the work that has
7621-
///< been enqueued in nativeEnqueueFunc.
7619+
phEvent ///< [out][optional] return an event object that identifies the work that has
7620+
///< been enqueued in nativeEnqueueFunc.
76227621
) {
76237622
ur_result_t result = UR_RESULT_SUCCESS;
76247623
return result;

0 commit comments

Comments
 (0)