From 5e5fb16bb2f6161b143865160177670767c91c08 Mon Sep 17 00:00:00 2001 From: Sean Stirling Date: Fri, 21 Feb 2025 15:30:58 +0000 Subject: [PATCH 1/6] [AsyncAlloc][UR][Exp] Initial spec for async alloc entry points Introduce UR API for the creation and use of memory pools with enqueued allocs/frees. Currently, this only supports device allocated memory pools. This is only a spec introduced to enable parallel working between teams. Since this spec is experimental, it may change drastically between revisions. co-authored-by: Sean Stirling co-authored-by: Hugh Delaney --- unified-runtime/include/ur_api.h | 1518 +++++++++----- unified-runtime/include/ur_api_funcs.def | 36 +- unified-runtime/include/ur_ddi.h | 353 ++-- unified-runtime/include/ur_print.h | 380 ++-- unified-runtime/include/ur_print.hpp | 1742 ++++++++++++----- .../scripts/core/EXP-ASYNC-ALLOC.rst | 105 + .../scripts/core/exp-async-alloc.yml | 472 +++++ unified-runtime/scripts/core/registry.yml | 36 + .../source/adapters/cuda/CMakeLists.txt | 1 + .../source/adapters/cuda/async_alloc.cpp | 43 + .../adapters/cuda/ur_interface_loader.cpp | 12 + unified-runtime/source/adapters/cuda/usm.cpp | 82 + .../source/adapters/hip/CMakeLists.txt | 1 + .../source/adapters/hip/async_alloc.cpp | 40 + .../adapters/hip/ur_interface_loader.cpp | 8 + unified-runtime/source/adapters/hip/usm.cpp | 84 + .../source/adapters/level_zero/CMakeLists.txt | 1 + .../adapters/level_zero/async_alloc.cpp | 40 + .../level_zero/ur_interface_loader.cpp | 15 + .../level_zero/ur_interface_loader.hpp | 47 + .../source/adapters/level_zero/usm.cpp | 204 ++ .../adapters/level_zero/v2/queue_api.cpp | 43 + .../adapters/level_zero/v2/queue_api.hpp | 18 + .../source/adapters/mock/ur_mockddi.cpp | 670 +++++++ .../source/adapters/native_cpu/CMakeLists.txt | 1 + .../adapters/native_cpu/async_alloc.cpp | 40 + .../source/adapters/native_cpu/usm.cpp | 84 + .../source/adapters/opencl/CMakeLists.txt | 1 + .../source/adapters/opencl/async_alloc.cpp | 40 + .../source/adapters/opencl/usm.cpp | 84 + .../source/common/stype_map_helpers.def | 2 + .../loader/layers/tracing/ur_trcddi.cpp | 589 ++++++ .../loader/layers/validation/ur_valddi.cpp | 670 ++++++- unified-runtime/source/loader/loader.def.in | 26 + unified-runtime/source/loader/loader.map.in | 26 + unified-runtime/source/loader/ur_ldrddi.cpp | 576 ++++++ unified-runtime/source/loader/ur_libapi.cpp | 502 ++++- unified-runtime/source/loader/ur_print.cpp | 113 ++ unified-runtime/source/ur_api.cpp | 423 +++- unified-runtime/tools/urinfo/urinfo.hpp | 2 + 40 files changed, 7924 insertions(+), 1206 deletions(-) create mode 100644 unified-runtime/scripts/core/EXP-ASYNC-ALLOC.rst create mode 100644 unified-runtime/scripts/core/exp-async-alloc.yml create mode 100644 unified-runtime/source/adapters/cuda/async_alloc.cpp create mode 100644 unified-runtime/source/adapters/hip/async_alloc.cpp create mode 100644 unified-runtime/source/adapters/level_zero/async_alloc.cpp create mode 100644 unified-runtime/source/adapters/native_cpu/async_alloc.cpp create mode 100644 unified-runtime/source/adapters/opencl/async_alloc.cpp diff --git a/unified-runtime/include/ur_api.h b/unified-runtime/include/ur_api.h index c390ed4410d16..6c3f161436d21 100644 --- a/unified-runtime/include/ur_api.h +++ b/unified-runtime/include/ur_api.h @@ -429,6 +429,30 @@ typedef enum ur_function_t { UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER_EXT = 246, /// Enumerator for ::urPhysicalMemGetInfo UR_FUNCTION_PHYSICAL_MEM_GET_INFO = 249, + /// Enumerator for ::urEnqueueUSMDeviceAllocExp + UR_FUNCTION_ENQUEUE_USM_DEVICE_ALLOC_EXP = 250, + /// Enumerator for ::urEnqueueUSMSharedAllocExp + UR_FUNCTION_ENQUEUE_USM_SHARED_ALLOC_EXP = 251, + /// Enumerator for ::urEnqueueUSMHostAllocExp + UR_FUNCTION_ENQUEUE_USM_HOST_ALLOC_EXP = 252, + /// Enumerator for ::urEnqueueUSMFreeExp + UR_FUNCTION_ENQUEUE_USM_FREE_EXP = 253, + /// Enumerator for ::urUSMPoolCreateExp + UR_FUNCTION_USM_POOL_CREATE_EXP = 254, + /// Enumerator for ::urUSMPoolDestroyExp + UR_FUNCTION_USM_POOL_DESTROY_EXP = 255, + /// Enumerator for ::urUSMPoolSetThresholdExp + UR_FUNCTION_USM_POOL_SET_THRESHOLD_EXP = 256, + /// Enumerator for ::urUSMPoolGetDefaultDevicePoolExp + UR_FUNCTION_USM_POOL_GET_DEFAULT_DEVICE_POOL_EXP = 257, + /// Enumerator for ::urUSMPoolSetDevicePoolExp + UR_FUNCTION_USM_POOL_SET_DEVICE_POOL_EXP = 259, + /// Enumerator for ::urUSMPoolGetDevicePoolExp + UR_FUNCTION_USM_POOL_GET_DEVICE_POOL_EXP = 260, + /// Enumerator for ::urUSMPoolTrimToExp + UR_FUNCTION_USM_POOL_TRIM_TO_EXP = 261, + /// Enumerator for ::urUSMPoolGetInfoExp + UR_FUNCTION_USM_POOL_GET_INFO_EXP = 262, /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -534,6 +558,8 @@ typedef enum ur_structure_type_t { UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES = 0x2006, /// ::ur_exp_image_copy_region_t UR_STRUCTURE_TYPE_EXP_IMAGE_COPY_REGION = 0x2007, + /// ::ur_exp_async_usm_alloc_properties_t + UR_STRUCTURE_TYPE_EXP_ASYNC_USM_ALLOC_PROPERTIES = 0x2050, /// ::ur_exp_enqueue_native_command_properties_t UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES = 0x3000, /// ::ur_exp_enqueue_ext_properties_t @@ -2290,6 +2316,9 @@ typedef enum ur_device_info_t { /// [::ur_exp_device_2d_block_array_capability_flags_t] return a bit-field /// of Intel GPU 2D block array capabilities UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP = 0x2022, + /// [::ur_bool_t] returns true if the device supports enqueueing of + /// allocations and frees. + UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP = 0x2050, /// @cond UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -2315,7 +2344,7 @@ typedef enum ur_device_info_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP < propName` +/// + `::UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -4189,13 +4218,18 @@ typedef enum ur_usm_pool_flag_t { /// All coarse-grain allocations (allocations from the driver) will be /// zero-initialized. UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK = UR_BIT(0), + /// Use the native memory pool API + UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP = UR_BIT(1), + /// Performance hint asserting that all memory allocations from the + /// memory pool will only ever be read from within SYCL kernel functions + UR_USM_POOL_FLAG_READ_ONLY_EXP = UR_BIT(2), /// @cond UR_USM_POOL_FLAG_FORCE_UINT32 = 0x7fffffff /// @endcond } ur_usm_pool_flag_t; /// @brief Bit Mask for validating ur_usm_pool_flags_t -#define UR_USM_POOL_FLAGS_MASK 0xfffffffe +#define UR_USM_POOL_FLAGS_MASK 0xfffffff8 /////////////////////////////////////////////////////////////////////////////// /// @brief USM allocation type @@ -4694,6 +4728,21 @@ typedef enum ur_usm_pool_info_t { UR_USM_POOL_INFO_REFERENCE_COUNT = 0, /// [::ur_context_handle_t] USM memory pool context info UR_USM_POOL_INFO_CONTEXT = 1, + /// [size_t] Memory pool release threshold + UR_USM_POOL_INFO_RELEASE_THRESHOLD_EXP = 0x2050, + /// [size_t] Memory pool maximum size + UR_USM_POOL_INFO_MAXIMUM_SIZE_EXP = 0x2051, + /// [size_t] Amount of backing memory currently allocated for the memory + /// pool + UR_USM_POOL_INFO_RESERVED_CURRENT_EXP = 0x2052, + /// [size_t] High watermark of backing memory allocated for the memory + /// pool + UR_USM_POOL_INFO_RESERVED_HIGH_EXP = 0x2053, + /// [size_t] Amount of memory from the pool that is currently in use + UR_USM_POOL_INFO_USED_CURRENT_EXP = 0x2054, + /// [size_t] High watermark of the amount of memory from the pool that was + /// in use + UR_USM_POOL_INFO_USED_HIGH_EXP = 0x2055, /// @cond UR_USM_POOL_INFO_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -4711,7 +4760,7 @@ typedef enum ur_usm_pool_info_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPool` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_USM_POOL_INFO_CONTEXT < propName` +/// + `::UR_USM_POOL_INFO_USED_HIGH_EXP < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -7055,6 +7104,14 @@ typedef enum ur_command_t { UR_COMMAND_TIMESTAMP_RECORDING_EXP = 0x2002, /// Event created by ::urEnqueueNativeCommandExp UR_COMMAND_ENQUEUE_NATIVE_EXP = 0x2004, + /// Event created by ::urEnqueueUSMDeviceAllocExp + UR_COMMAND_ENQUEUE_USM_DEVICE_ALLOC_EXP = 0x2050, + /// Event created by ::urEnqueueUSMSharedAllocExp + UR_COMMAND_ENQUEUE_USM_SHARED_ALLOC_EXP = 0x2051, + /// Event created by ::urEnqueueUSMHostAllocExp + UR_COMMAND_ENQUEUE_USM_HOST_ALLOC_EXP = 0x2052, + /// Event created by ::urEnqueueUSMFreeExp + UR_COMMAND_ENQUEUE_USM_FREE_EXP = 0x2053, /// @cond UR_COMMAND_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -8957,6 +9014,423 @@ typedef enum ur_exp_device_2d_block_array_capability_flag_t { /// ur_exp_device_2d_block_array_capability_flags_t #define UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAGS_MASK 0xfffffffc +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental API for asynchronous allocations +#if !defined(__GNUC__) +#pragma region async_alloc_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Async alloc properties +typedef uint32_t ur_exp_async_usm_alloc_flags_t; +typedef enum ur_exp_async_usm_alloc_flag_t { + /// Reserved for future use. + UR_EXP_ASYNC_USM_ALLOC_FLAG_TBD = UR_BIT(0), + /// @cond + UR_EXP_ASYNC_USM_ALLOC_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_async_usm_alloc_flag_t; +/// @brief Bit Mask for validating ur_exp_async_usm_alloc_flags_t +#define UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK 0xfffffffe + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Async alloc properties +typedef struct ur_exp_async_usm_alloc_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_ASYNC_USM_ALLOC_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] async alloc flags + ur_exp_async_usm_alloc_flags_t flags; + +} ur_exp_async_usm_alloc_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async device allocation +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async shared allocation +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async host allocation +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async free +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFreeExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] pointer to USM memory object + void *pMem, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create USM memory pool with desired properties. +/// +/// @details +/// - Create a memory pool associated with a single device. +/// - See also ::urUSMPoolCreate and ::ur_usm_pool_limits_desc_t. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPoolDesc` +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_POOL_FLAGS_MASK & pPoolDesc->flags` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolCreateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] pointer to USM pool descriptor. Can be chained with + /// ::ur_usm_pool_limits_desc_t + ur_usm_pool_desc_t *pPoolDesc, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Destroy a USM memory pool. +/// +/// @details +/// - Destroy a memory pool associated with a single device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolDestroyExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to be destroyed + ur_usm_pool_handle_t hPool); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a new release threshold for a USM memory pool. +/// +/// @details +/// - Set a new release threshold for a USM memory pool. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for the threshold to be set + ur_usm_pool_handle_t hPool, + /// [in] release threshold to be set + size_t newThreshold); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the default pool for a device. +/// +/// @details +/// - Get the default pool for a device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query a pool for specific properties. +/// +/// @details +/// - Query a memory pool for specific properties. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_POOL_INFO_USED_HIGH_EXP < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_DEVICE +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfoExp( + /// [in] handle to USM memory pool for property retrieval + ur_usm_pool_handle_t hPool, + /// [in] queried property name + ur_usm_pool_info_t propName, + /// [out][optional] returned query value + void *pPropValue, + /// [out][optional] returned query value size + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the current pool for a device. +/// +/// @details +/// - Set the current pool for a device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to set for a device + ur_usm_pool_handle_t hPool); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the currently set pool for a device. +/// +/// @details +/// - Get the currently set pool for a device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Attempt to release a pool's memory back to the OS +/// +/// @details +/// - Attempt to release a pool's memory back to the OS +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolTrimToExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for trimming + ur_usm_pool_handle_t hPool, + /// [in] minimum number of bytes to keep in the pool + size_t minBytesToKeep); + #if !defined(__GNUC__) #pragma endregion #endif @@ -13015,541 +13489,816 @@ typedef struct ur_physical_mem_release_params_t { } ur_physical_mem_release_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urPhysicalMemGetInfo +/// @brief Function parameters for urPhysicalMemGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_physical_mem_get_info_params_t { + ur_physical_mem_handle_t *phPhysicalMem; + ur_physical_mem_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_physical_mem_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterGet +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_get_params_t { + uint32_t *pNumEntries; + ur_adapter_handle_t **pphAdapters; + uint32_t **ppNumAdapters; +} ur_adapter_get_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_release_params_t { + ur_adapter_handle_t *phAdapter; +} ur_adapter_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_retain_params_t { + ur_adapter_handle_t *phAdapter; +} ur_adapter_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterGetLastError +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_get_last_error_params_t { + ur_adapter_handle_t *phAdapter; + const char ***pppMessage; + int32_t **ppError; +} ur_adapter_get_last_error_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_get_info_params_t { + ur_adapter_handle_t *phAdapter; + ur_adapter_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_adapter_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueKernelLaunch +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_kernel_launch_params_t { + ur_queue_handle_t *phQueue; + ur_kernel_handle_t *phKernel; + uint32_t *pworkDim; + const size_t **ppGlobalWorkOffset; + const size_t **ppGlobalWorkSize; + const size_t **ppLocalWorkSize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_kernel_launch_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueEventsWait +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_events_wait_params_t { + ur_queue_handle_t *phQueue; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_events_wait_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueEventsWaitWithBarrier +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_events_wait_with_barrier_params_t { + ur_queue_handle_t *phQueue; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_events_wait_with_barrier_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferRead +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_read_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingRead; + size_t *poffset; + size_t *psize; + void **ppDst; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_read_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferWrite +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_write_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingWrite; + size_t *poffset; + size_t *psize; + const void **ppSrc; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_write_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferReadRect +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_read_rect_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingRead; + ur_rect_offset_t *pbufferOrigin; + ur_rect_offset_t *phostOrigin; + ur_rect_region_t *pregion; + size_t *pbufferRowPitch; + size_t *pbufferSlicePitch; + size_t *phostRowPitch; + size_t *phostSlicePitch; + void **ppDst; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_read_rect_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferWriteRect +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_write_rect_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingWrite; + ur_rect_offset_t *pbufferOrigin; + ur_rect_offset_t *phostOrigin; + ur_rect_region_t *pregion; + size_t *pbufferRowPitch; + size_t *pbufferSlicePitch; + size_t *phostRowPitch; + size_t *phostSlicePitch; + void **ppSrc; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_write_rect_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferCopy +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_copy_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBufferSrc; + ur_mem_handle_t *phBufferDst; + size_t *psrcOffset; + size_t *pdstOffset; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_copy_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferCopyRect +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_copy_rect_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBufferSrc; + ur_mem_handle_t *phBufferDst; + ur_rect_offset_t *psrcOrigin; + ur_rect_offset_t *pdstOrigin; + ur_rect_region_t *pregion; + size_t *psrcRowPitch; + size_t *psrcSlicePitch; + size_t *pdstRowPitch; + size_t *pdstSlicePitch; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_copy_rect_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferFill +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_fill_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + const void **ppPattern; + size_t *ppatternSize; + size_t *poffset; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_fill_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemImageRead /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_physical_mem_get_info_params_t { - ur_physical_mem_handle_t *phPhysicalMem; - ur_physical_mem_info_t *ppropName; - size_t *ppropSize; - void **ppPropValue; - size_t **ppPropSizeRet; -} ur_physical_mem_get_info_params_t; +typedef struct ur_enqueue_mem_image_read_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phImage; + bool *pblockingRead; + ur_rect_offset_t *porigin; + ur_rect_region_t *pregion; + size_t *prowPitch; + size_t *pslicePitch; + void **ppDst; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_image_read_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterGet +/// @brief Function parameters for urEnqueueMemImageWrite /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_get_params_t { - uint32_t *pNumEntries; - ur_adapter_handle_t **pphAdapters; - uint32_t **ppNumAdapters; -} ur_adapter_get_params_t; +typedef struct ur_enqueue_mem_image_write_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phImage; + bool *pblockingWrite; + ur_rect_offset_t *porigin; + ur_rect_region_t *pregion; + size_t *prowPitch; + size_t *pslicePitch; + void **ppSrc; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_image_write_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterRelease +/// @brief Function parameters for urEnqueueMemImageCopy /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_release_params_t { - ur_adapter_handle_t *phAdapter; -} ur_adapter_release_params_t; +typedef struct ur_enqueue_mem_image_copy_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phImageSrc; + ur_mem_handle_t *phImageDst; + ur_rect_offset_t *psrcOrigin; + ur_rect_offset_t *pdstOrigin; + ur_rect_region_t *pregion; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_image_copy_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterRetain +/// @brief Function parameters for urEnqueueMemBufferMap /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_retain_params_t { - ur_adapter_handle_t *phAdapter; -} ur_adapter_retain_params_t; +typedef struct ur_enqueue_mem_buffer_map_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingMap; + ur_map_flags_t *pmapFlags; + size_t *poffset; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; + void ***pppRetMap; +} ur_enqueue_mem_buffer_map_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterGetLastError +/// @brief Function parameters for urEnqueueMemUnmap /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_get_last_error_params_t { - ur_adapter_handle_t *phAdapter; - const char ***pppMessage; - int32_t **ppError; -} ur_adapter_get_last_error_params_t; +typedef struct ur_enqueue_mem_unmap_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phMem; + void **ppMappedPtr; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_unmap_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterGetInfo +/// @brief Function parameters for urEnqueueUSMFill /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_get_info_params_t { - ur_adapter_handle_t *phAdapter; - ur_adapter_info_t *ppropName; - size_t *ppropSize; - void **ppPropValue; - size_t **ppPropSizeRet; -} ur_adapter_get_info_params_t; +typedef struct ur_enqueue_usm_fill_params_t { + ur_queue_handle_t *phQueue; + void **ppMem; + size_t *ppatternSize; + const void **ppPattern; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_usm_fill_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueKernelLaunch +/// @brief Function parameters for urEnqueueUSMMemcpy /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_kernel_launch_params_t { +typedef struct ur_enqueue_usm_memcpy_params_t { ur_queue_handle_t *phQueue; - ur_kernel_handle_t *phKernel; - uint32_t *pworkDim; - const size_t **ppGlobalWorkOffset; - const size_t **ppGlobalWorkSize; - const size_t **ppLocalWorkSize; + bool *pblocking; + void **ppDst; + const void **ppSrc; + size_t *psize; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_kernel_launch_params_t; +} ur_enqueue_usm_memcpy_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueEventsWait +/// @brief Function parameters for urEnqueueUSMPrefetch /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_events_wait_params_t { +typedef struct ur_enqueue_usm_prefetch_params_t { ur_queue_handle_t *phQueue; + const void **ppMem; + size_t *psize; + ur_usm_migration_flags_t *pflags; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_events_wait_params_t; +} ur_enqueue_usm_prefetch_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueEventsWaitWithBarrier +/// @brief Function parameters for urEnqueueUSMAdvise /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_events_wait_with_barrier_params_t { +typedef struct ur_enqueue_usm_advise_params_t { + ur_queue_handle_t *phQueue; + const void **ppMem; + size_t *psize; + ur_usm_advice_flags_t *padvice; + ur_event_handle_t **pphEvent; +} ur_enqueue_usm_advise_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueUSMFill2D +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_usm_fill_2d_params_t { ur_queue_handle_t *phQueue; + void **ppMem; + size_t *ppitch; + size_t *ppatternSize; + const void **ppPattern; + size_t *pwidth; + size_t *pheight; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_events_wait_with_barrier_params_t; +} ur_enqueue_usm_fill_2d_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemBufferRead +/// @brief Function parameters for urEnqueueUSMMemcpy2D /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_buffer_read_params_t { +typedef struct ur_enqueue_usm_memcpy_2d_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phBuffer; - bool *pblockingRead; - size_t *poffset; - size_t *psize; + bool *pblocking; void **ppDst; + size_t *pdstPitch; + const void **ppSrc; + size_t *psrcPitch; + size_t *pwidth; + size_t *pheight; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_buffer_read_params_t; +} ur_enqueue_usm_memcpy_2d_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemBufferWrite +/// @brief Function parameters for urEnqueueDeviceGlobalVariableWrite /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_buffer_write_params_t { +typedef struct ur_enqueue_device_global_variable_write_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phBuffer; + ur_program_handle_t *phProgram; + const char **pname; bool *pblockingWrite; + size_t *pcount; size_t *poffset; - size_t *psize; const void **ppSrc; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_buffer_write_params_t; +} ur_enqueue_device_global_variable_write_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemBufferReadRect +/// @brief Function parameters for urEnqueueDeviceGlobalVariableRead /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_buffer_read_rect_params_t { +typedef struct ur_enqueue_device_global_variable_read_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phBuffer; + ur_program_handle_t *phProgram; + const char **pname; bool *pblockingRead; - ur_rect_offset_t *pbufferOrigin; - ur_rect_offset_t *phostOrigin; - ur_rect_region_t *pregion; - size_t *pbufferRowPitch; - size_t *pbufferSlicePitch; - size_t *phostRowPitch; - size_t *phostSlicePitch; + size_t *pcount; + size_t *poffset; void **ppDst; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_buffer_read_rect_params_t; +} ur_enqueue_device_global_variable_read_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemBufferWriteRect +/// @brief Function parameters for urEnqueueReadHostPipe /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_buffer_write_rect_params_t { +typedef struct ur_enqueue_read_host_pipe_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phBuffer; - bool *pblockingWrite; - ur_rect_offset_t *pbufferOrigin; - ur_rect_offset_t *phostOrigin; - ur_rect_region_t *pregion; - size_t *pbufferRowPitch; - size_t *pbufferSlicePitch; - size_t *phostRowPitch; - size_t *phostSlicePitch; - void **ppSrc; + ur_program_handle_t *phProgram; + const char **ppipe_symbol; + bool *pblocking; + void **ppDst; + size_t *psize; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_buffer_write_rect_params_t; +} ur_enqueue_read_host_pipe_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemBufferCopy +/// @brief Function parameters for urEnqueueWriteHostPipe /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_buffer_copy_params_t { +typedef struct ur_enqueue_write_host_pipe_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phBufferSrc; - ur_mem_handle_t *phBufferDst; - size_t *psrcOffset; - size_t *pdstOffset; + ur_program_handle_t *phProgram; + const char **ppipe_symbol; + bool *pblocking; + void **ppSrc; size_t *psize; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_buffer_copy_params_t; +} ur_enqueue_write_host_pipe_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemBufferCopyRect +/// @brief Function parameters for urEnqueueKernelLaunchCustomExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_buffer_copy_rect_params_t { +typedef struct ur_enqueue_kernel_launch_custom_exp_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phBufferSrc; - ur_mem_handle_t *phBufferDst; - ur_rect_offset_t *psrcOrigin; - ur_rect_offset_t *pdstOrigin; - ur_rect_region_t *pregion; - size_t *psrcRowPitch; - size_t *psrcSlicePitch; - size_t *pdstRowPitch; - size_t *pdstSlicePitch; + ur_kernel_handle_t *phKernel; + uint32_t *pworkDim; + const size_t **ppGlobalWorkOffset; + const size_t **ppGlobalWorkSize; + const size_t **ppLocalWorkSize; + uint32_t *pnumPropsInLaunchPropList; + const ur_exp_launch_property_t **plaunchPropList; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_buffer_copy_rect_params_t; +} ur_enqueue_kernel_launch_custom_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemBufferFill +/// @brief Function parameters for urEnqueueEventsWaitWithBarrierExt /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_buffer_fill_params_t { +typedef struct ur_enqueue_events_wait_with_barrier_ext_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phBuffer; - const void **ppPattern; - size_t *ppatternSize; - size_t *poffset; - size_t *psize; + const ur_exp_enqueue_ext_properties_t **ppProperties; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_buffer_fill_params_t; +} ur_enqueue_events_wait_with_barrier_ext_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemImageRead +/// @brief Function parameters for urEnqueueUSMDeviceAllocExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_image_read_params_t { +typedef struct ur_enqueue_usm_device_alloc_exp_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phImage; - bool *pblockingRead; - ur_rect_offset_t *porigin; - ur_rect_region_t *pregion; - size_t *prowPitch; - size_t *pslicePitch; - void **ppDst; + ur_usm_pool_handle_t *ppPool; + const size_t *psize; + const ur_exp_async_usm_alloc_properties_t **ppProperties; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; + void ***pppMem; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_image_read_params_t; +} ur_enqueue_usm_device_alloc_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemImageWrite +/// @brief Function parameters for urEnqueueUSMSharedAllocExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_image_write_params_t { +typedef struct ur_enqueue_usm_shared_alloc_exp_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phImage; - bool *pblockingWrite; - ur_rect_offset_t *porigin; - ur_rect_region_t *pregion; - size_t *prowPitch; - size_t *pslicePitch; - void **ppSrc; + ur_usm_pool_handle_t *ppPool; + const size_t *psize; + const ur_exp_async_usm_alloc_properties_t **ppProperties; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; + void ***pppMem; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_image_write_params_t; +} ur_enqueue_usm_shared_alloc_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemImageCopy +/// @brief Function parameters for urEnqueueUSMHostAllocExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_image_copy_params_t { +typedef struct ur_enqueue_usm_host_alloc_exp_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phImageSrc; - ur_mem_handle_t *phImageDst; - ur_rect_offset_t *psrcOrigin; - ur_rect_offset_t *pdstOrigin; - ur_rect_region_t *pregion; + ur_usm_pool_handle_t *ppPool; + const size_t *psize; + const ur_exp_async_usm_alloc_properties_t **ppProperties; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; + void ***pppMem; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_image_copy_params_t; +} ur_enqueue_usm_host_alloc_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemBufferMap +/// @brief Function parameters for urEnqueueUSMFreeExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_buffer_map_params_t { +typedef struct ur_enqueue_usm_free_exp_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phBuffer; - bool *pblockingMap; - ur_map_flags_t *pmapFlags; - size_t *poffset; - size_t *psize; + ur_usm_pool_handle_t *ppPool; + void **ppMem; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; - void ***pppRetMap; -} ur_enqueue_mem_buffer_map_params_t; +} ur_enqueue_usm_free_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueMemUnmap +/// @brief Function parameters for urEnqueueCooperativeKernelLaunchExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_mem_unmap_params_t { +typedef struct ur_enqueue_cooperative_kernel_launch_exp_params_t { ur_queue_handle_t *phQueue; - ur_mem_handle_t *phMem; - void **ppMappedPtr; + ur_kernel_handle_t *phKernel; + uint32_t *pworkDim; + const size_t **ppGlobalWorkOffset; + const size_t **ppGlobalWorkSize; + const size_t **ppLocalWorkSize; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_mem_unmap_params_t; +} ur_enqueue_cooperative_kernel_launch_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueUSMFill +/// @brief Function parameters for urEnqueueTimestampRecordingExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_usm_fill_params_t { +typedef struct ur_enqueue_timestamp_recording_exp_params_t { ur_queue_handle_t *phQueue; - void **ppMem; - size_t *ppatternSize; - const void **ppPattern; - size_t *psize; + bool *pblocking; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_usm_fill_params_t; +} ur_enqueue_timestamp_recording_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueUSMMemcpy +/// @brief Function parameters for urEnqueueNativeCommandExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_usm_memcpy_params_t { +typedef struct ur_enqueue_native_command_exp_params_t { ur_queue_handle_t *phQueue; - bool *pblocking; - void **ppDst; - const void **ppSrc; - size_t *psize; + ur_exp_enqueue_native_command_function_t *ppfnNativeEnqueue; + void **pdata; + uint32_t *pnumMemsInMemList; + const ur_mem_handle_t **pphMemList; + const ur_exp_enqueue_native_command_properties_t **ppProperties; uint32_t *pnumEventsInWaitList; const ur_event_handle_t **pphEventWaitList; ur_event_handle_t **pphEvent; -} ur_enqueue_usm_memcpy_params_t; +} ur_enqueue_native_command_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueUSMPrefetch +/// @brief Function parameters for urUSMHostAlloc /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_usm_prefetch_params_t { - ur_queue_handle_t *phQueue; - const void **ppMem; +typedef struct ur_usm_host_alloc_params_t { + ur_context_handle_t *phContext; + const ur_usm_desc_t **ppUSMDesc; + ur_usm_pool_handle_t *ppool; size_t *psize; - ur_usm_migration_flags_t *pflags; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_usm_prefetch_params_t; + void ***pppMem; +} ur_usm_host_alloc_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueUSMAdvise +/// @brief Function parameters for urUSMDeviceAlloc /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_usm_advise_params_t { - ur_queue_handle_t *phQueue; - const void **ppMem; +typedef struct ur_usm_device_alloc_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_usm_desc_t **ppUSMDesc; + ur_usm_pool_handle_t *ppool; size_t *psize; - ur_usm_advice_flags_t *padvice; - ur_event_handle_t **pphEvent; -} ur_enqueue_usm_advise_params_t; + void ***pppMem; +} ur_usm_device_alloc_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueUSMFill2D +/// @brief Function parameters for urUSMSharedAlloc /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_usm_fill_2d_params_t { - ur_queue_handle_t *phQueue; +typedef struct ur_usm_shared_alloc_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_usm_desc_t **ppUSMDesc; + ur_usm_pool_handle_t *ppool; + size_t *psize; + void ***pppMem; +} ur_usm_shared_alloc_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMFree +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_free_params_t { + ur_context_handle_t *phContext; void **ppMem; - size_t *ppitch; - size_t *ppatternSize; - const void **ppPattern; - size_t *pwidth; - size_t *pheight; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_usm_fill_2d_params_t; +} ur_usm_free_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueUSMMemcpy2D +/// @brief Function parameters for urUSMGetMemAllocInfo /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_usm_memcpy_2d_params_t { - ur_queue_handle_t *phQueue; - bool *pblocking; - void **ppDst; - size_t *pdstPitch; - const void **ppSrc; - size_t *psrcPitch; - size_t *pwidth; - size_t *pheight; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_usm_memcpy_2d_params_t; +typedef struct ur_usm_get_mem_alloc_info_params_t { + ur_context_handle_t *phContext; + const void **ppMem; + ur_usm_alloc_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_usm_get_mem_alloc_info_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueDeviceGlobalVariableWrite +/// @brief Function parameters for urUSMPoolCreate /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_device_global_variable_write_params_t { - ur_queue_handle_t *phQueue; - ur_program_handle_t *phProgram; - const char **pname; - bool *pblockingWrite; - size_t *pcount; - size_t *poffset; - const void **ppSrc; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_device_global_variable_write_params_t; +typedef struct ur_usm_pool_create_params_t { + ur_context_handle_t *phContext; + ur_usm_pool_desc_t **ppPoolDesc; + ur_usm_pool_handle_t **pppPool; +} ur_usm_pool_create_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueDeviceGlobalVariableRead +/// @brief Function parameters for urUSMPoolRetain /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_device_global_variable_read_params_t { - ur_queue_handle_t *phQueue; - ur_program_handle_t *phProgram; - const char **pname; - bool *pblockingRead; - size_t *pcount; - size_t *poffset; - void **ppDst; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_device_global_variable_read_params_t; +typedef struct ur_usm_pool_retain_params_t { + ur_usm_pool_handle_t *ppPool; +} ur_usm_pool_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPoolRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pool_release_params_t { + ur_usm_pool_handle_t *ppPool; +} ur_usm_pool_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPoolGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pool_get_info_params_t { + ur_usm_pool_handle_t *phPool; + ur_usm_pool_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_usm_pool_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPoolCreateExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pool_create_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_usm_pool_desc_t **ppPoolDesc; + ur_usm_pool_handle_t **ppPool; +} ur_usm_pool_create_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPoolDestroyExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pool_destroy_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_usm_pool_handle_t *phPool; +} ur_usm_pool_destroy_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPoolSetThresholdExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pool_set_threshold_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_usm_pool_handle_t *phPool; + size_t *pnewThreshold; +} ur_usm_pool_set_threshold_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueReadHostPipe +/// @brief Function parameters for urUSMPoolGetDefaultDevicePoolExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_read_host_pipe_params_t { - ur_queue_handle_t *phQueue; - ur_program_handle_t *phProgram; - const char **ppipe_symbol; - bool *pblocking; - void **ppDst; - size_t *psize; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_read_host_pipe_params_t; +typedef struct ur_usm_pool_get_default_device_pool_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_usm_pool_handle_t **ppPool; +} ur_usm_pool_get_default_device_pool_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueWriteHostPipe +/// @brief Function parameters for urUSMPoolGetInfoExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_write_host_pipe_params_t { - ur_queue_handle_t *phQueue; - ur_program_handle_t *phProgram; - const char **ppipe_symbol; - bool *pblocking; - void **ppSrc; - size_t *psize; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_write_host_pipe_params_t; +typedef struct ur_usm_pool_get_info_exp_params_t { + ur_usm_pool_handle_t *phPool; + ur_usm_pool_info_t *ppropName; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_usm_pool_get_info_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueKernelLaunchCustomExp +/// @brief Function parameters for urUSMPoolSetDevicePoolExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_kernel_launch_custom_exp_params_t { - ur_queue_handle_t *phQueue; - ur_kernel_handle_t *phKernel; - uint32_t *pworkDim; - const size_t **ppGlobalWorkOffset; - const size_t **ppGlobalWorkSize; - const size_t **ppLocalWorkSize; - uint32_t *pnumPropsInLaunchPropList; - const ur_exp_launch_property_t **plaunchPropList; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_kernel_launch_custom_exp_params_t; +typedef struct ur_usm_pool_set_device_pool_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_usm_pool_handle_t *phPool; +} ur_usm_pool_set_device_pool_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueEventsWaitWithBarrierExt +/// @brief Function parameters for urUSMPoolGetDevicePoolExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_events_wait_with_barrier_ext_params_t { - ur_queue_handle_t *phQueue; - const ur_exp_enqueue_ext_properties_t **ppProperties; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_events_wait_with_barrier_ext_params_t; +typedef struct ur_usm_pool_get_device_pool_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_usm_pool_handle_t **ppPool; +} ur_usm_pool_get_device_pool_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueCooperativeKernelLaunchExp +/// @brief Function parameters for urUSMPoolTrimToExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_cooperative_kernel_launch_exp_params_t { - ur_queue_handle_t *phQueue; - ur_kernel_handle_t *phKernel; - uint32_t *pworkDim; - const size_t **ppGlobalWorkOffset; - const size_t **ppGlobalWorkSize; - const size_t **ppLocalWorkSize; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_cooperative_kernel_launch_exp_params_t; +typedef struct ur_usm_pool_trim_to_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_usm_pool_handle_t *phPool; + size_t *pminBytesToKeep; +} ur_usm_pool_trim_to_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueTimestampRecordingExp +/// @brief Function parameters for urUSMPitchedAllocExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_timestamp_recording_exp_params_t { - ur_queue_handle_t *phQueue; - bool *pblocking; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_timestamp_recording_exp_params_t; +typedef struct ur_usm_pitched_alloc_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_usm_desc_t **ppUSMDesc; + ur_usm_pool_handle_t *ppool; + size_t *pwidthInBytes; + size_t *pheight; + size_t *pelementSizeBytes; + void ***pppMem; + size_t **ppResultPitch; +} ur_usm_pitched_alloc_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urEnqueueNativeCommandExp +/// @brief Function parameters for urUSMImportExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_enqueue_native_command_exp_params_t { - ur_queue_handle_t *phQueue; - ur_exp_enqueue_native_command_function_t *ppfnNativeEnqueue; - void **pdata; - uint32_t *pnumMemsInMemList; - const ur_mem_handle_t **pphMemList; - const ur_exp_enqueue_native_command_properties_t **ppProperties; - uint32_t *pnumEventsInWaitList; - const ur_event_handle_t **pphEventWaitList; - ur_event_handle_t **pphEvent; -} ur_enqueue_native_command_exp_params_t; +typedef struct ur_usm_import_exp_params_t { + ur_context_handle_t *phContext; + void **ppMem; + size_t *psize; +} ur_usm_import_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMReleaseExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_release_exp_params_t { + ur_context_handle_t *phContext; + void **ppMem; +} ur_usm_release_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for @@ -13773,139 +14522,6 @@ typedef struct ur_bindless_images_signal_external_semaphore_exp_params_t { ur_event_handle_t **pphEvent; } ur_bindless_images_signal_external_semaphore_exp_params_t; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMHostAlloc -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_host_alloc_params_t { - ur_context_handle_t *phContext; - const ur_usm_desc_t **ppUSMDesc; - ur_usm_pool_handle_t *ppool; - size_t *psize; - void ***pppMem; -} ur_usm_host_alloc_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMDeviceAlloc -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_device_alloc_params_t { - ur_context_handle_t *phContext; - ur_device_handle_t *phDevice; - const ur_usm_desc_t **ppUSMDesc; - ur_usm_pool_handle_t *ppool; - size_t *psize; - void ***pppMem; -} ur_usm_device_alloc_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMSharedAlloc -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_shared_alloc_params_t { - ur_context_handle_t *phContext; - ur_device_handle_t *phDevice; - const ur_usm_desc_t **ppUSMDesc; - ur_usm_pool_handle_t *ppool; - size_t *psize; - void ***pppMem; -} ur_usm_shared_alloc_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMFree -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_free_params_t { - ur_context_handle_t *phContext; - void **ppMem; -} ur_usm_free_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMGetMemAllocInfo -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_get_mem_alloc_info_params_t { - ur_context_handle_t *phContext; - const void **ppMem; - ur_usm_alloc_info_t *ppropName; - size_t *ppropSize; - void **ppPropValue; - size_t **ppPropSizeRet; -} ur_usm_get_mem_alloc_info_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMPoolCreate -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_pool_create_params_t { - ur_context_handle_t *phContext; - ur_usm_pool_desc_t **ppPoolDesc; - ur_usm_pool_handle_t **pppPool; -} ur_usm_pool_create_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMPoolRetain -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_pool_retain_params_t { - ur_usm_pool_handle_t *ppPool; -} ur_usm_pool_retain_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMPoolRelease -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_pool_release_params_t { - ur_usm_pool_handle_t *ppPool; -} ur_usm_pool_release_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMPoolGetInfo -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_pool_get_info_params_t { - ur_usm_pool_handle_t *phPool; - ur_usm_pool_info_t *ppropName; - size_t *ppropSize; - void **ppPropValue; - size_t **ppPropSizeRet; -} ur_usm_pool_get_info_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMPitchedAllocExp -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_pitched_alloc_exp_params_t { - ur_context_handle_t *phContext; - ur_device_handle_t *phDevice; - const ur_usm_desc_t **ppUSMDesc; - ur_usm_pool_handle_t *ppool; - size_t *pwidthInBytes; - size_t *pheight; - size_t *pelementSizeBytes; - void ***pppMem; - size_t **ppResultPitch; -} ur_usm_pitched_alloc_exp_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMImportExp -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_import_exp_params_t { - ur_context_handle_t *phContext; - void **ppMem; - size_t *psize; -} ur_usm_import_exp_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urUSMReleaseExp -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_usm_release_exp_params_t { - ur_context_handle_t *phContext; - void **ppMem; -} ur_usm_release_exp_params_t; - /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urCommandBufferCreateExp /// @details Each entry is a pointer to the parameter passed to the function; diff --git a/unified-runtime/include/ur_api_funcs.def b/unified-runtime/include/ur_api_funcs.def index 8c25dde67f466..97adbfcf29c85 100644 --- a/unified-runtime/include/ur_api_funcs.def +++ b/unified-runtime/include/ur_api_funcs.def @@ -132,9 +132,33 @@ _UR_API(urEnqueueReadHostPipe) _UR_API(urEnqueueWriteHostPipe) _UR_API(urEnqueueEventsWaitWithBarrierExt) _UR_API(urEnqueueKernelLaunchCustomExp) +_UR_API(urEnqueueUSMDeviceAllocExp) +_UR_API(urEnqueueUSMSharedAllocExp) +_UR_API(urEnqueueUSMHostAllocExp) +_UR_API(urEnqueueUSMFreeExp) _UR_API(urEnqueueCooperativeKernelLaunchExp) _UR_API(urEnqueueTimestampRecordingExp) _UR_API(urEnqueueNativeCommandExp) +_UR_API(urUSMHostAlloc) +_UR_API(urUSMDeviceAlloc) +_UR_API(urUSMSharedAlloc) +_UR_API(urUSMFree) +_UR_API(urUSMGetMemAllocInfo) +_UR_API(urUSMPoolCreate) +_UR_API(urUSMPoolRetain) +_UR_API(urUSMPoolRelease) +_UR_API(urUSMPoolGetInfo) +_UR_API(urUSMPoolCreateExp) +_UR_API(urUSMPoolDestroyExp) +_UR_API(urUSMPoolSetThresholdExp) +_UR_API(urUSMPoolGetDefaultDevicePoolExp) +_UR_API(urUSMPoolGetInfoExp) +_UR_API(urUSMPoolSetDevicePoolExp) +_UR_API(urUSMPoolGetDevicePoolExp) +_UR_API(urUSMPoolTrimToExp) +_UR_API(urUSMPitchedAllocExp) +_UR_API(urUSMImportExp) +_UR_API(urUSMReleaseExp) _UR_API(urBindlessImagesUnsampledImageHandleDestroyExp) _UR_API(urBindlessImagesSampledImageHandleDestroyExp) _UR_API(urBindlessImagesImageAllocateExp) @@ -153,18 +177,6 @@ _UR_API(urBindlessImagesImportExternalSemaphoreExp) _UR_API(urBindlessImagesReleaseExternalSemaphoreExp) _UR_API(urBindlessImagesWaitExternalSemaphoreExp) _UR_API(urBindlessImagesSignalExternalSemaphoreExp) -_UR_API(urUSMHostAlloc) -_UR_API(urUSMDeviceAlloc) -_UR_API(urUSMSharedAlloc) -_UR_API(urUSMFree) -_UR_API(urUSMGetMemAllocInfo) -_UR_API(urUSMPoolCreate) -_UR_API(urUSMPoolRetain) -_UR_API(urUSMPoolRelease) -_UR_API(urUSMPoolGetInfo) -_UR_API(urUSMPitchedAllocExp) -_UR_API(urUSMImportExp) -_UR_API(urUSMReleaseExp) _UR_API(urCommandBufferCreateExp) _UR_API(urCommandBufferRetainExp) _UR_API(urCommandBufferReleaseExp) diff --git a/unified-runtime/include/ur_ddi.h b/unified-runtime/include/ur_ddi.h index c64aaa8d464b7..0f4a6d685fea6 100644 --- a/unified-runtime/include/ur_ddi.h +++ b/unified-runtime/include/ur_ddi.h @@ -1117,6 +1117,33 @@ typedef ur_result_t(UR_APICALL *ur_pfnEnqueueKernelLaunchCustomExp_t)( const size_t *, const size_t *, uint32_t, const ur_exp_launch_property_t *, uint32_t, const ur_event_handle_t *, ur_event_handle_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMDeviceAllocExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMDeviceAllocExp_t)( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMSharedAllocExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMSharedAllocExp_t)( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMHostAllocExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMHostAllocExp_t)( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMFreeExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMFreeExp_t)( + ur_queue_handle_t, ur_usm_pool_handle_t, void *, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urEnqueueCooperativeKernelLaunchExp typedef ur_result_t(UR_APICALL *ur_pfnEnqueueCooperativeKernelLaunchExp_t)( @@ -1142,6 +1169,10 @@ typedef ur_result_t(UR_APICALL *ur_pfnEnqueueNativeCommandExp_t)( /// @brief Table of EnqueueExp functions pointers typedef struct ur_enqueue_exp_dditable_t { ur_pfnEnqueueKernelLaunchCustomExp_t pfnKernelLaunchCustomExp; + ur_pfnEnqueueUSMDeviceAllocExp_t pfnUSMDeviceAllocExp; + ur_pfnEnqueueUSMSharedAllocExp_t pfnUSMSharedAllocExp; + ur_pfnEnqueueUSMHostAllocExp_t pfnUSMHostAllocExp; + ur_pfnEnqueueUSMFreeExp_t pfnUSMFreeExp; ur_pfnEnqueueCooperativeKernelLaunchExp_t pfnCooperativeKernelLaunchExp; ur_pfnEnqueueTimestampRecordingExp_t pfnTimestampRecordingExp; ur_pfnEnqueueNativeCommandExp_t pfnNativeCommandExp; @@ -1167,6 +1198,192 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( typedef ur_result_t(UR_APICALL *ur_pfnGetEnqueueExpProcAddrTable_t)( ur_api_version_t, ur_enqueue_exp_dditable_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMHostAlloc +typedef ur_result_t(UR_APICALL *ur_pfnUSMHostAlloc_t)(ur_context_handle_t, + const ur_usm_desc_t *, + ur_usm_pool_handle_t, + size_t, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMDeviceAlloc +typedef ur_result_t(UR_APICALL *ur_pfnUSMDeviceAlloc_t)(ur_context_handle_t, + ur_device_handle_t, + const ur_usm_desc_t *, + ur_usm_pool_handle_t, + size_t, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMSharedAlloc +typedef ur_result_t(UR_APICALL *ur_pfnUSMSharedAlloc_t)(ur_context_handle_t, + ur_device_handle_t, + const ur_usm_desc_t *, + ur_usm_pool_handle_t, + size_t, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMFree +typedef ur_result_t(UR_APICALL *ur_pfnUSMFree_t)(ur_context_handle_t, void *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMGetMemAllocInfo +typedef ur_result_t(UR_APICALL *ur_pfnUSMGetMemAllocInfo_t)(ur_context_handle_t, + const void *, + ur_usm_alloc_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolCreate +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolCreate_t)(ur_context_handle_t, + ur_usm_pool_desc_t *, + ur_usm_pool_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolRetain +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolRetain_t)(ur_usm_pool_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolRelease +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolRelease_t)(ur_usm_pool_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolGetInfo_t)(ur_usm_pool_handle_t, + ur_usm_pool_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of USM functions pointers +typedef struct ur_usm_dditable_t { + ur_pfnUSMHostAlloc_t pfnHostAlloc; + ur_pfnUSMDeviceAlloc_t pfnDeviceAlloc; + ur_pfnUSMSharedAlloc_t pfnSharedAlloc; + ur_pfnUSMFree_t pfnFree; + ur_pfnUSMGetMemAllocInfo_t pfnGetMemAllocInfo; + ur_pfnUSMPoolCreate_t pfnPoolCreate; + ur_pfnUSMPoolRetain_t pfnPoolRetain; + ur_pfnUSMPoolRelease_t pfnPoolRelease; + ur_pfnUSMPoolGetInfo_t pfnPoolGetInfo; +} ur_usm_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's USM table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_usm_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetUSMProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetUSMProcAddrTable_t)( + ur_api_version_t, ur_usm_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolCreateExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolCreateExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_desc_t *, + ur_usm_pool_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolDestroyExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolDestroyExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolSetThresholdExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolSetThresholdExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t, size_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolGetDefaultDevicePoolExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolGetDefaultDevicePoolExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolGetInfoExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolGetInfoExp_t)(ur_usm_pool_handle_t, + ur_usm_pool_info_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolSetDevicePoolExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolSetDevicePoolExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolGetDevicePoolExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolGetDevicePoolExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolTrimToExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolTrimToExp_t)(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t, + size_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPitchedAllocExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPitchedAllocExp_t)( + ur_context_handle_t, ur_device_handle_t, const ur_usm_desc_t *, + ur_usm_pool_handle_t, size_t, size_t, size_t, void **, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMImportExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMImportExp_t)(ur_context_handle_t, + void *, size_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMReleaseExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMReleaseExp_t)(ur_context_handle_t, + void *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of USMExp functions pointers +typedef struct ur_usm_exp_dditable_t { + ur_pfnUSMPoolCreateExp_t pfnPoolCreateExp; + ur_pfnUSMPoolDestroyExp_t pfnPoolDestroyExp; + ur_pfnUSMPoolSetThresholdExp_t pfnPoolSetThresholdExp; + ur_pfnUSMPoolGetDefaultDevicePoolExp_t pfnPoolGetDefaultDevicePoolExp; + ur_pfnUSMPoolGetInfoExp_t pfnPoolGetInfoExp; + ur_pfnUSMPoolSetDevicePoolExp_t pfnPoolSetDevicePoolExp; + ur_pfnUSMPoolGetDevicePoolExp_t pfnPoolGetDevicePoolExp; + ur_pfnUSMPoolTrimToExp_t pfnPoolTrimToExp; + ur_pfnUSMPitchedAllocExp_t pfnPitchedAllocExp; + ur_pfnUSMImportExp_t pfnImportExp; + ur_pfnUSMReleaseExp_t pfnReleaseExp; +} ur_usm_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's USMExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_usm_exp_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetUSMExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetUSMExpProcAddrTable_t)( + ur_api_version_t, ur_usm_exp_dditable_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urBindlessImagesUnsampledImageHandleDestroyExp typedef ur_result_t( @@ -1331,140 +1548,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetBindlessImagesExpProcAddrTable( typedef ur_result_t(UR_APICALL *ur_pfnGetBindlessImagesExpProcAddrTable_t)( ur_api_version_t, ur_bindless_images_exp_dditable_t *); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMHostAlloc -typedef ur_result_t(UR_APICALL *ur_pfnUSMHostAlloc_t)(ur_context_handle_t, - const ur_usm_desc_t *, - ur_usm_pool_handle_t, - size_t, void **); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMDeviceAlloc -typedef ur_result_t(UR_APICALL *ur_pfnUSMDeviceAlloc_t)(ur_context_handle_t, - ur_device_handle_t, - const ur_usm_desc_t *, - ur_usm_pool_handle_t, - size_t, void **); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMSharedAlloc -typedef ur_result_t(UR_APICALL *ur_pfnUSMSharedAlloc_t)(ur_context_handle_t, - ur_device_handle_t, - const ur_usm_desc_t *, - ur_usm_pool_handle_t, - size_t, void **); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMFree -typedef ur_result_t(UR_APICALL *ur_pfnUSMFree_t)(ur_context_handle_t, void *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMGetMemAllocInfo -typedef ur_result_t(UR_APICALL *ur_pfnUSMGetMemAllocInfo_t)(ur_context_handle_t, - const void *, - ur_usm_alloc_info_t, - size_t, void *, - size_t *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMPoolCreate -typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolCreate_t)(ur_context_handle_t, - ur_usm_pool_desc_t *, - ur_usm_pool_handle_t *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMPoolRetain -typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolRetain_t)(ur_usm_pool_handle_t); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMPoolRelease -typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolRelease_t)(ur_usm_pool_handle_t); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMPoolGetInfo -typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolGetInfo_t)(ur_usm_pool_handle_t, - ur_usm_pool_info_t, - size_t, void *, - size_t *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Table of USM functions pointers -typedef struct ur_usm_dditable_t { - ur_pfnUSMHostAlloc_t pfnHostAlloc; - ur_pfnUSMDeviceAlloc_t pfnDeviceAlloc; - ur_pfnUSMSharedAlloc_t pfnSharedAlloc; - ur_pfnUSMFree_t pfnFree; - ur_pfnUSMGetMemAllocInfo_t pfnGetMemAllocInfo; - ur_pfnUSMPoolCreate_t pfnPoolCreate; - ur_pfnUSMPoolRetain_t pfnPoolRetain; - ur_pfnUSMPoolRelease_t pfnPoolRelease; - ur_pfnUSMPoolGetInfo_t pfnPoolGetInfo; -} ur_usm_dditable_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Exported function for filling application's USM table -/// with current process' addresses -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION -UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMProcAddrTable( - /// [in] API version requested - ur_api_version_t version, - /// [in,out] pointer to table of DDI function pointers - ur_usm_dditable_t *pDdiTable); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urGetUSMProcAddrTable -typedef ur_result_t(UR_APICALL *ur_pfnGetUSMProcAddrTable_t)( - ur_api_version_t, ur_usm_dditable_t *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMPitchedAllocExp -typedef ur_result_t(UR_APICALL *ur_pfnUSMPitchedAllocExp_t)( - ur_context_handle_t, ur_device_handle_t, const ur_usm_desc_t *, - ur_usm_pool_handle_t, size_t, size_t, size_t, void **, size_t *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMImportExp -typedef ur_result_t(UR_APICALL *ur_pfnUSMImportExp_t)(ur_context_handle_t, - void *, size_t); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urUSMReleaseExp -typedef ur_result_t(UR_APICALL *ur_pfnUSMReleaseExp_t)(ur_context_handle_t, - void *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Table of USMExp functions pointers -typedef struct ur_usm_exp_dditable_t { - ur_pfnUSMPitchedAllocExp_t pfnPitchedAllocExp; - ur_pfnUSMImportExp_t pfnImportExp; - ur_pfnUSMReleaseExp_t pfnReleaseExp; -} ur_usm_exp_dditable_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Exported function for filling application's USMExp table -/// with current process' addresses -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION -UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( - /// [in] API version requested - ur_api_version_t version, - /// [in,out] pointer to table of DDI function pointers - ur_usm_exp_dditable_t *pDdiTable); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urGetUSMExpProcAddrTable -typedef ur_result_t(UR_APICALL *ur_pfnGetUSMExpProcAddrTable_t)( - ur_api_version_t, ur_usm_exp_dditable_t *); - /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urCommandBufferCreateExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferCreateExp_t)( @@ -1880,9 +1963,9 @@ typedef struct ur_dditable_t { ur_global_dditable_t Global; ur_enqueue_dditable_t Enqueue; ur_enqueue_exp_dditable_t EnqueueExp; - ur_bindless_images_exp_dditable_t BindlessImagesExp; ur_usm_dditable_t USM; ur_usm_exp_dditable_t USMExp; + ur_bindless_images_exp_dditable_t BindlessImagesExp; ur_command_buffer_exp_dditable_t CommandBufferExp; ur_usm_p2p_exp_dditable_t UsmP2PExp; ur_virtual_mem_dditable_t VirtualMem; diff --git a/unified-runtime/include/ur_print.h b/unified-runtime/include/ur_print.h index f58133bb8a0c1..1b4f625b99925 100644 --- a/unified-runtime/include/ur_print.h +++ b/unified-runtime/include/ur_print.h @@ -1122,6 +1122,26 @@ urPrintExpDevice_2dBlockArrayCapabilityFlags( enum ur_exp_device_2d_block_array_capability_flag_t value, char *buffer, const size_t buff_size, size_t *out_size); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_async_usm_alloc_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpAsyncUsmAllocFlags( + enum ur_exp_async_usm_alloc_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_async_usm_alloc_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpAsyncUsmAllocProperties( + const struct ur_exp_async_usm_alloc_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_exp_image_copy_flag_t enum /// @returns @@ -2626,6 +2646,46 @@ urPrintEnqueueEventsWaitWithBarrierExtParams( const struct ur_enqueue_events_wait_with_barrier_ext_params_t *params, char *buffer, const size_t buff_size, size_t *out_size); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_device_alloc_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmDeviceAllocExpParams( + const struct ur_enqueue_usm_device_alloc_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_shared_alloc_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmSharedAllocExpParams( + const struct ur_enqueue_usm_shared_alloc_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_host_alloc_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmHostAllocExpParams( + const struct ur_enqueue_usm_host_alloc_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_free_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmFreeExpParams( + const struct ur_enqueue_usm_free_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_enqueue_cooperative_kernel_launch_exp_params_t struct /// @returns @@ -2657,6 +2717,206 @@ 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); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_host_alloc_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmHostAllocParams( + const struct ur_usm_host_alloc_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_device_alloc_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmDeviceAllocParams( + const struct ur_usm_device_alloc_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_shared_alloc_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmSharedAllocParams( + const struct ur_usm_shared_alloc_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_free_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmFreeParams(const struct ur_usm_free_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_get_mem_alloc_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmGetMemAllocInfoParams( + const struct ur_usm_get_mem_alloc_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolCreateParams( + const struct ur_usm_pool_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolRetainParams( + const struct ur_usm_pool_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolReleaseParams( + const struct ur_usm_pool_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolGetInfoParams( + const struct ur_usm_pool_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_create_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolCreateExpParams( + const struct ur_usm_pool_create_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_destroy_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolDestroyExpParams( + const struct ur_usm_pool_destroy_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_set_threshold_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolSetThresholdExpParams( + const struct ur_usm_pool_set_threshold_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_get_default_device_pool_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolGetDefaultDevicePoolExpParams( + const struct ur_usm_pool_get_default_device_pool_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_get_info_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolGetInfoExpParams( + const struct ur_usm_pool_get_info_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_set_device_pool_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolSetDevicePoolExpParams( + const struct ur_usm_pool_set_device_pool_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_get_device_pool_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolGetDevicePoolExpParams( + const struct ur_usm_pool_get_device_pool_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_trim_to_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolTrimToExpParams( + const struct ur_usm_pool_trim_to_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pitched_alloc_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPitchedAllocExpParams( + const struct ur_usm_pitched_alloc_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_import_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmImportExpParams( + const struct ur_usm_import_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_release_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmReleaseExpParams( + const struct ur_usm_release_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_bindless_images_unsampled_image_handle_destroy_exp_params_t /// struct @@ -2864,126 +3124,6 @@ urPrintBindlessImagesSignalExternalSemaphoreExpParams( *params, char *buffer, const size_t buff_size, size_t *out_size); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_host_alloc_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmHostAllocParams( - const struct ur_usm_host_alloc_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_device_alloc_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmDeviceAllocParams( - const struct ur_usm_device_alloc_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_shared_alloc_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmSharedAllocParams( - const struct ur_usm_shared_alloc_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_free_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL -urPrintUsmFreeParams(const struct ur_usm_free_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_get_mem_alloc_info_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmGetMemAllocInfoParams( - const struct ur_usm_get_mem_alloc_info_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_pool_create_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolCreateParams( - const struct ur_usm_pool_create_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_pool_retain_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolRetainParams( - const struct ur_usm_pool_retain_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_pool_release_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolReleaseParams( - const struct ur_usm_pool_release_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_pool_get_info_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolGetInfoParams( - const struct ur_usm_pool_get_info_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_pitched_alloc_exp_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPitchedAllocExpParams( - const struct ur_usm_pitched_alloc_exp_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_import_exp_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmImportExpParams( - const struct ur_usm_import_exp_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print ur_usm_release_exp_params_t struct -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_INVALID_SIZE -/// - `buff_size < out_size` -UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmReleaseExpParams( - const struct ur_usm_release_exp_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size); - /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_command_buffer_create_exp_params_t struct /// @returns diff --git a/unified-runtime/include/ur_print.hpp b/unified-runtime/include/ur_print.hpp index 5c5f573477929..ddbfbe45aeeea 100644 --- a/unified-runtime/include/ur_print.hpp +++ b/unified-runtime/include/ur_print.hpp @@ -225,6 +225,10 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t flag); +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + template <> inline ur_result_t printFlag(std::ostream &os, uint32_t flag); @@ -502,6 +506,11 @@ inline std::ostream &operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, enum ur_exp_device_2d_block_array_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_async_usm_alloc_flag_t value); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_async_usm_alloc_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_exp_image_copy_flag_t value); inline std::ostream & @@ -1177,6 +1186,42 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_PHYSICAL_MEM_GET_INFO: os << "UR_FUNCTION_PHYSICAL_MEM_GET_INFO"; break; + case UR_FUNCTION_ENQUEUE_USM_DEVICE_ALLOC_EXP: + os << "UR_FUNCTION_ENQUEUE_USM_DEVICE_ALLOC_EXP"; + break; + case UR_FUNCTION_ENQUEUE_USM_SHARED_ALLOC_EXP: + os << "UR_FUNCTION_ENQUEUE_USM_SHARED_ALLOC_EXP"; + break; + case UR_FUNCTION_ENQUEUE_USM_HOST_ALLOC_EXP: + os << "UR_FUNCTION_ENQUEUE_USM_HOST_ALLOC_EXP"; + break; + case UR_FUNCTION_ENQUEUE_USM_FREE_EXP: + os << "UR_FUNCTION_ENQUEUE_USM_FREE_EXP"; + break; + case UR_FUNCTION_USM_POOL_CREATE_EXP: + os << "UR_FUNCTION_USM_POOL_CREATE_EXP"; + break; + case UR_FUNCTION_USM_POOL_DESTROY_EXP: + os << "UR_FUNCTION_USM_POOL_DESTROY_EXP"; + break; + case UR_FUNCTION_USM_POOL_SET_THRESHOLD_EXP: + os << "UR_FUNCTION_USM_POOL_SET_THRESHOLD_EXP"; + break; + case UR_FUNCTION_USM_POOL_GET_DEFAULT_DEVICE_POOL_EXP: + os << "UR_FUNCTION_USM_POOL_GET_DEFAULT_DEVICE_POOL_EXP"; + break; + case UR_FUNCTION_USM_POOL_SET_DEVICE_POOL_EXP: + os << "UR_FUNCTION_USM_POOL_SET_DEVICE_POOL_EXP"; + break; + case UR_FUNCTION_USM_POOL_GET_DEVICE_POOL_EXP: + os << "UR_FUNCTION_USM_POOL_GET_DEVICE_POOL_EXP"; + break; + case UR_FUNCTION_USM_POOL_TRIM_TO_EXP: + os << "UR_FUNCTION_USM_POOL_TRIM_TO_EXP"; + break; + case UR_FUNCTION_USM_POOL_GET_INFO_EXP: + os << "UR_FUNCTION_USM_POOL_GET_INFO_EXP"; + break; default: os << "unknown enumerator"; break; @@ -1334,6 +1379,9 @@ inline std::ostream &operator<<(std::ostream &os, case UR_STRUCTURE_TYPE_EXP_IMAGE_COPY_REGION: os << "UR_STRUCTURE_TYPE_EXP_IMAGE_COPY_REGION"; break; + case UR_STRUCTURE_TYPE_EXP_ASYNC_USM_ALLOC_PROPERTIES: + os << "UR_STRUCTURE_TYPE_EXP_ASYNC_USM_ALLOC_PROPERTIES"; + break; case UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES: os << "UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES"; break; @@ -1633,6 +1681,12 @@ inline ur_result_t printStruct(std::ostream &os, const void *ptr) { printPtr(os, pstruct); } break; + case UR_STRUCTURE_TYPE_EXP_ASYNC_USM_ALLOC_PROPERTIES: { + const ur_exp_async_usm_alloc_properties_t *pstruct = + (const ur_exp_async_usm_alloc_properties_t *)ptr; + printPtr(os, pstruct); + } break; + case UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES: { const ur_exp_enqueue_native_command_properties_t *pstruct = (const ur_exp_enqueue_native_command_properties_t *)ptr; @@ -2975,6 +3029,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { case UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP: os << "UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP"; break; + case UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP: + os << "UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP"; + break; default: os << "unknown enumerator"; break; @@ -4966,6 +5023,19 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, os << ")"; } break; + case UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; default: os << "unknown enumerator"; return UR_RESULT_ERROR_INVALID_ENUMERATION; @@ -7188,6 +7258,12 @@ inline std::ostream &operator<<(std::ostream &os, case UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK: os << "UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK"; break; + case UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP: + os << "UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP"; + break; + case UR_USM_POOL_FLAG_READ_ONLY_EXP: + os << "UR_USM_POOL_FLAG_READ_ONLY_EXP"; + break; default: os << "unknown enumerator"; break; @@ -7214,6 +7290,28 @@ inline ur_result_t printFlag(std::ostream &os, } os << UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK; } + + if ((val & UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP) == + (uint32_t)UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP) { + val ^= (uint32_t)UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP; + } + + if ((val & UR_USM_POOL_FLAG_READ_ONLY_EXP) == + (uint32_t)UR_USM_POOL_FLAG_READ_ONLY_EXP) { + val ^= (uint32_t)UR_USM_POOL_FLAG_READ_ONLY_EXP; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_POOL_FLAG_READ_ONLY_EXP; + } if (val != 0) { std::bitset<32> bits(val); if (!first) { @@ -7807,6 +7905,24 @@ inline std::ostream &operator<<(std::ostream &os, case UR_USM_POOL_INFO_CONTEXT: os << "UR_USM_POOL_INFO_CONTEXT"; break; + case UR_USM_POOL_INFO_RELEASE_THRESHOLD_EXP: + os << "UR_USM_POOL_INFO_RELEASE_THRESHOLD_EXP"; + break; + case UR_USM_POOL_INFO_MAXIMUM_SIZE_EXP: + os << "UR_USM_POOL_INFO_MAXIMUM_SIZE_EXP"; + break; + case UR_USM_POOL_INFO_RESERVED_CURRENT_EXP: + os << "UR_USM_POOL_INFO_RESERVED_CURRENT_EXP"; + break; + case UR_USM_POOL_INFO_RESERVED_HIGH_EXP: + os << "UR_USM_POOL_INFO_RESERVED_HIGH_EXP"; + break; + case UR_USM_POOL_INFO_USED_CURRENT_EXP: + os << "UR_USM_POOL_INFO_USED_CURRENT_EXP"; + break; + case UR_USM_POOL_INFO_USED_HIGH_EXP: + os << "UR_USM_POOL_INFO_USED_HIGH_EXP"; + break; default: os << "unknown enumerator"; break; @@ -7850,6 +7966,84 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, os << ")"; } break; + case UR_USM_POOL_INFO_RELEASE_THRESHOLD_EXP: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_USM_POOL_INFO_MAXIMUM_SIZE_EXP: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_USM_POOL_INFO_RESERVED_CURRENT_EXP: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_USM_POOL_INFO_RESERVED_HIGH_EXP: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_USM_POOL_INFO_USED_CURRENT_EXP: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_USM_POOL_INFO_USED_HIGH_EXP: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; default: os << "unknown enumerator"; return UR_RESULT_ERROR_INVALID_ENUMERATION; @@ -9914,6 +10108,18 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_command_t value) { case UR_COMMAND_ENQUEUE_NATIVE_EXP: os << "UR_COMMAND_ENQUEUE_NATIVE_EXP"; break; + case UR_COMMAND_ENQUEUE_USM_DEVICE_ALLOC_EXP: + os << "UR_COMMAND_ENQUEUE_USM_DEVICE_ALLOC_EXP"; + break; + case UR_COMMAND_ENQUEUE_USM_SHARED_ALLOC_EXP: + os << "UR_COMMAND_ENQUEUE_USM_SHARED_ALLOC_EXP"; + break; + case UR_COMMAND_ENQUEUE_USM_HOST_ALLOC_EXP: + os << "UR_COMMAND_ENQUEUE_USM_HOST_ALLOC_EXP"; + break; + case UR_COMMAND_ENQUEUE_USM_FREE_EXP: + os << "UR_COMMAND_ENQUEUE_USM_FREE_EXP"; + break; default: os << "unknown enumerator"; break; @@ -10407,6 +10613,80 @@ printFlag(std::ostream &os, } } // namespace ur::details /////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_async_usm_alloc_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_async_usm_alloc_flag_t value) { + switch (value) { + case UR_EXP_ASYNC_USM_ALLOC_FLAG_TBD: + os << "UR_EXP_ASYNC_USM_ALLOC_FLAG_TBD"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_async_usm_alloc_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_EXP_ASYNC_USM_ALLOC_FLAG_TBD) == + (uint32_t)UR_EXP_ASYNC_USM_ALLOC_FLAG_TBD) { + val ^= (uint32_t)UR_EXP_ASYNC_USM_ALLOC_FLAG_TBD; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_EXP_ASYNC_USM_ALLOC_FLAG_TBD; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_async_usm_alloc_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_async_usm_alloc_properties_t params) { + os << "(struct ur_exp_async_usm_alloc_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, (params.flags)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_exp_image_copy_flag_t type /// @returns /// std::ostream & @@ -16206,42 +16486,32 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_enqueue_cooperative_kernel_launch_exp_params_t type +/// @brief Print operator for the ur_enqueue_usm_device_alloc_exp_params_t type /// @returns /// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_enqueue_cooperative_kernel_launch_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_device_alloc_exp_params_t + *params) { os << ".hQueue = "; ur::details::printPtr(os, *(params->phQueue)); os << ", "; - os << ".hKernel = "; - - ur::details::printPtr(os, *(params->phKernel)); - - os << ", "; - os << ".workDim = "; - - os << *(params->pworkDim); - - os << ", "; - os << ".pGlobalWorkOffset = "; + os << ".pPool = "; - ur::details::printPtr(os, *(params->ppGlobalWorkOffset)); + ur::details::printPtr(os, *(params->ppPool)); os << ", "; - os << ".pGlobalWorkSize = "; + os << ".size = "; - ur::details::printPtr(os, *(params->ppGlobalWorkSize)); + os << *(params->psize); os << ", "; - os << ".pLocalWorkSize = "; + os << ".pProperties = "; - ur::details::printPtr(os, *(params->ppLocalWorkSize)); + ur::details::printPtr(os, *(params->ppProperties)); os << ", "; os << ".numEventsInWaitList = "; @@ -16264,6 +16534,11 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << "}"; } + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + os << ", "; os << ".phEvent = "; @@ -16273,13 +16548,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_enqueue_timestamp_recording_exp_params_t -/// type +/// @brief Print operator for the ur_enqueue_usm_shared_alloc_exp_params_t type /// @returns /// std::ostream & inline std::ostream &operator<<( std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_timestamp_recording_exp_params_t + [[maybe_unused]] const struct ur_enqueue_usm_shared_alloc_exp_params_t *params) { os << ".hQueue = "; @@ -16287,9 +16561,19 @@ inline std::ostream &operator<<( ur::details::printPtr(os, *(params->phQueue)); os << ", "; - os << ".blocking = "; + os << ".pPool = "; - os << *(params->pblocking); + ur::details::printPtr(os, *(params->ppPool)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); os << ", "; os << ".numEventsInWaitList = "; @@ -16312,6 +16596,11 @@ inline std::ostream &operator<<( os << "}"; } + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + os << ", "; os << ".phEvent = "; @@ -16321,12 +16610,12 @@ inline std::ostream &operator<<( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_enqueue_native_command_exp_params_t type +/// @brief Print operator for the ur_enqueue_usm_host_alloc_exp_params_t type /// @returns /// std::ostream & inline std::ostream & operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_native_command_exp_params_t + [[maybe_unused]] const struct ur_enqueue_usm_host_alloc_exp_params_t *params) { os << ".hQueue = "; @@ -16334,12 +16623,240 @@ operator<<(std::ostream &os, ur::details::printPtr(os, *(params->phQueue)); os << ", "; - os << ".pfnNativeEnqueue = "; + os << ".pPool = "; - os << reinterpret_cast(*(params->ppfnNativeEnqueue)); + ur::details::printPtr(os, *(params->ppPool)); os << ", "; - os << ".data = "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_free_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_free_exp_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pPool = "; + + ur::details::printPtr(os, *(params->ppPool)); + + os << ", "; + os << ".pMem = "; + + ur::details::printPtr(os, *(params->ppMem)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_enqueue_cooperative_kernel_launch_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_enqueue_cooperative_kernel_launch_exp_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".workDim = "; + + os << *(params->pworkDim); + + os << ", "; + os << ".pGlobalWorkOffset = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkOffset)); + + os << ", "; + os << ".pGlobalWorkSize = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkSize)); + + os << ", "; + os << ".pLocalWorkSize = "; + + ur::details::printPtr(os, *(params->ppLocalWorkSize)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_timestamp_recording_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_timestamp_recording_exp_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".blocking = "; + + os << *(params->pblocking); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_native_command_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_native_command_exp_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pfnNativeEnqueue = "; + + os << reinterpret_cast(*(params->ppfnNativeEnqueue)); + + os << ", "; + os << ".data = "; ur::details::printPtr(os, *(params->pdata)); @@ -16399,170 +16916,277 @@ operator<<(std::ostream &os, } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_unsampled_image_handle_destroy_exp_params_t type +/// @brief Print operator for the ur_usm_host_alloc_params_t type /// @returns /// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_host_alloc_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pUSMDesc = "; + + ur::details::printPtr(os, *(params->ppUSMDesc)); + + os << ", "; + os << ".pool = "; + + ur::details::printPtr(os, *(params->ppool)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_device_alloc_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_device_alloc_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pUSMDesc = "; + + ur::details::printPtr(os, *(params->ppUSMDesc)); + + os << ", "; + os << ".pool = "; + + ur::details::printPtr(os, *(params->ppool)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_shared_alloc_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_shared_alloc_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pUSMDesc = "; - os << ".hContext = "; + ur::details::printPtr(os, *(params->ppUSMDesc)); - ur::details::printPtr(os, *(params->phContext)); + os << ", "; + os << ".pool = "; + + ur::details::printPtr(os, *(params->ppool)); os << ", "; - os << ".hDevice = "; + os << ".size = "; - ur::details::printPtr(os, *(params->phDevice)); + os << *(params->psize); os << ", "; - os << ".hImage = "; + os << ".ppMem = "; - ur::details::printPtr(os, reinterpret_cast(*(params->phImage))); + ur::details::printPtr(os, *(params->pppMem)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_sampled_image_handle_destroy_exp_params_t type +/// @brief Print operator for the ur_usm_free_params_t type /// @returns /// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_sampled_image_handle_destroy_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_free_params_t *params) { os << ".hContext = "; ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".hDevice = "; - - ur::details::printPtr(os, *(params->phDevice)); - - os << ", "; - os << ".hImage = "; + os << ".pMem = "; - ur::details::printPtr(os, reinterpret_cast(*(params->phImage))); + ur::details::printPtr(os, *(params->ppMem)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_bindless_images_image_allocate_exp_params_t -/// type +/// @brief Print operator for the ur_usm_get_mem_alloc_info_params_t type /// @returns /// std::ostream & inline std::ostream &operator<<( std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_image_allocate_exp_params_t - *params) { + [[maybe_unused]] const struct ur_usm_get_mem_alloc_info_params_t *params) { os << ".hContext = "; ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".hDevice = "; + os << ".pMem = "; - ur::details::printPtr(os, *(params->phDevice)); + ur::details::printPtr(os, *(params->ppMem)); os << ", "; - os << ".pImageFormat = "; + os << ".propName = "; - ur::details::printPtr(os, *(params->ppImageFormat)); + os << *(params->ppropName); os << ", "; - os << ".pImageDesc = "; + os << ".propSize = "; - ur::details::printPtr(os, *(params->ppImageDesc)); + os << *(params->ppropSize); os << ", "; - os << ".phImageMem = "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); - ur::details::printPtr(os, *(params->pphImageMem)); + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_bindless_images_image_free_exp_params_t -/// type +/// @brief Print operator for the ur_usm_pool_create_params_t type /// @returns /// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_image_free_exp_params_t - *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_create_params_t *params) { os << ".hContext = "; ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".hDevice = "; + os << ".pPoolDesc = "; - ur::details::printPtr(os, *(params->phDevice)); + ur::details::printPtr(os, *(params->ppPoolDesc)); os << ", "; - os << ".hImageMem = "; + os << ".ppPool = "; - ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + ur::details::printPtr(os, *(params->pppPool)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_unsampled_image_create_exp_params_t type +/// @brief Print operator for the ur_usm_pool_retain_params_t type /// @returns /// std::ostream & inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_unsampled_image_create_exp_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_retain_params_t *params) { - os << ".hContext = "; + os << ".pPool = "; - ur::details::printPtr(os, *(params->phContext)); + ur::details::printPtr(os, *(params->ppPool)); - os << ", "; - os << ".hDevice = "; + return os; +} - ur::details::printPtr(os, *(params->phDevice)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_release_params_t *params) { - os << ", "; - os << ".hImageMem = "; + os << ".pPool = "; - ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + ur::details::printPtr(os, *(params->ppPool)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_get_info_params_t *params) { + + os << ".hPool = "; + + ur::details::printPtr(os, *(params->phPool)); os << ", "; - os << ".pImageFormat = "; + os << ".propName = "; - ur::details::printPtr(os, *(params->ppImageFormat)); + os << *(params->ppropName); os << ", "; - os << ".pImageDesc = "; + os << ".propSize = "; - ur::details::printPtr(os, *(params->ppImageDesc)); + os << *(params->ppropSize); os << ", "; - os << ".phImage = "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); - ur::details::printPtr(os, *(params->pphImage)); + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_sampled_image_create_exp_params_t type +/// @brief Print operator for the ur_usm_pool_create_exp_params_t type /// @returns /// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_sampled_image_create_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_create_exp_params_t *params) { os << ".hContext = "; @@ -16574,125 +17198,137 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".hImageMem = "; + os << ".pPoolDesc = "; - ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + ur::details::printPtr(os, *(params->ppPoolDesc)); os << ", "; - os << ".pImageFormat = "; + os << ".pPool = "; - ur::details::printPtr(os, *(params->ppImageFormat)); + ur::details::printPtr(os, *(params->ppPool)); - os << ", "; - os << ".pImageDesc = "; + return os; +} - ur::details::printPtr(os, *(params->ppImageDesc)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_destroy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_destroy_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".hSampler = "; + os << ".hDevice = "; - ur::details::printPtr(os, *(params->phSampler)); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".phImage = "; + os << ".hPool = "; - ur::details::printPtr(os, *(params->pphImage)); + ur::details::printPtr(os, *(params->phPool)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_bindless_images_image_copy_exp_params_t -/// type +/// @brief Print operator for the ur_usm_pool_set_threshold_exp_params_t type /// @returns /// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_image_copy_exp_params_t - *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_set_threshold_exp_params_t + *params) { - os << ".hQueue = "; + os << ".hContext = "; - ur::details::printPtr(os, *(params->phQueue)); + ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".pSrc = "; + os << ".hDevice = "; - ur::details::printPtr(os, *(params->ppSrc)); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".pDst = "; + os << ".hPool = "; - ur::details::printPtr(os, *(params->ppDst)); + ur::details::printPtr(os, *(params->phPool)); os << ", "; - os << ".pSrcImageDesc = "; + os << ".newThreshold = "; - ur::details::printPtr(os, *(params->ppSrcImageDesc)); + os << *(params->pnewThreshold); - os << ", "; - os << ".pDstImageDesc = "; + return os; +} - ur::details::printPtr(os, *(params->ppDstImageDesc)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_usm_pool_get_default_device_pool_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_usm_pool_get_default_device_pool_exp_params_t *params) { - os << ", "; - os << ".pSrcImageFormat = "; + os << ".hContext = "; - ur::details::printPtr(os, *(params->ppSrcImageFormat)); + ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".pDstImageFormat = "; + os << ".hDevice = "; - ur::details::printPtr(os, *(params->ppDstImageFormat)); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".pCopyRegion = "; + os << ".pPool = "; - ur::details::printPtr(os, *(params->ppCopyRegion)); + ur::details::printPtr(os, *(params->ppPool)); - os << ", "; - os << ".imageCopyFlags = "; + return os; +} - ur::details::printFlag(os, - *(params->pimageCopyFlags)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_get_info_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_get_info_exp_params_t *params) { - os << ", "; - os << ".numEventsInWaitList = "; + os << ".hPool = "; - os << *(params->pnumEventsInWaitList); + ur::details::printPtr(os, *(params->phPool)); os << ", "; - os << ".phEventWaitList = "; - ur::details::printPtr( - os, reinterpret_cast(*(params->pphEventWaitList))); - if (*(params->pphEventWaitList) != NULL) { - os << " {"; - for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { - if (i != 0) { - os << ", "; - } + os << ".propName = "; - ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; - } + os << *(params->ppropName); + + os << ", "; + os << ".pPropValue = "; + + ur::details::printPtr(os, *(params->ppPropValue)); os << ", "; - os << ".phEvent = "; + os << ".pPropSizeRet = "; - ur::details::printPtr(os, *(params->pphEvent)); + ur::details::printPtr(os, *(params->ppPropSizeRet)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_bindless_images_image_get_info_exp_params_t -/// type +/// @brief Print operator for the ur_usm_pool_set_device_pool_exp_params_t type /// @returns /// std::ostream & inline std::ostream &operator<<( std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_image_get_info_exp_params_t + [[maybe_unused]] const struct ur_usm_pool_set_device_pool_exp_params_t *params) { os << ".hContext = "; @@ -16700,36 +17336,51 @@ inline std::ostream &operator<<( ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".hImageMem = "; + os << ".hDevice = "; - ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".propName = "; + os << ".hPool = "; - os << *(params->ppropName); + ur::details::printPtr(os, *(params->phPool)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_get_device_pool_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_get_device_pool_exp_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".pPropValue = "; + os << ".hDevice = "; - ur::details::printPtr(os, *(params->ppPropValue)); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".pPropSizeRet = "; + os << ".pPool = "; - ur::details::printPtr(os, *(params->ppPropSizeRet)); + ur::details::printPtr(os, *(params->ppPool)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_mipmap_get_level_exp_params_t type +/// @brief Print operator for the ur_usm_pool_trim_to_exp_params_t type /// @returns /// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_mipmap_get_level_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_trim_to_exp_params_t *params) { os << ".hContext = "; @@ -16741,32 +17392,25 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".hImageMem = "; - - ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); - - os << ", "; - os << ".mipmapLevel = "; + os << ".hPool = "; - os << *(params->pmipmapLevel); + ur::details::printPtr(os, *(params->phPool)); os << ", "; - os << ".phImageMem = "; + os << ".minBytesToKeep = "; - ur::details::printPtr(os, *(params->pphImageMem)); + os << *(params->pminBytesToKeep); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_bindless_images_mipmap_free_exp_params_t -/// type +/// @brief Print operator for the ur_usm_pitched_alloc_exp_params_t type /// @returns /// std::ostream & inline std::ostream &operator<<( std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_mipmap_free_exp_params_t - *params) { + [[maybe_unused]] const struct ur_usm_pitched_alloc_exp_params_t *params) { os << ".hContext = "; @@ -16778,62 +17422,96 @@ inline std::ostream &operator<<( ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".hMem = "; + os << ".pUSMDesc = "; - ur::details::printPtr(os, reinterpret_cast(*(params->phMem))); + ur::details::printPtr(os, *(params->ppUSMDesc)); + + os << ", "; + os << ".pool = "; + + ur::details::printPtr(os, *(params->ppool)); + + os << ", "; + os << ".widthInBytes = "; + + os << *(params->pwidthInBytes); + + os << ", "; + os << ".height = "; + + os << *(params->pheight); + + os << ", "; + os << ".elementSizeBytes = "; + + os << *(params->pelementSizeBytes); + + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + + os << ", "; + os << ".pResultPitch = "; + + ur::details::printPtr(os, *(params->ppResultPitch)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_import_external_memory_exp_params_t type +/// @brief Print operator for the ur_usm_import_exp_params_t type /// @returns /// std::ostream & inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_import_external_memory_exp_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_import_exp_params_t *params) { os << ".hContext = "; ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".hDevice = "; + os << ".pMem = "; - ur::details::printPtr(os, *(params->phDevice)); + ur::details::printPtr(os, *(params->ppMem)); os << ", "; os << ".size = "; os << *(params->psize); - os << ", "; - os << ".memHandleType = "; + return os; +} - os << *(params->pmemHandleType); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_release_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_release_exp_params_t *params) { - os << ", "; - os << ".pExternalMemDesc = "; + os << ".hContext = "; - ur::details::printPtr(os, *(params->ppExternalMemDesc)); + ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".phExternalMem = "; + os << ".pMem = "; - ur::details::printPtr(os, *(params->pphExternalMem)); + ur::details::printPtr(os, *(params->ppMem)); return os; } /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the -/// ur_bindless_images_map_external_array_exp_params_t type +/// ur_bindless_images_unsampled_image_handle_destroy_exp_params_t type /// @returns /// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_map_external_array_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *params) { os << ".hContext = "; @@ -16845,36 +17523,48 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".pImageFormat = "; + os << ".hImage = "; - ur::details::printPtr(os, *(params->ppImageFormat)); + ur::details::printPtr(os, reinterpret_cast(*(params->phImage))); - os << ", "; - os << ".pImageDesc = "; + return os; +} - ur::details::printPtr(os, *(params->ppImageDesc)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_sampled_image_handle_destroy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_sampled_image_handle_destroy_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".hExternalMem = "; + os << ".hDevice = "; - ur::details::printPtr(os, *(params->phExternalMem)); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".phImageMem = "; + os << ".hImage = "; - ur::details::printPtr(os, *(params->pphImageMem)); + ur::details::printPtr(os, reinterpret_cast(*(params->phImage))); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_map_external_linear_memory_exp_params_t type +/// @brief Print operator for the ur_bindless_images_image_allocate_exp_params_t +/// type /// @returns /// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_map_external_linear_memory_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_allocate_exp_params_t + *params) { os << ".hContext = "; @@ -16886,36 +17576,32 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".offset = "; - - os << *(params->poffset); - - os << ", "; - os << ".size = "; + os << ".pImageFormat = "; - os << *(params->psize); + ur::details::printPtr(os, *(params->ppImageFormat)); os << ", "; - os << ".hExternalMem = "; + os << ".pImageDesc = "; - ur::details::printPtr(os, *(params->phExternalMem)); + ur::details::printPtr(os, *(params->ppImageDesc)); os << ", "; - os << ".ppRetMem = "; + os << ".phImageMem = "; - ur::details::printPtr(os, *(params->pppRetMem)); + ur::details::printPtr(os, *(params->pphImageMem)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_release_external_memory_exp_params_t type +/// @brief Print operator for the ur_bindless_images_image_free_exp_params_t +/// type /// @returns /// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_release_external_memory_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_free_exp_params_t + *params) { os << ".hContext = "; @@ -16927,21 +17613,21 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".hExternalMem = "; + os << ".hImageMem = "; - ur::details::printPtr(os, *(params->phExternalMem)); + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); return os; } /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the -/// ur_bindless_images_import_external_semaphore_exp_params_t type +/// ur_bindless_images_unsampled_image_create_exp_params_t type /// @returns /// std::ostream & inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_import_external_semaphore_exp_params_t *params) { + ur_bindless_images_unsampled_image_create_exp_params_t *params) { os << ".hContext = "; @@ -16953,31 +17639,36 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".semHandleType = "; + os << ".hImageMem = "; - os << *(params->psemHandleType); + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); os << ", "; - os << ".pExternalSemaphoreDesc = "; + os << ".pImageFormat = "; - ur::details::printPtr(os, *(params->ppExternalSemaphoreDesc)); + ur::details::printPtr(os, *(params->ppImageFormat)); os << ", "; - os << ".phExternalSemaphore = "; + os << ".pImageDesc = "; - ur::details::printPtr(os, *(params->pphExternalSemaphore)); + ur::details::printPtr(os, *(params->ppImageDesc)); + + os << ", "; + os << ".phImage = "; + + ur::details::printPtr(os, *(params->pphImage)); return os; } /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the -/// ur_bindless_images_release_external_semaphore_exp_params_t type +/// ur_bindless_images_sampled_image_create_exp_params_t type /// @returns /// std::ostream & inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_release_external_semaphore_exp_params_t *params) { + ur_bindless_images_sampled_image_create_exp_params_t *params) { os << ".hContext = "; @@ -16989,97 +17680,87 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".hExternalSemaphore = "; + os << ".hImageMem = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + + os << ", "; + os << ".pImageFormat = "; + + ur::details::printPtr(os, *(params->ppImageFormat)); + + os << ", "; + os << ".pImageDesc = "; + + ur::details::printPtr(os, *(params->ppImageDesc)); + + os << ", "; + os << ".hSampler = "; + + ur::details::printPtr(os, *(params->phSampler)); + + os << ", "; + os << ".phImage = "; - ur::details::printPtr(os, *(params->phExternalSemaphore)); + ur::details::printPtr(os, *(params->pphImage)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_wait_external_semaphore_exp_params_t type +/// @brief Print operator for the ur_bindless_images_image_copy_exp_params_t +/// type /// @returns /// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_wait_external_semaphore_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_copy_exp_params_t + *params) { os << ".hQueue = "; ur::details::printPtr(os, *(params->phQueue)); os << ", "; - os << ".hSemaphore = "; - - ur::details::printPtr(os, *(params->phSemaphore)); - - os << ", "; - os << ".hasWaitValue = "; + os << ".pSrc = "; - os << *(params->phasWaitValue); + ur::details::printPtr(os, *(params->ppSrc)); os << ", "; - os << ".waitValue = "; + os << ".pDst = "; - os << *(params->pwaitValue); + ur::details::printPtr(os, *(params->ppDst)); os << ", "; - os << ".numEventsInWaitList = "; + os << ".pSrcImageDesc = "; - os << *(params->pnumEventsInWaitList); + ur::details::printPtr(os, *(params->ppSrcImageDesc)); os << ", "; - os << ".phEventWaitList = "; - ur::details::printPtr( - os, reinterpret_cast(*(params->pphEventWaitList))); - if (*(params->pphEventWaitList) != NULL) { - os << " {"; - for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { - if (i != 0) { - os << ", "; - } + os << ".pDstImageDesc = "; - ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; - } + ur::details::printPtr(os, *(params->ppDstImageDesc)); os << ", "; - os << ".phEvent = "; - - ur::details::printPtr(os, *(params->pphEvent)); - - return os; -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the -/// ur_bindless_images_signal_external_semaphore_exp_params_t type -/// @returns -/// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_signal_external_semaphore_exp_params_t *params) { - - os << ".hQueue = "; + os << ".pSrcImageFormat = "; - ur::details::printPtr(os, *(params->phQueue)); + ur::details::printPtr(os, *(params->ppSrcImageFormat)); os << ", "; - os << ".hSemaphore = "; + os << ".pDstImageFormat = "; - ur::details::printPtr(os, *(params->phSemaphore)); + ur::details::printPtr(os, *(params->ppDstImageFormat)); os << ", "; - os << ".hasSignalValue = "; + os << ".pCopyRegion = "; - os << *(params->phasSignalValue); + ur::details::printPtr(os, *(params->ppCopyRegion)); os << ", "; - os << ".signalValue = "; + os << ".imageCopyFlags = "; - os << *(params->psignalValue); + ur::details::printFlag(os, + *(params->pimageCopyFlags)); os << ", "; os << ".numEventsInWaitList = "; @@ -17111,47 +17792,50 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_host_alloc_params_t type +/// @brief Print operator for the ur_bindless_images_image_get_info_exp_params_t +/// type /// @returns /// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_host_alloc_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_get_info_exp_params_t + *params) { os << ".hContext = "; ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".pUSMDesc = "; + os << ".hImageMem = "; - ur::details::printPtr(os, *(params->ppUSMDesc)); + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); os << ", "; - os << ".pool = "; + os << ".propName = "; - ur::details::printPtr(os, *(params->ppool)); + os << *(params->ppropName); os << ", "; - os << ".size = "; + os << ".pPropValue = "; - os << *(params->psize); + ur::details::printPtr(os, *(params->ppPropValue)); os << ", "; - os << ".ppMem = "; + os << ".pPropSizeRet = "; - ur::details::printPtr(os, *(params->pppMem)); + ur::details::printPtr(os, *(params->ppPropSizeRet)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_device_alloc_params_t type +/// @brief Print operator for the +/// ur_bindless_images_mipmap_get_level_exp_params_t type /// @returns /// std::ostream & inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_device_alloc_params_t *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_mipmap_get_level_exp_params_t *params) { os << ".hContext = "; @@ -17163,35 +17847,32 @@ operator<<(std::ostream &os, ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".pUSMDesc = "; - - ur::details::printPtr(os, *(params->ppUSMDesc)); - - os << ", "; - os << ".pool = "; + os << ".hImageMem = "; - ur::details::printPtr(os, *(params->ppool)); + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); os << ", "; - os << ".size = "; + os << ".mipmapLevel = "; - os << *(params->psize); + os << *(params->pmipmapLevel); os << ", "; - os << ".ppMem = "; + os << ".phImageMem = "; - ur::details::printPtr(os, *(params->pppMem)); + ur::details::printPtr(os, *(params->pphImageMem)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_shared_alloc_params_t type +/// @brief Print operator for the ur_bindless_images_mipmap_free_exp_params_t +/// type /// @returns /// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_shared_alloc_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_mipmap_free_exp_params_t + *params) { os << ".hContext = "; @@ -17203,14 +17884,30 @@ operator<<(std::ostream &os, ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".pUSMDesc = "; + os << ".hMem = "; - ur::details::printPtr(os, *(params->ppUSMDesc)); + ur::details::printPtr(os, reinterpret_cast(*(params->phMem))); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_import_external_memory_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_import_external_memory_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".pool = "; + os << ".hDevice = "; - ur::details::printPtr(os, *(params->ppool)); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; os << ".size = "; @@ -17218,170 +17915,175 @@ operator<<(std::ostream &os, os << *(params->psize); os << ", "; - os << ".ppMem = "; - - ur::details::printPtr(os, *(params->pppMem)); - - return os; -} + os << ".memHandleType = "; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_free_params_t type -/// @returns -/// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_free_params_t *params) { + os << *(params->pmemHandleType); - os << ".hContext = "; + os << ", "; + os << ".pExternalMemDesc = "; - ur::details::printPtr(os, *(params->phContext)); + ur::details::printPtr(os, *(params->ppExternalMemDesc)); os << ", "; - os << ".pMem = "; + os << ".phExternalMem = "; - ur::details::printPtr(os, *(params->ppMem)); + ur::details::printPtr(os, *(params->pphExternalMem)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_get_mem_alloc_info_params_t type +/// @brief Print operator for the +/// ur_bindless_images_map_external_array_exp_params_t type /// @returns /// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_usm_get_mem_alloc_info_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_map_external_array_exp_params_t *params) { os << ".hContext = "; ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".pMem = "; + os << ".hDevice = "; - ur::details::printPtr(os, *(params->ppMem)); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".propName = "; + os << ".pImageFormat = "; - os << *(params->ppropName); + ur::details::printPtr(os, *(params->ppImageFormat)); os << ", "; - os << ".propSize = "; + os << ".pImageDesc = "; - os << *(params->ppropSize); + ur::details::printPtr(os, *(params->ppImageDesc)); os << ", "; - os << ".pPropValue = "; - ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + os << ".hExternalMem = "; + + ur::details::printPtr(os, *(params->phExternalMem)); os << ", "; - os << ".pPropSizeRet = "; + os << ".phImageMem = "; - ur::details::printPtr(os, *(params->ppPropSizeRet)); + ur::details::printPtr(os, *(params->pphImageMem)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_pool_create_params_t type +/// @brief Print operator for the +/// ur_bindless_images_map_external_linear_memory_exp_params_t type /// @returns /// std::ostream & inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_create_params_t *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_map_external_linear_memory_exp_params_t *params) { os << ".hContext = "; ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".pPoolDesc = "; + os << ".hDevice = "; - ur::details::printPtr(os, *(params->ppPoolDesc)); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".ppPool = "; + os << ".offset = "; - ur::details::printPtr(os, *(params->pppPool)); + os << *(params->poffset); - return os; -} + os << ", "; + os << ".size = "; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_pool_retain_params_t type -/// @returns -/// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_retain_params_t *params) { + os << *(params->psize); - os << ".pPool = "; + os << ", "; + os << ".hExternalMem = "; - ur::details::printPtr(os, *(params->ppPool)); + ur::details::printPtr(os, *(params->phExternalMem)); + + os << ", "; + os << ".ppRetMem = "; + + ur::details::printPtr(os, *(params->pppRetMem)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_pool_release_params_t type +/// @brief Print operator for the +/// ur_bindless_images_release_external_memory_exp_params_t type /// @returns /// std::ostream & inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_release_params_t *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_release_external_memory_exp_params_t *params) { - os << ".pPool = "; + os << ".hContext = "; - ur::details::printPtr(os, *(params->ppPool)); + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hExternalMem = "; + + ur::details::printPtr(os, *(params->phExternalMem)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_pool_get_info_params_t type +/// @brief Print operator for the +/// ur_bindless_images_import_external_semaphore_exp_params_t type /// @returns /// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_get_info_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_import_external_semaphore_exp_params_t *params) { - os << ".hPool = "; + os << ".hContext = "; - ur::details::printPtr(os, *(params->phPool)); + ur::details::printPtr(os, *(params->phContext)); os << ", "; - os << ".propName = "; + os << ".hDevice = "; - os << *(params->ppropName); + ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".propSize = "; + os << ".semHandleType = "; - os << *(params->ppropSize); + os << *(params->psemHandleType); os << ", "; - os << ".pPropValue = "; - ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + os << ".pExternalSemaphoreDesc = "; + + ur::details::printPtr(os, *(params->ppExternalSemaphoreDesc)); os << ", "; - os << ".pPropSizeRet = "; + os << ".phExternalSemaphore = "; - ur::details::printPtr(os, *(params->ppPropSizeRet)); + ur::details::printPtr(os, *(params->pphExternalSemaphore)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_pitched_alloc_exp_params_t type +/// @brief Print operator for the +/// ur_bindless_images_release_external_semaphore_exp_params_t type /// @returns /// std::ostream & -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_usm_pitched_alloc_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_release_external_semaphore_exp_params_t *params) { os << ".hContext = "; @@ -17393,84 +18095,123 @@ inline std::ostream &operator<<( ur::details::printPtr(os, *(params->phDevice)); os << ", "; - os << ".pUSMDesc = "; + os << ".hExternalSemaphore = "; - ur::details::printPtr(os, *(params->ppUSMDesc)); + ur::details::printPtr(os, *(params->phExternalSemaphore)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_wait_external_semaphore_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_wait_external_semaphore_exp_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); os << ", "; - os << ".pool = "; + os << ".hSemaphore = "; - ur::details::printPtr(os, *(params->ppool)); + ur::details::printPtr(os, *(params->phSemaphore)); os << ", "; - os << ".widthInBytes = "; + os << ".hasWaitValue = "; - os << *(params->pwidthInBytes); + os << *(params->phasWaitValue); os << ", "; - os << ".height = "; + os << ".waitValue = "; - os << *(params->pheight); + os << *(params->pwaitValue); os << ", "; - os << ".elementSizeBytes = "; + os << ".numEventsInWaitList = "; - os << *(params->pelementSizeBytes); + os << *(params->pnumEventsInWaitList); os << ", "; - os << ".ppMem = "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } - ur::details::printPtr(os, *(params->pppMem)); + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } os << ", "; - os << ".pResultPitch = "; + os << ".phEvent = "; - ur::details::printPtr(os, *(params->ppResultPitch)); + ur::details::printPtr(os, *(params->pphEvent)); return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_import_exp_params_t type +/// @brief Print operator for the +/// ur_bindless_images_signal_external_semaphore_exp_params_t type /// @returns /// std::ostream & inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_import_exp_params_t *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_signal_external_semaphore_exp_params_t *params) { - os << ".hContext = "; + os << ".hQueue = "; - ur::details::printPtr(os, *(params->phContext)); + ur::details::printPtr(os, *(params->phQueue)); os << ", "; - os << ".pMem = "; + os << ".hSemaphore = "; - ur::details::printPtr(os, *(params->ppMem)); + ur::details::printPtr(os, *(params->phSemaphore)); os << ", "; - os << ".size = "; + os << ".hasSignalValue = "; - os << *(params->psize); + os << *(params->phasSignalValue); - return os; -} + os << ", "; + os << ".signalValue = "; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_usm_release_exp_params_t type -/// @returns -/// std::ostream & -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_release_exp_params_t *params) { + os << *(params->psignalValue); - os << ".hContext = "; + os << ", "; + os << ".numEventsInWaitList = "; - ur::details::printPtr(os, *(params->phContext)); + os << *(params->pnumEventsInWaitList); os << ", "; - os << ".pMem = "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } - ur::details::printPtr(os, *(params->ppMem)); + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); return os; } @@ -19890,6 +20631,18 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, os << (const struct ur_enqueue_events_wait_with_barrier_ext_params_t *) params; } break; + case UR_FUNCTION_ENQUEUE_USM_DEVICE_ALLOC_EXP: { + os << (const struct ur_enqueue_usm_device_alloc_exp_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_SHARED_ALLOC_EXP: { + os << (const struct ur_enqueue_usm_shared_alloc_exp_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_HOST_ALLOC_EXP: { + os << (const struct ur_enqueue_usm_host_alloc_exp_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_FREE_EXP: { + os << (const struct ur_enqueue_usm_free_exp_params_t *)params; + } break; case UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP: { os << (const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *) params; @@ -19900,6 +20653,67 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, case UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP: { os << (const struct ur_enqueue_native_command_exp_params_t *)params; } break; + case UR_FUNCTION_USM_HOST_ALLOC: { + os << (const struct ur_usm_host_alloc_params_t *)params; + } break; + case UR_FUNCTION_USM_DEVICE_ALLOC: { + os << (const struct ur_usm_device_alloc_params_t *)params; + } break; + case UR_FUNCTION_USM_SHARED_ALLOC: { + os << (const struct ur_usm_shared_alloc_params_t *)params; + } break; + case UR_FUNCTION_USM_FREE: { + os << (const struct ur_usm_free_params_t *)params; + } break; + case UR_FUNCTION_USM_GET_MEM_ALLOC_INFO: { + os << (const struct ur_usm_get_mem_alloc_info_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_CREATE: { + os << (const struct ur_usm_pool_create_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_RETAIN: { + os << (const struct ur_usm_pool_retain_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_RELEASE: { + os << (const struct ur_usm_pool_release_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_GET_INFO: { + os << (const struct ur_usm_pool_get_info_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_CREATE_EXP: { + os << (const struct ur_usm_pool_create_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_DESTROY_EXP: { + os << (const struct ur_usm_pool_destroy_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_SET_THRESHOLD_EXP: { + os << (const struct ur_usm_pool_set_threshold_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_GET_DEFAULT_DEVICE_POOL_EXP: { + os << (const struct ur_usm_pool_get_default_device_pool_exp_params_t *) + params; + } break; + case UR_FUNCTION_USM_POOL_GET_INFO_EXP: { + os << (const struct ur_usm_pool_get_info_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_SET_DEVICE_POOL_EXP: { + os << (const struct ur_usm_pool_set_device_pool_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_GET_DEVICE_POOL_EXP: { + os << (const struct ur_usm_pool_get_device_pool_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_TRIM_TO_EXP: { + os << (const struct ur_usm_pool_trim_to_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_PITCHED_ALLOC_EXP: { + os << (const struct ur_usm_pitched_alloc_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_IMPORT_EXP: { + os << (const struct ur_usm_import_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_RELEASE_EXP: { + os << (const struct ur_usm_release_exp_params_t *)params; + } break; case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP: { os << (const struct ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *) @@ -19969,42 +20783,6 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, os << (const struct ur_bindless_images_signal_external_semaphore_exp_params_t *)params; } break; - case UR_FUNCTION_USM_HOST_ALLOC: { - os << (const struct ur_usm_host_alloc_params_t *)params; - } break; - case UR_FUNCTION_USM_DEVICE_ALLOC: { - os << (const struct ur_usm_device_alloc_params_t *)params; - } break; - case UR_FUNCTION_USM_SHARED_ALLOC: { - os << (const struct ur_usm_shared_alloc_params_t *)params; - } break; - case UR_FUNCTION_USM_FREE: { - os << (const struct ur_usm_free_params_t *)params; - } break; - case UR_FUNCTION_USM_GET_MEM_ALLOC_INFO: { - os << (const struct ur_usm_get_mem_alloc_info_params_t *)params; - } break; - case UR_FUNCTION_USM_POOL_CREATE: { - os << (const struct ur_usm_pool_create_params_t *)params; - } break; - case UR_FUNCTION_USM_POOL_RETAIN: { - os << (const struct ur_usm_pool_retain_params_t *)params; - } break; - case UR_FUNCTION_USM_POOL_RELEASE: { - os << (const struct ur_usm_pool_release_params_t *)params; - } break; - case UR_FUNCTION_USM_POOL_GET_INFO: { - os << (const struct ur_usm_pool_get_info_params_t *)params; - } break; - case UR_FUNCTION_USM_PITCHED_ALLOC_EXP: { - os << (const struct ur_usm_pitched_alloc_exp_params_t *)params; - } break; - case UR_FUNCTION_USM_IMPORT_EXP: { - os << (const struct ur_usm_import_exp_params_t *)params; - } break; - case UR_FUNCTION_USM_RELEASE_EXP: { - os << (const struct ur_usm_release_exp_params_t *)params; - } break; case UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP: { os << (const struct ur_command_buffer_create_exp_params_t *)params; } break; diff --git a/unified-runtime/scripts/core/EXP-ASYNC-ALLOC.rst b/unified-runtime/scripts/core/EXP-ASYNC-ALLOC.rst new file mode 100644 index 0000000000000..74122553ae627 --- /dev/null +++ b/unified-runtime/scripts/core/EXP-ASYNC-ALLOC.rst @@ -0,0 +1,105 @@ +<% + OneApi=tags['$OneApi'] + x=tags['$x'] + X=x.upper() +%> + +.. _experimental-async-allocations: + +================================================================================ +Async Allocation Functions +================================================================================ + +.. warning:: + + Experimental features: + + * May be replaced, updated, or removed at any time. + * Do not require maintaining API/ABI stability of their own additions over + time. + * Do not require conformance testing of their own additions. + + +Motivation +-------------------------------------------------------------------------------- + +Asynchronous allocations can allow queues to allocate and free memory between +UR command enqueues without forcing synchronization points in the asynchronous +command DAG associated with a queue. Through the enqueue-ordering semantics, +memory allocated within a pool can be reused so as to avoid expensive and +redundant calls into the OS, which can improve performance. + +API +-------------------------------------------------------------------------------- + +Enums +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* ${x}_device_info_t + * ${X}_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP +* ${x}_usm_pool_flags_t + * ${X}_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP + * ${X}_USM_POOL_FLAG_READ_ONLY_EXP +* ${x}_usm_pool_info_t + * ${X}_USM_POOL_INFO_RELEASE_THRESHOLD_EXP + * ${X}_USM_POOL_INFO_MAXIMUM_SIZE_EXP + * ${X}_USM_POOL_INFO_RESERVED_CURRENT_EXP + * ${X}_USM_POOL_INFO_RESERVED_HIGH_EXP + * ${X}_USM_POOL_INFO_USED_CURRENT_EXP + * ${X}_USM_POOL_INFO_USED_HIGH_EXP +* ${x}_command_t + * ${X}_COMMAND_ENQUEUE_USM_DEVICE_ALLOC_EXP + * ${X}_COMMAND_ENQUEUE_USM_SHARED_ALLOC_EXP + * ${X}_COMMAND_ENQUEUE_USM_HOST_ALLOC_EXP + * ${X}_COMMAND_ENQUEUE_USM_FREE_EXP +* ${x}_structure_type_t + * ${X}_STRUCTURE_TYPE_EXP_ASYNC_USM_ALLOC_PROPERTIES +* ${x}_exp_async_usm_alloc_flags_t + +Types +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* ${x}_exp_async_usm_alloc_properties_t + +Functions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* ${x}EnqueueUSMDeviceAllocExp +* ${x}EnqueueUSMSharedAllocExp +* ${x}EnqueueUSMHostAllocExp +* ${x}EnqueueUSMFreeExp +* ${x}USMPoolCreateExp +* ${x}USMPoolDestroyExp +* ${x}USMPoolSetThresholdExp +* ${x}USMPoolGetDefaultDevicePoolExp +* ${x}USMPoolGetInfoExp +* ${x}USMPoolSetDevicePoolExp +* ${x}USMPoolGetDevicePoolExp +* ${x}USMPoolTrimToExp + + +Changelog +-------------------------------------------------------------------------------- + ++----------+----------------------------------------------------------+ +| Revision | Changes | ++==========+==========================================================+ +| 1.0 | Initial Draft | ++----------+----------------------------------------------------------+ +| 1.1 | Fix typos/warnings/descriptions | +| | Change enum values | +| | Add missing properties/enums/funcs to API list | ++----------+----------------------------------------------------------+ + +Support +-------------------------------------------------------------------------------- + +Adapters which support this experimental feature *must* return true for the new +``${X}_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP`` device info query. + + +Contributors +-------------------------------------------------------------------------------- + +* Hugh Delaney `hugh.delaney@codeplay.com `_ +* Sean Stirling `sean.stirling@codeplay.com `_ diff --git a/unified-runtime/scripts/core/exp-async-alloc.yml b/unified-runtime/scripts/core/exp-async-alloc.yml new file mode 100644 index 0000000000000..fa8a584fe6345 --- /dev/null +++ b/unified-runtime/scripts/core/exp-async-alloc.yml @@ -0,0 +1,472 @@ +# +# Copyright (C) 2025 Intel Corporation +# +# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +# See LICENSE.TXT +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# See YaML.md for syntax definition +# +--- #-------------------------------------------------------------------------- +type: header +desc: "Intel $OneApi Unified Runtime Experimental API for asynchronous allocations" +ordinal: "99" + +--- #-------------------------------------------------------------------------- +type: enum +extend: true +typed_etors: true +desc: "Extension enums to $x_device_info_t to support async allocations." +name: $x_device_info_t +etors: + - name: ASYNC_USM_ALLOCATIONS_EXP + value: "0x2050" + desc: | + [$x_bool_t] returns true if the device supports enqueueing of + allocations and frees. + +--- #-------------------------------------------------------------------------- +type: enum +extend: true +name: $x_usm_pool_flags_t +desc: "USM memory property flag for creating a native USM pool" +etors: + - name: USE_NATIVE_MEMORY_POOL_EXP + value: "$X_BIT(1)" + desc: "Use the native memory pool API" + - name: READ_ONLY_EXP + value: "$X_BIT(2)" + desc: | + Performance hint asserting that all memory allocations from the + memory pool will only ever be read from within SYCL kernel functions + +--- #-------------------------------------------------------------------------- +type: enum +extend: true +typed_etors: true +name: $x_usm_pool_info_t +desc: "Extension enums for named memory pool info retrieval." +etors: + - name: RELEASE_THRESHOLD_EXP + value: "0x2050" + desc: "[size_t] Memory pool release threshold" + - name: MAXIMUM_SIZE_EXP + value: "0x2051" + desc: "[size_t] Memory pool maximum size" + - name: RESERVED_CURRENT_EXP + value: "0x2052" + desc: "[size_t] Amount of backing memory currently allocated for the memory pool" + - name: RESERVED_HIGH_EXP + value: "0x2053" + desc: "[size_t] High watermark of backing memory allocated for the memory pool" + - name: USED_CURRENT_EXP + value: "0x2054" + desc: "[size_t] Amount of memory from the pool that is currently in use" + - name: USED_HIGH_EXP + value: "0x2055" + desc: "[size_t] High watermark of the amount of memory from the pool that was in use" + +--- #-------------------------------------------------------------------------- +type: enum +extend: true +desc: "Command Type experimental enumerations." +name: $x_command_t +etors: + - name: ENQUEUE_USM_DEVICE_ALLOC_EXP + value: "0x2050" + desc: "Event created by $xEnqueueUSMDeviceAllocExp" + - name: ENQUEUE_USM_SHARED_ALLOC_EXP + value: "0x2051" + desc: "Event created by $xEnqueueUSMSharedAllocExp" + - name: ENQUEUE_USM_HOST_ALLOC_EXP + value: "0x2052" + desc: "Event created by $xEnqueueUSMHostAllocExp" + - name: ENQUEUE_USM_FREE_EXP + value: "0x2053" + desc: "Event created by $xEnqueueUSMFreeExp" + +--- #-------------------------------------------------------------------------- +type: enum +extend: true +desc: "Structure type experimental enumerations" +name: $x_structure_type_t +etors: + - name: EXP_ASYNC_USM_ALLOC_PROPERTIES + desc: "$x_exp_async_usm_alloc_properties_t" + value: "0x2050" + +--- #-------------------------------------------------------------------------- +type: enum +desc: "Async alloc properties" +name: $x_exp_async_usm_alloc_flags_t +etors: + - name: TBD + desc: "Reserved for future use." + value: "$X_BIT(0)" + +--- #-------------------------------------------------------------------------- +type: struct +desc: "Async alloc properties" +name: $x_exp_async_usm_alloc_properties_t +base: $x_base_properties_t +members: + - type: $x_exp_async_usm_alloc_flags_t + name: flags + desc: "[in] async alloc flags" + +--- #-------------------------------------------------------------------------- +type: function +desc: "Enqueue an async device allocation" +class: $xEnqueue +name: USMDeviceAllocExp +params: + - type: $x_queue_handle_t + name: hQueue + desc: "[in] handle of the queue object" + - type: $x_usm_pool_handle_t + desc: "[in][optional] USM pool descriptor" + name: pPool + - type: const size_t + desc: "[in] minimum size in bytes of the USM memory object to be allocated" + name: size + - type: const $x_exp_async_usm_alloc_properties_t* + name: pProperties + desc: "[in][optional] pointer to the enqueue async alloc properties" + - type: uint32_t + name: numEventsInWaitList + desc: "[in] size of the event wait list" + - type: const $x_event_handle_t* + name: phEventWaitList + desc: | + [in][optional][range(0, numEventsInWaitList)] pointer to a list of events that must be complete before the kernel execution. + If nullptr, the numEventsInWaitList must be 0, indicating no wait events. + - type: void** + name: ppMem + desc: "[out] pointer to USM memory object" + - type: $x_event_handle_t* + name: phEvent + desc: "[out][optional] return an event object that identifies the async alloc" +returns: + - $X_RESULT_ERROR_OUT_OF_RESOURCES + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_NULL_POINTER + - $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST + +--- #-------------------------------------------------------------------------- +type: function +desc: "Enqueue an async shared allocation" +class: $xEnqueue +name: USMSharedAllocExp +params: + - type: $x_queue_handle_t + name: hQueue + desc: "[in] handle of the queue object" + - type: $x_usm_pool_handle_t + desc: "[in][optional] USM pool descriptor" + name: pPool + - type: const size_t + desc: "[in] minimum size in bytes of the USM memory object to be allocated" + name: size + - type: const $x_exp_async_usm_alloc_properties_t* + name: pProperties + desc: "[in][optional] pointer to the enqueue async alloc properties" + - type: uint32_t + name: numEventsInWaitList + desc: "[in] size of the event wait list" + - type: const $x_event_handle_t* + name: phEventWaitList + desc: | + [in][optional][range(0, numEventsInWaitList)] pointer to a list of events that must be complete before the kernel execution. + If nullptr, the numEventsInWaitList must be 0, indicating no wait events. + - type: void** + name: ppMem + desc: "[out] pointer to USM memory object" + - type: $x_event_handle_t* + name: phEvent + desc: "[out][optional] return an event object that identifies the async alloc" +returns: + - $X_RESULT_ERROR_OUT_OF_RESOURCES + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_NULL_POINTER + - $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST + +--- #-------------------------------------------------------------------------- +type: function +desc: "Enqueue an async host allocation" +class: $xEnqueue +name: USMHostAllocExp +params: + - type: $x_queue_handle_t + name: hQueue + desc: "[in] handle of the queue object" + - type: $x_usm_pool_handle_t + desc: "[in][optional] USM pool descriptor" + name: pPool + - type: const size_t + desc: "[in] minimum size in bytes of the USM memory object to be allocated" + name: size + - type: const $x_exp_async_usm_alloc_properties_t* + name: pProperties + desc: "[in][optional] pointer to the enqueue async alloc properties" + - type: uint32_t + name: numEventsInWaitList + desc: "[in] size of the event wait list" + - type: const $x_event_handle_t* + name: phEventWaitList + desc: | + [in][optional][range(0, numEventsInWaitList)] pointer to a list of events that must be complete before the kernel execution. + If nullptr, the numEventsInWaitList must be 0, indicating no wait events. + - type: void** + name: ppMem + desc: "[out] pointer to USM memory object" + - type: $x_event_handle_t* + name: phEvent + desc: "[out][optional] return an event object that identifies the async alloc" +returns: + - $X_RESULT_ERROR_OUT_OF_RESOURCES + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_NULL_POINTER + - $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST + +--- #-------------------------------------------------------------------------- +type: function +desc: "Enqueue an async free" +class: $xEnqueue +name: USMFreeExp +params: + - type: $x_queue_handle_t + name: hQueue + desc: "[in] handle of the queue object" + - type: $x_usm_pool_handle_t + desc: "[in][optional] USM pool descriptor" + name: pPool + - type: void* + name: pMem + desc: "[in] pointer to USM memory object" + - type: uint32_t + name: numEventsInWaitList + desc: "[in] size of the event wait list" + - type: const $x_event_handle_t* + name: phEventWaitList + desc: | + [in][optional][range(0, numEventsInWaitList)] pointer to a list of events that must be complete before the kernel execution. + If nullptr, the numEventsInWaitList must be 0, indicating no wait events. + - type: $x_event_handle_t* + name: phEvent + desc: "[out][optional] return an event object that identifies the async alloc" +returns: + - $X_RESULT_ERROR_OUT_OF_RESOURCES + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_NULL_POINTER + - $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST + +--- #-------------------------------------------------------------------------- +type: function +desc: "Create USM memory pool with desired properties." +class: $xUSM +name: PoolCreateExp +ordinal: "0" +details: + - "Create a memory pool associated with a single device." + - "See also $xUSMPoolCreate and $x_usm_pool_limits_desc_t." +params: + - type: $x_context_handle_t + name: hContext + desc: "[in] handle of the context object" + - type: $x_device_handle_t + name: hDevice + desc: "[in] handle of the device object" + - type: $x_usm_pool_desc_t* + name: pPoolDesc + desc: "[in] pointer to USM pool descriptor. Can be chained with $x_usm_pool_limits_desc_t" + - type: $x_usm_pool_handle_t* + name: pPool + desc: "[out] pointer to USM memory pool" +returns: + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_VALUE + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_UNSUPPORTED_FEATURE: + - "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT" + +--- #-------------------------------------------------------------------------- +type: function +desc: "Destroy a USM memory pool." +class: $xUSM +name: PoolDestroyExp +ordinal: "0" +details: + - "Destroy a memory pool associated with a single device." +params: + - type: $x_context_handle_t + name: hContext + desc: "[in] handle of the context object" + - type: $x_device_handle_t + name: hDevice + desc: "[in] handle of the device object" + - type: $x_usm_pool_handle_t + name: hPool + desc: "[in] handle to USM memory pool to be destroyed" +returns: + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_VALUE + - $X_RESULT_ERROR_UNSUPPORTED_FEATURE: + - "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT" + +--- #-------------------------------------------------------------------------- +type: function +desc: "Set a new release threshold for a USM memory pool." +class: $xUSM +name: PoolSetThresholdExp +ordinal: "0" +details: + - "Set a new release threshold for a USM memory pool." +params: + - type: $x_context_handle_t + name: hContext + desc: "[in] handle of the context object" + - type: $x_device_handle_t + name: hDevice + desc: "[in] handle of the device object" + - type: $x_usm_pool_handle_t + name: hPool + desc: "[in] handle to USM memory pool for the threshold to be set" + - type: size_t + name: newThreshold + desc: "[in] release threshold to be set" +returns: + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_VALUE + - $X_RESULT_ERROR_UNSUPPORTED_FEATURE: + - "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT" + +--- #-------------------------------------------------------------------------- +type: function +desc: "Get the default pool for a device." +class: $xUSM +name: PoolGetDefaultDevicePoolExp +ordinal: "0" +details: + - "Get the default pool for a device." +params: + - type: $x_context_handle_t + name: hContext + desc: "[in] handle of the context object" + - type: $x_device_handle_t + name: hDevice + desc: "[in] handle of the device object" + - type: $x_usm_pool_handle_t* + name: pPool + desc: "[out] pointer to USM memory pool" +returns: + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_VALUE + - $X_RESULT_ERROR_UNSUPPORTED_FEATURE: + - "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT" + +--- #-------------------------------------------------------------------------- +type: function +desc: "Query a pool for specific properties." +class: $xUSM +name: PoolGetInfoExp +ordinal: "0" +details: + - "Query a memory pool for specific properties." +params: + - type: $x_usm_pool_handle_t + name: hPool + desc: "[in] handle to USM memory pool for property retrieval" + - type: $x_usm_pool_info_t + name: propName + desc: "[in] queried property name" + - type: void* + name: pPropValue + desc: "[out][optional] returned query value" + - type: size_t* + name: pPropSizeRet + desc: "[out][optional] returned query value size" +returns: + - $X_RESULT_ERROR_UNSUPPORTED_ENUMERATION: + - "If `propName` is not supported by the adapter." + - $X_RESULT_ERROR_INVALID_NULL_POINTER: + - "`pPropValue == NULL && pPropSizeRet == NULL`" + - $X_RESULT_ERROR_INVALID_DEVICE + - $X_RESULT_ERROR_OUT_OF_RESOURCES + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + +--- #-------------------------------------------------------------------------- +type: function +desc: "Set the current pool for a device." +class: $xUSM +name: PoolSetDevicePoolExp +ordinal: "0" +details: + - "Set the current pool for a device." +params: + - type: $x_context_handle_t + name: hContext + desc: "[in] handle of the context object" + - type: $x_device_handle_t + name: hDevice + desc: "[in] handle of the device object" + - type: $x_usm_pool_handle_t + name: hPool + desc: "[in] handle to USM memory pool to set for a device" +returns: + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_VALUE + - $X_RESULT_ERROR_UNSUPPORTED_FEATURE: + - "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT" + +--- #-------------------------------------------------------------------------- +type: function +desc: "Get the currently set pool for a device." +class: $xUSM +name: PoolGetDevicePoolExp +ordinal: "0" +details: + - "Get the currently set pool for a device." +params: + - type: $x_context_handle_t + name: hContext + desc: "[in] handle of the context object" + - type: $x_device_handle_t + name: hDevice + desc: "[in] handle of the device object" + - type: $x_usm_pool_handle_t* + name: pPool + desc: "[out] pointer to USM memory pool" +returns: + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_VALUE + - $X_RESULT_ERROR_UNSUPPORTED_FEATURE: + - "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT" + +--- #-------------------------------------------------------------------------- +type: function +desc: "Attempt to release a pool's memory back to the OS" +class: $xUSM +name: PoolTrimToExp +ordinal: "0" +details: + - "Attempt to release a pool's memory back to the OS" +params: + - type: $x_context_handle_t + name: hContext + desc: "[in] handle of the context object" + - type: $x_device_handle_t + name: hDevice + desc: "[in] handle of the device object" + - type: $x_usm_pool_handle_t + name: hPool + desc: "[in] handle to USM memory pool for trimming" + - type: size_t + name: minBytesToKeep + desc: "[in] minimum number of bytes to keep in the pool" +returns: + - $X_RESULT_ERROR_INVALID_NULL_HANDLE + - $X_RESULT_ERROR_INVALID_VALUE + - $X_RESULT_ERROR_UNSUPPORTED_FEATURE: + - "If any device associated with `hContext` reports `false` for $X_DEVICE_INFO_USM_POOL_SUPPORT" diff --git a/unified-runtime/scripts/core/registry.yml b/unified-runtime/scripts/core/registry.yml index c774642482a0b..e37d7fef27092 100644 --- a/unified-runtime/scripts/core/registry.yml +++ b/unified-runtime/scripts/core/registry.yml @@ -601,6 +601,42 @@ etors: - name: PHYSICAL_MEM_GET_INFO desc: Enumerator for $xPhysicalMemGetInfo value: '249' +- name: ENQUEUE_USM_DEVICE_ALLOC_EXP + desc: Enumerator for $xEnqueueUSMDeviceAllocExp + value: '250' +- name: ENQUEUE_USM_SHARED_ALLOC_EXP + desc: Enumerator for $xEnqueueUSMSharedAllocExp + value: '251' +- name: ENQUEUE_USM_HOST_ALLOC_EXP + desc: Enumerator for $xEnqueueUSMHostAllocExp + value: '252' +- name: ENQUEUE_USM_FREE_EXP + desc: Enumerator for $xEnqueueUSMFreeExp + value: '253' +- name: USM_POOL_CREATE_EXP + desc: Enumerator for $xUSMPoolCreateExp + value: '254' +- name: USM_POOL_DESTROY_EXP + desc: Enumerator for $xUSMPoolDestroyExp + value: '255' +- name: USM_POOL_SET_THRESHOLD_EXP + desc: Enumerator for $xUSMPoolSetThresholdExp + value: '256' +- name: USM_POOL_GET_DEFAULT_DEVICE_POOL_EXP + desc: Enumerator for $xUSMPoolGetDefaultDevicePoolExp + value: '257' +- name: USM_POOL_SET_DEVICE_POOL_EXP + desc: Enumerator for $xUSMPoolSetDevicePoolExp + value: '259' +- name: USM_POOL_GET_DEVICE_POOL_EXP + desc: Enumerator for $xUSMPoolGetDevicePoolExp + value: '260' +- name: USM_POOL_TRIM_TO_EXP + desc: Enumerator for $xUSMPoolTrimToExp + value: '261' +- name: USM_POOL_GET_INFO_EXP + desc: Enumerator for $xUSMPoolGetInfoExp + value: '262' --- type: enum desc: Defines structure types diff --git a/unified-runtime/source/adapters/cuda/CMakeLists.txt b/unified-runtime/source/adapters/cuda/CMakeLists.txt index b6b153a5d8fdb..ed69dc0996542 100644 --- a/unified-runtime/source/adapters/cuda/CMakeLists.txt +++ b/unified-runtime/source/adapters/cuda/CMakeLists.txt @@ -10,6 +10,7 @@ add_ur_adapter(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/ur_interface_loader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/adapter.hpp ${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/async_alloc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.hpp ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/common.hpp diff --git a/unified-runtime/source/adapters/cuda/async_alloc.cpp b/unified-runtime/source/adapters/cuda/async_alloc.cpp new file mode 100644 index 0000000000000..ddc76fb499e13 --- /dev/null +++ b/unified-runtime/source/adapters/cuda/async_alloc.cpp @@ -0,0 +1,43 @@ +//===--------- async_alloc.cpp - CUDA Adapter -----------------------------===// +// +// Copyright (C) 2025 Intel Corporation +// +// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM +// Exceptions. See LICENSE.TXT +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include + +#include "context.hpp" +#include "enqueue.hpp" +#include "event.hpp" +#include "queue.hpp" +#include "usm.hpp" + +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urEnqueueUSMFreeExp(ur_queue_handle_t, ur_usm_pool_handle_t, void *, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/unified-runtime/source/adapters/cuda/ur_interface_loader.cpp b/unified-runtime/source/adapters/cuda/ur_interface_loader.cpp index d701c93d4468f..1e375ecc20273 100644 --- a/unified-runtime/source/adapters/cuda/ur_interface_loader.cpp +++ b/unified-runtime/source/adapters/cuda/ur_interface_loader.cpp @@ -361,6 +361,14 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( return result; } pDdiTable->pfnPitchedAllocExp = urUSMPitchedAllocExp; + pDdiTable->pfnPoolCreateExp = urUSMPoolCreateExp; + pDdiTable->pfnPoolDestroyExp = urUSMPoolDestroyExp; + pDdiTable->pfnPoolGetDefaultDevicePoolExp = urUSMPoolGetDefaultDevicePoolExp; + pDdiTable->pfnPoolSetThresholdExp = urUSMPoolSetThresholdExp; + pDdiTable->pfnPoolGetInfoExp = urUSMPoolGetInfoExp; + pDdiTable->pfnPoolSetDevicePoolExp = urUSMPoolSetDevicePoolExp; + pDdiTable->pfnPoolGetDevicePoolExp = urUSMPoolGetDevicePoolExp; + pDdiTable->pfnPoolTrimToExp = urUSMPoolTrimToExp; return UR_RESULT_SUCCESS; } @@ -415,6 +423,10 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnTimestampRecordingExp = urEnqueueTimestampRecordingExp; pDdiTable->pfnKernelLaunchCustomExp = urEnqueueKernelLaunchCustomExp; pDdiTable->pfnNativeCommandExp = urEnqueueNativeCommandExp; + pDdiTable->pfnUSMDeviceAllocExp = urEnqueueUSMDeviceAllocExp; + pDdiTable->pfnUSMSharedAllocExp = urEnqueueUSMSharedAllocExp; + pDdiTable->pfnUSMHostAllocExp = urEnqueueUSMHostAllocExp; + pDdiTable->pfnUSMFreeExp = urEnqueueUSMFreeExp; return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/adapters/cuda/usm.cpp b/unified-runtime/source/adapters/cuda/usm.cpp index 5d2d43442de70..62b9fe04c0770 100644 --- a/unified-runtime/source/adapters/cuda/usm.cpp +++ b/unified-runtime/source/adapters/cuda/usm.cpp @@ -413,3 +413,85 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfo( } } } + +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolCreateExp( + ur_context_handle_t hContext, ///< [in] handle of the context object + ur_device_handle_t hDevice, ///< [in] handle of the device object + ur_usm_pool_desc_t *pPoolDesc, ///< [in] pointer to USM pool descriptor. + ///< Can be chained with + ///< ::ur_usm_pool_limits_desc_t + ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool +) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPoolDesc; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urUSMPoolDestroyExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, size_t newThreshold) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = newThreshold; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, ur_usm_pool_info_t propName, + void *pPropValue, size_t *pPropSizeRet) { + std::ignore = hPool; + std::ignore = propName; + std::ignore = pPropValue; + std::ignore = pPropSizeRet; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t minBytesToKeep) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = minBytesToKeep; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/unified-runtime/source/adapters/hip/CMakeLists.txt b/unified-runtime/source/adapters/hip/CMakeLists.txt index 9113d7b1cac0a..4ec5bfdc23212 100644 --- a/unified-runtime/source/adapters/hip/CMakeLists.txt +++ b/unified-runtime/source/adapters/hip/CMakeLists.txt @@ -59,6 +59,7 @@ add_ur_adapter(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/ur_interface_loader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/adapter.hpp ${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/async_alloc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.hpp ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/common.hpp diff --git a/unified-runtime/source/adapters/hip/async_alloc.cpp b/unified-runtime/source/adapters/hip/async_alloc.cpp new file mode 100644 index 0000000000000..9ae3ef88f0047 --- /dev/null +++ b/unified-runtime/source/adapters/hip/async_alloc.cpp @@ -0,0 +1,40 @@ +//===--------- async_alloc.cpp - CUDA Adapter -----------------------------===// +// +// Copyright (C) 2025 Intel Corporation +// +// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM +// Exceptions. See LICENSE.TXT +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include + +UR_APIEXPORT ur_result_t urEnqueueUSMDeviceAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMSharedAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMHostAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMFreeExp(ur_queue_handle_t, + ur_usm_pool_handle_t, void *, + uint32_t, + const ur_event_handle_t *, + ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/unified-runtime/source/adapters/hip/ur_interface_loader.cpp b/unified-runtime/source/adapters/hip/ur_interface_loader.cpp index 41aef5b44c131..fc2549c4d9ea2 100644 --- a/unified-runtime/source/adapters/hip/ur_interface_loader.cpp +++ b/unified-runtime/source/adapters/hip/ur_interface_loader.cpp @@ -359,6 +359,14 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( return result; } pDdiTable->pfnPitchedAllocExp = urUSMPitchedAllocExp; + pDdiTable->pfnPoolCreateExp = urUSMPoolCreateExp; + pDdiTable->pfnPoolDestroyExp = urUSMPoolDestroyExp; + pDdiTable->pfnPoolGetDefaultDevicePoolExp = urUSMPoolGetDefaultDevicePoolExp; + pDdiTable->pfnPoolSetThresholdExp = urUSMPoolSetThresholdExp; + pDdiTable->pfnPoolGetInfoExp = urUSMPoolGetInfoExp; + pDdiTable->pfnPoolSetDevicePoolExp = urUSMPoolSetDevicePoolExp; + pDdiTable->pfnPoolGetDevicePoolExp = urUSMPoolGetDevicePoolExp; + pDdiTable->pfnPoolTrimToExp = urUSMPoolTrimToExp; return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/adapters/hip/usm.cpp b/unified-runtime/source/adapters/hip/usm.cpp index 922098e4a1f7b..337f76263bad6 100644 --- a/unified-runtime/source/adapters/hip/usm.cpp +++ b/unified-runtime/source/adapters/hip/usm.cpp @@ -478,3 +478,87 @@ ur_result_t umfPoolMallocHelper(ur_usm_pool_handle_t hPool, void **ppMem, } return UR_RESULT_SUCCESS; } + +ur_result_t UR_APICALL urUSMPoolCreateExp( + ur_context_handle_t hContext, ///< [in] handle of the context object + ur_device_handle_t hDevice, ///< [in] handle of the device object + ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. + ///< Can be chained with + ///< ::ur_usm_pool_limits_desc_t + ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool +) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = PoolDesc; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t newThreshold) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = newThreshold; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, + ur_usm_pool_info_t propName, + void *pPropValue, + size_t *pPropSizeRet) { + std::ignore = hPool; + std::ignore = propName; + std::ignore = pPropValue; + std::ignore = pPropSizeRet; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t minBytesToKeep) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = minBytesToKeep; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/unified-runtime/source/adapters/level_zero/CMakeLists.txt b/unified-runtime/source/adapters/level_zero/CMakeLists.txt index 784b01793fc69..1a7176e50f5e5 100644 --- a/unified-runtime/source/adapters/level_zero/CMakeLists.txt +++ b/unified-runtime/source/adapters/level_zero/CMakeLists.txt @@ -13,6 +13,7 @@ if(UR_BUILD_ADAPTER_L0) ${CMAKE_CURRENT_SOURCE_DIR}/ur_interface_loader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/adapter.hpp ${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/async_alloc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.hpp ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/common.hpp diff --git a/unified-runtime/source/adapters/level_zero/async_alloc.cpp b/unified-runtime/source/adapters/level_zero/async_alloc.cpp new file mode 100644 index 0000000000000..bf7bcb10bd60e --- /dev/null +++ b/unified-runtime/source/adapters/level_zero/async_alloc.cpp @@ -0,0 +1,40 @@ +//===--------- async_alloc.cpp - CUDA Adapter -----------------------------===// +// +// Copyright (C) 2024 Intel Corporation +// +// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM +// Exceptions. See LICENSE.TXT +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include + +UR_APIEXPORT ur_result_t urEnqueueUSMDeviceAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMSharedAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMHostAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMFreeExp(ur_queue_handle_t, + ur_usm_pool_handle_t, void *, + uint32_t, + const ur_event_handle_t *, + ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/unified-runtime/source/adapters/level_zero/ur_interface_loader.cpp b/unified-runtime/source/adapters/level_zero/ur_interface_loader.cpp index c237581016d18..c791027efdbc8 100644 --- a/unified-runtime/source/adapters/level_zero/ur_interface_loader.cpp +++ b/unified-runtime/source/adapters/level_zero/ur_interface_loader.cpp @@ -210,6 +210,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnKernelLaunchCustomExp = ur::level_zero::urEnqueueKernelLaunchCustomExp; + pDdiTable->pfnUSMDeviceAllocExp = ur::level_zero::urEnqueueUSMDeviceAllocExp; + pDdiTable->pfnUSMSharedAllocExp = ur::level_zero::urEnqueueUSMSharedAllocExp; + pDdiTable->pfnUSMHostAllocExp = ur::level_zero::urEnqueueUSMHostAllocExp; + pDdiTable->pfnUSMFreeExp = ur::level_zero::urEnqueueUSMFreeExp; pDdiTable->pfnCooperativeKernelLaunchExp = ur::level_zero::urEnqueueCooperativeKernelLaunchExp; pDdiTable->pfnTimestampRecordingExp = @@ -446,6 +450,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( return result; } + pDdiTable->pfnPoolCreateExp = ur::level_zero::urUSMPoolCreateExp; + pDdiTable->pfnPoolDestroyExp = ur::level_zero::urUSMPoolDestroyExp; + pDdiTable->pfnPoolSetThresholdExp = ur::level_zero::urUSMPoolSetThresholdExp; + pDdiTable->pfnPoolGetDefaultDevicePoolExp = + ur::level_zero::urUSMPoolGetDefaultDevicePoolExp; + pDdiTable->pfnPoolGetInfoExp = ur::level_zero::urUSMPoolGetInfoExp; + pDdiTable->pfnPoolSetDevicePoolExp = + ur::level_zero::urUSMPoolSetDevicePoolExp; + pDdiTable->pfnPoolGetDevicePoolExp = + ur::level_zero::urUSMPoolGetDevicePoolExp; + pDdiTable->pfnPoolTrimToExp = ur::level_zero::urUSMPoolTrimToExp; pDdiTable->pfnPitchedAllocExp = ur::level_zero::urUSMPitchedAllocExp; pDdiTable->pfnImportExp = ur::level_zero::urUSMImportExp; pDdiTable->pfnReleaseExp = ur::level_zero::urUSMReleaseExp; diff --git a/unified-runtime/source/adapters/level_zero/ur_interface_loader.hpp b/unified-runtime/source/adapters/level_zero/ur_interface_loader.hpp index 8803b86b07847..e794973d84958 100644 --- a/unified-runtime/source/adapters/level_zero/ur_interface_loader.hpp +++ b/unified-runtime/source/adapters/level_zero/ur_interface_loader.hpp @@ -466,6 +466,53 @@ ur_result_t urEnqueueWriteHostPipe(ur_queue_handle_t hQueue, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent); +ur_result_t urEnqueueUSMDeviceAllocExp( + ur_queue_handle_t hQueue, ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent); +ur_result_t urEnqueueUSMSharedAllocExp( + ur_queue_handle_t hQueue, ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent); +ur_result_t urEnqueueUSMHostAllocExp( + ur_queue_handle_t hQueue, ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent); +ur_result_t urEnqueueUSMFreeExp(ur_queue_handle_t hQueue, + ur_usm_pool_handle_t pPool, void *pMem, + uint32_t numEventsInWaitList, + const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent); +ur_result_t urUSMPoolCreateExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_desc_t *pPoolDesc, + ur_usm_pool_handle_t *pPool); +ur_result_t urUSMPoolDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool); +ur_result_t urUSMPoolSetThresholdExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t newThreshold); +ur_result_t urUSMPoolGetDefaultDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool); +ur_result_t urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, + ur_usm_pool_info_t propName, void *pPropValue, + size_t *pPropSizeRet); +ur_result_t urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool); +ur_result_t urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool); +ur_result_t urUSMPoolTrimToExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t minBytesToKeep); ur_result_t urUSMPitchedAllocExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, const ur_usm_desc_t *pUSMDesc, diff --git a/unified-runtime/source/adapters/level_zero/usm.cpp b/unified-runtime/source/adapters/level_zero/usm.cpp index 19480e83c5d98..ef92eb8730f1c 100644 --- a/unified-runtime/source/adapters/level_zero/usm.cpp +++ b/unified-runtime/source/adapters/level_zero/usm.cpp @@ -803,6 +803,210 @@ ur_result_t urUSMReleaseExp(ur_context_handle_t Context, void *HostPtr) { Context->getPlatform()->ZeDriverHandleExpTranslated, HostPtr); return UR_RESULT_SUCCESS; } + +ur_result_t urEnqueueUSMDeviceAllocExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_usm_pool_handle_t + pPool, ///< [in][optional] handle of the USM memory pool + const size_t size, ///< [in] minimum size in bytes of the USM memory object + ///< to be allocated + const ur_exp_async_usm_alloc_properties_t + *pProperties, ///< [in][optional] pointer to the enqueue asynchronous + ///< USM allocation properties + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t + *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] + ///< pointer to a list of events that must be complete + ///< before the kernel execution. If nullptr, the + ///< numEventsInWaitList must be 0, indicating no wait + ///< events. + void **ppMem, ///< [out] pointer to USM memory object + ur_event_handle_t + *phEvent ///< [out][optional] return an event object that identifies the + ///< asynchronous USM device allocation +) { + std::ignore = hQueue; + std::ignore = pPool; + std::ignore = size; + std::ignore = pProperties; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = ppMem; + std::ignore = phEvent; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t urEnqueueUSMSharedAllocExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_usm_pool_handle_t + pPool, ///< [in][optional] handle of the USM memory pool + const size_t size, ///< [in] minimum size in bytes of the USM memory object + ///< to be allocated + const ur_exp_async_usm_alloc_properties_t + *pProperties, ///< [in][optional] pointer to the enqueue asynchronous + ///< USM allocation properties + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t + *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] + ///< pointer to a list of events that must be complete + ///< before the kernel execution. If nullptr, the + ///< numEventsInWaitList must be 0, indicating no wait + ///< events. + void **ppMem, ///< [out] pointer to USM memory object + ur_event_handle_t + *phEvent ///< [out][optional] return an event object that identifies the + ///< asynchronous USM shared allocation +) { + std::ignore = hQueue; + std::ignore = pPool; + std::ignore = size; + std::ignore = pProperties; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = ppMem; + std::ignore = phEvent; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t urEnqueueUSMHostAllocExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_usm_pool_handle_t + pPool, ///< [in][optional] handle of the USM memory pool + const size_t size, ///< [in] minimum size in bytes of the USM memory object + ///< to be allocated + const ur_exp_async_usm_alloc_properties_t + *pProperties, ///< [in][optional] pointer to the enqueue asynchronous + ///< USM allocation properties + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t + *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] + ///< pointer to a list of events that must be complete + ///< before the kernel execution. If nullptr, the + ///< numEventsInWaitList must be 0, indicating no wait + ///< events. + void **ppMem, ///< [out] pointer to USM memory object + ur_event_handle_t + *phEvent ///< [out][optional] return an event object that identifies the + ///< asynchronous USM host allocation +) { + std::ignore = hQueue; + std::ignore = pPool; + std::ignore = size; + std::ignore = pProperties; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = ppMem; + std::ignore = phEvent; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t urEnqueueUSMFreeExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_usm_pool_handle_t + pPool, ///< [in][optional] handle of the USM memory pooliptor + void *pMem, ///< [in] pointer to USM memory object + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t + *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] + ///< pointer to a list of events that must be complete + ///< before the kernel execution. If nullptr, the + ///< numEventsInWaitList must be 0, indicating no wait + ///< events. + ur_event_handle_t *phEvent ///< [out][optional] return an event object that + ///< identifies the asynchronous USM deallocation +) { + std::ignore = hQueue; + std::ignore = pPool; + std::ignore = pMem; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = phEvent; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolCreateExp( + ur_context_handle_t hContext, ///< [in] handle of the context object + ur_device_handle_t hDevice, ///< [in] handle of the device object + ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. + ///< Can be chained with + ///< ::ur_usm_pool_limits_desc_t + ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool +) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = PoolDesc; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t newThreshold) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = newThreshold; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, + ur_usm_pool_info_t propName, + void *pPropValue, + size_t *pPropSizeRet) { + std::ignore = hPool; + std::ignore = propName; + std::ignore = pPropValue; + std::ignore = pPropSizeRet; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t minBytesToKeep) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = minBytesToKeep; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} } // namespace ur::level_zero static ur_result_t USMFreeImpl(ur_context_handle_t Context, void *Ptr) { diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_api.cpp b/unified-runtime/source/adapters/level_zero/v2/queue_api.cpp index aa7d27978a3ac..6ad438c5a042e 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_api.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_api.cpp @@ -342,6 +342,49 @@ ur_result_t urEnqueueWriteHostPipe(ur_queue_handle_t hQueue, } catch (...) { return exceptionToResult(std::current_exception()); } +ur_result_t urEnqueueUSMDeviceAllocExp( + ur_queue_handle_t hQueue, ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent) try { + return hQueue->get().enqueueUSMDeviceAllocExp( + pPool, size, pProperties, numEventsInWaitList, phEventWaitList, ppMem, + phEvent); +} catch (...) { + return exceptionToResult(std::current_exception()); +} +ur_result_t urEnqueueUSMSharedAllocExp( + ur_queue_handle_t hQueue, ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent) try { + return hQueue->get().enqueueUSMSharedAllocExp( + pPool, size, pProperties, numEventsInWaitList, phEventWaitList, ppMem, + phEvent); +} catch (...) { + return exceptionToResult(std::current_exception()); +} +ur_result_t urEnqueueUSMHostAllocExp( + ur_queue_handle_t hQueue, ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent) try { + return hQueue->get().enqueueUSMHostAllocExp(pPool, size, pProperties, + numEventsInWaitList, + phEventWaitList, ppMem, phEvent); +} catch (...) { + return exceptionToResult(std::current_exception()); +} +ur_result_t urEnqueueUSMFreeExp(ur_queue_handle_t hQueue, + ur_usm_pool_handle_t pPool, void *pMem, + uint32_t numEventsInWaitList, + const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) try { + return hQueue->get().enqueueUSMFreeExp(pPool, pMem, numEventsInWaitList, + phEventWaitList, phEvent); +} catch (...) { + return exceptionToResult(std::current_exception()); +} ur_result_t urBindlessImagesImageCopyExp( ur_queue_handle_t hQueue, const void *pSrc, void *pDst, const ur_image_desc_t *pSrcImageDesc, const ur_image_desc_t *pDstImageDesc, diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_api.hpp b/unified-runtime/source/adapters/level_zero/v2/queue_api.hpp index 82a43e976894c..be3c0ea8f6276 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_api.hpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_api.hpp @@ -128,6 +128,24 @@ struct ur_queue_t_ { bool, void *, size_t, uint32_t, const ur_event_handle_t *, ur_event_handle_t *) = 0; + virtual ur_result_t + enqueueUSMDeviceAllocExp(ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, + uint32_t, const ur_event_handle_t *, void **, + ur_event_handle_t *) = 0; + virtual ur_result_t + enqueueUSMSharedAllocExp(ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, + uint32_t, const ur_event_handle_t *, void **, + ur_event_handle_t *) = 0; + virtual ur_result_t + enqueueUSMHostAllocExp(ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, + ur_event_handle_t *) = 0; + virtual ur_result_t enqueueUSMFreeExp(ur_usm_pool_handle_t, void *, uint32_t, + const ur_event_handle_t *, + ur_event_handle_t *) = 0; virtual ur_result_t bindlessImagesImageCopyExp( const void *, void *, const ur_image_desc_t *, const ur_image_desc_t *, const ur_image_format_t *, const ur_image_format_t *, diff --git a/unified-runtime/source/adapters/mock/ur_mockddi.cpp b/unified-runtime/source/adapters/mock/ur_mockddi.cpp index 9a4ace593e430..eb85b9ed09d54 100644 --- a/unified-runtime/source/adapters/mock/ur_mockddi.cpp +++ b/unified-runtime/source/adapters/mock/ur_mockddi.cpp @@ -7287,6 +7287,651 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMDeviceAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_enqueue_usm_device_alloc_exp_params_t params = { + &hQueue, &pPool, &size, &pProperties, &numEventsInWaitList, + &phEventWaitList, &ppMem, &phEvent}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urEnqueueUSMDeviceAllocExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urEnqueueUSMDeviceAllocExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + // optional output handle + if (phEvent) { + *phEvent = mock::createDummyHandle(); + } + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urEnqueueUSMDeviceAllocExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMSharedAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_enqueue_usm_shared_alloc_exp_params_t params = { + &hQueue, &pPool, &size, &pProperties, &numEventsInWaitList, + &phEventWaitList, &ppMem, &phEvent}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urEnqueueUSMSharedAllocExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urEnqueueUSMSharedAllocExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + // optional output handle + if (phEvent) { + *phEvent = mock::createDummyHandle(); + } + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urEnqueueUSMSharedAllocExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMHostAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_enqueue_usm_host_alloc_exp_params_t params = { + &hQueue, &pPool, &size, &pProperties, &numEventsInWaitList, + &phEventWaitList, &ppMem, &phEvent}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urEnqueueUSMHostAllocExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urEnqueueUSMHostAllocExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + // optional output handle + if (phEvent) { + *phEvent = mock::createDummyHandle(); + } + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urEnqueueUSMHostAllocExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMFreeExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMFreeExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] pointer to USM memory object + void *pMem, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_enqueue_usm_free_exp_params_t params = { + &hQueue, &pPool, &pMem, &numEventsInWaitList, &phEventWaitList, &phEvent}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urEnqueueUSMFreeExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urEnqueueUSMFreeExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + // optional output handle + if (phEvent) { + *phEvent = mock::createDummyHandle(); + } + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urEnqueueUSMFreeExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolCreateExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolCreateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] pointer to USM pool descriptor. Can be chained with + /// ::ur_usm_pool_limits_desc_t + ur_usm_pool_desc_t *pPoolDesc, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_usm_pool_create_exp_params_t params = {&hContext, &hDevice, &pPoolDesc, + &pPool}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urUSMPoolCreateExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urUSMPoolCreateExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + *pPool = mock::createDummyHandle(); + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urUSMPoolCreateExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolDestroyExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolDestroyExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to be destroyed + ur_usm_pool_handle_t hPool) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_usm_pool_destroy_exp_params_t params = {&hContext, &hDevice, &hPool}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urUSMPoolDestroyExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urUSMPoolDestroyExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urUSMPoolDestroyExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolSetThresholdExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for the threshold to be set + ur_usm_pool_handle_t hPool, + /// [in] release threshold to be set + size_t newThreshold) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_usm_pool_set_threshold_exp_params_t params = {&hContext, &hDevice, &hPool, + &newThreshold}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urUSMPoolSetThresholdExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urUSMPoolSetThresholdExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urUSMPoolSetThresholdExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetDefaultDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_usm_pool_get_default_device_pool_exp_params_t params = {&hContext, + &hDevice, &pPool}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback( + "urUSMPoolGetDefaultDevicePoolExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback( + "urUSMPoolGetDefaultDevicePoolExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + *pPool = mock::createDummyHandle(); + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback( + "urUSMPoolGetDefaultDevicePoolExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetInfoExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfoExp( + /// [in] handle to USM memory pool for property retrieval + ur_usm_pool_handle_t hPool, + /// [in] queried property name + ur_usm_pool_info_t propName, + /// [out][optional] returned query value + void *pPropValue, + /// [out][optional] returned query value size + size_t *pPropSizeRet) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_usm_pool_get_info_exp_params_t params = {&hPool, &propName, &pPropValue, + &pPropSizeRet}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urUSMPoolGetInfoExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urUSMPoolGetInfoExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urUSMPoolGetInfoExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolSetDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to set for a device + ur_usm_pool_handle_t hPool) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_usm_pool_set_device_pool_exp_params_t params = {&hContext, &hDevice, + &hPool}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urUSMPoolSetDevicePoolExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urUSMPoolSetDevicePoolExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urUSMPoolSetDevicePoolExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_usm_pool_get_device_pool_exp_params_t params = {&hContext, &hDevice, + &pPool}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urUSMPoolGetDevicePoolExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urUSMPoolGetDevicePoolExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + *pPool = mock::createDummyHandle(); + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urUSMPoolGetDevicePoolExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolTrimToExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolTrimToExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for trimming + ur_usm_pool_handle_t hPool, + /// [in] minimum number of bytes to keep in the pool + size_t minBytesToKeep) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_usm_pool_trim_to_exp_params_t params = {&hContext, &hDevice, &hPool, + &minBytesToKeep}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urUSMPoolTrimToExp")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urUSMPoolTrimToExp")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urUSMPoolTrimToExp")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMPitchedAllocExp __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( @@ -11219,6 +11864,14 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnKernelLaunchCustomExp = driver::urEnqueueKernelLaunchCustomExp; + pDdiTable->pfnUSMDeviceAllocExp = driver::urEnqueueUSMDeviceAllocExp; + + pDdiTable->pfnUSMSharedAllocExp = driver::urEnqueueUSMSharedAllocExp; + + pDdiTable->pfnUSMHostAllocExp = driver::urEnqueueUSMHostAllocExp; + + pDdiTable->pfnUSMFreeExp = driver::urEnqueueUSMFreeExp; + pDdiTable->pfnCooperativeKernelLaunchExp = driver::urEnqueueCooperativeKernelLaunchExp; @@ -11718,6 +12371,23 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( ur_result_t result = UR_RESULT_SUCCESS; + pDdiTable->pfnPoolCreateExp = driver::urUSMPoolCreateExp; + + pDdiTable->pfnPoolDestroyExp = driver::urUSMPoolDestroyExp; + + pDdiTable->pfnPoolSetThresholdExp = driver::urUSMPoolSetThresholdExp; + + pDdiTable->pfnPoolGetDefaultDevicePoolExp = + driver::urUSMPoolGetDefaultDevicePoolExp; + + pDdiTable->pfnPoolGetInfoExp = driver::urUSMPoolGetInfoExp; + + pDdiTable->pfnPoolSetDevicePoolExp = driver::urUSMPoolSetDevicePoolExp; + + pDdiTable->pfnPoolGetDevicePoolExp = driver::urUSMPoolGetDevicePoolExp; + + pDdiTable->pfnPoolTrimToExp = driver::urUSMPoolTrimToExp; + pDdiTable->pfnPitchedAllocExp = driver::urUSMPitchedAllocExp; pDdiTable->pfnImportExp = driver::urUSMImportExp; diff --git a/unified-runtime/source/adapters/native_cpu/CMakeLists.txt b/unified-runtime/source/adapters/native_cpu/CMakeLists.txt index 17467bfdeff4a..c197d544fd643 100644 --- a/unified-runtime/source/adapters/native_cpu/CMakeLists.txt +++ b/unified-runtime/source/adapters/native_cpu/CMakeLists.txt @@ -11,6 +11,7 @@ add_ur_adapter(${TARGET_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/adapter.hpp ${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/async_alloc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/common.cpp ${CMAKE_CURRENT_SOURCE_DIR}/common.hpp diff --git a/unified-runtime/source/adapters/native_cpu/async_alloc.cpp b/unified-runtime/source/adapters/native_cpu/async_alloc.cpp new file mode 100644 index 0000000000000..9ae3ef88f0047 --- /dev/null +++ b/unified-runtime/source/adapters/native_cpu/async_alloc.cpp @@ -0,0 +1,40 @@ +//===--------- async_alloc.cpp - CUDA Adapter -----------------------------===// +// +// Copyright (C) 2025 Intel Corporation +// +// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM +// Exceptions. See LICENSE.TXT +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include + +UR_APIEXPORT ur_result_t urEnqueueUSMDeviceAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMSharedAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMHostAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMFreeExp(ur_queue_handle_t, + ur_usm_pool_handle_t, void *, + uint32_t, + const ur_event_handle_t *, + ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/unified-runtime/source/adapters/native_cpu/usm.cpp b/unified-runtime/source/adapters/native_cpu/usm.cpp index 2fe0d551a82c5..160e12e4c764a 100644 --- a/unified-runtime/source/adapters/native_cpu/usm.cpp +++ b/unified-runtime/source/adapters/native_cpu/usm.cpp @@ -155,3 +155,87 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMReleaseExp(ur_context_handle_t Context, std::ignore = HostPtr; DIE_NO_IMPLEMENTATION; } + +ur_result_t UR_APICALL urUSMPoolCreateExp( + ur_context_handle_t hContext, ///< [in] handle of the context object + ur_device_handle_t hDevice, ///< [in] handle of the device object + ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. + ///< Can be chained with + ///< ::ur_usm_pool_limits_desc_t + ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool +) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = PoolDesc; + std::ignore = pPool; + DIE_NO_IMPLEMENTATION; +} + +ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + DIE_NO_IMPLEMENTATION; +} + +ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t newThreshold) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = newThreshold; + DIE_NO_IMPLEMENTATION; +} + +ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + DIE_NO_IMPLEMENTATION; +} + +ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, + ur_usm_pool_info_t propName, + void *pPropValue, + size_t *pPropSizeRet) { + std::ignore = hPool; + std::ignore = propName; + std::ignore = pPropValue; + std::ignore = pPropSizeRet; + DIE_NO_IMPLEMENTATION; +} + +ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + DIE_NO_IMPLEMENTATION; +} + +ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + DIE_NO_IMPLEMENTATION; +} + +ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t minBytesToKeep) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = minBytesToKeep; + DIE_NO_IMPLEMENTATION; +} diff --git a/unified-runtime/source/adapters/opencl/CMakeLists.txt b/unified-runtime/source/adapters/opencl/CMakeLists.txt index a7e91f75e5346..80d7b7852eea5 100644 --- a/unified-runtime/source/adapters/opencl/CMakeLists.txt +++ b/unified-runtime/source/adapters/opencl/CMakeLists.txt @@ -16,6 +16,7 @@ add_ur_adapter(${TARGET_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/ur_interface_loader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/adapter.hpp ${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/async_alloc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.hpp ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/common.hpp diff --git a/unified-runtime/source/adapters/opencl/async_alloc.cpp b/unified-runtime/source/adapters/opencl/async_alloc.cpp new file mode 100644 index 0000000000000..9ae3ef88f0047 --- /dev/null +++ b/unified-runtime/source/adapters/opencl/async_alloc.cpp @@ -0,0 +1,40 @@ +//===--------- async_alloc.cpp - CUDA Adapter -----------------------------===// +// +// Copyright (C) 2025 Intel Corporation +// +// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM +// Exceptions. See LICENSE.TXT +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include + +UR_APIEXPORT ur_result_t urEnqueueUSMDeviceAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMSharedAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMHostAllocExp( + ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t urEnqueueUSMFreeExp(ur_queue_handle_t, + ur_usm_pool_handle_t, void *, + uint32_t, + const ur_event_handle_t *, + ur_event_handle_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/unified-runtime/source/adapters/opencl/usm.cpp b/unified-runtime/source/adapters/opencl/usm.cpp index 7961cb76ff7f0..3bc0fab534c68 100644 --- a/unified-runtime/source/adapters/opencl/usm.cpp +++ b/unified-runtime/source/adapters/opencl/usm.cpp @@ -728,3 +728,87 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfo( [[maybe_unused]] size_t *pPropSizeRet) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } + +ur_result_t UR_APICALL urUSMPoolCreateExp( + ur_context_handle_t hContext, ///< [in] handle of the context object + ur_device_handle_t hDevice, ///< [in] handle of the device object + ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. + ///< Can be chained with + ///< ::ur_usm_pool_limits_desc_t + ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool +) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = PoolDesc; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t newThreshold) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = newThreshold; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, + ur_usm_pool_info_t propName, + void *pPropValue, + size_t *pPropSizeRet) { + std::ignore = hPool; + std::ignore = propName; + std::ignore = pPropValue; + std::ignore = pPropSizeRet; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t minBytesToKeep) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hPool; + std::ignore = minBytesToKeep; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/unified-runtime/source/common/stype_map_helpers.def b/unified-runtime/source/common/stype_map_helpers.def index ec2856e60d513..28397713f1625 100644 --- a/unified-runtime/source/common/stype_map_helpers.def +++ b/unified-runtime/source/common/stype_map_helpers.def @@ -98,6 +98,8 @@ struct stype_map : stype_map_impl struct stype_map : stype_map_impl {}; template <> +struct stype_map : stype_map_impl {}; +template <> struct stype_map : stype_map_impl {}; template <> struct stype_map : stype_map_impl {}; diff --git a/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp b/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp index e716eaaa49372..653db12cf10d6 100644 --- a/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp +++ b/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp @@ -6008,6 +6008,552 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMDeviceAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + auto pfnUSMDeviceAllocExp = + getContext()->urDdiTable.EnqueueExp.pfnUSMDeviceAllocExp; + + if (nullptr == pfnUSMDeviceAllocExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_enqueue_usm_device_alloc_exp_params_t params = { + &hQueue, &pPool, &size, &pProperties, &numEventsInWaitList, + &phEventWaitList, &ppMem, &phEvent}; + uint64_t instance = + getContext()->notify_begin(UR_FUNCTION_ENQUEUE_USM_DEVICE_ALLOC_EXP, + "urEnqueueUSMDeviceAllocExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urEnqueueUSMDeviceAllocExp\n"); + + ur_result_t result = pfnUSMDeviceAllocExp(hQueue, pPool, size, pProperties, + numEventsInWaitList, + phEventWaitList, ppMem, phEvent); + + getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_DEVICE_ALLOC_EXP, + "urEnqueueUSMDeviceAllocExp", ¶ms, &result, + instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_USM_DEVICE_ALLOC_EXP, ¶ms); + logger.info(" <--- urEnqueueUSMDeviceAllocExp({}) -> {};\n", + args_str.str(), result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMSharedAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + auto pfnUSMSharedAllocExp = + getContext()->urDdiTable.EnqueueExp.pfnUSMSharedAllocExp; + + if (nullptr == pfnUSMSharedAllocExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_enqueue_usm_shared_alloc_exp_params_t params = { + &hQueue, &pPool, &size, &pProperties, &numEventsInWaitList, + &phEventWaitList, &ppMem, &phEvent}; + uint64_t instance = + getContext()->notify_begin(UR_FUNCTION_ENQUEUE_USM_SHARED_ALLOC_EXP, + "urEnqueueUSMSharedAllocExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urEnqueueUSMSharedAllocExp\n"); + + ur_result_t result = pfnUSMSharedAllocExp(hQueue, pPool, size, pProperties, + numEventsInWaitList, + phEventWaitList, ppMem, phEvent); + + getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_SHARED_ALLOC_EXP, + "urEnqueueUSMSharedAllocExp", ¶ms, &result, + instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_USM_SHARED_ALLOC_EXP, ¶ms); + logger.info(" <--- urEnqueueUSMSharedAllocExp({}) -> {};\n", + args_str.str(), result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMHostAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + auto pfnUSMHostAllocExp = + getContext()->urDdiTable.EnqueueExp.pfnUSMHostAllocExp; + + if (nullptr == pfnUSMHostAllocExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_enqueue_usm_host_alloc_exp_params_t params = { + &hQueue, &pPool, &size, &pProperties, &numEventsInWaitList, + &phEventWaitList, &ppMem, &phEvent}; + uint64_t instance = + getContext()->notify_begin(UR_FUNCTION_ENQUEUE_USM_HOST_ALLOC_EXP, + "urEnqueueUSMHostAllocExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urEnqueueUSMHostAllocExp\n"); + + ur_result_t result = + pfnUSMHostAllocExp(hQueue, pPool, size, pProperties, numEventsInWaitList, + phEventWaitList, ppMem, phEvent); + + getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_HOST_ALLOC_EXP, + "urEnqueueUSMHostAllocExp", ¶ms, &result, + instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_USM_HOST_ALLOC_EXP, ¶ms); + logger.info(" <--- urEnqueueUSMHostAllocExp({}) -> {};\n", args_str.str(), + result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMFreeExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMFreeExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] pointer to USM memory object + void *pMem, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + auto pfnUSMFreeExp = getContext()->urDdiTable.EnqueueExp.pfnUSMFreeExp; + + if (nullptr == pfnUSMFreeExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_enqueue_usm_free_exp_params_t params = { + &hQueue, &pPool, &pMem, &numEventsInWaitList, &phEventWaitList, &phEvent}; + uint64_t instance = getContext()->notify_begin( + UR_FUNCTION_ENQUEUE_USM_FREE_EXP, "urEnqueueUSMFreeExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urEnqueueUSMFreeExp\n"); + + ur_result_t result = pfnUSMFreeExp(hQueue, pPool, pMem, numEventsInWaitList, + phEventWaitList, phEvent); + + getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_FREE_EXP, + "urEnqueueUSMFreeExp", ¶ms, &result, instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_FREE_EXP, + ¶ms); + logger.info(" <--- urEnqueueUSMFreeExp({}) -> {};\n", args_str.str(), + result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolCreateExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolCreateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] pointer to USM pool descriptor. Can be chained with + /// ::ur_usm_pool_limits_desc_t + ur_usm_pool_desc_t *pPoolDesc, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + auto pfnPoolCreateExp = getContext()->urDdiTable.USMExp.pfnPoolCreateExp; + + if (nullptr == pfnPoolCreateExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_usm_pool_create_exp_params_t params = {&hContext, &hDevice, &pPoolDesc, + &pPool}; + uint64_t instance = getContext()->notify_begin( + UR_FUNCTION_USM_POOL_CREATE_EXP, "urUSMPoolCreateExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urUSMPoolCreateExp\n"); + + ur_result_t result = pfnPoolCreateExp(hContext, hDevice, pPoolDesc, pPool); + + getContext()->notify_end(UR_FUNCTION_USM_POOL_CREATE_EXP, + "urUSMPoolCreateExp", ¶ms, &result, instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_CREATE_EXP, + ¶ms); + logger.info(" <--- urUSMPoolCreateExp({}) -> {};\n", args_str.str(), + result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolDestroyExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolDestroyExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to be destroyed + ur_usm_pool_handle_t hPool) { + auto pfnPoolDestroyExp = getContext()->urDdiTable.USMExp.pfnPoolDestroyExp; + + if (nullptr == pfnPoolDestroyExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_usm_pool_destroy_exp_params_t params = {&hContext, &hDevice, &hPool}; + uint64_t instance = getContext()->notify_begin( + UR_FUNCTION_USM_POOL_DESTROY_EXP, "urUSMPoolDestroyExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urUSMPoolDestroyExp\n"); + + ur_result_t result = pfnPoolDestroyExp(hContext, hDevice, hPool); + + getContext()->notify_end(UR_FUNCTION_USM_POOL_DESTROY_EXP, + "urUSMPoolDestroyExp", ¶ms, &result, instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_DESTROY_EXP, + ¶ms); + logger.info(" <--- urUSMPoolDestroyExp({}) -> {};\n", args_str.str(), + result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolSetThresholdExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for the threshold to be set + ur_usm_pool_handle_t hPool, + /// [in] release threshold to be set + size_t newThreshold) { + auto pfnPoolSetThresholdExp = + getContext()->urDdiTable.USMExp.pfnPoolSetThresholdExp; + + if (nullptr == pfnPoolSetThresholdExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_usm_pool_set_threshold_exp_params_t params = {&hContext, &hDevice, &hPool, + &newThreshold}; + uint64_t instance = + getContext()->notify_begin(UR_FUNCTION_USM_POOL_SET_THRESHOLD_EXP, + "urUSMPoolSetThresholdExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urUSMPoolSetThresholdExp\n"); + + ur_result_t result = + pfnPoolSetThresholdExp(hContext, hDevice, hPool, newThreshold); + + getContext()->notify_end(UR_FUNCTION_USM_POOL_SET_THRESHOLD_EXP, + "urUSMPoolSetThresholdExp", ¶ms, &result, + instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_USM_POOL_SET_THRESHOLD_EXP, ¶ms); + logger.info(" <--- urUSMPoolSetThresholdExp({}) -> {};\n", args_str.str(), + result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetDefaultDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + auto pfnPoolGetDefaultDevicePoolExp = + getContext()->urDdiTable.USMExp.pfnPoolGetDefaultDevicePoolExp; + + if (nullptr == pfnPoolGetDefaultDevicePoolExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_usm_pool_get_default_device_pool_exp_params_t params = {&hContext, + &hDevice, &pPool}; + uint64_t instance = getContext()->notify_begin( + UR_FUNCTION_USM_POOL_GET_DEFAULT_DEVICE_POOL_EXP, + "urUSMPoolGetDefaultDevicePoolExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urUSMPoolGetDefaultDevicePoolExp\n"); + + ur_result_t result = pfnPoolGetDefaultDevicePoolExp(hContext, hDevice, pPool); + + getContext()->notify_end(UR_FUNCTION_USM_POOL_GET_DEFAULT_DEVICE_POOL_EXP, + "urUSMPoolGetDefaultDevicePoolExp", ¶ms, &result, + instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_USM_POOL_GET_DEFAULT_DEVICE_POOL_EXP, ¶ms); + logger.info(" <--- urUSMPoolGetDefaultDevicePoolExp({}) -> {};\n", + args_str.str(), result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetInfoExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfoExp( + /// [in] handle to USM memory pool for property retrieval + ur_usm_pool_handle_t hPool, + /// [in] queried property name + ur_usm_pool_info_t propName, + /// [out][optional] returned query value + void *pPropValue, + /// [out][optional] returned query value size + size_t *pPropSizeRet) { + auto pfnPoolGetInfoExp = getContext()->urDdiTable.USMExp.pfnPoolGetInfoExp; + + if (nullptr == pfnPoolGetInfoExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_usm_pool_get_info_exp_params_t params = {&hPool, &propName, &pPropValue, + &pPropSizeRet}; + uint64_t instance = getContext()->notify_begin( + UR_FUNCTION_USM_POOL_GET_INFO_EXP, "urUSMPoolGetInfoExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urUSMPoolGetInfoExp\n"); + + ur_result_t result = + pfnPoolGetInfoExp(hPool, propName, pPropValue, pPropSizeRet); + + getContext()->notify_end(UR_FUNCTION_USM_POOL_GET_INFO_EXP, + "urUSMPoolGetInfoExp", ¶ms, &result, instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_GET_INFO_EXP, + ¶ms); + logger.info(" <--- urUSMPoolGetInfoExp({}) -> {};\n", args_str.str(), + result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolSetDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to set for a device + ur_usm_pool_handle_t hPool) { + auto pfnPoolSetDevicePoolExp = + getContext()->urDdiTable.USMExp.pfnPoolSetDevicePoolExp; + + if (nullptr == pfnPoolSetDevicePoolExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_usm_pool_set_device_pool_exp_params_t params = {&hContext, &hDevice, + &hPool}; + uint64_t instance = + getContext()->notify_begin(UR_FUNCTION_USM_POOL_SET_DEVICE_POOL_EXP, + "urUSMPoolSetDevicePoolExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urUSMPoolSetDevicePoolExp\n"); + + ur_result_t result = pfnPoolSetDevicePoolExp(hContext, hDevice, hPool); + + getContext()->notify_end(UR_FUNCTION_USM_POOL_SET_DEVICE_POOL_EXP, + "urUSMPoolSetDevicePoolExp", ¶ms, &result, + instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_USM_POOL_SET_DEVICE_POOL_EXP, ¶ms); + logger.info(" <--- urUSMPoolSetDevicePoolExp({}) -> {};\n", + args_str.str(), result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + auto pfnPoolGetDevicePoolExp = + getContext()->urDdiTable.USMExp.pfnPoolGetDevicePoolExp; + + if (nullptr == pfnPoolGetDevicePoolExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_usm_pool_get_device_pool_exp_params_t params = {&hContext, &hDevice, + &pPool}; + uint64_t instance = + getContext()->notify_begin(UR_FUNCTION_USM_POOL_GET_DEVICE_POOL_EXP, + "urUSMPoolGetDevicePoolExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urUSMPoolGetDevicePoolExp\n"); + + ur_result_t result = pfnPoolGetDevicePoolExp(hContext, hDevice, pPool); + + getContext()->notify_end(UR_FUNCTION_USM_POOL_GET_DEVICE_POOL_EXP, + "urUSMPoolGetDevicePoolExp", ¶ms, &result, + instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_USM_POOL_GET_DEVICE_POOL_EXP, ¶ms); + logger.info(" <--- urUSMPoolGetDevicePoolExp({}) -> {};\n", + args_str.str(), result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolTrimToExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolTrimToExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for trimming + ur_usm_pool_handle_t hPool, + /// [in] minimum number of bytes to keep in the pool + size_t minBytesToKeep) { + auto pfnPoolTrimToExp = getContext()->urDdiTable.USMExp.pfnPoolTrimToExp; + + if (nullptr == pfnPoolTrimToExp) + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ur_usm_pool_trim_to_exp_params_t params = {&hContext, &hDevice, &hPool, + &minBytesToKeep}; + uint64_t instance = getContext()->notify_begin( + UR_FUNCTION_USM_POOL_TRIM_TO_EXP, "urUSMPoolTrimToExp", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urUSMPoolTrimToExp\n"); + + ur_result_t result = + pfnPoolTrimToExp(hContext, hDevice, hPool, minBytesToKeep); + + getContext()->notify_end(UR_FUNCTION_USM_POOL_TRIM_TO_EXP, + "urUSMPoolTrimToExp", ¶ms, &result, instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_TRIM_TO_EXP, + ¶ms); + logger.info(" <--- urUSMPoolTrimToExp({}) -> {};\n", args_str.str(), + result); + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMPitchedAllocExp __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( @@ -9543,6 +10089,20 @@ __urdlllocal ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnKernelLaunchCustomExp = ur_tracing_layer::urEnqueueKernelLaunchCustomExp; + dditable.pfnUSMDeviceAllocExp = pDdiTable->pfnUSMDeviceAllocExp; + pDdiTable->pfnUSMDeviceAllocExp = + ur_tracing_layer::urEnqueueUSMDeviceAllocExp; + + dditable.pfnUSMSharedAllocExp = pDdiTable->pfnUSMSharedAllocExp; + pDdiTable->pfnUSMSharedAllocExp = + ur_tracing_layer::urEnqueueUSMSharedAllocExp; + + dditable.pfnUSMHostAllocExp = pDdiTable->pfnUSMHostAllocExp; + pDdiTable->pfnUSMHostAllocExp = ur_tracing_layer::urEnqueueUSMHostAllocExp; + + dditable.pfnUSMFreeExp = pDdiTable->pfnUSMFreeExp; + pDdiTable->pfnUSMFreeExp = ur_tracing_layer::urEnqueueUSMFreeExp; + dditable.pfnCooperativeKernelLaunchExp = pDdiTable->pfnCooperativeKernelLaunchExp; pDdiTable->pfnCooperativeKernelLaunchExp = @@ -10166,6 +10726,35 @@ __urdlllocal ur_result_t UR_APICALL urGetUSMExpProcAddrTable( ur_result_t result = UR_RESULT_SUCCESS; + dditable.pfnPoolCreateExp = pDdiTable->pfnPoolCreateExp; + pDdiTable->pfnPoolCreateExp = ur_tracing_layer::urUSMPoolCreateExp; + + dditable.pfnPoolDestroyExp = pDdiTable->pfnPoolDestroyExp; + pDdiTable->pfnPoolDestroyExp = ur_tracing_layer::urUSMPoolDestroyExp; + + dditable.pfnPoolSetThresholdExp = pDdiTable->pfnPoolSetThresholdExp; + pDdiTable->pfnPoolSetThresholdExp = + ur_tracing_layer::urUSMPoolSetThresholdExp; + + dditable.pfnPoolGetDefaultDevicePoolExp = + pDdiTable->pfnPoolGetDefaultDevicePoolExp; + pDdiTable->pfnPoolGetDefaultDevicePoolExp = + ur_tracing_layer::urUSMPoolGetDefaultDevicePoolExp; + + dditable.pfnPoolGetInfoExp = pDdiTable->pfnPoolGetInfoExp; + pDdiTable->pfnPoolGetInfoExp = ur_tracing_layer::urUSMPoolGetInfoExp; + + dditable.pfnPoolSetDevicePoolExp = pDdiTable->pfnPoolSetDevicePoolExp; + pDdiTable->pfnPoolSetDevicePoolExp = + ur_tracing_layer::urUSMPoolSetDevicePoolExp; + + dditable.pfnPoolGetDevicePoolExp = pDdiTable->pfnPoolGetDevicePoolExp; + pDdiTable->pfnPoolGetDevicePoolExp = + ur_tracing_layer::urUSMPoolGetDevicePoolExp; + + dditable.pfnPoolTrimToExp = pDdiTable->pfnPoolTrimToExp; + pDdiTable->pfnPoolTrimToExp = ur_tracing_layer::urUSMPoolTrimToExp; + dditable.pfnPitchedAllocExp = pDdiTable->pfnPitchedAllocExp; pDdiTable->pfnPitchedAllocExp = ur_tracing_layer::urUSMPitchedAllocExp; diff --git a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp index acb1f65c94ce5..ffcd6e35e5359 100644 --- a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp +++ b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp @@ -496,7 +496,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( if (pPropValue == NULL && pPropSizeRet == NULL) return UR_RESULT_ERROR_INVALID_NULL_POINTER; - if (UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP < propName) + if (UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP < propName) return UR_RESULT_ERROR_INVALID_ENUMERATION; if (propSize == 0 && pPropValue != NULL) @@ -2082,7 +2082,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfo( if (pPropValue == NULL && pPropSizeRet == NULL) return UR_RESULT_ERROR_INVALID_NULL_POINTER; - if (UR_USM_POOL_INFO_CONTEXT < propName) + if (UR_USM_POOL_INFO_USED_HIGH_EXP < propName) return UR_RESULT_ERROR_INVALID_ENUMERATION; if (propSize == 0 && pPropValue != NULL) @@ -6574,6 +6574,629 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMDeviceAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + auto pfnUSMDeviceAllocExp = + getContext()->urDdiTable.EnqueueExp.pfnUSMDeviceAllocExp; + + if (nullptr == pfnUSMDeviceAllocExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hQueue) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == ppMem) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + + if (NULL != pProperties && + UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & pProperties->flags) + return UR_RESULT_ERROR_INVALID_ENUMERATION; + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hQueue)) { + getContext()->refCountContext->logInvalidReference(hQueue); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(pPool)) { + getContext()->refCountContext->logInvalidReference(pPool); + } + + ur_result_t result = pfnUSMDeviceAllocExp(hQueue, pPool, size, pProperties, + numEventsInWaitList, + phEventWaitList, ppMem, phEvent); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMSharedAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + auto pfnUSMSharedAllocExp = + getContext()->urDdiTable.EnqueueExp.pfnUSMSharedAllocExp; + + if (nullptr == pfnUSMSharedAllocExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hQueue) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == ppMem) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + + if (NULL != pProperties && + UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & pProperties->flags) + return UR_RESULT_ERROR_INVALID_ENUMERATION; + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hQueue)) { + getContext()->refCountContext->logInvalidReference(hQueue); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(pPool)) { + getContext()->refCountContext->logInvalidReference(pPool); + } + + ur_result_t result = pfnUSMSharedAllocExp(hQueue, pPool, size, pProperties, + numEventsInWaitList, + phEventWaitList, ppMem, phEvent); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMHostAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + auto pfnUSMHostAllocExp = + getContext()->urDdiTable.EnqueueExp.pfnUSMHostAllocExp; + + if (nullptr == pfnUSMHostAllocExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hQueue) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == ppMem) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + + if (NULL != pProperties && + UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & pProperties->flags) + return UR_RESULT_ERROR_INVALID_ENUMERATION; + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hQueue)) { + getContext()->refCountContext->logInvalidReference(hQueue); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(pPool)) { + getContext()->refCountContext->logInvalidReference(pPool); + } + + ur_result_t result = + pfnUSMHostAllocExp(hQueue, pPool, size, pProperties, numEventsInWaitList, + phEventWaitList, ppMem, phEvent); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMFreeExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMFreeExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] pointer to USM memory object + void *pMem, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + auto pfnUSMFreeExp = getContext()->urDdiTable.EnqueueExp.pfnUSMFreeExp; + + if (nullptr == pfnUSMFreeExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hQueue) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == pMem) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hQueue)) { + getContext()->refCountContext->logInvalidReference(hQueue); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(pPool)) { + getContext()->refCountContext->logInvalidReference(pPool); + } + + ur_result_t result = pfnUSMFreeExp(hQueue, pPool, pMem, numEventsInWaitList, + phEventWaitList, phEvent); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolCreateExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolCreateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] pointer to USM pool descriptor. Can be chained with + /// ::ur_usm_pool_limits_desc_t + ur_usm_pool_desc_t *pPoolDesc, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + auto pfnPoolCreateExp = getContext()->urDdiTable.USMExp.pfnPoolCreateExp; + + if (nullptr == pfnPoolCreateExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hContext) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hDevice) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == pPoolDesc) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + + if (NULL == pPool) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + + if (UR_USM_POOL_FLAGS_MASK & pPoolDesc->flags) + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hContext)) { + getContext()->refCountContext->logInvalidReference(hContext); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hDevice)) { + getContext()->refCountContext->logInvalidReference(hDevice); + } + + ur_result_t result = pfnPoolCreateExp(hContext, hDevice, pPoolDesc, pPool); + + if (getContext()->enableLeakChecking && result == UR_RESULT_SUCCESS) { + getContext()->refCountContext->createRefCount(*pPool); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolDestroyExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolDestroyExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to be destroyed + ur_usm_pool_handle_t hPool) { + auto pfnPoolDestroyExp = getContext()->urDdiTable.USMExp.pfnPoolDestroyExp; + + if (nullptr == pfnPoolDestroyExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hContext) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hDevice) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hPool) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hContext)) { + getContext()->refCountContext->logInvalidReference(hContext); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hDevice)) { + getContext()->refCountContext->logInvalidReference(hDevice); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hPool)) { + getContext()->refCountContext->logInvalidReference(hPool); + } + + ur_result_t result = pfnPoolDestroyExp(hContext, hDevice, hPool); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolSetThresholdExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for the threshold to be set + ur_usm_pool_handle_t hPool, + /// [in] release threshold to be set + size_t newThreshold) { + auto pfnPoolSetThresholdExp = + getContext()->urDdiTable.USMExp.pfnPoolSetThresholdExp; + + if (nullptr == pfnPoolSetThresholdExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hContext) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hDevice) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hPool) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hContext)) { + getContext()->refCountContext->logInvalidReference(hContext); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hDevice)) { + getContext()->refCountContext->logInvalidReference(hDevice); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hPool)) { + getContext()->refCountContext->logInvalidReference(hPool); + } + + ur_result_t result = + pfnPoolSetThresholdExp(hContext, hDevice, hPool, newThreshold); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetDefaultDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + auto pfnPoolGetDefaultDevicePoolExp = + getContext()->urDdiTable.USMExp.pfnPoolGetDefaultDevicePoolExp; + + if (nullptr == pfnPoolGetDefaultDevicePoolExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hContext) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hDevice) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == pPool) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hContext)) { + getContext()->refCountContext->logInvalidReference(hContext); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hDevice)) { + getContext()->refCountContext->logInvalidReference(hDevice); + } + + ur_result_t result = pfnPoolGetDefaultDevicePoolExp(hContext, hDevice, pPool); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetInfoExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfoExp( + /// [in] handle to USM memory pool for property retrieval + ur_usm_pool_handle_t hPool, + /// [in] queried property name + ur_usm_pool_info_t propName, + /// [out][optional] returned query value + void *pPropValue, + /// [out][optional] returned query value size + size_t *pPropSizeRet) { + auto pfnPoolGetInfoExp = getContext()->urDdiTable.USMExp.pfnPoolGetInfoExp; + + if (nullptr == pfnPoolGetInfoExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hPool) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (pPropValue == NULL && pPropSizeRet == NULL) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + + if (UR_USM_POOL_INFO_USED_HIGH_EXP < propName) + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hPool)) { + getContext()->refCountContext->logInvalidReference(hPool); + } + + ur_result_t result = + pfnPoolGetInfoExp(hPool, propName, pPropValue, pPropSizeRet); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolSetDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to set for a device + ur_usm_pool_handle_t hPool) { + auto pfnPoolSetDevicePoolExp = + getContext()->urDdiTable.USMExp.pfnPoolSetDevicePoolExp; + + if (nullptr == pfnPoolSetDevicePoolExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hContext) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hDevice) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hPool) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hContext)) { + getContext()->refCountContext->logInvalidReference(hContext); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hDevice)) { + getContext()->refCountContext->logInvalidReference(hDevice); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hPool)) { + getContext()->refCountContext->logInvalidReference(hPool); + } + + ur_result_t result = pfnPoolSetDevicePoolExp(hContext, hDevice, hPool); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + auto pfnPoolGetDevicePoolExp = + getContext()->urDdiTable.USMExp.pfnPoolGetDevicePoolExp; + + if (nullptr == pfnPoolGetDevicePoolExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hContext) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hDevice) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == pPool) + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hContext)) { + getContext()->refCountContext->logInvalidReference(hContext); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hDevice)) { + getContext()->refCountContext->logInvalidReference(hDevice); + } + + ur_result_t result = pfnPoolGetDevicePoolExp(hContext, hDevice, pPool); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolTrimToExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolTrimToExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for trimming + ur_usm_pool_handle_t hPool, + /// [in] minimum number of bytes to keep in the pool + size_t minBytesToKeep) { + auto pfnPoolTrimToExp = getContext()->urDdiTable.USMExp.pfnPoolTrimToExp; + + if (nullptr == pfnPoolTrimToExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hContext) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hDevice) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + + if (NULL == hPool) + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hContext)) { + getContext()->refCountContext->logInvalidReference(hContext); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hDevice)) { + getContext()->refCountContext->logInvalidReference(hDevice); + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hPool)) { + getContext()->refCountContext->logInvalidReference(hPool); + } + + ur_result_t result = + pfnPoolTrimToExp(hContext, hDevice, hPool, minBytesToKeep); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMPitchedAllocExp __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( @@ -10202,6 +10825,20 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( pDdiTable->pfnKernelLaunchCustomExp = ur_validation_layer::urEnqueueKernelLaunchCustomExp; + dditable.pfnUSMDeviceAllocExp = pDdiTable->pfnUSMDeviceAllocExp; + pDdiTable->pfnUSMDeviceAllocExp = + ur_validation_layer::urEnqueueUSMDeviceAllocExp; + + dditable.pfnUSMSharedAllocExp = pDdiTable->pfnUSMSharedAllocExp; + pDdiTable->pfnUSMSharedAllocExp = + ur_validation_layer::urEnqueueUSMSharedAllocExp; + + dditable.pfnUSMHostAllocExp = pDdiTable->pfnUSMHostAllocExp; + pDdiTable->pfnUSMHostAllocExp = ur_validation_layer::urEnqueueUSMHostAllocExp; + + dditable.pfnUSMFreeExp = pDdiTable->pfnUSMFreeExp; + pDdiTable->pfnUSMFreeExp = ur_validation_layer::urEnqueueUSMFreeExp; + dditable.pfnCooperativeKernelLaunchExp = pDdiTable->pfnCooperativeKernelLaunchExp; pDdiTable->pfnCooperativeKernelLaunchExp = @@ -10841,6 +11478,35 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( ur_result_t result = UR_RESULT_SUCCESS; + dditable.pfnPoolCreateExp = pDdiTable->pfnPoolCreateExp; + pDdiTable->pfnPoolCreateExp = ur_validation_layer::urUSMPoolCreateExp; + + dditable.pfnPoolDestroyExp = pDdiTable->pfnPoolDestroyExp; + pDdiTable->pfnPoolDestroyExp = ur_validation_layer::urUSMPoolDestroyExp; + + dditable.pfnPoolSetThresholdExp = pDdiTable->pfnPoolSetThresholdExp; + pDdiTable->pfnPoolSetThresholdExp = + ur_validation_layer::urUSMPoolSetThresholdExp; + + dditable.pfnPoolGetDefaultDevicePoolExp = + pDdiTable->pfnPoolGetDefaultDevicePoolExp; + pDdiTable->pfnPoolGetDefaultDevicePoolExp = + ur_validation_layer::urUSMPoolGetDefaultDevicePoolExp; + + dditable.pfnPoolGetInfoExp = pDdiTable->pfnPoolGetInfoExp; + pDdiTable->pfnPoolGetInfoExp = ur_validation_layer::urUSMPoolGetInfoExp; + + dditable.pfnPoolSetDevicePoolExp = pDdiTable->pfnPoolSetDevicePoolExp; + pDdiTable->pfnPoolSetDevicePoolExp = + ur_validation_layer::urUSMPoolSetDevicePoolExp; + + dditable.pfnPoolGetDevicePoolExp = pDdiTable->pfnPoolGetDevicePoolExp; + pDdiTable->pfnPoolGetDevicePoolExp = + ur_validation_layer::urUSMPoolGetDevicePoolExp; + + dditable.pfnPoolTrimToExp = pDdiTable->pfnPoolTrimToExp; + pDdiTable->pfnPoolTrimToExp = ur_validation_layer::urUSMPoolTrimToExp; + dditable.pfnPitchedAllocExp = pDdiTable->pfnPitchedAllocExp; pDdiTable->pfnPitchedAllocExp = ur_validation_layer::urUSMPitchedAllocExp; diff --git a/unified-runtime/source/loader/loader.def.in b/unified-runtime/source/loader/loader.def.in index 1425c602d6718..6f1d487a17f1f 100644 --- a/unified-runtime/source/loader/loader.def.in +++ b/unified-runtime/source/loader/loader.def.in @@ -85,11 +85,15 @@ EXPORTS urEnqueueReadHostPipe urEnqueueTimestampRecordingExp urEnqueueUSMAdvise + urEnqueueUSMDeviceAllocExp urEnqueueUSMFill urEnqueueUSMFill2D + urEnqueueUSMFreeExp + urEnqueueUSMHostAllocExp urEnqueueUSMMemcpy urEnqueueUSMMemcpy2D urEnqueueUSMPrefetch + urEnqueueUSMSharedAllocExp urEnqueueWriteHostPipe urEventCreateWithNativeHandle urEventGetInfo @@ -282,11 +286,15 @@ EXPORTS urPrintEnqueueReadHostPipeParams urPrintEnqueueTimestampRecordingExpParams urPrintEnqueueUsmAdviseParams + urPrintEnqueueUsmDeviceAllocExpParams urPrintEnqueueUsmFillParams urPrintEnqueueUsmFill_2dParams + urPrintEnqueueUsmFreeExpParams + urPrintEnqueueUsmHostAllocExpParams urPrintEnqueueUsmMemcpyParams urPrintEnqueueUsmMemcpy_2dParams urPrintEnqueueUsmPrefetchParams + urPrintEnqueueUsmSharedAllocExpParams urPrintEnqueueWriteHostPipeParams urPrintEventCreateWithNativeHandleParams urPrintEventGetInfoParams @@ -300,6 +308,8 @@ EXPORTS urPrintEventStatus urPrintEventWaitParams urPrintExecutionInfo + urPrintExpAsyncUsmAllocFlags + urPrintExpAsyncUsmAllocProperties urPrintExpCommandBufferCommandInfo urPrintExpCommandBufferDesc urPrintExpCommandBufferInfo @@ -480,14 +490,22 @@ EXPORTS urPrintUsmP2pEnablePeerAccessExpParams urPrintUsmP2pPeerAccessGetInfoExpParams urPrintUsmPitchedAllocExpParams + urPrintUsmPoolCreateExpParams urPrintUsmPoolCreateParams urPrintUsmPoolDesc + urPrintUsmPoolDestroyExpParams urPrintUsmPoolFlags + urPrintUsmPoolGetDefaultDevicePoolExpParams + urPrintUsmPoolGetDevicePoolExpParams + urPrintUsmPoolGetInfoExpParams urPrintUsmPoolGetInfoParams urPrintUsmPoolInfo urPrintUsmPoolLimitsDesc urPrintUsmPoolReleaseParams urPrintUsmPoolRetainParams + urPrintUsmPoolSetDevicePoolExpParams + urPrintUsmPoolSetThresholdExpParams + urPrintUsmPoolTrimToExpParams urPrintUsmReleaseExpParams urPrintUsmSharedAllocParams urPrintUsmType @@ -539,9 +557,17 @@ EXPORTS urUSMImportExp urUSMPitchedAllocExp urUSMPoolCreate + urUSMPoolCreateExp + urUSMPoolDestroyExp + urUSMPoolGetDefaultDevicePoolExp + urUSMPoolGetDevicePoolExp urUSMPoolGetInfo + urUSMPoolGetInfoExp urUSMPoolRelease urUSMPoolRetain + urUSMPoolSetDevicePoolExp + urUSMPoolSetThresholdExp + urUSMPoolTrimToExp urUSMReleaseExp urUSMSharedAlloc urUsmP2PDisablePeerAccessExp diff --git a/unified-runtime/source/loader/loader.map.in b/unified-runtime/source/loader/loader.map.in index ebb413c98543b..5ba9b9123d50b 100644 --- a/unified-runtime/source/loader/loader.map.in +++ b/unified-runtime/source/loader/loader.map.in @@ -85,11 +85,15 @@ urEnqueueReadHostPipe; urEnqueueTimestampRecordingExp; urEnqueueUSMAdvise; + urEnqueueUSMDeviceAllocExp; urEnqueueUSMFill; urEnqueueUSMFill2D; + urEnqueueUSMFreeExp; + urEnqueueUSMHostAllocExp; urEnqueueUSMMemcpy; urEnqueueUSMMemcpy2D; urEnqueueUSMPrefetch; + urEnqueueUSMSharedAllocExp; urEnqueueWriteHostPipe; urEventCreateWithNativeHandle; urEventGetInfo; @@ -282,11 +286,15 @@ urPrintEnqueueReadHostPipeParams; urPrintEnqueueTimestampRecordingExpParams; urPrintEnqueueUsmAdviseParams; + urPrintEnqueueUsmDeviceAllocExpParams; urPrintEnqueueUsmFillParams; urPrintEnqueueUsmFill_2dParams; + urPrintEnqueueUsmFreeExpParams; + urPrintEnqueueUsmHostAllocExpParams; urPrintEnqueueUsmMemcpyParams; urPrintEnqueueUsmMemcpy_2dParams; urPrintEnqueueUsmPrefetchParams; + urPrintEnqueueUsmSharedAllocExpParams; urPrintEnqueueWriteHostPipeParams; urPrintEventCreateWithNativeHandleParams; urPrintEventGetInfoParams; @@ -300,6 +308,8 @@ urPrintEventStatus; urPrintEventWaitParams; urPrintExecutionInfo; + urPrintExpAsyncUsmAllocFlags; + urPrintExpAsyncUsmAllocProperties; urPrintExpCommandBufferCommandInfo; urPrintExpCommandBufferDesc; urPrintExpCommandBufferInfo; @@ -480,14 +490,22 @@ urPrintUsmP2pEnablePeerAccessExpParams; urPrintUsmP2pPeerAccessGetInfoExpParams; urPrintUsmPitchedAllocExpParams; + urPrintUsmPoolCreateExpParams; urPrintUsmPoolCreateParams; urPrintUsmPoolDesc; + urPrintUsmPoolDestroyExpParams; urPrintUsmPoolFlags; + urPrintUsmPoolGetDefaultDevicePoolExpParams; + urPrintUsmPoolGetDevicePoolExpParams; + urPrintUsmPoolGetInfoExpParams; urPrintUsmPoolGetInfoParams; urPrintUsmPoolInfo; urPrintUsmPoolLimitsDesc; urPrintUsmPoolReleaseParams; urPrintUsmPoolRetainParams; + urPrintUsmPoolSetDevicePoolExpParams; + urPrintUsmPoolSetThresholdExpParams; + urPrintUsmPoolTrimToExpParams; urPrintUsmReleaseExpParams; urPrintUsmSharedAllocParams; urPrintUsmType; @@ -539,9 +557,17 @@ urUSMImportExp; urUSMPitchedAllocExp; urUSMPoolCreate; + urUSMPoolCreateExp; + urUSMPoolDestroyExp; + urUSMPoolGetDefaultDevicePoolExp; + urUSMPoolGetDevicePoolExp; urUSMPoolGetInfo; + urUSMPoolGetInfoExp; urUSMPoolRelease; urUSMPoolRetain; + urUSMPoolSetDevicePoolExp; + urUSMPoolSetThresholdExp; + urUSMPoolTrimToExp; urUSMReleaseExp; urUSMSharedAlloc; urUsmP2PDisablePeerAccessExp; diff --git a/unified-runtime/source/loader/ur_ldrddi.cpp b/unified-runtime/source/loader/ur_ldrddi.cpp index c1e21fd58b7bc..07d9dcc25c586 100644 --- a/unified-runtime/source/loader/ur_ldrddi.cpp +++ b/unified-runtime/source/loader/ur_ldrddi.cpp @@ -6170,6 +6170,569 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMDeviceAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hQueue)->dditable; + auto pfnUSMDeviceAllocExp = dditable->ur.EnqueueExp.pfnUSMDeviceAllocExp; + if (nullptr == pfnUSMDeviceAllocExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hQueue = reinterpret_cast(hQueue)->handle; + + // convert loader handle to platform handle + pPool = (pPool) ? reinterpret_cast(pPool)->handle + : nullptr; + + // convert loader handles to platform handles + auto phEventWaitListLocal = + std::vector(numEventsInWaitList); + for (size_t i = 0; i < numEventsInWaitList; ++i) + phEventWaitListLocal[i] = + reinterpret_cast(phEventWaitList[i])->handle; + + // forward to device-platform + result = pfnUSMDeviceAllocExp(hQueue, pPool, size, pProperties, + numEventsInWaitList, + phEventWaitListLocal.data(), ppMem, phEvent); + + // In the event of ERROR_ADAPTER_SPECIFIC we should still attempt to wrap any + // output handles below. + if (UR_RESULT_SUCCESS != result && UR_RESULT_ERROR_ADAPTER_SPECIFIC != result) + return result; + try { + // convert platform handle to loader handle + if (nullptr != phEvent) + *phEvent = reinterpret_cast( + context->factories.ur_event_factory.getInstance(*phEvent, dditable)); + } catch (std::bad_alloc &) { + result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMSharedAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hQueue)->dditable; + auto pfnUSMSharedAllocExp = dditable->ur.EnqueueExp.pfnUSMSharedAllocExp; + if (nullptr == pfnUSMSharedAllocExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hQueue = reinterpret_cast(hQueue)->handle; + + // convert loader handle to platform handle + pPool = (pPool) ? reinterpret_cast(pPool)->handle + : nullptr; + + // convert loader handles to platform handles + auto phEventWaitListLocal = + std::vector(numEventsInWaitList); + for (size_t i = 0; i < numEventsInWaitList; ++i) + phEventWaitListLocal[i] = + reinterpret_cast(phEventWaitList[i])->handle; + + // forward to device-platform + result = pfnUSMSharedAllocExp(hQueue, pPool, size, pProperties, + numEventsInWaitList, + phEventWaitListLocal.data(), ppMem, phEvent); + + // In the event of ERROR_ADAPTER_SPECIFIC we should still attempt to wrap any + // output handles below. + if (UR_RESULT_SUCCESS != result && UR_RESULT_ERROR_ADAPTER_SPECIFIC != result) + return result; + try { + // convert platform handle to loader handle + if (nullptr != phEvent) + *phEvent = reinterpret_cast( + context->factories.ur_event_factory.getInstance(*phEvent, dditable)); + } catch (std::bad_alloc &) { + result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMHostAllocExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hQueue)->dditable; + auto pfnUSMHostAllocExp = dditable->ur.EnqueueExp.pfnUSMHostAllocExp; + if (nullptr == pfnUSMHostAllocExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hQueue = reinterpret_cast(hQueue)->handle; + + // convert loader handle to platform handle + pPool = (pPool) ? reinterpret_cast(pPool)->handle + : nullptr; + + // convert loader handles to platform handles + auto phEventWaitListLocal = + std::vector(numEventsInWaitList); + for (size_t i = 0; i < numEventsInWaitList; ++i) + phEventWaitListLocal[i] = + reinterpret_cast(phEventWaitList[i])->handle; + + // forward to device-platform + result = + pfnUSMHostAllocExp(hQueue, pPool, size, pProperties, numEventsInWaitList, + phEventWaitListLocal.data(), ppMem, phEvent); + + // In the event of ERROR_ADAPTER_SPECIFIC we should still attempt to wrap any + // output handles below. + if (UR_RESULT_SUCCESS != result && UR_RESULT_ERROR_ADAPTER_SPECIFIC != result) + return result; + try { + // convert platform handle to loader handle + if (nullptr != phEvent) + *phEvent = reinterpret_cast( + context->factories.ur_event_factory.getInstance(*phEvent, dditable)); + } catch (std::bad_alloc &) { + result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueUSMFreeExp +__urdlllocal ur_result_t UR_APICALL urEnqueueUSMFreeExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] pointer to USM memory object + void *pMem, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hQueue)->dditable; + auto pfnUSMFreeExp = dditable->ur.EnqueueExp.pfnUSMFreeExp; + if (nullptr == pfnUSMFreeExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hQueue = reinterpret_cast(hQueue)->handle; + + // convert loader handle to platform handle + pPool = (pPool) ? reinterpret_cast(pPool)->handle + : nullptr; + + // convert loader handles to platform handles + auto phEventWaitListLocal = + std::vector(numEventsInWaitList); + for (size_t i = 0; i < numEventsInWaitList; ++i) + phEventWaitListLocal[i] = + reinterpret_cast(phEventWaitList[i])->handle; + + // forward to device-platform + result = pfnUSMFreeExp(hQueue, pPool, pMem, numEventsInWaitList, + phEventWaitListLocal.data(), phEvent); + + // In the event of ERROR_ADAPTER_SPECIFIC we should still attempt to wrap any + // output handles below. + if (UR_RESULT_SUCCESS != result && UR_RESULT_ERROR_ADAPTER_SPECIFIC != result) + return result; + try { + // convert platform handle to loader handle + if (nullptr != phEvent) + *phEvent = reinterpret_cast( + context->factories.ur_event_factory.getInstance(*phEvent, dditable)); + } catch (std::bad_alloc &) { + result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolCreateExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolCreateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] pointer to USM pool descriptor. Can be chained with + /// ::ur_usm_pool_limits_desc_t + ur_usm_pool_desc_t *pPoolDesc, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hContext)->dditable; + auto pfnPoolCreateExp = dditable->ur.USMExp.pfnPoolCreateExp; + if (nullptr == pfnPoolCreateExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hContext = reinterpret_cast(hContext)->handle; + + // convert loader handle to platform handle + hDevice = reinterpret_cast(hDevice)->handle; + + // forward to device-platform + result = pfnPoolCreateExp(hContext, hDevice, pPoolDesc, pPool); + + if (UR_RESULT_SUCCESS != result) + return result; + + try { + // convert platform handle to loader handle + *pPool = reinterpret_cast( + context->factories.ur_usm_pool_factory.getInstance(*pPool, dditable)); + } catch (std::bad_alloc &) { + result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolDestroyExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolDestroyExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to be destroyed + ur_usm_pool_handle_t hPool) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hContext)->dditable; + auto pfnPoolDestroyExp = dditable->ur.USMExp.pfnPoolDestroyExp; + if (nullptr == pfnPoolDestroyExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hContext = reinterpret_cast(hContext)->handle; + + // convert loader handle to platform handle + hDevice = reinterpret_cast(hDevice)->handle; + + // convert loader handle to platform handle + hPool = reinterpret_cast(hPool)->handle; + + // forward to device-platform + result = pfnPoolDestroyExp(hContext, hDevice, hPool); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolSetThresholdExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for the threshold to be set + ur_usm_pool_handle_t hPool, + /// [in] release threshold to be set + size_t newThreshold) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hContext)->dditable; + auto pfnPoolSetThresholdExp = dditable->ur.USMExp.pfnPoolSetThresholdExp; + if (nullptr == pfnPoolSetThresholdExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hContext = reinterpret_cast(hContext)->handle; + + // convert loader handle to platform handle + hDevice = reinterpret_cast(hDevice)->handle; + + // convert loader handle to platform handle + hPool = reinterpret_cast(hPool)->handle; + + // forward to device-platform + result = pfnPoolSetThresholdExp(hContext, hDevice, hPool, newThreshold); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetDefaultDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hContext)->dditable; + auto pfnPoolGetDefaultDevicePoolExp = + dditable->ur.USMExp.pfnPoolGetDefaultDevicePoolExp; + if (nullptr == pfnPoolGetDefaultDevicePoolExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hContext = reinterpret_cast(hContext)->handle; + + // convert loader handle to platform handle + hDevice = reinterpret_cast(hDevice)->handle; + + // forward to device-platform + result = pfnPoolGetDefaultDevicePoolExp(hContext, hDevice, pPool); + + if (UR_RESULT_SUCCESS != result) + return result; + + try { + // convert platform handle to loader handle + *pPool = reinterpret_cast( + context->factories.ur_usm_pool_factory.getInstance(*pPool, dditable)); + } catch (std::bad_alloc &) { + result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetInfoExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfoExp( + /// [in] handle to USM memory pool for property retrieval + ur_usm_pool_handle_t hPool, + /// [in] queried property name + ur_usm_pool_info_t propName, + /// [out][optional] returned query value + void *pPropValue, + /// [out][optional] returned query value size + size_t *pPropSizeRet) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hPool)->dditable; + auto pfnPoolGetInfoExp = dditable->ur.USMExp.pfnPoolGetInfoExp; + if (nullptr == pfnPoolGetInfoExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hPool = reinterpret_cast(hPool)->handle; + + // forward to device-platform + result = pfnPoolGetInfoExp(hPool, propName, pPropValue, pPropSizeRet); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolSetDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to set for a device + ur_usm_pool_handle_t hPool) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hContext)->dditable; + auto pfnPoolSetDevicePoolExp = dditable->ur.USMExp.pfnPoolSetDevicePoolExp; + if (nullptr == pfnPoolSetDevicePoolExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hContext = reinterpret_cast(hContext)->handle; + + // convert loader handle to platform handle + hDevice = reinterpret_cast(hDevice)->handle; + + // convert loader handle to platform handle + hPool = reinterpret_cast(hPool)->handle; + + // forward to device-platform + result = pfnPoolSetDevicePoolExp(hContext, hDevice, hPool); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolGetDevicePoolExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hContext)->dditable; + auto pfnPoolGetDevicePoolExp = dditable->ur.USMExp.pfnPoolGetDevicePoolExp; + if (nullptr == pfnPoolGetDevicePoolExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hContext = reinterpret_cast(hContext)->handle; + + // convert loader handle to platform handle + hDevice = reinterpret_cast(hDevice)->handle; + + // forward to device-platform + result = pfnPoolGetDevicePoolExp(hContext, hDevice, pPool); + + if (UR_RESULT_SUCCESS != result) + return result; + + try { + // convert platform handle to loader handle + *pPool = reinterpret_cast( + context->factories.ur_usm_pool_factory.getInstance(*pPool, dditable)); + } catch (std::bad_alloc &) { + result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urUSMPoolTrimToExp +__urdlllocal ur_result_t UR_APICALL urUSMPoolTrimToExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for trimming + ur_usm_pool_handle_t hPool, + /// [in] minimum number of bytes to keep in the pool + size_t minBytesToKeep) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hContext)->dditable; + auto pfnPoolTrimToExp = dditable->ur.USMExp.pfnPoolTrimToExp; + if (nullptr == pfnPoolTrimToExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to platform handle + hContext = reinterpret_cast(hContext)->handle; + + // convert loader handle to platform handle + hDevice = reinterpret_cast(hDevice)->handle; + + // convert loader handle to platform handle + hPool = reinterpret_cast(hPool)->handle; + + // forward to device-platform + result = pfnPoolTrimToExp(hContext, hDevice, hPool, minBytesToKeep); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMPitchedAllocExp __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( @@ -9697,6 +10260,10 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( // return pointers to loader's DDIs pDdiTable->pfnKernelLaunchCustomExp = ur_loader::urEnqueueKernelLaunchCustomExp; + pDdiTable->pfnUSMDeviceAllocExp = ur_loader::urEnqueueUSMDeviceAllocExp; + pDdiTable->pfnUSMSharedAllocExp = ur_loader::urEnqueueUSMSharedAllocExp; + pDdiTable->pfnUSMHostAllocExp = ur_loader::urEnqueueUSMHostAllocExp; + pDdiTable->pfnUSMFreeExp = ur_loader::urEnqueueUSMFreeExp; pDdiTable->pfnCooperativeKernelLaunchExp = ur_loader::urEnqueueCooperativeKernelLaunchExp; pDdiTable->pfnTimestampRecordingExp = @@ -10420,6 +10987,15 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( if (ur_loader::getContext()->platforms.size() != 1 || ur_loader::getContext()->forceIntercept) { // return pointers to loader's DDIs + pDdiTable->pfnPoolCreateExp = ur_loader::urUSMPoolCreateExp; + pDdiTable->pfnPoolDestroyExp = ur_loader::urUSMPoolDestroyExp; + pDdiTable->pfnPoolSetThresholdExp = ur_loader::urUSMPoolSetThresholdExp; + pDdiTable->pfnPoolGetDefaultDevicePoolExp = + ur_loader::urUSMPoolGetDefaultDevicePoolExp; + pDdiTable->pfnPoolGetInfoExp = ur_loader::urUSMPoolGetInfoExp; + pDdiTable->pfnPoolSetDevicePoolExp = ur_loader::urUSMPoolSetDevicePoolExp; + pDdiTable->pfnPoolGetDevicePoolExp = ur_loader::urUSMPoolGetDevicePoolExp; + pDdiTable->pfnPoolTrimToExp = ur_loader::urUSMPoolTrimToExp; pDdiTable->pfnPitchedAllocExp = ur_loader::urUSMPitchedAllocExp; pDdiTable->pfnImportExp = ur_loader::urUSMImportExp; pDdiTable->pfnReleaseExp = ur_loader::urUSMReleaseExp; diff --git a/unified-runtime/source/loader/ur_libapi.cpp b/unified-runtime/source/loader/ur_libapi.cpp index e5797537632bf..bca1a7abb01f8 100644 --- a/unified-runtime/source/loader/ur_libapi.cpp +++ b/unified-runtime/source/loader/ur_libapi.cpp @@ -869,7 +869,7 @@ ur_result_t UR_APICALL urDeviceGetSelected( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP < propName` +/// + `::UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -2591,7 +2591,7 @@ ur_result_t UR_APICALL urUSMPoolRelease( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPool` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_USM_POOL_INFO_CONTEXT < propName` +/// + `::UR_USM_POOL_INFO_USED_HIGH_EXP < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -6703,6 +6703,504 @@ ur_result_t UR_APICALL urEnqueueWriteHostPipe( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async device allocation +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) try { + auto pfnUSMDeviceAllocExp = + ur_lib::getContext()->urDdiTable.EnqueueExp.pfnUSMDeviceAllocExp; + if (nullptr == pfnUSMDeviceAllocExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnUSMDeviceAllocExp(hQueue, pPool, size, pProperties, + numEventsInWaitList, phEventWaitList, ppMem, + phEvent); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async shared allocation +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) try { + auto pfnUSMSharedAllocExp = + ur_lib::getContext()->urDdiTable.EnqueueExp.pfnUSMSharedAllocExp; + if (nullptr == pfnUSMSharedAllocExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnUSMSharedAllocExp(hQueue, pPool, size, pProperties, + numEventsInWaitList, phEventWaitList, ppMem, + phEvent); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async host allocation +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) try { + auto pfnUSMHostAllocExp = + ur_lib::getContext()->urDdiTable.EnqueueExp.pfnUSMHostAllocExp; + if (nullptr == pfnUSMHostAllocExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnUSMHostAllocExp(hQueue, pPool, size, pProperties, + numEventsInWaitList, phEventWaitList, ppMem, + phEvent); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async free +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +ur_result_t UR_APICALL urEnqueueUSMFreeExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] pointer to USM memory object + void *pMem, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) try { + auto pfnUSMFreeExp = + ur_lib::getContext()->urDdiTable.EnqueueExp.pfnUSMFreeExp; + if (nullptr == pfnUSMFreeExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnUSMFreeExp(hQueue, pPool, pMem, numEventsInWaitList, + phEventWaitList, phEvent); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create USM memory pool with desired properties. +/// +/// @details +/// - Create a memory pool associated with a single device. +/// - See also ::urUSMPoolCreate and ::ur_usm_pool_limits_desc_t. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPoolDesc` +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_POOL_FLAGS_MASK & pPoolDesc->flags` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolCreateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] pointer to USM pool descriptor. Can be chained with + /// ::ur_usm_pool_limits_desc_t + ur_usm_pool_desc_t *pPoolDesc, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) try { + auto pfnPoolCreateExp = + ur_lib::getContext()->urDdiTable.USMExp.pfnPoolCreateExp; + if (nullptr == pfnPoolCreateExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnPoolCreateExp(hContext, hDevice, pPoolDesc, pPool); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Destroy a USM memory pool. +/// +/// @details +/// - Destroy a memory pool associated with a single device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolDestroyExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to be destroyed + ur_usm_pool_handle_t hPool) try { + auto pfnPoolDestroyExp = + ur_lib::getContext()->urDdiTable.USMExp.pfnPoolDestroyExp; + if (nullptr == pfnPoolDestroyExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnPoolDestroyExp(hContext, hDevice, hPool); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a new release threshold for a USM memory pool. +/// +/// @details +/// - Set a new release threshold for a USM memory pool. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for the threshold to be set + ur_usm_pool_handle_t hPool, + /// [in] release threshold to be set + size_t newThreshold) try { + auto pfnPoolSetThresholdExp = + ur_lib::getContext()->urDdiTable.USMExp.pfnPoolSetThresholdExp; + if (nullptr == pfnPoolSetThresholdExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnPoolSetThresholdExp(hContext, hDevice, hPool, newThreshold); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the default pool for a device. +/// +/// @details +/// - Get the default pool for a device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) try { + auto pfnPoolGetDefaultDevicePoolExp = + ur_lib::getContext()->urDdiTable.USMExp.pfnPoolGetDefaultDevicePoolExp; + if (nullptr == pfnPoolGetDefaultDevicePoolExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnPoolGetDefaultDevicePoolExp(hContext, hDevice, pPool); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query a pool for specific properties. +/// +/// @details +/// - Query a memory pool for specific properties. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_POOL_INFO_USED_HIGH_EXP < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_DEVICE +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +ur_result_t UR_APICALL urUSMPoolGetInfoExp( + /// [in] handle to USM memory pool for property retrieval + ur_usm_pool_handle_t hPool, + /// [in] queried property name + ur_usm_pool_info_t propName, + /// [out][optional] returned query value + void *pPropValue, + /// [out][optional] returned query value size + size_t *pPropSizeRet) try { + auto pfnPoolGetInfoExp = + ur_lib::getContext()->urDdiTable.USMExp.pfnPoolGetInfoExp; + if (nullptr == pfnPoolGetInfoExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnPoolGetInfoExp(hPool, propName, pPropValue, pPropSizeRet); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the current pool for a device. +/// +/// @details +/// - Set the current pool for a device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to set for a device + ur_usm_pool_handle_t hPool) try { + auto pfnPoolSetDevicePoolExp = + ur_lib::getContext()->urDdiTable.USMExp.pfnPoolSetDevicePoolExp; + if (nullptr == pfnPoolSetDevicePoolExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnPoolSetDevicePoolExp(hContext, hDevice, hPool); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the currently set pool for a device. +/// +/// @details +/// - Get the currently set pool for a device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) try { + auto pfnPoolGetDevicePoolExp = + ur_lib::getContext()->urDdiTable.USMExp.pfnPoolGetDevicePoolExp; + if (nullptr == pfnPoolGetDevicePoolExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnPoolGetDevicePoolExp(hContext, hDevice, pPool); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Attempt to release a pool's memory back to the OS +/// +/// @details +/// - Attempt to release a pool's memory back to the OS +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolTrimToExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for trimming + ur_usm_pool_handle_t hPool, + /// [in] minimum number of bytes to keep in the pool + size_t minBytesToKeep) try { + auto pfnPoolTrimToExp = + ur_lib::getContext()->urDdiTable.USMExp.pfnPoolTrimToExp; + if (nullptr == pfnPoolTrimToExp) + return UR_RESULT_ERROR_UNINITIALIZED; + + return pfnPoolTrimToExp(hContext, hDevice, hPool, minBytesToKeep); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief USM allocate pitched memory /// diff --git a/unified-runtime/source/loader/ur_print.cpp b/unified-runtime/source/loader/ur_print.cpp index d75272a1ae62b..569adc51e6fe1 100644 --- a/unified-runtime/source/loader/ur_print.cpp +++ b/unified-runtime/source/loader/ur_print.cpp @@ -897,6 +897,23 @@ ur_result_t urPrintExpDevice_2dBlockArrayCapabilityFlags( return str_copy(&ss, buffer, buff_size, out_size); } +ur_result_t +urPrintExpAsyncUsmAllocFlags(enum ur_exp_async_usm_alloc_flag_t value, + char *buffer, const size_t buff_size, + size_t *out_size) { + std::stringstream ss; + ss << value; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintExpAsyncUsmAllocProperties( + const struct ur_exp_async_usm_alloc_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + ur_result_t urPrintExpImageCopyFlags(enum ur_exp_image_copy_flag_t value, char *buffer, const size_t buff_size, size_t *out_size) { @@ -1764,6 +1781,38 @@ ur_result_t urPrintEnqueueEventsWaitWithBarrierExtParams( return str_copy(&ss, buffer, buff_size, out_size); } +ur_result_t urPrintEnqueueUsmDeviceAllocExpParams( + const struct ur_enqueue_usm_device_alloc_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintEnqueueUsmSharedAllocExpParams( + const struct ur_enqueue_usm_shared_alloc_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintEnqueueUsmHostAllocExpParams( + const struct ur_enqueue_usm_host_alloc_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintEnqueueUsmFreeExpParams( + const struct ur_enqueue_usm_free_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + ur_result_t urPrintEnqueueCooperativeKernelLaunchExpParams( const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size) { @@ -2581,6 +2630,70 @@ urPrintUsmPoolGetInfoParams(const struct ur_usm_pool_get_info_params_t *params, return str_copy(&ss, buffer, buff_size, out_size); } +ur_result_t urPrintUsmPoolCreateExpParams( + const struct ur_usm_pool_create_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintUsmPoolDestroyExpParams( + const struct ur_usm_pool_destroy_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintUsmPoolSetThresholdExpParams( + const struct ur_usm_pool_set_threshold_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintUsmPoolGetDefaultDevicePoolExpParams( + const struct ur_usm_pool_get_default_device_pool_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintUsmPoolGetInfoExpParams( + const struct ur_usm_pool_get_info_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintUsmPoolSetDevicePoolExpParams( + const struct ur_usm_pool_set_device_pool_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintUsmPoolGetDevicePoolExpParams( + const struct ur_usm_pool_get_device_pool_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintUsmPoolTrimToExpParams( + const struct ur_usm_pool_trim_to_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + ur_result_t urPrintUsmPitchedAllocExpParams( const struct ur_usm_pitched_alloc_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size) { diff --git a/unified-runtime/source/ur_api.cpp b/unified-runtime/source/ur_api.cpp index c5651c0fc4f83..d2c136f7d7737 100644 --- a/unified-runtime/source/ur_api.cpp +++ b/unified-runtime/source/ur_api.cpp @@ -783,7 +783,7 @@ ur_result_t UR_APICALL urDeviceGetSelected( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP < propName` +/// + `::UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -2288,7 +2288,7 @@ ur_result_t UR_APICALL urUSMPoolRelease( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPool` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_USM_POOL_INFO_CONTEXT < propName` +/// + `::UR_USM_POOL_INFO_USED_HIGH_EXP < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -5891,6 +5891,425 @@ ur_result_t UR_APICALL urEnqueueWriteHostPipe( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async device allocation +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async shared allocation +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async host allocation +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ASYNC_USM_ALLOC_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] minimum size in bytes of the USM memory object to be allocated + const size_t size, + /// [in][optional] pointer to the enqueue async alloc properties + const ur_exp_async_usm_alloc_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out] pointer to USM memory object + void **ppMem, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue an async free +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +ur_result_t UR_APICALL urEnqueueUSMFreeExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] USM pool descriptor + ur_usm_pool_handle_t pPool, + /// [in] pointer to USM memory object + void *pMem, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] return an event object that identifies the async alloc + ur_event_handle_t *phEvent) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create USM memory pool with desired properties. +/// +/// @details +/// - Create a memory pool associated with a single device. +/// - See also ::urUSMPoolCreate and ::ur_usm_pool_limits_desc_t. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPoolDesc` +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_POOL_FLAGS_MASK & pPoolDesc->flags` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolCreateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] pointer to USM pool descriptor. Can be chained with + /// ::ur_usm_pool_limits_desc_t + ur_usm_pool_desc_t *pPoolDesc, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Destroy a USM memory pool. +/// +/// @details +/// - Destroy a memory pool associated with a single device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolDestroyExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to be destroyed + ur_usm_pool_handle_t hPool) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a new release threshold for a USM memory pool. +/// +/// @details +/// - Set a new release threshold for a USM memory pool. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for the threshold to be set + ur_usm_pool_handle_t hPool, + /// [in] release threshold to be set + size_t newThreshold) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the default pool for a device. +/// +/// @details +/// - Get the default pool for a device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query a pool for specific properties. +/// +/// @details +/// - Query a memory pool for specific properties. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_POOL_INFO_USED_HIGH_EXP < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_DEVICE +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +ur_result_t UR_APICALL urUSMPoolGetInfoExp( + /// [in] handle to USM memory pool for property retrieval + ur_usm_pool_handle_t hPool, + /// [in] queried property name + ur_usm_pool_info_t propName, + /// [out][optional] returned query value + void *pPropValue, + /// [out][optional] returned query value size + size_t *pPropSizeRet) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the current pool for a device. +/// +/// @details +/// - Set the current pool for a device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool to set for a device + ur_usm_pool_handle_t hPool) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the currently set pool for a device. +/// +/// @details +/// - Get the currently set pool for a device. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [out] pointer to USM memory pool + ur_usm_pool_handle_t *pPool) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Attempt to release a pool's memory back to the OS +/// +/// @details +/// - Attempt to release a pool's memory back to the OS +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +ur_result_t UR_APICALL urUSMPoolTrimToExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to USM memory pool for trimming + ur_usm_pool_handle_t hPool, + /// [in] minimum number of bytes to keep in the pool + size_t minBytesToKeep) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief USM allocate pitched memory /// diff --git a/unified-runtime/tools/urinfo/urinfo.hpp b/unified-runtime/tools/urinfo/urinfo.hpp index d01245138f28e..2da92dc7ca334 100644 --- a/unified-runtime/tools/urinfo/urinfo.hpp +++ b/unified-runtime/tools/urinfo/urinfo.hpp @@ -420,5 +420,7 @@ inline void printDeviceInfos(ur_device_handle_t hDevice, std::cout << prefix; printDeviceInfo( hDevice, UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP); + std::cout << prefix; + printDeviceInfo(hDevice, UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_EXP); } } // namespace urinfo From 4f15509bc1f6520b7215d900df039ef0dde240ae Mon Sep 17 00:00:00 2001 From: Sean Stirling Date: Mon, 24 Feb 2025 10:08:07 +0000 Subject: [PATCH 2/6] Add missing L0 immediate in order queue declarations/definitions --- .../v2/queue_immediate_in_order.cpp | 56 +++++++++++++++++++ .../v2/queue_immediate_in_order.hpp | 20 +++++++ 2 files changed, 76 insertions(+) diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp index 3f88161b90d5c..2c151867bfd31 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp @@ -705,6 +705,62 @@ ur_result_t ur_queue_immediate_in_order_t::enqueueWriteHostPipe( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } +ur_result_t ur_queue_immediate_in_order_t::enqueueUSMDeviceAllocExp( + ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent) { + std::ignore = pPool; + std::ignore = size; + std::ignore = pProperties; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = ppMem; + std::ignore = phEvent; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t ur_queue_immediate_in_order_t::enqueueUSMSharedAllocExp( + ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent) { + std::ignore = pPool; + std::ignore = size; + std::ignore = pProperties; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = ppMem; + std::ignore = phEvent; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t ur_queue_immediate_in_order_t::enqueueUSMHostAllocExp( + ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent) { + std::ignore = pPool; + std::ignore = size; + std::ignore = pProperties; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = ppMem; + std::ignore = phEvent; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t ur_queue_immediate_in_order_t::enqueueUSMFreeExp( + ur_usm_pool_handle_t pPool, void *pMem, uint32_t numEventsInWaitList, + const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { + std::ignore = pPool; + std::ignore = pMem; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = phEvent; + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + ur_result_t ur_queue_immediate_in_order_t::bindlessImagesImageCopyExp( const void *pSrc, void *pDst, const ur_image_desc_t *pSrcImageDesc, const ur_image_desc_t *pDstImageDesc, diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.hpp b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.hpp index 2c51d8ac1f3de..284c4661dc0e7 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.hpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.hpp @@ -215,6 +215,26 @@ struct ur_queue_immediate_in_order_t : _ur_object, public ur_queue_t_ { uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) override; + ur_result_t enqueueUSMDeviceAllocExp( + ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent) override; + ur_result_t enqueueUSMSharedAllocExp( + ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + void **ppMem, ur_event_handle_t *phEvent) override; + ur_result_t + enqueueUSMHostAllocExp(ur_usm_pool_handle_t pPool, const size_t size, + const ur_exp_async_usm_alloc_properties_t *pProperties, + uint32_t numEventsInWaitList, + const ur_event_handle_t *phEventWaitList, void **ppMem, + ur_event_handle_t *phEvent) override; + ur_result_t enqueueUSMFreeExp(ur_usm_pool_handle_t pPool, void *pMem, + uint32_t numEventsInWaitList, + const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) override; ur_result_t bindlessImagesImageCopyExp( const void *pSrc, void *pDst, const ur_image_desc_t *pSrcImageDesc, const ur_image_desc_t *pDstImageDesc, From ef87475b7f2a6bba8f785fae001a539955018947 Mon Sep 17 00:00:00 2001 From: Sean Stirling Date: Tue, 25 Feb 2025 10:52:58 +0000 Subject: [PATCH 3/6] Fix double defintion in L0 --- .../adapters/level_zero/async_alloc.cpp | 3 + .../source/adapters/level_zero/usm.cpp | 120 ------------------ 2 files changed, 3 insertions(+), 120 deletions(-) diff --git a/unified-runtime/source/adapters/level_zero/async_alloc.cpp b/unified-runtime/source/adapters/level_zero/async_alloc.cpp index bf7bcb10bd60e..c25647aad9d43 100644 --- a/unified-runtime/source/adapters/level_zero/async_alloc.cpp +++ b/unified-runtime/source/adapters/level_zero/async_alloc.cpp @@ -10,6 +10,8 @@ #include +namespace ur::level_zero { + UR_APIEXPORT ur_result_t urEnqueueUSMDeviceAllocExp( ur_queue_handle_t, ur_usm_pool_handle_t, const size_t, const ur_exp_async_usm_alloc_properties_t *, uint32_t, @@ -38,3 +40,4 @@ UR_APIEXPORT ur_result_t urEnqueueUSMFreeExp(ur_queue_handle_t, ur_event_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } +} // namespace ur::level_zero diff --git a/unified-runtime/source/adapters/level_zero/usm.cpp b/unified-runtime/source/adapters/level_zero/usm.cpp index ef92eb8730f1c..9bd74297686cc 100644 --- a/unified-runtime/source/adapters/level_zero/usm.cpp +++ b/unified-runtime/source/adapters/level_zero/usm.cpp @@ -804,126 +804,6 @@ ur_result_t urUSMReleaseExp(ur_context_handle_t Context, void *HostPtr) { return UR_RESULT_SUCCESS; } -ur_result_t urEnqueueUSMDeviceAllocExp( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_usm_pool_handle_t - pPool, ///< [in][optional] handle of the USM memory pool - const size_t size, ///< [in] minimum size in bytes of the USM memory object - ///< to be allocated - const ur_exp_async_usm_alloc_properties_t - *pProperties, ///< [in][optional] pointer to the enqueue asynchronous - ///< USM allocation properties - uint32_t numEventsInWaitList, ///< [in] size of the event wait list - const ur_event_handle_t - *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] - ///< pointer to a list of events that must be complete - ///< before the kernel execution. If nullptr, the - ///< numEventsInWaitList must be 0, indicating no wait - ///< events. - void **ppMem, ///< [out] pointer to USM memory object - ur_event_handle_t - *phEvent ///< [out][optional] return an event object that identifies the - ///< asynchronous USM device allocation -) { - std::ignore = hQueue; - std::ignore = pPool; - std::ignore = size; - std::ignore = pProperties; - std::ignore = numEventsInWaitList; - std::ignore = phEventWaitList; - std::ignore = ppMem; - std::ignore = phEvent; - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ur_result_t urEnqueueUSMSharedAllocExp( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_usm_pool_handle_t - pPool, ///< [in][optional] handle of the USM memory pool - const size_t size, ///< [in] minimum size in bytes of the USM memory object - ///< to be allocated - const ur_exp_async_usm_alloc_properties_t - *pProperties, ///< [in][optional] pointer to the enqueue asynchronous - ///< USM allocation properties - uint32_t numEventsInWaitList, ///< [in] size of the event wait list - const ur_event_handle_t - *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] - ///< pointer to a list of events that must be complete - ///< before the kernel execution. If nullptr, the - ///< numEventsInWaitList must be 0, indicating no wait - ///< events. - void **ppMem, ///< [out] pointer to USM memory object - ur_event_handle_t - *phEvent ///< [out][optional] return an event object that identifies the - ///< asynchronous USM shared allocation -) { - std::ignore = hQueue; - std::ignore = pPool; - std::ignore = size; - std::ignore = pProperties; - std::ignore = numEventsInWaitList; - std::ignore = phEventWaitList; - std::ignore = ppMem; - std::ignore = phEvent; - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ur_result_t urEnqueueUSMHostAllocExp( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_usm_pool_handle_t - pPool, ///< [in][optional] handle of the USM memory pool - const size_t size, ///< [in] minimum size in bytes of the USM memory object - ///< to be allocated - const ur_exp_async_usm_alloc_properties_t - *pProperties, ///< [in][optional] pointer to the enqueue asynchronous - ///< USM allocation properties - uint32_t numEventsInWaitList, ///< [in] size of the event wait list - const ur_event_handle_t - *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] - ///< pointer to a list of events that must be complete - ///< before the kernel execution. If nullptr, the - ///< numEventsInWaitList must be 0, indicating no wait - ///< events. - void **ppMem, ///< [out] pointer to USM memory object - ur_event_handle_t - *phEvent ///< [out][optional] return an event object that identifies the - ///< asynchronous USM host allocation -) { - std::ignore = hQueue; - std::ignore = pPool; - std::ignore = size; - std::ignore = pProperties; - std::ignore = numEventsInWaitList; - std::ignore = phEventWaitList; - std::ignore = ppMem; - std::ignore = phEvent; - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ur_result_t urEnqueueUSMFreeExp( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_usm_pool_handle_t - pPool, ///< [in][optional] handle of the USM memory pooliptor - void *pMem, ///< [in] pointer to USM memory object - uint32_t numEventsInWaitList, ///< [in] size of the event wait list - const ur_event_handle_t - *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] - ///< pointer to a list of events that must be complete - ///< before the kernel execution. If nullptr, the - ///< numEventsInWaitList must be 0, indicating no wait - ///< events. - ur_event_handle_t *phEvent ///< [out][optional] return an event object that - ///< identifies the asynchronous USM deallocation -) { - std::ignore = hQueue; - std::ignore = pPool; - std::ignore = pMem; - std::ignore = numEventsInWaitList; - std::ignore = phEventWaitList; - std::ignore = phEvent; - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - ur_result_t UR_APICALL urUSMPoolCreateExp( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object From bc21a7f6baec4ed24adf4f54bb887a6ce90b145c Mon Sep 17 00:00:00 2001 From: Sean Stirling Date: Tue, 25 Feb 2025 12:47:18 +0000 Subject: [PATCH 4/6] Add missing L0 v2 definitions --- .../source/adapters/level_zero/v2/api.cpp | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/unified-runtime/source/adapters/level_zero/v2/api.cpp b/unified-runtime/source/adapters/level_zero/v2/api.cpp index 129db02594b5e..0700ec35d6040 100644 --- a/unified-runtime/source/adapters/level_zero/v2/api.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/api.cpp @@ -192,4 +192,68 @@ ur_result_t urCommandBufferUpdateWaitEventsExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } +ur_result_t UR_APICALL urUSMPoolCreateExp( + ur_context_handle_t hContext, ///< [in] handle of the context object + ur_device_handle_t hDevice, ///< [in] handle of the device object + ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. + ///< Can be chained with + ///< ::ur_usm_pool_limits_desc_t + ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool +) { + logger::error("{} function not implemented!", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + logger::error("{} function not implemented!", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t newThreshold) { + logger::error("{} function not implemented!", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + logger::error("{} function not implemented!", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, + ur_usm_pool_info_t propName, + void *pPropValue, + size_t *pPropSizeRet) { + logger::error("{} function not implemented!", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t *pPool) { + logger::error("{} function not implemented!", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool) { + logger::error("{} function not implemented!", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_handle_t hPool, + size_t minBytesToKeep) { + logger::error("{} function not implemented!", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + } // namespace ur::level_zero From 8aed328dc3f14bfcf8d31b581a0ddf9b774ad0f3 Mon Sep 17 00:00:00 2001 From: Sean Stirling Date: Tue, 25 Feb 2025 15:19:00 +0000 Subject: [PATCH 5/6] Minor cleanup --- .../source/adapters/level_zero/v2/api.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/unified-runtime/source/adapters/level_zero/v2/api.cpp b/unified-runtime/source/adapters/level_zero/v2/api.cpp index 0700ec35d6040..57b6ed8dd569d 100644 --- a/unified-runtime/source/adapters/level_zero/v2/api.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/api.cpp @@ -192,14 +192,10 @@ ur_result_t urCommandBufferUpdateWaitEventsExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolCreateExp( - ur_context_handle_t hContext, ///< [in] handle of the context object - ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. - ///< Can be chained with - ///< ::ur_usm_pool_limits_desc_t - ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool -) { +ur_result_t UR_APICALL urUSMPoolCreateExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_usm_pool_desc_t *PoolDesc, + ur_usm_pool_handle_t *pPool) { logger::error("{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } From 258b9724a3ad363e0a46d3729dd62a9ad0a5d5a5 Mon Sep 17 00:00:00 2001 From: Sean Stirling Date: Thu, 27 Feb 2025 11:14:10 +0000 Subject: [PATCH 6/6] Address nit feedback by using no-names over std::ignore --- unified-runtime/source/adapters/cuda/usm.cpp | 72 ++++------------ unified-runtime/source/adapters/hip/usm.cpp | 82 +++++-------------- .../source/adapters/level_zero/usm.cpp | 82 ++++++------------- .../v2/queue_immediate_in_order.cpp | 51 +++--------- .../source/adapters/native_cpu/usm.cpp | 82 +++++-------------- .../source/adapters/opencl/usm.cpp | 82 +++++-------------- 6 files changed, 118 insertions(+), 333 deletions(-) diff --git a/unified-runtime/source/adapters/cuda/usm.cpp b/unified-runtime/source/adapters/cuda/usm.cpp index 62b9fe04c0770..5ee1ee5aecbae 100644 --- a/unified-runtime/source/adapters/cuda/usm.cpp +++ b/unified-runtime/source/adapters/cuda/usm.cpp @@ -414,84 +414,48 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfo( } } -UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolCreateExp( - ur_context_handle_t hContext, ///< [in] handle of the context object - ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_usm_pool_desc_t *pPoolDesc, ///< [in] pointer to USM pool descriptor. - ///< Can be chained with - ///< ::ur_usm_pool_limits_desc_t - ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool -) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPoolDesc; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolCreateExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_desc_t *, + ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL -urUSMPoolDestroyExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetThresholdExp( - ur_context_handle_t hContext, ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, size_t newThreshold) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = newThreshold; + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t, size_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( - ur_context_handle_t hContext, ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL -urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, ur_usm_pool_info_t propName, - void *pPropValue, size_t *pPropSizeRet) { - std::ignore = hPool; - std::ignore = propName; - std::ignore = pPropValue; - std::ignore = pPropSizeRet; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t, + ur_usm_pool_info_t, + void *, size_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( - ur_context_handle_t hContext, ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( - ur_context_handle_t hContext, ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, - size_t minBytesToKeep) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = minBytesToKeep; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t, + size_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/hip/usm.cpp b/unified-runtime/source/adapters/hip/usm.cpp index 337f76263bad6..7412d4b1eb8b2 100644 --- a/unified-runtime/source/adapters/hip/usm.cpp +++ b/unified-runtime/source/adapters/hip/usm.cpp @@ -479,86 +479,48 @@ ur_result_t umfPoolMallocHelper(ur_usm_pool_handle_t hPool, void **ppMem, return UR_RESULT_SUCCESS; } -ur_result_t UR_APICALL urUSMPoolCreateExp( - ur_context_handle_t hContext, ///< [in] handle of the context object - ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. - ///< Can be chained with - ///< ::ur_usm_pool_limits_desc_t - ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool -) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = PoolDesc; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolCreateExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_desc_t *, + ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, - size_t newThreshold) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = newThreshold; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t, size_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( - ur_context_handle_t hContext, ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, - ur_usm_pool_info_t propName, - void *pPropValue, - size_t *pPropSizeRet) { - std::ignore = hPool; - std::ignore = propName; - std::ignore = pPropValue; - std::ignore = pPropSizeRet; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t, + ur_usm_pool_info_t, + void *, size_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, - size_t minBytesToKeep) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = minBytesToKeep; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t, + size_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/usm.cpp b/unified-runtime/source/adapters/level_zero/usm.cpp index 9bd74297686cc..ae3a693d20981 100644 --- a/unified-runtime/source/adapters/level_zero/usm.cpp +++ b/unified-runtime/source/adapters/level_zero/usm.cpp @@ -804,87 +804,51 @@ ur_result_t urUSMReleaseExp(ur_context_handle_t Context, void *HostPtr) { return UR_RESULT_SUCCESS; } -ur_result_t UR_APICALL urUSMPoolCreateExp( - ur_context_handle_t hContext, ///< [in] handle of the context object - ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. - ///< Can be chained with - ///< ::ur_usm_pool_limits_desc_t - ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool -) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = PoolDesc; - std::ignore = pPool; +ur_result_t UR_APICALL urUSMPoolCreateExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_desc_t *, + ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; +ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, - size_t newThreshold) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = newThreshold; +ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t, size_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( - ur_context_handle_t hContext, ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, - ur_usm_pool_info_t propName, - void *pPropValue, - size_t *pPropSizeRet) { - std::ignore = hPool; - std::ignore = propName; - std::ignore = pPropValue; - std::ignore = pPropSizeRet; +ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t, + ur_usm_pool_info_t, void *, + size_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; +ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; +ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, - size_t minBytesToKeep) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = minBytesToKeep; +ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t, size_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } } // namespace ur::level_zero diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp index 2c151867bfd31..f636d1400940a 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp @@ -706,58 +706,29 @@ ur_result_t ur_queue_immediate_in_order_t::enqueueWriteHostPipe( } ur_result_t ur_queue_immediate_in_order_t::enqueueUSMDeviceAllocExp( - ur_usm_pool_handle_t pPool, const size_t size, - const ur_exp_async_usm_alloc_properties_t *pProperties, - uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, - void **ppMem, ur_event_handle_t *phEvent) { - std::ignore = pPool; - std::ignore = size; - std::ignore = pProperties; - std::ignore = numEventsInWaitList; - std::ignore = phEventWaitList; - std::ignore = ppMem; - std::ignore = phEvent; + ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t ur_queue_immediate_in_order_t::enqueueUSMSharedAllocExp( - ur_usm_pool_handle_t pPool, const size_t size, - const ur_exp_async_usm_alloc_properties_t *pProperties, - uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, - void **ppMem, ur_event_handle_t *phEvent) { - std::ignore = pPool; - std::ignore = size; - std::ignore = pProperties; - std::ignore = numEventsInWaitList; - std::ignore = phEventWaitList; - std::ignore = ppMem; - std::ignore = phEvent; + ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t ur_queue_immediate_in_order_t::enqueueUSMHostAllocExp( - ur_usm_pool_handle_t pPool, const size_t size, - const ur_exp_async_usm_alloc_properties_t *pProperties, - uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, - void **ppMem, ur_event_handle_t *phEvent) { - std::ignore = pPool; - std::ignore = size; - std::ignore = pProperties; - std::ignore = numEventsInWaitList; - std::ignore = phEventWaitList; - std::ignore = ppMem; - std::ignore = phEvent; + ur_usm_pool_handle_t, const size_t, + const ur_exp_async_usm_alloc_properties_t *, uint32_t, + const ur_event_handle_t *, void **, ur_event_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t ur_queue_immediate_in_order_t::enqueueUSMFreeExp( - ur_usm_pool_handle_t pPool, void *pMem, uint32_t numEventsInWaitList, - const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - std::ignore = pPool; - std::ignore = pMem; - std::ignore = numEventsInWaitList; - std::ignore = phEventWaitList; - std::ignore = phEvent; + ur_usm_pool_handle_t, void *, uint32_t, const ur_event_handle_t *, + ur_event_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/native_cpu/usm.cpp b/unified-runtime/source/adapters/native_cpu/usm.cpp index 160e12e4c764a..6185178df321c 100644 --- a/unified-runtime/source/adapters/native_cpu/usm.cpp +++ b/unified-runtime/source/adapters/native_cpu/usm.cpp @@ -156,86 +156,48 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMReleaseExp(ur_context_handle_t Context, DIE_NO_IMPLEMENTATION; } -ur_result_t UR_APICALL urUSMPoolCreateExp( - ur_context_handle_t hContext, ///< [in] handle of the context object - ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. - ///< Can be chained with - ///< ::ur_usm_pool_limits_desc_t - ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool -) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = PoolDesc; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolCreateExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_desc_t *, + ur_usm_pool_handle_t *) { DIE_NO_IMPLEMENTATION; } -ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t) { DIE_NO_IMPLEMENTATION; } -ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, - size_t newThreshold) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = newThreshold; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t, size_t) { DIE_NO_IMPLEMENTATION; } -ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( - ur_context_handle_t hContext, ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *) { DIE_NO_IMPLEMENTATION; } -ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, - ur_usm_pool_info_t propName, - void *pPropValue, - size_t *pPropSizeRet) { - std::ignore = hPool; - std::ignore = propName; - std::ignore = pPropValue; - std::ignore = pPropSizeRet; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t, + ur_usm_pool_info_t, + void *, size_t *) { DIE_NO_IMPLEMENTATION; } -ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *) { DIE_NO_IMPLEMENTATION; } -ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t) { DIE_NO_IMPLEMENTATION; } -ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, - size_t minBytesToKeep) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = minBytesToKeep; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t, + size_t) { DIE_NO_IMPLEMENTATION; } diff --git a/unified-runtime/source/adapters/opencl/usm.cpp b/unified-runtime/source/adapters/opencl/usm.cpp index 3bc0fab534c68..e708a19b73dda 100644 --- a/unified-runtime/source/adapters/opencl/usm.cpp +++ b/unified-runtime/source/adapters/opencl/usm.cpp @@ -729,86 +729,48 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfo( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolCreateExp( - ur_context_handle_t hContext, ///< [in] handle of the context object - ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_usm_pool_desc_t *PoolDesc, ///< [in] pointer to USM pool descriptor. - ///< Can be chained with - ///< ::ur_usm_pool_limits_desc_t - ur_usm_pool_handle_t *pPool ///< [out] pointer to USM memory pool -) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = PoolDesc; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolCreateExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_desc_t *, + ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolSetThresholdExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, - size_t newThreshold) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = newThreshold; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetThresholdExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t, size_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( - ur_context_handle_t hContext, ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, - ur_usm_pool_info_t propName, - void *pPropValue, - size_t *pPropSizeRet) { - std::ignore = hPool; - std::ignore = propName; - std::ignore = pPropValue; - std::ignore = pPropSizeRet; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t, + ur_usm_pool_info_t, + void *, size_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t *pPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = pPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t *) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( + ur_context_handle_t, ur_device_handle_t, ur_usm_pool_handle_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, - ur_device_handle_t hDevice, - ur_usm_pool_handle_t hPool, - size_t minBytesToKeep) { - std::ignore = hContext; - std::ignore = hDevice; - std::ignore = hPool; - std::ignore = minBytesToKeep; +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t, + ur_device_handle_t, + ur_usm_pool_handle_t, + size_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; }