diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index de327f92c7..a72b7caf77 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -9,8 +9,9 @@ name: coverity-unified-runtime # It runs static analysis build - Coverity. It requires special token (set in CI's secret). on: - push: - branches: ["main"] + schedule: + # Run every day at 23:00 UTC + - cron: '0 23 * * *' workflow_dispatch: env: diff --git a/include/ur.py b/include/ur.py index 09b7955e07..b35a259fcd 100644 --- a/include/ur.py +++ b/include/ur.py @@ -249,14 +249,14 @@ class ur_structure_type_v(IntEnum): KERNEL_EXEC_INFO_PROPERTIES = 31 ## ::ur_kernel_exec_info_properties_t KERNEL_ARG_VALUE_PROPERTIES = 32 ## ::ur_kernel_arg_value_properties_t KERNEL_ARG_LOCAL_PROPERTIES = 33 ## ::ur_kernel_arg_local_properties_t + USM_ALLOC_LOCATION_DESC = 35 ## ::ur_usm_alloc_location_desc_t EXP_COMMAND_BUFFER_DESC = 0x1000 ## ::ur_exp_command_buffer_desc_t EXP_SAMPLER_MIP_PROPERTIES = 0x2000 ## ::ur_exp_sampler_mip_properties_t EXP_INTEROP_MEM_DESC = 0x2001 ## ::ur_exp_interop_mem_desc_t EXP_INTEROP_SEMAPHORE_DESC = 0x2002 ## ::ur_exp_interop_semaphore_desc_t EXP_FILE_DESCRIPTOR = 0x2003 ## ::ur_exp_file_descriptor_t EXP_WIN32_HANDLE = 0x2004 ## ::ur_exp_win32_handle_t - EXP_LAYERED_IMAGE_PROPERTIES = 0x2005 ## ::ur_exp_layered_image_properties_t - EXP_SAMPLER_ADDR_MODES = 0x2006 ## ::ur_exp_sampler_addr_modes_t + EXP_SAMPLER_ADDR_MODES = 0x2005 ## ::ur_exp_sampler_addr_modes_t class ur_structure_type_t(c_int): def __str__(self): @@ -1558,6 +1558,25 @@ class ur_usm_device_desc_t(Structure): ("flags", ur_usm_device_mem_flags_t) ## [in] device memory allocation flags. ] +############################################################################### +## @brief USM allocation location desc +## +## @details +## - Specify these properties in ::urUSMHostAlloc, ::urUSMDeviceAlloc and +## ::urUSMSharedAlloc via ::ur_usm_desc_t as part of a `pNext` chain. +## +## @remarks +## _Analogues_ +## - cl_intel_mem_alloc_buffer_location +class ur_usm_alloc_location_desc_t(Structure): + _fields_ = [ + ("stype", ur_structure_type_t), ## [in] type of this structure, must be + ## ::UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC + ("pNext", c_void_p), ## [in][optional] pointer to extension-specific structure + ("location", c_ulong) ## [in] Identifies the ID of global memory partition to which the memory + ## should be allocated. + ] + ############################################################################### ## @brief USM pool descriptor type class ur_usm_pool_desc_t(Structure): @@ -2274,21 +2293,6 @@ class ur_exp_interop_semaphore_desc_t(Structure): ("pNext", c_void_p) ## [in][optional] pointer to extension-specific structure ] -############################################################################### -## @brief Describes layered image properties -## -## @details -## - Specify these properties in ::urBindlessImagesUnsampledImageCreateExp -## or ::urBindlessImagesSampledImageCreateExp via ::ur_image_desc_t as -## part of a `pNext` chain. -class ur_exp_layered_image_properties_t(Structure): - _fields_ = [ - ("stype", ur_structure_type_t), ## [in] type of this structure, must be - ## ::UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES - ("pNext", c_void_p), ## [in,out][optional] pointer to extension-specific structure - ("numLayers", c_ulong) ## [in] number of layers the image should have - ] - ############################################################################### ## @brief The extension string which defines support for command-buffers which ## is returned when querying device extensions. diff --git a/include/ur_api.h b/include/ur_api.h index 63f5fc8083..0403e2b306 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -224,48 +224,48 @@ typedef enum ur_function_t { /////////////////////////////////////////////////////////////////////////////// /// @brief Defines structure types typedef enum ur_structure_type_t { - UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES = 0, ///< ::ur_context_properties_t - UR_STRUCTURE_TYPE_IMAGE_DESC = 1, ///< ::ur_image_desc_t - UR_STRUCTURE_TYPE_BUFFER_PROPERTIES = 2, ///< ::ur_buffer_properties_t - UR_STRUCTURE_TYPE_BUFFER_REGION = 3, ///< ::ur_buffer_region_t - UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES = 4, ///< ::ur_buffer_channel_properties_t - UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES = 5, ///< ::ur_buffer_alloc_location_properties_t - UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES = 6, ///< ::ur_program_properties_t - UR_STRUCTURE_TYPE_USM_DESC = 7, ///< ::ur_usm_desc_t - UR_STRUCTURE_TYPE_USM_HOST_DESC = 8, ///< ::ur_usm_host_desc_t - UR_STRUCTURE_TYPE_USM_DEVICE_DESC = 9, ///< ::ur_usm_device_desc_t - UR_STRUCTURE_TYPE_USM_POOL_DESC = 10, ///< ::ur_usm_pool_desc_t - UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC = 11, ///< ::ur_usm_pool_limits_desc_t - UR_STRUCTURE_TYPE_DEVICE_BINARY = 12, ///< ::ur_device_binary_t - UR_STRUCTURE_TYPE_SAMPLER_DESC = 13, ///< ::ur_sampler_desc_t - UR_STRUCTURE_TYPE_QUEUE_PROPERTIES = 14, ///< ::ur_queue_properties_t - UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES = 15, ///< ::ur_queue_index_properties_t - UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES = 16, ///< ::ur_context_native_properties_t - UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES = 17, ///< ::ur_kernel_native_properties_t - UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES = 18, ///< ::ur_queue_native_properties_t - UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES = 19, ///< ::ur_mem_native_properties_t - UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES = 20, ///< ::ur_event_native_properties_t - UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES = 21, ///< ::ur_platform_native_properties_t - UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES = 22, ///< ::ur_device_native_properties_t - UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES = 23, ///< ::ur_program_native_properties_t - UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES = 24, ///< ::ur_sampler_native_properties_t - UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC = 25, ///< ::ur_queue_native_desc_t - UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES = 26, ///< ::ur_device_partition_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES = 27, ///< ::ur_kernel_arg_mem_obj_properties_t - UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES = 28, ///< ::ur_physical_mem_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES = 29, ///< ::ur_kernel_arg_pointer_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES = 30, ///< ::ur_kernel_arg_sampler_properties_t - UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES = 31, ///< ::ur_kernel_exec_info_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES = 32, ///< ::ur_kernel_arg_value_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES = 33, ///< ::ur_kernel_arg_local_properties_t - UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC = 0x1000, ///< ::ur_exp_command_buffer_desc_t - UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES = 0x2000, ///< ::ur_exp_sampler_mip_properties_t - UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC = 0x2001, ///< ::ur_exp_interop_mem_desc_t - UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC = 0x2002, ///< ::ur_exp_interop_semaphore_desc_t - UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR = 0x2003, ///< ::ur_exp_file_descriptor_t - UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t - UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES = 0x2005, ///< ::ur_exp_layered_image_properties_t - UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES = 0x2006, ///< ::ur_exp_sampler_addr_modes_t + UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES = 0, ///< ::ur_context_properties_t + UR_STRUCTURE_TYPE_IMAGE_DESC = 1, ///< ::ur_image_desc_t + UR_STRUCTURE_TYPE_BUFFER_PROPERTIES = 2, ///< ::ur_buffer_properties_t + UR_STRUCTURE_TYPE_BUFFER_REGION = 3, ///< ::ur_buffer_region_t + UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES = 4, ///< ::ur_buffer_channel_properties_t + UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES = 5, ///< ::ur_buffer_alloc_location_properties_t + UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES = 6, ///< ::ur_program_properties_t + UR_STRUCTURE_TYPE_USM_DESC = 7, ///< ::ur_usm_desc_t + UR_STRUCTURE_TYPE_USM_HOST_DESC = 8, ///< ::ur_usm_host_desc_t + UR_STRUCTURE_TYPE_USM_DEVICE_DESC = 9, ///< ::ur_usm_device_desc_t + UR_STRUCTURE_TYPE_USM_POOL_DESC = 10, ///< ::ur_usm_pool_desc_t + UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC = 11, ///< ::ur_usm_pool_limits_desc_t + UR_STRUCTURE_TYPE_DEVICE_BINARY = 12, ///< ::ur_device_binary_t + UR_STRUCTURE_TYPE_SAMPLER_DESC = 13, ///< ::ur_sampler_desc_t + UR_STRUCTURE_TYPE_QUEUE_PROPERTIES = 14, ///< ::ur_queue_properties_t + UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES = 15, ///< ::ur_queue_index_properties_t + UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES = 16, ///< ::ur_context_native_properties_t + UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES = 17, ///< ::ur_kernel_native_properties_t + UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES = 18, ///< ::ur_queue_native_properties_t + UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES = 19, ///< ::ur_mem_native_properties_t + UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES = 20, ///< ::ur_event_native_properties_t + UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES = 21, ///< ::ur_platform_native_properties_t + UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES = 22, ///< ::ur_device_native_properties_t + UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES = 23, ///< ::ur_program_native_properties_t + UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES = 24, ///< ::ur_sampler_native_properties_t + UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC = 25, ///< ::ur_queue_native_desc_t + UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES = 26, ///< ::ur_device_partition_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES = 27, ///< ::ur_kernel_arg_mem_obj_properties_t + UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES = 28, ///< ::ur_physical_mem_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES = 29, ///< ::ur_kernel_arg_pointer_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES = 30, ///< ::ur_kernel_arg_sampler_properties_t + UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES = 31, ///< ::ur_kernel_exec_info_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES = 32, ///< ::ur_kernel_arg_value_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES = 33, ///< ::ur_kernel_arg_local_properties_t + UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC = 35, ///< ::ur_usm_alloc_location_desc_t + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC = 0x1000, ///< ::ur_exp_command_buffer_desc_t + UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES = 0x2000, ///< ::ur_exp_sampler_mip_properties_t + UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC = 0x2001, ///< ::ur_exp_interop_mem_desc_t + UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC = 0x2002, ///< ::ur_exp_interop_semaphore_desc_t + UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR = 0x2003, ///< ::ur_exp_file_descriptor_t + UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t + UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES = 0x2005, ///< ::ur_exp_sampler_addr_modes_t /// @cond UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -3287,6 +3287,25 @@ typedef struct ur_usm_device_desc_t { } ur_usm_device_desc_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM allocation location desc +/// +/// @details +/// - Specify these properties in ::urUSMHostAlloc, ::urUSMDeviceAlloc and +/// ::urUSMSharedAlloc via ::ur_usm_desc_t as part of a `pNext` chain. +/// +/// @remarks +/// _Analogues_ +/// - cl_intel_mem_alloc_buffer_location +typedef struct ur_usm_alloc_location_desc_t { + ur_structure_type_t stype; ///< [in] type of this structure, must be + ///< ::UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC + const void *pNext; ///< [in][optional] pointer to extension-specific structure + uint32_t location; ///< [in] Identifies the ID of global memory partition to which the memory + ///< should be allocated. + +} ur_usm_alloc_location_desc_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief USM pool descriptor type typedef struct ur_usm_pool_desc_t { @@ -3324,6 +3343,7 @@ typedef struct ur_usm_pool_limits_desc_t { /// - Any flags/hints passed through pUSMDesc only affect the single /// allocation. /// - See also ::ur_usm_host_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -3369,6 +3389,7 @@ urUSMHostAlloc( /// - Any flags/hints passed through pUSMDesc only affect the single /// allocation. /// - See also ::ur_usm_device_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -3417,6 +3438,7 @@ urUSMDeviceAlloc( /// allocation. /// - See also ::ur_usm_host_desc_t. /// - See also ::ur_usm_device_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -7129,21 +7151,6 @@ typedef struct ur_exp_interop_semaphore_desc_t { } ur_exp_interop_semaphore_desc_t; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Describes layered image properties -/// -/// @details -/// - Specify these properties in ::urBindlessImagesUnsampledImageCreateExp -/// or ::urBindlessImagesSampledImageCreateExp via ::ur_image_desc_t as -/// part of a `pNext` chain. -typedef struct ur_exp_layered_image_properties_t { - ur_structure_type_t stype; ///< [in] type of this structure, must be - ///< ::UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - uint32_t numLayers; ///< [in] number of layers the image should have - -} ur_exp_layered_image_properties_t; - /////////////////////////////////////////////////////////////////////////////// /// @brief USM allocate pitched memory /// diff --git a/include/ur_print.hpp b/include/ur_print.hpp index 9a0ce9e657..70e5b9886d 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -267,6 +267,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_usm_advice_flag_t value); inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_desc_t params); inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_host_desc_t params); inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_device_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_alloc_location_desc_t params); inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_desc_t params); inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_limits_desc_t params); inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_info_t value); @@ -317,7 +318,6 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_addr_modes_t params); inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_mem_desc_t params); inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_semaphore_desc_t params); -inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_layered_image_properties_t params); inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_desc_t params); inline std::ostream &operator<<(std::ostream &os, ur_exp_peer_info_t value); @@ -993,6 +993,9 @@ inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value) { case UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES: os << "UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES"; break; + case UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC: + os << "UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC"; + break; case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC: os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC"; break; @@ -1011,9 +1014,6 @@ inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value) { case UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE: os << "UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE"; break; - case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: - os << "UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES"; - break; case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES"; break; @@ -1204,6 +1204,11 @@ inline ur_result_t printStruct(std::ostream &os, const void *ptr) { printPtr(os, pstruct); } break; + case UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC: { + const ur_usm_alloc_location_desc_t *pstruct = (const ur_usm_alloc_location_desc_t *)ptr; + printPtr(os, pstruct); + } break; + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC: { const ur_exp_command_buffer_desc_t *pstruct = (const ur_exp_command_buffer_desc_t *)ptr; printPtr(os, pstruct); @@ -1234,11 +1239,6 @@ inline ur_result_t printStruct(std::ostream &os, const void *ptr) { printPtr(os, pstruct); } break; - case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: { - const ur_exp_layered_image_properties_t *pstruct = (const ur_exp_layered_image_properties_t *)ptr; - printPtr(os, pstruct); - } break; - case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: { const ur_exp_sampler_addr_modes_t *pstruct = (const ur_exp_sampler_addr_modes_t *)ptr; printPtr(os, pstruct); @@ -6537,6 +6537,31 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_device_des return os; } /////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_alloc_location_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_alloc_location_desc_t params) { + os << "(struct ur_usm_alloc_location_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, + (params.pNext)); + + os << ", "; + os << ".location = "; + + os << (params.location); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_usm_pool_desc_t type /// @returns /// std::ostream & @@ -9096,31 +9121,6 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_interop_se return os; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Print operator for the ur_exp_layered_image_properties_t type -/// @returns -/// std::ostream & -inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_layered_image_properties_t params) { - os << "(struct ur_exp_layered_image_properties_t){"; - - os << ".stype = "; - - os << (params.stype); - - os << ", "; - os << ".pNext = "; - - ur::details::printStruct(os, - (params.pNext)); - - os << ", "; - os << ".numLayers = "; - - os << (params.numLayers); - - os << "}"; - return os; -} -/////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_exp_command_buffer_desc_t type /// @returns /// std::ostream & diff --git a/scripts/core/EXP-BINDLESS-IMAGES.rst b/scripts/core/EXP-BINDLESS-IMAGES.rst index c794c199d9..fe6a1ac32b 100644 --- a/scripts/core/EXP-BINDLESS-IMAGES.rst +++ b/scripts/core/EXP-BINDLESS-IMAGES.rst @@ -68,7 +68,6 @@ Enums ${X}_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC ${X}_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR ${X}_STRUCTURE_TYPE_EXP_WIN32_HANDLE - ${X}_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES ${X}_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES * ${x}_device_info_t @@ -129,7 +128,6 @@ Types * ${x}_exp_interop_semaphore_desc_t * ${x}_exp_file_descriptor_t * ${x}_exp_win32_handle_t -* ${x}_exp_layered_image_properties_t * ${x}_exp_sampler_addr_modes_t Functions @@ -184,6 +182,8 @@ Changelog +----------+-------------------------------------------------------------+ | 8.0 | Added structure for sampler addressing modes per dimension. | +------------------------------------------------------------------------+ +| 9.0 | Remove layered image properties struct. | ++------------------------------------------------------------------------+ Contributors -------------------------------------------------------------------------------- diff --git a/scripts/core/exp-bindless-images.yml b/scripts/core/exp-bindless-images.yml index b5f87a6633..d2e508c4a7 100644 --- a/scripts/core/exp-bindless-images.yml +++ b/scripts/core/exp-bindless-images.yml @@ -107,12 +107,9 @@ etors: - name: EXP_WIN32_HANDLE desc: $x_exp_win32_handle_t value: "0x2004" - - name: EXP_LAYERED_IMAGE_PROPERTIES - desc: $x_exp_layered_image_properties_t - value: "0x2005" - name: EXP_SAMPLER_ADDR_MODES desc: $x_exp_sampler_addr_modes_t - value: "0x2006" + value: "0x2005" --- #-------------------------------------------------------------------------- type: enum extend: true @@ -205,20 +202,6 @@ name: $x_exp_interop_semaphore_desc_t base: $x_base_desc_t members: [] --- #-------------------------------------------------------------------------- -type: struct -desc: "Describes layered image properties" -details: - - Specify these properties in $xBindlessImagesUnsampledImageCreateExp or - $xBindlessImagesSampledImageCreateExp via $x_image_desc_t as part of a - `pNext` chain. -class: $xBindlessImages -name: $x_exp_layered_image_properties_t -base: $x_base_properties_t -members: - - type: uint32_t - name: numLayers - desc: "[in] number of layers the image should have" ---- #-------------------------------------------------------------------------- type: function desc: "USM allocate pitched memory" class: $xUSM diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index deb5ee9604..6195cd4980 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -666,3 +666,6 @@ etors: - name: KERNEL_ARG_LOCAL_PROPERTIES desc: $x_kernel_arg_local_properties_t value: '33' +- name: USM_ALLOC_LOCATION_DESC + desc: $x_usm_alloc_location_desc_t + value: '35' diff --git a/scripts/core/usm.yml b/scripts/core/usm.yml index 0b793d7226..1476eec34a 100644 --- a/scripts/core/usm.yml +++ b/scripts/core/usm.yml @@ -175,6 +175,23 @@ members: desc: "[in] device memory allocation flags." --- #-------------------------------------------------------------------------- type: struct +desc: "USM allocation location desc" +details: + - Specify these properties in $xUSMHostAlloc, $xUSMDeviceAlloc and + $xUSMSharedAlloc via $x_usm_desc_t as part of a `pNext` chain. +analogue: + - "cl_intel_mem_alloc_buffer_location" +class: $xUSM +name: $x_usm_alloc_location_desc_t +base: $x_base_desc_t +members: + - type: uint32_t + name: location + desc: > + [in] Identifies the ID of global memory partition to which the memory + should be allocated. +--- #-------------------------------------------------------------------------- +type: struct desc: "USM pool descriptor type" class: $xUSM name: $x_usm_pool_desc_t @@ -212,6 +229,7 @@ details: - "Allocations served from different memory pools must be isolated and must not reside on the same page." - "Any flags/hints passed through pUSMDesc only affect the single allocation." - "See also $x_usm_host_desc_t." + - "See also $x_usm_alloc_location_desc_t." params: - type: $x_context_handle_t name: hContext @@ -253,6 +271,7 @@ details: - "Allocations served from different memory pools must be isolated and must not reside on the same page." - "Any flags/hints passed through pUSMDesc only affect the single allocation." - "See also $x_usm_device_desc_t." + - "See also $x_usm_alloc_location_desc_t." params: - type: $x_context_handle_t name: hContext @@ -298,6 +317,7 @@ details: - "Any flags/hints passed through pUSMDesc only affect the single allocation." - "See also $x_usm_host_desc_t." - "See also $x_usm_device_desc_t." + - "See also $x_usm_alloc_location_desc_t." params: - type: $x_context_handle_t name: hContext diff --git a/scripts/templates/ldrddi.cpp.mako b/scripts/templates/ldrddi.cpp.mako index f79f2aca3b..eaca102ea9 100644 --- a/scripts/templates/ldrddi.cpp.mako +++ b/scripts/templates/ldrddi.cpp.mako @@ -130,14 +130,17 @@ namespace ur_loader %else: <%param_replacements={}%> %for i, item in enumerate(th.get_loader_prologue(n, tags, obj, meta)): - %if 0 == i: + %if not '_native_object_' in item['obj'] or th.make_func_name(n, tags, obj) == 'urPlatformCreateWithNativeHandle': // extract platform's function pointer table auto dditable = reinterpret_cast<${item['obj']}*>( ${item['pointer']}${item['name']} )->dditable; auto ${th.make_pfn_name(n, tags, obj)} = dditable->${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}; if( nullptr == ${th.make_pfn_name(n, tags, obj)} ) return ${X}_RESULT_ERROR_UNINITIALIZED; + <%break%> %endif + %endfor + %for i, item in enumerate(th.get_loader_prologue(n, tags, obj, meta)): %if 'range' in item: <% add_local = True @@ -146,6 +149,7 @@ namespace ur_loader for( size_t i = ${item['range'][0]}; i < ${item['range'][1]}; ++i ) ${item['name']}Local[ i ] = reinterpret_cast<${item['obj']}*>( ${item['name']}[ i ] )->handle; %else: + %if not '_native_object_' in item['obj'] or th.make_func_name(n, tags, obj) == 'urPlatformCreateWithNativeHandle': // convert loader handle to platform handle %if item['optional']: ${item['name']} = ( ${item['name']} ) ? reinterpret_cast<${item['obj']}*>( ${item['name']} )->handle : nullptr; @@ -153,6 +157,7 @@ namespace ur_loader ${item['name']} = reinterpret_cast<${item['obj']}*>( ${item['name']} )->handle; %endif %endif + %endif %endfor // forward to device-platform @@ -173,7 +178,7 @@ namespace ur_loader %if item['release']: // release loader handle ${item['factory']}.release( ${item['name']} ); - %else: + %elif not '_native_object_' in item['obj'] or th.make_func_name(n, tags, obj) == 'urPlatformCreateWithNativeHandle': try { %if 'range' in item: diff --git a/source/adapters/opencl/usm.cpp b/source/adapters/opencl/usm.cpp index 5d46aec2ef..0d64f23d13 100644 --- a/source/adapters/opencl/usm.cpp +++ b/source/adapters/opencl/usm.cpp @@ -10,6 +10,75 @@ #include "common.hpp" +inline cl_mem_alloc_flags_intel +hostDescToClFlags(const ur_usm_host_desc_t &desc) { + cl_mem_alloc_flags_intel allocFlags = 0; + if (desc.flags & UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT) { + allocFlags |= CL_MEM_ALLOC_INITIAL_PLACEMENT_HOST_INTEL; + } + return allocFlags; +} + +inline cl_mem_alloc_flags_intel +deviceDescToClFlags(const ur_usm_device_desc_t &desc) { + cl_mem_alloc_flags_intel allocFlags = 0; + if (desc.flags & UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT) { + allocFlags |= CL_MEM_ALLOC_INITIAL_PLACEMENT_DEVICE_INTEL; + } + if (desc.flags & UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED) { + allocFlags |= CL_MEM_ALLOC_WRITE_COMBINED_INTEL; + } + return allocFlags; +} + +ur_result_t +usmDescToCLMemProperties(const ur_base_desc_t *Desc, + std::vector &Properties) { + cl_mem_alloc_flags_intel AllocFlags = 0; + const auto *Next = Desc; + do { + switch (Next->stype) { + case UR_STRUCTURE_TYPE_USM_HOST_DESC: { + auto HostDesc = reinterpret_cast(Next); + if (UR_USM_HOST_MEM_FLAGS_MASK & HostDesc->flags) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + AllocFlags |= hostDescToClFlags(*HostDesc); + break; + } + case UR_STRUCTURE_TYPE_USM_DEVICE_DESC: { + auto DeviceDesc = reinterpret_cast(Next); + if (UR_USM_HOST_MEM_FLAGS_MASK & DeviceDesc->flags) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + AllocFlags |= deviceDescToClFlags(*DeviceDesc); + break; + } + case UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC: { + auto LocationDesc = + reinterpret_cast(Next); + Properties.push_back(CL_MEM_ALLOC_BUFFER_LOCATION_INTEL); + // CL bitfields are cl_ulong + Properties.push_back(static_cast(LocationDesc->location)); + break; + } + default: + return UR_RESULT_ERROR_INVALID_VALUE; + } + + Next = Next->pNext ? static_cast(Next->pNext) + : nullptr; + } while (Next); + + if (AllocFlags) { + Properties.push_back(CL_MEM_ALLOC_FLAGS_INTEL); + Properties.push_back(AllocFlags); + } + Properties.push_back(0); + + return UR_RESULT_SUCCESS; +} + UR_APIEXPORT ur_result_t UR_APICALL urUSMHostAlloc(ur_context_handle_t hContext, const ur_usm_desc_t *pUSMDesc, ur_usm_pool_handle_t, size_t size, void **ppMem) { @@ -17,23 +86,10 @@ urUSMHostAlloc(ur_context_handle_t hContext, const ur_usm_desc_t *pUSMDesc, void *Ptr = nullptr; uint32_t Alignment = pUSMDesc ? pUSMDesc->align : 0; - cl_mem_alloc_flags_intel Flags = 0; - cl_mem_properties_intel Properties[3]; - - if (pUSMDesc && pUSMDesc->pNext && - static_cast(pUSMDesc->pNext)->stype == - UR_STRUCTURE_TYPE_USM_HOST_DESC) { - const auto *HostDesc = - static_cast(pUSMDesc->pNext); - - if (HostDesc->flags & UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT) { - Flags |= CL_MEM_ALLOC_INITIAL_PLACEMENT_HOST_INTEL; - } - Properties[0] = CL_MEM_ALLOC_FLAGS_INTEL; - Properties[1] = Flags; - Properties[2] = 0; - } else { - Properties[0] = 0; + std::vector AllocProperties; + if (pUSMDesc && pUSMDesc->pNext) { + UR_RETURN_ON_FAILURE(usmDescToCLMemProperties( + static_cast(pUSMDesc->pNext), AllocProperties)); } // First we need to look up the function pointer @@ -47,7 +103,9 @@ urUSMHostAlloc(ur_context_handle_t hContext, const ur_usm_desc_t *pUSMDesc, if (FuncPtr) { cl_int ClResult = CL_SUCCESS; - Ptr = FuncPtr(CLContext, Properties, size, Alignment, &ClResult); + Ptr = FuncPtr(CLContext, + AllocProperties.empty() ? nullptr : AllocProperties.data(), + size, Alignment, &ClResult); if (ClResult == CL_INVALID_BUFFER_SIZE) { return UR_RESULT_ERROR_INVALID_USM_SIZE; } @@ -71,25 +129,10 @@ urUSMDeviceAlloc(ur_context_handle_t hContext, ur_device_handle_t hDevice, void *Ptr = nullptr; uint32_t Alignment = pUSMDesc ? pUSMDesc->align : 0; - cl_mem_alloc_flags_intel Flags = 0; - cl_mem_properties_intel Properties[3]; - if (pUSMDesc && pUSMDesc->pNext && - static_cast(pUSMDesc->pNext)->stype == - UR_STRUCTURE_TYPE_USM_DEVICE_DESC) { - const auto *HostDesc = - static_cast(pUSMDesc->pNext); - - if (HostDesc->flags & UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT) { - Flags |= CL_MEM_ALLOC_INITIAL_PLACEMENT_DEVICE_INTEL; - } - if (HostDesc->flags & UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED) { - Flags |= CL_MEM_ALLOC_WRITE_COMBINED_INTEL; - } - Properties[0] = CL_MEM_ALLOC_FLAGS_INTEL; - Properties[1] = Flags; - Properties[2] = 0; - } else { - Properties[0] = 0; + std::vector AllocProperties; + if (pUSMDesc && pUSMDesc->pNext) { + UR_RETURN_ON_FAILURE(usmDescToCLMemProperties( + static_cast(pUSMDesc->pNext), AllocProperties)); } // First we need to look up the function pointer @@ -104,8 +147,8 @@ urUSMDeviceAlloc(ur_context_handle_t hContext, ur_device_handle_t hDevice, if (FuncPtr) { cl_int ClResult = CL_SUCCESS; Ptr = FuncPtr(CLContext, cl_adapter::cast(hDevice), - cl_adapter::cast(Properties), size, - Alignment, &ClResult); + AllocProperties.empty() ? nullptr : AllocProperties.data(), + size, Alignment, &ClResult); if (ClResult == CL_INVALID_BUFFER_SIZE) { return UR_RESULT_ERROR_INVALID_USM_SIZE; } @@ -129,35 +172,10 @@ urUSMSharedAlloc(ur_context_handle_t hContext, ur_device_handle_t hDevice, void *Ptr = nullptr; uint32_t Alignment = pUSMDesc ? pUSMDesc->align : 0; - cl_mem_alloc_flags_intel Flags = 0; - const auto *NextStruct = - (pUSMDesc ? static_cast(pUSMDesc->pNext) - : nullptr); - while (NextStruct) { - if (NextStruct->stype == UR_STRUCTURE_TYPE_USM_HOST_DESC) { - const auto *HostDesc = - reinterpret_cast(NextStruct); - if (HostDesc->flags & UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT) { - Flags |= CL_MEM_ALLOC_INITIAL_PLACEMENT_HOST_INTEL; - } - } else if (NextStruct->stype == UR_STRUCTURE_TYPE_USM_DEVICE_DESC) { - const auto *DevDesc = - reinterpret_cast(NextStruct); - if (DevDesc->flags & UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT) { - Flags |= CL_MEM_ALLOC_INITIAL_PLACEMENT_DEVICE_INTEL; - } - if (DevDesc->flags & UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED) { - Flags |= CL_MEM_ALLOC_WRITE_COMBINED_INTEL; - } - } - NextStruct = static_cast(NextStruct->pNext); - } - - cl_mem_properties_intel Properties[3] = {CL_MEM_ALLOC_FLAGS_INTEL, Flags, 0}; - - // Passing a flags value of 0 doesn't work, so truncate the properties - if (Flags == 0) { - Properties[0] = 0; + std::vector AllocProperties; + if (pUSMDesc && pUSMDesc->pNext) { + UR_RETURN_ON_FAILURE(usmDescToCLMemProperties( + static_cast(pUSMDesc->pNext), AllocProperties)); } // First we need to look up the function pointer @@ -172,8 +190,8 @@ urUSMSharedAlloc(ur_context_handle_t hContext, ur_device_handle_t hDevice, if (FuncPtr) { cl_int ClResult = CL_SUCCESS; Ptr = FuncPtr(CLContext, cl_adapter::cast(hDevice), - cl_adapter::cast(Properties), size, - Alignment, cl_adapter::cast(&ClResult)); + AllocProperties.empty() ? nullptr : AllocProperties.data(), + size, Alignment, cl_adapter::cast(&ClResult)); if (ClResult == CL_INVALID_BUFFER_SIZE) { return UR_RESULT_ERROR_INVALID_USM_SIZE; } diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 5d7df7e672..6d3dda30f0 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -352,14 +352,6 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetNativeHandle( return result; } - try { - // convert platform handle to loader handle - *phNativePlatform = reinterpret_cast( - ur_native_factory.getInstance(*phNativePlatform, dditable)); - } catch (std::bad_alloc &) { - result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return result; } @@ -673,14 +665,6 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetNativeHandle( return result; } - try { - // convert platform handle to loader handle - *phNativeDevice = reinterpret_cast( - ur_native_factory.getInstance(*phNativeDevice, dditable)); - } catch (std::bad_alloc &) { - result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return result; } @@ -699,17 +683,13 @@ __urdlllocal ur_result_t UR_APICALL urDeviceCreateWithNativeHandle( // extract platform's function pointer table auto dditable = - reinterpret_cast(hNativeDevice)->dditable; + reinterpret_cast(hPlatform)->dditable; auto pfnCreateWithNativeHandle = dditable->ur.Device.pfnCreateWithNativeHandle; if (nullptr == pfnCreateWithNativeHandle) { return UR_RESULT_ERROR_UNINITIALIZED; } - // convert loader handle to platform handle - hNativeDevice = - reinterpret_cast(hNativeDevice)->handle; - // convert loader handle to platform handle hPlatform = reinterpret_cast(hPlatform)->handle; @@ -916,14 +896,6 @@ __urdlllocal ur_result_t UR_APICALL urContextGetNativeHandle( return result; } - try { - // convert platform handle to loader handle - *phNativeContext = reinterpret_cast( - ur_native_factory.getInstance(*phNativeContext, dditable)); - } catch (std::bad_alloc &) { - result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return result; } @@ -944,17 +916,13 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle( // extract platform's function pointer table auto dditable = - reinterpret_cast(hNativeContext)->dditable; + reinterpret_cast(*phDevices)->dditable; auto pfnCreateWithNativeHandle = dditable->ur.Context.pfnCreateWithNativeHandle; if (nullptr == pfnCreateWithNativeHandle) { return UR_RESULT_ERROR_UNINITIALIZED; } - // convert loader handle to platform handle - hNativeContext = - reinterpret_cast(hNativeContext)->handle; - // convert loader handles to platform handles auto phDevicesLocal = std::vector(numDevices); for (size_t i = 0; i < numDevices; ++i) { @@ -1207,14 +1175,6 @@ __urdlllocal ur_result_t UR_APICALL urMemGetNativeHandle( return result; } - try { - // convert platform handle to loader handle - *phNativeMem = reinterpret_cast( - ur_native_factory.getInstance(*phNativeMem, dditable)); - } catch (std::bad_alloc &) { - result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return result; } @@ -1232,17 +1192,13 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle( ur_result_t result = UR_RESULT_SUCCESS; // extract platform's function pointer table - auto dditable = - reinterpret_cast(hNativeMem)->dditable; + auto dditable = reinterpret_cast(hContext)->dditable; auto pfnBufferCreateWithNativeHandle = dditable->ur.Mem.pfnBufferCreateWithNativeHandle; if (nullptr == pfnBufferCreateWithNativeHandle) { return UR_RESULT_ERROR_UNINITIALIZED; } - // convert loader handle to platform handle - hNativeMem = reinterpret_cast(hNativeMem)->handle; - // convert loader handle to platform handle hContext = reinterpret_cast(hContext)->handle; @@ -1282,17 +1238,13 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( ur_result_t result = UR_RESULT_SUCCESS; // extract platform's function pointer table - auto dditable = - reinterpret_cast(hNativeMem)->dditable; + auto dditable = reinterpret_cast(hContext)->dditable; auto pfnImageCreateWithNativeHandle = dditable->ur.Mem.pfnImageCreateWithNativeHandle; if (nullptr == pfnImageCreateWithNativeHandle) { return UR_RESULT_ERROR_UNINITIALIZED; } - // convert loader handle to platform handle - hNativeMem = reinterpret_cast(hNativeMem)->handle; - // convert loader handle to platform handle hContext = reinterpret_cast(hContext)->handle; @@ -1528,14 +1480,6 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetNativeHandle( return result; } - try { - // convert platform handle to loader handle - *phNativeSampler = reinterpret_cast( - ur_native_factory.getInstance(*phNativeSampler, dditable)); - } catch (std::bad_alloc &) { - result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return result; } @@ -1553,18 +1497,13 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( ur_result_t result = UR_RESULT_SUCCESS; // extract platform's function pointer table - auto dditable = - reinterpret_cast(hNativeSampler)->dditable; + auto dditable = reinterpret_cast(hContext)->dditable; auto pfnCreateWithNativeHandle = dditable->ur.Sampler.pfnCreateWithNativeHandle; if (nullptr == pfnCreateWithNativeHandle) { return UR_RESULT_ERROR_UNINITIALIZED; } - // convert loader handle to platform handle - hNativeSampler = - reinterpret_cast(hNativeSampler)->handle; - // convert loader handle to platform handle hContext = reinterpret_cast(hContext)->handle; @@ -2604,14 +2543,6 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetNativeHandle( return result; } - try { - // convert platform handle to loader handle - *phNativeProgram = reinterpret_cast( - ur_native_factory.getInstance(*phNativeProgram, dditable)); - } catch (std::bad_alloc &) { - result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return result; } @@ -2629,18 +2560,13 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle( ur_result_t result = UR_RESULT_SUCCESS; // extract platform's function pointer table - auto dditable = - reinterpret_cast(hNativeProgram)->dditable; + auto dditable = reinterpret_cast(hContext)->dditable; auto pfnCreateWithNativeHandle = dditable->ur.Program.pfnCreateWithNativeHandle; if (nullptr == pfnCreateWithNativeHandle) { return UR_RESULT_ERROR_UNINITIALIZED; } - // convert loader handle to platform handle - hNativeProgram = - reinterpret_cast(hNativeProgram)->handle; - // convert loader handle to platform handle hContext = reinterpret_cast(hContext)->handle; @@ -3088,14 +3014,6 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetNativeHandle( return result; } - try { - // convert platform handle to loader handle - *phNativeKernel = reinterpret_cast( - ur_native_factory.getInstance(*phNativeKernel, dditable)); - } catch (std::bad_alloc &) { - result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return result; } @@ -3115,18 +3033,13 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreateWithNativeHandle( ur_result_t result = UR_RESULT_SUCCESS; // extract platform's function pointer table - auto dditable = - reinterpret_cast(hNativeKernel)->dditable; + auto dditable = reinterpret_cast(hContext)->dditable; auto pfnCreateWithNativeHandle = dditable->ur.Kernel.pfnCreateWithNativeHandle; if (nullptr == pfnCreateWithNativeHandle) { return UR_RESULT_ERROR_UNINITIALIZED; } - // convert loader handle to platform handle - hNativeKernel = - reinterpret_cast(hNativeKernel)->handle; - // convert loader handle to platform handle hContext = reinterpret_cast(hContext)->handle; @@ -3300,14 +3213,6 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetNativeHandle( return result; } - try { - // convert platform handle to loader handle - *phNativeQueue = reinterpret_cast( - ur_native_factory.getInstance(*phNativeQueue, dditable)); - } catch (std::bad_alloc &) { - result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return result; } @@ -3326,17 +3231,13 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreateWithNativeHandle( ur_result_t result = UR_RESULT_SUCCESS; // extract platform's function pointer table - auto dditable = - reinterpret_cast(hNativeQueue)->dditable; + auto dditable = reinterpret_cast(hContext)->dditable; auto pfnCreateWithNativeHandle = dditable->ur.Queue.pfnCreateWithNativeHandle; if (nullptr == pfnCreateWithNativeHandle) { return UR_RESULT_ERROR_UNINITIALIZED; } - // convert loader handle to platform handle - hNativeQueue = reinterpret_cast(hNativeQueue)->handle; - // convert loader handle to platform handle hContext = reinterpret_cast(hContext)->handle; @@ -3573,14 +3474,6 @@ __urdlllocal ur_result_t UR_APICALL urEventGetNativeHandle( return result; } - try { - // convert platform handle to loader handle - *phNativeEvent = reinterpret_cast( - ur_native_factory.getInstance(*phNativeEvent, dditable)); - } catch (std::bad_alloc &) { - result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return result; } @@ -3598,17 +3491,13 @@ __urdlllocal ur_result_t UR_APICALL urEventCreateWithNativeHandle( ur_result_t result = UR_RESULT_SUCCESS; // extract platform's function pointer table - auto dditable = - reinterpret_cast(hNativeEvent)->dditable; + auto dditable = reinterpret_cast(hContext)->dditable; auto pfnCreateWithNativeHandle = dditable->ur.Event.pfnCreateWithNativeHandle; if (nullptr == pfnCreateWithNativeHandle) { return UR_RESULT_ERROR_UNINITIALIZED; } - // convert loader handle to platform handle - hNativeEvent = reinterpret_cast(hNativeEvent)->handle; - // convert loader handle to platform handle hContext = reinterpret_cast(hContext)->handle; diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 80d1bc3fb6..4b7525d92f 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -2121,6 +2121,7 @@ ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( /// - Any flags/hints passed through pUSMDesc only affect the single /// allocation. /// - See also ::ur_usm_host_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -2177,6 +2178,7 @@ ur_result_t UR_APICALL urUSMHostAlloc( /// - Any flags/hints passed through pUSMDesc only affect the single /// allocation. /// - See also ::ur_usm_device_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -2236,6 +2238,7 @@ ur_result_t UR_APICALL urUSMDeviceAlloc( /// allocation. /// - See also ::ur_usm_host_desc_t. /// - See also ::ur_usm_device_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. /// /// @returns /// - ::UR_RESULT_SUCCESS diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 3a7cebca8c..eeca6c0c95 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -1811,6 +1811,7 @@ ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( /// - Any flags/hints passed through pUSMDesc only affect the single /// allocation. /// - See also ::ur_usm_host_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -1861,6 +1862,7 @@ ur_result_t UR_APICALL urUSMHostAlloc( /// - Any flags/hints passed through pUSMDesc only affect the single /// allocation. /// - See also ::ur_usm_device_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -1914,6 +1916,7 @@ ur_result_t UR_APICALL urUSMDeviceAlloc( /// allocation. /// - See also ::ur_usm_host_desc_t. /// - See also ::ur_usm_device_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. /// /// @returns /// - ::UR_RESULT_SUCCESS diff --git a/test/conformance/usm/usm_adapter_opencl.match b/test/conformance/usm/usm_adapter_opencl.match index b9aa3f3bdf..16211ba8e7 100644 --- a/test/conformance/usm/usm_adapter_opencl.match +++ b/test/conformance/usm/usm_adapter_opencl.match @@ -1,6 +1,5 @@ urUSMDeviceAllocTest.Success/Intel_R__OpenCL___{{.*}}___UsePoolEnabled urUSMDeviceAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolEnabled -urUSMDeviceAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolDisabled urUSMDeviceAllocTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}___UsePoolEnabled urUSMDeviceAllocTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UsePoolEnabled urUSMDeviceAllocTest.InvalidNullPtrResult/Intel_R__OpenCL___{{.*}}___UsePoolEnabled @@ -9,7 +8,6 @@ urUSMDeviceAllocTest.InvalidValueAlignPowerOfTwo/Intel_R__OpenCL___{{.*}}___UseP urUSMAllocInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_USM_ALLOC_INFO_POOL urUSMHostAllocTest.Success/Intel_R__OpenCL___{{.*}}___UsePoolEnabled urUSMHostAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolEnabled -urUSMHostAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolDisabled urUSMHostAllocTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}___UsePoolEnabled urUSMHostAllocTest.InvalidNullPtrMem/Intel_R__OpenCL___{{.*}}___UsePoolEnabled urUSMHostAllocTest.InvalidUSMSize/Intel_R__OpenCL___{{.*}}___UsePoolEnabled