Skip to content

Commit 86a2db9

Browse files
author
Hugh Delaney
committed
Make some params optional
Allow some params to be nullptr. Also update docs to add an entry in ur_structure_type_t. And update Native CPU DDI table
1 parent 69268a3 commit 86a2db9

File tree

15 files changed

+67
-68
lines changed

15 files changed

+67
-68
lines changed

include/ur_api.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ typedef enum ur_structure_type_t {
282282
UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t
283283
UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES = 0x2005, ///< ::ur_exp_sampler_addr_modes_t
284284
UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES = 0x2006, ///< ::ur_exp_sampler_cubemap_properties_t
285+
UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES = 0x3000, ///< ::ur_exp_enqueue_native_command_properties_t
285286
/// @cond
286287
UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff
287288
/// @endcond
@@ -5686,7 +5687,7 @@ typedef enum ur_command_t {
56865687
UR_COMMAND_INTEROP_SEMAPHORE_WAIT_EXP = 0x2000, ///< Event created by ::urBindlessImagesWaitExternalSemaphoreExp
56875688
UR_COMMAND_INTEROP_SEMAPHORE_SIGNAL_EXP = 0x2001, ///< Event created by ::urBindlessImagesSignalExternalSemaphoreExp
56885689
UR_COMMAND_TIMESTAMP_RECORDING_EXP = 0x2002, ///< Event created by ::urEnqueueTimestampRecordingExp
5689-
UR_COMMAND_ENQUEUE_NATIVE_EXP = 0x2004, ///< Event created by ::urNativeEnqueueExp
5690+
UR_COMMAND_ENQUEUE_NATIVE_EXP = 0x2004, ///< Event created by ::urEnqueueNativeCommandExp
56905691
/// @cond
56915692
UR_COMMAND_FORCE_UINT32 = 0x7fffffff
56925693
/// @endcond
@@ -9551,24 +9552,21 @@ typedef void (*ur_exp_enqueue_native_command_function_t)(
95519552
/// + `NULL == hQueue`
95529553
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
95539554
/// + `NULL == pfnNativeEnqueue`
9554-
/// + `NULL == data`
9555-
/// + `NULL == pProperties`
95569555
/// + `NULL == phEvent`
95579556
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
9558-
/// + `::UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK & pProperties->flags`
9557+
/// + `NULL != pProperties && ::UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK & pProperties->flags`
95599558
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
95609559
UR_APIEXPORT ur_result_t UR_APICALL
95619560
urEnqueueNativeCommandExp(
95629561
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
95639562
ur_exp_enqueue_native_command_function_t pfnNativeEnqueue, ///< [in] function calling the native underlying API, to be executed
95649563
///< immediately.
9565-
void *data, ///< [in] data used by pfnNativeEnqueue
9566-
const ur_exp_enqueue_native_command_properties_t *pProperties, ///< [in] pointer to the native enqueue properties
9564+
void *data, ///< [in][optional] data used by pfnNativeEnqueue
9565+
const ur_exp_enqueue_native_command_properties_t *pProperties, ///< [in][optional] pointer to the native enqueue properties
95679566
uint32_t numEventsInWaitList, ///< [in] size of the event wait list
95689567
const ur_event_handle_t *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of
95699568
///< events that must be complete before the kernel execution.
9570-
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait
9571-
///< events.
9569+
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
95729570
ur_event_handle_t *phEvent ///< [in,out] return an event object that identifies the work that has
95739571
///< been enqueued in nativeEnqueueFunc.
95749572
);

include/ur_print.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_structure_type_t value
10951095
case UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES:
10961096
os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES";
10971097
break;
1098+
case UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES:
1099+
os << "UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES";
1100+
break;
10981101
default:
10991102
os << "unknown enumerator";
11001103
break;
@@ -1346,6 +1349,11 @@ inline ur_result_t printStruct(std::ostream &os, const void *ptr) {
13461349
const ur_exp_sampler_cubemap_properties_t *pstruct = (const ur_exp_sampler_cubemap_properties_t *)ptr;
13471350
printPtr(os, pstruct);
13481351
} break;
1352+
1353+
case UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES: {
1354+
const ur_exp_enqueue_native_command_properties_t *pstruct = (const ur_exp_enqueue_native_command_properties_t *)ptr;
1355+
printPtr(os, pstruct);
1356+
} break;
13491357
default:
13501358
os << "unknown enumerator";
13511359
return UR_RESULT_ERROR_INVALID_ENUMERATION;

scripts/core/EXP-NATIVE-ENQUEUE.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
X=x.upper()
55
%>
66

7-
.. _experimental-enqueue-timestamp-recording:
7+
.. _experimental-enqueue-native-command:
88

99
================================================================================
10-
Enqueue Timestamp Recording
10+
Enqueue Native Command
1111
================================================================================
1212

1313
.. warning::
@@ -50,7 +50,6 @@ Types
5050
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5151

5252
${x}_exp_enqueue_native_command_properties_t
53-
${x}_exp_enqueue_native_command_function_t
5453

5554
Functions
5655
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

scripts/core/exp-native-enqueue.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ name: $x_command_t
3131
etors:
3232
- name: ENQUEUE_NATIVE_EXP
3333
value: "0x2004"
34-
desc: Event created by $xNativeEnqueueExp
34+
desc: Event created by $xEnqueueNativeCommandExp
3535

3636
--- #--------------------------------------------------------------------------
3737
type: enum
@@ -51,6 +51,16 @@ members:
5151
name: flags
5252
desc: "[in] native enqueue flags"
5353

54+
--- #--------------------------------------------------------------------------
55+
type: enum
56+
extend: true
57+
desc: "Structure type experimental enumerations"
58+
name: $x_structure_type_t
59+
etors:
60+
- name: EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES
61+
desc: $x_exp_enqueue_native_command_properties_t
62+
value: "0x3000"
63+
5464
--- #--------------------------------------------------------------------------
5565
type: fptr_typedef
5666
desc: "Function enqueueing work through the native API to be executed immediately."
@@ -78,18 +88,18 @@ params:
7888
name: pfnNativeEnqueue
7989
- type: void*
8090
name: data
81-
desc: "[in] data used by pfnNativeEnqueue"
91+
desc: "[in][optional] data used by pfnNativeEnqueue"
8292
- type: const $x_exp_enqueue_native_command_properties_t*
8393
name: pProperties
84-
desc: "[in] pointer to the native enqueue properties"
94+
desc: "[in][optional] pointer to the native enqueue properties"
8595
- type: uint32_t
8696
name: numEventsInWaitList
8797
desc: "[in] size of the event wait list"
8898
- type: const $x_event_handle_t*
8999
name: phEventWaitList
90100
desc: |
91101
[in][optional][range(0, numEventsInWaitList)] pointer to a list of events that must be complete before the kernel execution.
92-
If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
102+
If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
93103
- type: $x_event_handle_t*
94104
name: phEvent
95105
desc: |

source/adapters/hip/enqueue_native.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
UR_APICALL UR_APIEXPORT ur_result_t urEnqueueNativeCommandExp(
1414
ur_queue_handle_t, ur_exp_enqueue_native_command_function_t, void *,
15-
const ur_exp_enqueue_native_command_properties_t *,
16-
uint32_t, const ur_event_handle_t *, ur_event_handle_t *) {
15+
const ur_exp_enqueue_native_command_properties_t *, uint32_t,
16+
const ur_event_handle_t *, ur_event_handle_t *) {
1717
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
1818
}
19-

source/adapters/level_zero/enqueue_native.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
UR_APICALL UR_APIEXPORT ur_result_t urEnqueueNativeCommandExp(
1414
ur_queue_handle_t, ur_exp_enqueue_native_command_function_t, void *,
15-
const ur_exp_enqueue_native_command_properties_t *,
16-
uint32_t, const ur_event_handle_t *, ur_event_handle_t *) {
15+
const ur_exp_enqueue_native_command_properties_t *, uint32_t,
16+
const ur_event_handle_t *, ur_event_handle_t *) {
1717
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
1818
}

source/adapters/native_cpu/ur_interface_loader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable(
395395

396396
pDdiTable->pfnCooperativeKernelLaunchExp = nullptr;
397397
pDdiTable->pfnTimestampRecordingExp = urEnqueueTimestampRecordingExp;
398+
pDdiTable->pfnNativeCommandExp = urEnqueueNativeCommandExp;
398399

399400
return UR_RESULT_SUCCESS;
400401
}

source/adapters/null/ur_nullddi.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5867,15 +5867,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp(
58675867
ur_exp_enqueue_native_command_function_t
58685868
pfnNativeEnqueue, ///< [in] function calling the native underlying API, to be executed
58695869
///< immediately.
5870-
void *data, ///< [in] data used by pfnNativeEnqueue
5871-
const ur_exp_enqueue_native_command_properties_t
5872-
*pProperties, ///< [in] pointer to the native enqueue properties
5870+
void *data, ///< [in][optional] data used by pfnNativeEnqueue
5871+
const ur_exp_enqueue_native_command_properties_t *
5872+
pProperties, ///< [in][optional] pointer to the native enqueue properties
58735873
uint32_t numEventsInWaitList, ///< [in] size of the event wait list
58745874
const ur_event_handle_t *
58755875
phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of
58765876
///< events that must be complete before the kernel execution.
5877-
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait
5878-
///< events.
5877+
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
58795878
ur_event_handle_t *
58805879
phEvent ///< [in,out] return an event object that identifies the work that has
58815880
///< been enqueued in nativeEnqueueFunc.

source/adapters/opencl/enqueue_native.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
UR_APICALL UR_APIEXPORT ur_result_t urEnqueueNativeCommandExp(
1414
ur_queue_handle_t, ur_exp_enqueue_native_command_function_t, void *,
15-
const ur_exp_enqueue_native_command_properties_t *,
16-
uint32_t, const ur_event_handle_t *, ur_event_handle_t *) {
15+
const ur_exp_enqueue_native_command_properties_t *, uint32_t,
16+
const ur_event_handle_t *, ur_event_handle_t *) {
1717
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
1818
}
19-

source/common/stype_map_helpers.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,6 @@ template <>
9595
struct stype_map<ur_exp_sampler_addr_modes_t> : stype_map_impl<UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES> {};
9696
template <>
9797
struct stype_map<ur_exp_sampler_cubemap_properties_t> : stype_map_impl<UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES> {};
98+
template <>
99+
struct stype_map<ur_exp_enqueue_native_command_properties_t> : stype_map_impl<UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES> {};
98100

0 commit comments

Comments
 (0)