Skip to content

Commit 2e7488f

Browse files
committed
Merge branch 'main' into review/yang/misalign_access
2 parents 43e5dae + aaf0810 commit 2e7488f

Some content is hidden

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

64 files changed

+1558
-81
lines changed

include/ur_api.h

Lines changed: 102 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ typedef enum ur_function_t {
225225
UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE = 225, ///< Enumerator for ::urKernelGetSuggestedLocalWorkSize
226226
UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP = 226, ///< Enumerator for ::urBindlessImagesImportExternalMemoryExp
227227
UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP = 227, ///< Enumerator for ::urBindlessImagesImportExternalSemaphoreExp
228+
UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP = 228, ///< Enumerator for ::urEnqueueNativeCommandExp
228229
/// @cond
229230
UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
230231
/// @endcond
@@ -281,6 +282,7 @@ typedef enum ur_structure_type_t {
281282
UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t
282283
UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES = 0x2005, ///< ::ur_exp_sampler_addr_modes_t
283284
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
284286
/// @cond
285287
UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff
286288
/// @endcond
@@ -1599,6 +1601,7 @@ typedef enum ur_device_info_t {
15991601
///< command-buffers.
16001602
UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP = 0x1001, ///< [::ur_bool_t] Returns true if the device supports updating the kernel
16011603
///< commands in a command-buffer.
1604+
UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP = 0x1111, ///< [::ur_bool_t] return true if enqueue Cluster Launch is supported
16021605
UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP = 0x2000, ///< [::ur_bool_t] returns true if the device supports the creation of
16031606
///< bindless images
16041607
UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP = 0x2001, ///< [::ur_bool_t] returns true if the device supports the creation of
@@ -1648,6 +1651,8 @@ typedef enum ur_device_info_t {
16481651
UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP = 0x2017, ///< [::ur_bool_t] returns true if the device is capable of fetching
16491652
///< non-USM backed 3D sampled image data.
16501653
UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP = 0x2018, ///< [::ur_bool_t] returns true if the device supports timestamp recording
1654+
UR_DEVICE_INFO_ENQUEUE_NATIVE_COMMAND_SUPPORT_EXP = 0x2020, ///< [::ur_bool_t] returns true if the device supports enqueueing of native
1655+
///< work
16511656
/// @cond
16521657
UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff
16531658
/// @endcond
@@ -1673,7 +1678,7 @@ typedef enum ur_device_info_t {
16731678
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
16741679
/// + `NULL == hDevice`
16751680
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
1676-
/// + `::UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP < propName`
1681+
/// + `::UR_DEVICE_INFO_ENQUEUE_NATIVE_COMMAND_SUPPORT_EXP < propName`
16771682
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
16781683
/// + If `propName` is not supported by the adapter.
16791684
/// - ::UR_RESULT_ERROR_INVALID_SIZE
@@ -2820,6 +2825,8 @@ urMemBufferPartition(
28202825
/// - The application may call this function from simultaneous threads for
28212826
/// the same context.
28222827
/// - The implementation of this function should be thread-safe.
2828+
/// - The implementation may require a valid device handle to return the
2829+
/// native mem handle
28232830
///
28242831
/// @returns
28252832
/// - ::UR_RESULT_SUCCESS
@@ -2828,15 +2835,16 @@ urMemBufferPartition(
28282835
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
28292836
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
28302837
/// + `NULL == hMem`
2831-
/// + `NULL == hDevice`
2838+
/// + If `hDevice == NULL` and the implementation requires a valid device.
28322839
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
28332840
/// + `NULL == phNativeMem`
28342841
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
28352842
/// + If the adapter has no underlying equivalent handle.
28362843
UR_APIEXPORT ur_result_t UR_APICALL
28372844
urMemGetNativeHandle(
28382845
ur_mem_handle_t hMem, ///< [in] handle of the mem.
2839-
ur_device_handle_t hDevice, ///< [in] handle of the device that the native handle will be resident on.
2846+
ur_device_handle_t hDevice, ///< [in][optional] handle of the device that the native handle will be
2847+
///< resident on.
28402848
ur_native_handle_t *phNativeMem ///< [out] a pointer to the native handle of the mem.
28412849
);
28422850

@@ -5683,6 +5691,7 @@ typedef enum ur_command_t {
56835691
UR_COMMAND_INTEROP_SEMAPHORE_WAIT_EXP = 0x2000, ///< Event created by ::urBindlessImagesWaitExternalSemaphoreExp
56845692
UR_COMMAND_INTEROP_SEMAPHORE_SIGNAL_EXP = 0x2001, ///< Event created by ::urBindlessImagesSignalExternalSemaphoreExp
56855693
UR_COMMAND_TIMESTAMP_RECORDING_EXP = 0x2002, ///< Event created by ::urEnqueueTimestampRecordingExp
5694+
UR_COMMAND_ENQUEUE_NATIVE_EXP = 0x2004, ///< Event created by ::urEnqueueNativeCommandExp
56865695
/// @cond
56875696
UR_COMMAND_FORCE_UINT32 = 0x7fffffff
56885697
/// @endcond
@@ -9497,6 +9506,80 @@ urUsmP2PPeerAccessGetInfoExp(
94979506
size_t *pPropSizeRet ///< [out][optional] pointer to the actual size in bytes of the queried propName.
94989507
);
94999508

9509+
#if !defined(__GNUC__)
9510+
#pragma endregion
9511+
#endif
9512+
// Intel 'oneAPI' Unified Runtime Experimental API for enqueuing work through native APIs
9513+
#if !defined(__GNUC__)
9514+
#pragma region native enqueue(experimental)
9515+
#endif
9516+
///////////////////////////////////////////////////////////////////////////////
9517+
/// @brief Native enqueue properties
9518+
typedef uint32_t ur_exp_enqueue_native_command_flags_t;
9519+
typedef enum ur_exp_enqueue_native_command_flag_t {
9520+
UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_TBD = UR_BIT(0), ///< reserved for future use.
9521+
/// @cond
9522+
UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_FORCE_UINT32 = 0x7fffffff
9523+
/// @endcond
9524+
9525+
} ur_exp_enqueue_native_command_flag_t;
9526+
/// @brief Bit Mask for validating ur_exp_enqueue_native_command_flags_t
9527+
#define UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK 0xfffffffe
9528+
9529+
///////////////////////////////////////////////////////////////////////////////
9530+
/// @brief Native enqueue properties
9531+
typedef struct ur_exp_enqueue_native_command_properties_t {
9532+
ur_structure_type_t stype; ///< [in] type of this structure, must be
9533+
///< ::UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES
9534+
void *pNext; ///< [in,out][optional] pointer to extension-specific structure
9535+
ur_exp_enqueue_native_command_flags_t flags; ///< [in] native enqueue flags
9536+
9537+
} ur_exp_enqueue_native_command_properties_t;
9538+
9539+
///////////////////////////////////////////////////////////////////////////////
9540+
/// @brief Function enqueueing work through the native API to be executed
9541+
/// immediately.
9542+
typedef void (*ur_exp_enqueue_native_command_function_t)(
9543+
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
9544+
void *pUserData ///< [in][out] pointer to data to be passed to callback
9545+
);
9546+
9547+
///////////////////////////////////////////////////////////////////////////////
9548+
/// @brief Immediately enqueue work through a native backend API
9549+
///
9550+
/// @returns
9551+
/// - ::UR_RESULT_SUCCESS
9552+
/// - ::UR_RESULT_ERROR_UNINITIALIZED
9553+
/// - ::UR_RESULT_ERROR_DEVICE_LOST
9554+
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
9555+
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
9556+
/// + `NULL == hQueue`
9557+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
9558+
/// + `NULL == pfnNativeEnqueue`
9559+
/// + `NULL == phEvent`
9560+
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
9561+
/// + `NULL != pProperties && ::UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK & pProperties->flags`
9562+
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
9563+
UR_APIEXPORT ur_result_t UR_APICALL
9564+
urEnqueueNativeCommandExp(
9565+
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
9566+
ur_exp_enqueue_native_command_function_t pfnNativeEnqueue, ///< [in] function calling the native underlying API, to be executed
9567+
///< immediately.
9568+
void *data, ///< [in][optional] data used by pfnNativeEnqueue
9569+
uint32_t numMemsInMemList, ///< [in] size of the mem list
9570+
const ur_mem_handle_t *phMemList, ///< [in][optional][range(0, numMemsInMemList)] mems that are used within
9571+
///< pfnNativeEnqueue using ::urMemGetNativeHandle.
9572+
///< If nullptr, the numMemsInMemList must be 0, indicating that no mems
9573+
///< are accessed with ::urMemGetNativeHandle within pfnNativeEnqueue.
9574+
const ur_exp_enqueue_native_command_properties_t *pProperties, ///< [in][optional] pointer to the native enqueue properties
9575+
uint32_t numEventsInWaitList, ///< [in] size of the event wait list
9576+
const ur_event_handle_t *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of
9577+
///< events that must be complete before the kernel execution.
9578+
///< If nullptr, the numEventsInWaitList must be 0, indicating no wait events.
9579+
ur_event_handle_t *phEvent ///< [in,out] return an event object that identifies the work that has
9580+
///< been enqueued in nativeEnqueueFunc.
9581+
);
9582+
95009583
#if !defined(__GNUC__)
95019584
#pragma endregion
95029585
#endif
@@ -10916,6 +10999,22 @@ typedef struct ur_enqueue_timestamp_recording_exp_params_t {
1091610999
ur_event_handle_t **pphEvent;
1091711000
} ur_enqueue_timestamp_recording_exp_params_t;
1091811001

11002+
///////////////////////////////////////////////////////////////////////////////
11003+
/// @brief Function parameters for urEnqueueNativeCommandExp
11004+
/// @details Each entry is a pointer to the parameter passed to the function;
11005+
/// allowing the callback the ability to modify the parameter's value
11006+
typedef struct ur_enqueue_native_command_exp_params_t {
11007+
ur_queue_handle_t *phQueue;
11008+
ur_exp_enqueue_native_command_function_t *ppfnNativeEnqueue;
11009+
void **pdata;
11010+
uint32_t *pnumMemsInMemList;
11011+
const ur_mem_handle_t **pphMemList;
11012+
const ur_exp_enqueue_native_command_properties_t **ppProperties;
11013+
uint32_t *pnumEventsInWaitList;
11014+
const ur_event_handle_t **pphEventWaitList;
11015+
ur_event_handle_t **pphEvent;
11016+
} ur_enqueue_native_command_exp_params_t;
11017+
1091911018
///////////////////////////////////////////////////////////////////////////////
1092011019
/// @brief Function parameters for urBindlessImagesUnsampledImageHandleDestroyExp
1092111020
/// @details Each entry is a pointer to the parameter passed to the function;

include/ur_ddi.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,12 +1483,26 @@ typedef ur_result_t(UR_APICALL *ur_pfnEnqueueTimestampRecordingExp_t)(
14831483
const ur_event_handle_t *,
14841484
ur_event_handle_t *);
14851485

1486+
///////////////////////////////////////////////////////////////////////////////
1487+
/// @brief Function-pointer for urEnqueueNativeCommandExp
1488+
typedef ur_result_t(UR_APICALL *ur_pfnEnqueueNativeCommandExp_t)(
1489+
ur_queue_handle_t,
1490+
ur_exp_enqueue_native_command_function_t,
1491+
void *,
1492+
uint32_t,
1493+
const ur_mem_handle_t *,
1494+
const ur_exp_enqueue_native_command_properties_t *,
1495+
uint32_t,
1496+
const ur_event_handle_t *,
1497+
ur_event_handle_t *);
1498+
14861499
///////////////////////////////////////////////////////////////////////////////
14871500
/// @brief Table of EnqueueExp functions pointers
14881501
typedef struct ur_enqueue_exp_dditable_t {
14891502
ur_pfnEnqueueKernelLaunchCustomExp_t pfnKernelLaunchCustomExp;
14901503
ur_pfnEnqueueCooperativeKernelLaunchExp_t pfnCooperativeKernelLaunchExp;
14911504
ur_pfnEnqueueTimestampRecordingExp_t pfnTimestampRecordingExp;
1505+
ur_pfnEnqueueNativeCommandExp_t pfnNativeCommandExp;
14921506
} ur_enqueue_exp_dditable_t;
14931507

14941508
///////////////////////////////////////////////////////////////////////////////

include/ur_print.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintExpLaunchProperty(const struct ur_exp
10421042
/// - `buff_size < out_size`
10431043
UR_APIEXPORT ur_result_t UR_APICALL urPrintExpPeerInfo(enum ur_exp_peer_info_t value, char *buffer, const size_t buff_size, size_t *out_size);
10441044

1045+
///////////////////////////////////////////////////////////////////////////////
1046+
/// @brief Print ur_exp_enqueue_native_command_flag_t enum
1047+
/// @returns
1048+
/// - ::UR_RESULT_SUCCESS
1049+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
1050+
/// - `buff_size < out_size`
1051+
UR_APIEXPORT ur_result_t UR_APICALL urPrintExpEnqueueNativeCommandFlags(enum ur_exp_enqueue_native_command_flag_t value, char *buffer, const size_t buff_size, size_t *out_size);
1052+
1053+
///////////////////////////////////////////////////////////////////////////////
1054+
/// @brief Print ur_exp_enqueue_native_command_properties_t struct
1055+
/// @returns
1056+
/// - ::UR_RESULT_SUCCESS
1057+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
1058+
/// - `buff_size < out_size`
1059+
UR_APIEXPORT ur_result_t UR_APICALL urPrintExpEnqueueNativeCommandProperties(const struct ur_exp_enqueue_native_command_properties_t params, char *buffer, const size_t buff_size, size_t *out_size);
1060+
10451061
///////////////////////////////////////////////////////////////////////////////
10461062
/// @brief Print ur_loader_config_create_params_t struct
10471063
/// @returns
@@ -2010,6 +2026,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueCooperativeKernelLaunchExpPara
20102026
/// - `buff_size < out_size`
20112027
UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueTimestampRecordingExpParams(const struct ur_enqueue_timestamp_recording_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
20122028

2029+
///////////////////////////////////////////////////////////////////////////////
2030+
/// @brief Print ur_enqueue_native_command_exp_params_t struct
2031+
/// @returns
2032+
/// - ::UR_RESULT_SUCCESS
2033+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
2034+
/// - `buff_size < out_size`
2035+
UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueNativeCommandExpParams(const struct ur_enqueue_native_command_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
2036+
20132037
///////////////////////////////////////////////////////////////////////////////
20142038
/// @brief Print ur_bindless_images_unsampled_image_handle_destroy_exp_params_t struct
20152039
/// @returns

0 commit comments

Comments
 (0)