From fc60063702ec4a4faf36056024f764fed0170943 Mon Sep 17 00:00:00 2001 From: SYCL Unbound Team Date: Wed, 28 Jun 2023 14:11:21 +0100 Subject: [PATCH 01/19] [SYCL][Bindless][2/4] Add experimental implementation of SYCL bindless images extension This commit stands as the second commit of four to make code review easier, covering the changes made to the PI. Co-authored-by: Isaac Ault Co-authored-by: Hugh Bird Co-authored-by: Duncan Brawley Co-authored-by: Przemek Malon Co-authored-by: Chedy Najjar Co-authored-by: Sean Stirling Co-authored-by: Peter Zuzek Implement revision 4 of the bindless images extension proposal: https://github.com/intel/llvm/pull/9842 --- sycl/include/sycl/detail/pi.def | 22 + sycl/include/sycl/detail/pi.h | 270 +++- sycl/include/sycl/detail/pi.hpp | 7 + sycl/include/sycl/sampler.hpp | 19 + sycl/plugins/cuda/CMakeLists.txt | 2 + sycl/plugins/cuda/pi_cuda.cpp | 25 + .../esimd_emulator/pi_esimd_emulator.cpp | 2 +- sycl/plugins/hip/pi_hip.hpp | 15 +- sycl/plugins/level_zero/pi_level_zero.cpp | 263 +++- sycl/plugins/opencl/pi_opencl.cpp | 3 + sycl/plugins/unified_runtime/CMakeLists.txt | 4 +- sycl/plugins/unified_runtime/pi2ur.hpp | 671 ++++++++++ .../unified_runtime/pi_unified_runtime.cpp | 4 +- .../ur/adapters/cuda/device.cpp | 79 ++ .../ur/adapters/cuda/enqueue.cpp | 1 + .../ur/adapters/cuda/enqueue.hpp | 16 + .../ur/adapters/cuda/image.cpp | 1101 +++++++++++++++++ .../ur/adapters/cuda/image.hpp | 31 + .../ur/adapters/cuda/memory.hpp | 41 +- .../ur/adapters/cuda/sampler.cpp | 15 + .../ur/adapters/cuda/sampler.hpp | 15 +- .../ur/adapters/cuda/ur_interface_loader.cpp | 43 + sycl/source/detail/sampler_impl.cpp | 28 +- sycl/source/detail/sampler_impl.hpp | 17 +- sycl/source/sampler.cpp | 26 +- sycl/test/abi/sycl_symbols_linux.dump | 14 +- sycl/unittests/helpers/PiMockPlugin.hpp | 149 ++- 27 files changed, 2855 insertions(+), 28 deletions(-) create mode 100644 sycl/plugins/unified_runtime/ur/adapters/cuda/enqueue.hpp create mode 100644 sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp create mode 100644 sycl/plugins/unified_runtime/ur/adapters/cuda/image.hpp diff --git a/sycl/include/sycl/detail/pi.def b/sycl/include/sycl/detail/pi.def index c97e82fb24733..8d9de2318afd3 100644 --- a/sycl/include/sycl/detail/pi.def +++ b/sycl/include/sycl/detail/pi.def @@ -126,6 +126,7 @@ _PI_API(piEnqueueMemUnmap) _PI_API(piextUSMHostAlloc) _PI_API(piextUSMDeviceAlloc) _PI_API(piextUSMSharedAlloc) +_PI_API(piextUSMPitchedAlloc) _PI_API(piextUSMFree) _PI_API(piextUSMEnqueueMemset) _PI_API(piextUSMEnqueueMemcpy) @@ -141,6 +142,27 @@ _PI_API(piextKernelSetArgSampler) _PI_API(piextPluginGetOpaqueData) +// Bindless Images +_PI_API(piextMemUnsampledImageHandleDestroy) +_PI_API(piextMemSampledImageHandleDestroy) +_PI_API(piextMemImageAllocate) +_PI_API(piextMemImageFree) +_PI_API(piextMemUnsampledImageCreate) +_PI_API(piextMemSampledImageCreate) +_PI_API(piextMemImageCopy) +_PI_API(piextMemImageGetInfo) +_PI_API(piextMemMipmapGetLevel) +_PI_API(piextMemMipmapFree) + +// Interop +_PI_API(piextMemImportOpaqueFD) +_PI_API(piextMemReleaseInterop) +_PI_API(piextMemMapExternalArray) +_PI_API(piextImportExternalSemaphoreOpaqueFD) +_PI_API(piextDestroyExternalSemaphore) +_PI_API(piextWaitExternalSemaphore) +_PI_API(piextSignalExternalSemaphore) + _PI_API(piPluginGetLastError) _PI_API(piTearDown) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index 9ae07e72c4d5e..d7e18fe5cff5d 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -356,6 +356,25 @@ typedef enum { PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT = 0x20008, // The number of max registers per block (device specific) PI_EXT_CODEPLAY_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP = 0x20009, + + // Bindless images, mipmaps, interop + PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT = 0x20100, + PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT = 0x20101, + PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT = 0x20102, + PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT = 0x20103, + PI_EXT_ONEAPI_DEVICE_INFO_IMAGE_PITCH_ALIGN = 0x20104, + PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH = 0x20105, + PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT = 0x20106, + PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH = 0x20107, + PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_SUPPORT = 0x20108, + PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT = 0x20109, + PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY = 0x2010A, + PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT = 0x2010B, + PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT = 0x2010C, + PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT = 0x2010D, + PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT = 0x2010E, + PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT = 0x2010F, + } _pi_device_info; typedef enum { @@ -426,7 +445,7 @@ typedef enum { PI_IMAGE_INFO_SLICE_PITCH = 0x1113, PI_IMAGE_INFO_WIDTH = 0x1114, PI_IMAGE_INFO_HEIGHT = 0x1115, - PI_IMAGE_INFO_DEPTH = 0x1116 + PI_IMAGE_INFO_DEPTH = 0x1116, } _pi_image_info; typedef enum { @@ -474,8 +493,10 @@ typedef enum { PI_COMMAND_TYPE_SVM_MEMFILL = 0x120B, PI_COMMAND_TYPE_SVM_MAP = 0x120C, PI_COMMAND_TYPE_SVM_UNMAP = 0x120D, + PI_COMMAND_TYPE_INTEROP_SEMAPHORE_WAIT = 0x120E, + PI_COMMAND_TYPE_INTEROP_SEMAPHORE_SIGNAL = 0x120F, PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_READ = 0x418E, - PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_WRITE = 0x418F + PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_WRITE = 0x418F, } _pi_command_type; typedef enum { @@ -540,6 +561,12 @@ typedef enum { PI_IMAGE_CHANNEL_TYPE_FLOAT = 0x10DE } _pi_image_channel_type; +typedef enum { + PI_IMAGE_COPY_HTOD = 0, + PI_IMAGE_COPY_DTOH = 1, + PI_IMAGE_COPY_DTOD = 2, +} _pi_image_copy_flags; + typedef enum { PI_BUFFER_CREATE_TYPE_REGION = 0x1220 } _pi_buffer_create_type; const pi_bool PI_TRUE = 1; @@ -569,6 +596,11 @@ typedef enum { PI_SAMPLER_FILTER_MODE_LINEAR = 0x1141, } _pi_sampler_filter_mode; +typedef enum { + PI_SAMPLER_MIP_FILTER_MODE_NEAREST = 0x1142, + PI_SAMPLER_MIP_FILTER_MODE_LINEAR = 0x1143, +} _pi_sampler_mip_filter_mode; + using pi_context_properties = intptr_t; using pi_device_exec_capabilities = pi_bitfield; @@ -582,6 +614,7 @@ constexpr pi_sampler_properties PI_SAMPLER_PROPERTIES_NORMALIZED_COORDS = 0x1152; constexpr pi_sampler_properties PI_SAMPLER_PROPERTIES_ADDRESSING_MODE = 0x1153; constexpr pi_sampler_properties PI_SAMPLER_PROPERTIES_FILTER_MODE = 0x1154; +constexpr pi_sampler_properties PI_SAMPLER_PROPERTIES_MIP_FILTER_MODE = 0x1155; using pi_memory_order_capabilities = pi_bitfield; constexpr pi_memory_order_capabilities PI_MEMORY_ORDER_RELAXED = 0x01; @@ -688,6 +721,7 @@ using pi_image_channel_type = _pi_image_channel_type; using pi_buffer_create_type = _pi_buffer_create_type; using pi_sampler_addressing_mode = _pi_sampler_addressing_mode; using pi_sampler_filter_mode = _pi_sampler_filter_mode; +using pi_sampler_mip_filter_mode = _pi_sampler_mip_filter_mode; using pi_sampler_info = _pi_sampler_info; using pi_event_status = _pi_event_status; using pi_program_build_info = _pi_program_build_info; @@ -697,6 +731,8 @@ using pi_kernel_info = _pi_kernel_info; using pi_profiling_info = _pi_profiling_info; using pi_kernel_cache_config = _pi_kernel_cache_config; +using pi_image_copy_flags = _pi_image_copy_flags; + // For compatibility with OpenCL define this not as enum. using pi_device_partition_property = intptr_t; static constexpr pi_device_partition_property PI_DEVICE_PARTITION_EQUALLY = @@ -1000,6 +1036,10 @@ using pi_program = _pi_program *; using pi_kernel = _pi_kernel *; using pi_event = _pi_event *; using pi_sampler = _pi_sampler *; +using pi_image_handle = pi_uint64; +using pi_image_mem_handle = void *; +using pi_interop_mem_handle = pi_uint64; +using pi_interop_semaphore_handle = pi_uint64; typedef struct { pi_image_channel_order image_channel_order; @@ -1589,6 +1629,7 @@ __SYCL_EXPORT pi_result piextEventCreateWithNativeHandle( // __SYCL_EXPORT pi_result piSamplerCreate( pi_context context, const pi_sampler_properties *sampler_properties, + float minMipmapLevelClamp, float maxMipmapLevelClamp, float maxAnisotropy, pi_sampler *result_sampler); __SYCL_EXPORT pi_result piSamplerGetInfo(pi_sampler sampler, @@ -1809,9 +1850,26 @@ __SYCL_EXPORT pi_result piextUSMSharedAlloc(void **result_ptr, pi_usm_mem_properties *properties, size_t size, pi_uint32 alignment); -/// Indicates that the allocated USM memory is no longer needed on the runtime -/// side. The actual freeing of the memory may be done in a blocking or deferred -/// manner, e.g. to avoid issues with indirect memory access from kernels. +/// Allocates memory accessible on device +/// +/// \param result_ptr contains the allocated memory +/// \param result_pitch contains the returned memory pitch +/// \param context is the pi_context +/// \param device is the device the memory will be allocated on +/// \param properties are optional allocation properties +/// \param width_in_bytes is the width of the allocation in bytes +/// \param height is the height of the allocation +/// \param element_size_bytes is the size in bytes of an element in the +/// allocation +__SYCL_EXPORT pi_result piextUSMPitchedAlloc( + void **result_ptr, size_t *result_pitch, pi_context context, + pi_device device, pi_usm_mem_properties *properties, size_t width_in_bytes, + size_t height, unsigned int element_size_bytes); + +/// Indicates that the allocated USM memory is no longer needed on the +/// runtime side. The actual freeing of the memory may be done in a blocking +/// or deferred manner, e.g. to avoid issues with indirect memory access +/// from kernels. /// /// \param context is the pi_context of the allocation /// \param ptr is the memory to be freed @@ -2100,6 +2158,208 @@ __SYCL_EXPORT pi_result piGetDeviceAndHostTimer(pi_device Device, uint64_t *DeviceTime, uint64_t *HostTime); +/// API to destroy bindless unsampled image handles. +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param handle is the image handle +__SYCL_EXPORT pi_result piextMemUnsampledImageHandleDestroy( + pi_context context, pi_device device, pi_image_handle handle); + +/// API to destroy bindless sampled image handles. +/// +/// \param context is the pi_context +/// \param handle is the image handle +__SYCL_EXPORT pi_result piextMemSampledImageHandleDestroy( + pi_context context, pi_device device, pi_image_handle handle); + +/// API to allocate memory for bindless images. +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param flags are extra flags to pass (currently unused) +/// \param image_format format of the image (channel order and data type) +/// \param image_desc image descriptor +/// \param ret_mem is the returning memory handle to newly allocated memory +__SYCL_EXPORT pi_result piextMemImageAllocate(pi_context context, + pi_device device, + pi_image_format *image_format, + pi_image_desc *image_desc, + pi_image_mem_handle *ret_mem); + +/// API to retrieve individual image from mipmap +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param mip_mem is the memory handle to the mipmap +/// \param level is the requested level of the mipmap +/// \param ret_mem is the returning memory handle to the individual image +__SYCL_EXPORT pi_result piextMemMipmapGetLevel(pi_context context, + pi_device device, + pi_image_mem_handle mip_mem, + unsigned int level, + pi_image_mem_handle *ret_mem); + +/// API to free memory for bindless images. +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param memory_handle is the handle to image memory to be freed +__SYCL_EXPORT pi_result piextMemImageFree(pi_context context, pi_device device, + pi_image_mem_handle memory_handle); + +/// API to free mipmap memory for bindless images. +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param memory_handle is the handle to image memory to be freed +__SYCL_EXPORT pi_result piextMemMipmapFree(pi_context context, pi_device device, + pi_image_mem_handle memory_handle); + +/// API to create bindless image handles. +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param img_mem is the handle to memory from which to create the image +/// \param image_format format of the image (channel order and data type) +/// \param image_desc image descriptor +/// \param ret_mem is the returning pi_mem image object +/// \param ret_handle is the returning memory handle to newly allocated memory +__SYCL_EXPORT pi_result piextMemUnsampledImageCreate( + pi_context context, pi_device device, pi_image_mem_handle img_mem, + pi_image_format *image_format, pi_image_desc *image_desc, pi_mem *ret_mem, + pi_image_handle *ret_handle); + +/// API to create sampled bindless image handles. +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param img_mem is the handle to memory from which to create the image +/// \param image_format format of the image (channel order and data type) +/// \param image_desc image descriptor +/// \param sampler is the pi_sampler +/// \param ret_mem is the returning pi_mem image object +/// \param ret_handle is the returning memory handle to newly allocated memory +__SYCL_EXPORT pi_result piextMemSampledImageCreate( + pi_context context, pi_device device, pi_image_mem_handle img_mem, + pi_image_format *image_format, pi_image_desc *image_desc, + pi_sampler sampler, pi_mem *ret_mem, pi_image_handle *ret_handle); + +/// API to copy image data Host to Device or Device to Host +/// +/// \param queue is the queue to submit to +/// \param dst_ptr is the location the data will be copied to +/// \param src_ptr is the data to be copied +/// \param image_format format of the image (channel order and data type) +/// \param image_desc image descriptor +/// \param flags flags describing copy direction (H2D or D2H) +/// \param src_offset is the offset into the source image/memory +/// \param dst_offset is the offset into the destination image/memory +/// \param copy_extent is the extent (region) of the image/memory to copy +/// \param host_extent is the extent (region) of the memory on the host +/// \param num_events_in_wait_list is the number of events in the wait list +/// \param event_wait_list is the list of events to wait on before copying +/// \param event is the returned event representing this operation +__SYCL_EXPORT pi_result piextMemImageCopy( + pi_queue command_queue, void *dst_ptr, void *src_ptr, + const pi_image_format *image_format, const pi_image_desc *image_desc, + const pi_image_copy_flags flags, pi_image_offset src_offset, + pi_image_offset dst_offset, pi_image_region copy_extent, + pi_image_region host_extent, pi_uint32 num_events_in_wait_list, + const pi_event *event_wait_list, pi_event *event); + +/// API to query an image memory handle for specific properties +/// +/// \param mem_handle is the handle to the image memory +/// \param param_name is the queried info name +/// \param param_value is the returned query value +/// \param param_value_size_ret is the returned query value size +__SYCL_EXPORT pi_result piextMemImageGetInfo( + const pi_image_mem_handle mem_handle, pi_image_info param_name, + void *param_value, size_t *param_value_size_ret); + +/// API to import external memory in the form of a file descriptor +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param size is the size of the external memory +/// \param file_descriptor is the file descriptor +/// \param ret_handle is the returned interop memory handle to the external +/// memory +__SYCL_EXPORT pi_result +piextMemImportOpaqueFD(pi_context context, pi_device device, size_t size, + int file_descriptor, pi_interop_mem_handle *ret_handle); + +/// API to map an interop memory handle to an image memory handle +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param image_format format of the image (channel order and data type) +/// \param image_desc image descriptor +/// \param mem_handle is the interop memory handle to the external memory +/// \param ret_mem is the returned image memory handle to the externally +/// allocated memory +__SYCL_EXPORT pi_result piextMemMapExternalArray( + pi_context context, pi_device device, pi_image_format *image_format, + pi_image_desc *image_desc, pi_interop_mem_handle mem_handle, + pi_image_mem_handle *ret_mem); + +/// API to destroy interop memory. +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param memory_handle is the handle to interop memory to be freed +__SYCL_EXPORT pi_result piextMemReleaseInterop( + pi_context context, pi_device device, pi_interop_mem_handle memory_handle); + +/// API to import an external semaphore in the form of a file descriptor +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param file_descriptor is the file descriptor +/// \param ret_handle is the returned interop semaphore handle to the external +/// semaphore +__SYCL_EXPORT pi_result piextImportExternalSemaphoreOpaqueFD( + pi_context context, pi_device device, int file_descriptor, + pi_interop_semaphore_handle *ret_handle); + +/// API to destroy the external semaphore handle +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param sem_handle is the interop semaphore handle to the external semaphore +/// to be destroyed +__SYCL_EXPORT pi_result +piextDestroyExternalSemaphore(pi_context context, pi_device device, + pi_interop_semaphore_handle sem_handle); + +/// API to instruct the queue with a non-blocking wait on an external semaphore +/// +/// \param command_queue is the queue instructed to wait +/// \param sem_handle is the interop semaphore handle +/// \param num_events_in_wait_list is the number of events in the wait list +/// \param event_wait_list is the list of events to wait on before this +/// operation +/// \param event is the returned event representing this operation +__SYCL_EXPORT pi_result piextWaitExternalSemaphore( + pi_queue command_queue, pi_interop_semaphore_handle sem_handle, + pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, + pi_event *event); + +/// API to instruct the queue to signal the external semaphore handle once all +/// previous commands have completed execution +/// +/// \param command_queue is the queue instructed to signal +/// \param sem_handle is the interop semaphore handle to signal +/// \param num_events_in_wait_list is the number of events in the wait list +/// \param event_wait_list is the list of events to wait on before this +/// operation +/// \param event is the returned event representing this operation +__SYCL_EXPORT pi_result piextSignalExternalSemaphore( + pi_queue command_queue, pi_interop_semaphore_handle sem_handle, + pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, + pi_event *event); + struct _pi_plugin { // PI version supported by host passed to the plugin. The Plugin // checks and writes the appropriate Function Pointers in diff --git a/sycl/include/sycl/detail/pi.hpp b/sycl/include/sycl/detail/pi.hpp index ed46c0547d4f7..cefe942b5fb6f 100644 --- a/sycl/include/sycl/detail/pi.hpp +++ b/sycl/include/sycl/detail/pi.hpp @@ -148,6 +148,13 @@ using PiMemObjectType = ::pi_mem_type; using PiMemImageChannelOrder = ::pi_image_channel_order; using PiMemImageChannelType = ::pi_image_channel_type; using PiKernelCacheConfig = ::pi_kernel_cache_config; +using PiImageHandle = ::pi_image_handle; +using PiImageMemHandle = ::pi_image_mem_handle; +using PiImageCopyFlags = ::pi_image_copy_flags; +using PiInteropMemHandle = ::pi_interop_mem_handle; +using PiInteropSemaphoreHandle = ::pi_interop_semaphore_handle; +using PiImageOffset = ::pi_image_offset_struct; +using PiImageRegion = ::pi_image_region_struct; __SYCL_EXPORT void contextSetExtendedDeleter(const sycl::context &constext, pi_context_extended_deleter func, diff --git a/sycl/include/sycl/sampler.hpp b/sycl/include/sycl/sampler.hpp index 24e94b4c157b2..7860cdaab9c1b 100644 --- a/sycl/include/sycl/sampler.hpp +++ b/sycl/include/sycl/sampler.hpp @@ -30,6 +30,11 @@ enum class filtering_mode : unsigned int { linear = PI_SAMPLER_FILTER_MODE_LINEAR }; +enum class mipmap_filtering_mode : unsigned int { + nearest = PI_SAMPLER_MIP_FILTER_MODE_NEAREST, + linear = PI_SAMPLER_MIP_FILTER_MODE_LINEAR +}; + enum class coordinate_normalization_mode : unsigned int { normalized = 1, unnormalized = 0 @@ -69,6 +74,12 @@ class __SYCL_EXPORT __SYCL_SPECIAL_CLASS __SYCL_TYPE(sampler) sampler { addressing_mode addressingMode, filtering_mode filteringMode, const property_list &propList = {}); + sampler(coordinate_normalization_mode normalizationMode, + addressing_mode addressingMode, filtering_mode filteringMode, + mipmap_filtering_mode mipmapFilteringMode, float minMipmapLevelClamp, + float maxMipmapLevelClamp, float maxAnisotropy, + const property_list &propList = {}); + #ifdef __SYCL_INTERNAL_API sampler(cl_sampler clSampler, const context &syclContext); #endif @@ -102,8 +113,16 @@ class __SYCL_EXPORT __SYCL_SPECIAL_CLASS __SYCL_TYPE(sampler) sampler { filtering_mode get_filtering_mode() const; + mipmap_filtering_mode get_mipmap_filtering_mode() const; + coordinate_normalization_mode get_coordinate_normalization_mode() const; + float get_min_mipmap_level_clamp() const; + + float get_max_mipmap_level_clamp() const; + + float get_max_anisotropy() const; + private: #ifdef __SYCL_DEVICE_ONLY__ detail::sampler_impl impl; diff --git a/sycl/plugins/cuda/CMakeLists.txt b/sycl/plugins/cuda/CMakeLists.txt index 2570b6f7e7348..1755d0ab33b9d 100644 --- a/sycl/plugins/cuda/CMakeLists.txt +++ b/sycl/plugins/cuda/CMakeLists.txt @@ -64,6 +64,8 @@ add_sycl_plugin(cuda "../unified_runtime/ur/adapters/cuda/enqueue.cpp" "../unified_runtime/ur/adapters/cuda/event.cpp" "../unified_runtime/ur/adapters/cuda/event.hpp" + "../unified_runtime/ur/adapters/cuda/image.cpp" + "../unified_runtime/ur/adapters/cuda/image.hpp" "../unified_runtime/ur/adapters/cuda/kernel.cpp" "../unified_runtime/ur/adapters/cuda/kernel.hpp" "../unified_runtime/ur/adapters/cuda/memory.cpp" diff --git a/sycl/plugins/cuda/pi_cuda.cpp b/sycl/plugins/cuda/pi_cuda.cpp index 9af47b47a6b2a..01a66bfb309cb 100644 --- a/sycl/plugins/cuda/pi_cuda.cpp +++ b/sycl/plugins/cuda/pi_cuda.cpp @@ -160,6 +160,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) { _PI_CL(piextUSMHostAlloc, pi2ur::piextUSMHostAlloc) _PI_CL(piextUSMDeviceAlloc, pi2ur::piextUSMDeviceAlloc) _PI_CL(piextUSMSharedAlloc, pi2ur::piextUSMSharedAlloc) + _PI_CL(piextUSMPitchedAlloc, pi2ur::piextUSMPitchedAlloc) _PI_CL(piextUSMFree, pi2ur::piextUSMFree) _PI_CL(piextUSMEnqueueMemset, pi2ur::piextUSMEnqueueMemset) _PI_CL(piextUSMEnqueueMemcpy, pi2ur::piextUSMEnqueueMemcpy) @@ -186,6 +187,30 @@ pi_result piPluginInit(pi_plugin *PluginInit) { _PI_CL(piGetDeviceAndHostTimer, pi2ur::piGetDeviceAndHostTimer) _PI_CL(piPluginGetBackendOption, pi2ur::piPluginGetBackendOption) + // Bindless Images + _PI_CL(piextMemUnsampledImageHandleDestroy, + pi2ur::piextMemUnsampledImageHandleDestroy) + _PI_CL(piextMemSampledImageHandleDestroy, + pi2ur::piextMemSampledImageHandleDestroy) + _PI_CL(piextMemImageAllocate, pi2ur::piextMemImageAllocate) + _PI_CL(piextMemImageFree, pi2ur::piextMemImageFree) + _PI_CL(piextMemUnsampledImageCreate, pi2ur::piextMemUnsampledImageCreate) + _PI_CL(piextMemSampledImageCreate, pi2ur::piextMemSampledImageCreate) + _PI_CL(piextMemImageCopy, pi2ur::piextMemImageCopy) + _PI_CL(piextMemImageGetInfo, pi2ur::piextMemImageGetInfo) + + _PI_CL(piextMemMipmapGetLevel, pi2ur::piextMemMipmapGetLevel) + _PI_CL(piextMemMipmapFree, pi2ur::piextMemMipmapFree) + + _PI_CL(piextMemImportOpaqueFD, pi2ur::piextMemImportOpaqueFD) + _PI_CL(piextMemReleaseInterop, pi2ur::piextMemReleaseInterop) + _PI_CL(piextMemMapExternalArray, pi2ur::piextMemMapExternalArray) + _PI_CL(piextImportExternalSemaphoreOpaqueFD, + pi2ur::piextImportExternalSemaphoreOpaqueFD) + _PI_CL(piextDestroyExternalSemaphore, pi2ur::piextDestroyExternalSemaphore) + _PI_CL(piextWaitExternalSemaphore, pi2ur::piextWaitExternalSemaphore) + _PI_CL(piextSignalExternalSemaphore, pi2ur::piextSignalExternalSemaphore) + #undef _PI_CL return PI_SUCCESS; diff --git a/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp b/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp index 574852b103ae0..123b86ef28a70 100644 --- a/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp +++ b/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp @@ -1553,7 +1553,7 @@ pi_result piextEventCreateWithNativeHandle(pi_native_handle, pi_context, bool, DIE_NO_IMPLEMENTATION; } pi_result piSamplerCreate(pi_context, const pi_sampler_properties *, - pi_sampler *) { + const float, const float, const float, pi_sampler *) { DIE_NO_IMPLEMENTATION; } diff --git a/sycl/plugins/hip/pi_hip.hpp b/sycl/plugins/hip/pi_hip.hpp index 4b3c5f53298d9..1ec9a18f72938 100644 --- a/sycl/plugins/hip/pi_hip.hpp +++ b/sycl/plugins/hip/pi_hip.hpp @@ -937,15 +937,24 @@ struct _pi_kernel { /// Implementation of samplers for HIP /// /// Sampler property layout: -/// | 31 30 ... 6 5 | 4 3 2 | 1 | 0 | -/// | N/A | addressing mode | fiter mode | normalize coords | +/// | | +/// ----------------------------------- +/// | 31 30 ... 6 | N/A +/// | 5 | mip filter mode +/// | 4 3 2 | addressing mode +/// | 1 | filter mode +/// | 0 | normalize coords struct _pi_sampler { std::atomic_uint32_t refCount_; pi_uint32 props_; + float minMipmapLevelClamp_; + float maxMipmapLevelClamp_; + float maxAnisotropy_; pi_context context_; _pi_sampler(pi_context context) - : refCount_(1), props_(0), context_(context) {} + : refCount_(1), props_(0), minMipmapLevelClamp_(0.0f), + maxMipmapLevelClamp_(0.0f), maxAnisotropy_(0.0f), context_(context) {} pi_uint32 increment_reference_count() noexcept { return ++refCount_; } diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index e7fd7128c319e..c8be3d334d52e 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -390,6 +390,248 @@ pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName, ParamValueSizeRet); } +pi_result piextMemUnsampledImageHandleDestroy(pi_context context, + pi_device device, + pi_image_handle handle) { + + assert(context != nullptr); + assert(device != nullptr); + assert(handle != 0); + + die("piextMemUnsampledImageHandleDestroy not implemented on level zero " + "backend.\n"); + pi_result retErr = PI_ERROR_UNKNOWN; + + return retErr; +} + +pi_result piextMemSampledImageHandleDestroy(pi_context context, + pi_device device, + pi_image_handle handle) { + + assert(context != nullptr); + assert(device != nullptr); + assert(handle != 0); + + die("piextMemSampledImageHandleDestroy not implemented on level zero " + "backend.\n"); + pi_result retErr = PI_ERROR_UNKNOWN; + + return retErr; +} + +pi_result piextMemImageAllocate(pi_context context, pi_device device, + pi_image_format *image_format, + pi_image_desc *image_desc, + pi_image_mem_handle *ret_mem) { + + assert(context != nullptr); + assert(device != nullptr); + assert(image_desc != nullptr); + assert(image_format != nullptr); + assert(ret_mem != nullptr); + + die("piExtMemImageAllocate not implemented on level zero backend.\n"); + // No image formats are supported! + pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + return retErr; +} + +pi_result piextMemMipmapGetLevel(pi_context context, pi_device device, + pi_image_mem_handle mip_mem, + unsigned int level, + pi_image_mem_handle *ret_mem) { + + assert(context != nullptr); + assert(device != nullptr); + assert(mip_mem != nullptr); + assert(ret_mem != nullptr); + + die("piextMemMipmapGetLevel not implemented on level zero backend.\n"); + pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + return retErr; +} + +pi_result piextMemImageFree(pi_context context, pi_device device, + pi_image_mem_handle memory_handle) { + + assert(context != nullptr); + assert(device != nullptr); + assert(memory_handle != nullptr); + + pi_result retErr = PI_SUCCESS; + die("piExtMemImageFree not implemented on level zero backend.\n"); + + return retErr; +} + +pi_result piextMemMipmapFree(pi_context context, pi_device device, + pi_image_mem_handle memory_handle) { + + assert(context != nullptr); + assert(device != nullptr); + assert(memory_handle != nullptr); + + die("piextMemMipmapFree not implemented on level zero backend.\n"); + // No image formats are supported! + pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + return retErr; +} + +pi_result piextMemUnsampledImageCreate(pi_context context, pi_device device, + pi_image_mem_handle img_mem, + pi_image_format *image_format, + pi_image_desc *desc, pi_mem *ret_mem, + pi_image_handle *ret_handle) { + + assert(context != nullptr); + assert(device != nullptr); + assert(img_mem != nullptr); + assert(ret_mem != nullptr); + assert(ret_handle != nullptr); + + die("piextMemUnsampledImageCreate not implemented on level zero backend.\n"); + // No image formats are supported! + pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + return retErr; +} + +pi_result piextMemImportOpaqueFD(pi_context context, pi_device device, + size_t size, int file_descriptor, + pi_interop_mem_handle *ret_handle) { + assert(context); + assert(device); + assert(file_descriptor); + assert(ret_handle); + + die("piextMemImportOpaqueFD not implemented on level zero backend.\n"); + pi_result retErr = PI_ERROR_UNKNOWN; + return retErr; +} + +pi_result +piextImportExternalSemaphoreOpaqueFD(pi_context context, pi_device device, + int file_descriptor, + pi_interop_semaphore_handle *ret_handle) { + assert(context); + assert(device); + assert(ret_handle); + die("piextImportExternalSemaphoreOpaqueFD not implemented on level zero " + "backend.\n"); + pi_result retErr = PI_ERROR_UNKNOWN; + return retErr; +} + +pi_result +piextDestroyExternalSemaphore(pi_context context, pi_device device, + pi_interop_semaphore_handle sem_handle) { + assert(context); + assert(device); + assert(sem_handle); + die("piextDestroyExternalSemaphore not implemented on level zero " + "backend.\n"); + pi_result retErr = PI_ERROR_UNKNOWN; + return retErr; +} + +pi_result piextWaitExternalSemaphore(pi_queue command_queue, + pi_interop_semaphore_handle sem_handle, + pi_uint32 num_events_in_wait_list, + const pi_event *event_wait_list, + pi_event *event) { + assert(command_queue); + assert(sem_handle); + die("piextWaitExternalSemaphore not implemented on level zero " + "backend.\n"); + pi_result retErr = PI_ERROR_UNKNOWN; + return retErr; +} + +pi_result piextSignalExternalSemaphore(pi_queue command_queue, + pi_interop_semaphore_handle sem_handle, + pi_uint32 num_events_in_wait_list, + const pi_event *event_wait_list, + pi_event *event) { + assert(command_queue); + assert(sem_handle); + die("piextSignalExternalSemaphore not implemented on level zero " + "backend.\n"); + pi_result retErr = PI_ERROR_UNKNOWN; + return retErr; +} + +pi_result piextMemMapExternalArray(pi_context context, pi_device device, + pi_image_format *image_format, + pi_image_desc *image_desc, + pi_interop_mem_handle mem_handle, + pi_image_mem_handle *ret_mem) { + assert(context); + assert(device); + assert(image_format); + assert(image_desc); + assert(mem_handle); + assert(ret_mem); + + die("piextMemMapExternalArray given unsupported image_channel_order.\n"); + + pi_result retErr = PI_ERROR_UNKNOWN; + return retErr; +} + +pi_result piextMemReleaseInterop(pi_context context, pi_device device, + pi_interop_mem_handle ext_mem) { + assert(context); + assert(ext_mem); + + die("piextMemReleaseInterop not implemented on level zero backend.\n"); + pi_result retErr = PI_ERROR_UNKNOWN; + return retErr; +} + +pi_result piextMemSampledImageCreate(pi_context context, pi_device device, + pi_image_mem_handle img_mem, + pi_image_format *format, + pi_image_desc *desc, pi_sampler sampler, + pi_mem *ret_mem, + pi_image_handle *ret_handle) { + assert(context != nullptr); + assert(device != nullptr); + assert(img_mem != nullptr); + assert(ret_mem != nullptr); + assert(ret_handle != nullptr); + + die("piExtMemSampledImageCreate not implemented on level zero backend.\n"); + // No image formats are supported! + pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + return retErr; +} + +pi_result piextMemImageCopy( + pi_queue command_queue, void *dst_ptr, void *src_ptr, + const pi_image_format *image_format, const pi_image_desc *image_desc, + const pi_image_copy_flags flags, pi_image_offset src_offset, + pi_image_offset dst_offset, pi_image_region copy_extent, + pi_image_region host_extent, pi_uint32 num_events_in_wait_list, + const pi_event *event_wait_list, pi_event *event) { + assert(command_queue != nullptr); + assert(dst_ptr != nullptr); + assert(src_ptr != nullptr); + + die("piExtMemImageCopy not implemented on level zero backend.\n"); + // No image formats are supported! + pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + return retErr; +} + +pi_result piextMemImageGetInfo(const pi_image_mem_handle mem_handle, + pi_image_info param_name, void *param_value, + size_t *param_value_size_ret) { + assert(mem_handle); + + die("piextMemImageGetInfo not implemented on level zero backend.\n"); + return PI_SUCCESS; +} + pi_result piKernelGetGroupInfo(pi_kernel Kernel, pi_device Device, pi_kernel_group_info ParamName, size_t ParamValueSize, void *ParamValue, @@ -512,8 +754,11 @@ pi_result piextEventCreateWithNativeHandle(pi_native_handle NativeHandle, // pi_result piSamplerCreate(pi_context Context, const pi_sampler_properties *SamplerProperties, - pi_sampler *RetSampler) { - return pi2ur::piSamplerCreate(Context, SamplerProperties, RetSampler); + const float minMipmapLevelClamp, + const float maxMipmapLevelClamp, + const float maxAnisotropy, pi_sampler *RetSampler) { + return pi2ur::piSamplerCreate(Context, SamplerProperties, minMipmapLevelClamp, + maxMipmapLevelClamp, maxAnisotropy, RetSampler); } pi_result piSamplerGetInfo(pi_sampler Sampler, pi_sampler_info ParamName, @@ -761,6 +1006,20 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context, Size, Alignment); } +pi_result piextUSMPitchedAlloc(void **result_ptr, size_t *result_pitch, + pi_context context, pi_device device, + pi_usm_mem_properties *properties, + size_t width_in_bytes, size_t height, + unsigned int element_size_bytes) { + die("piextUSMPitchedAlloc: not implemented"); + + assert(result_ptr != nullptr); + assert(context != nullptr); + assert(device != nullptr); + assert(properties == nullptr || *properties == 0); + return {}; +} + pi_result piextUSMHostAlloc(void **ResultPtr, pi_context Context, pi_usm_mem_properties *Properties, size_t Size, pi_uint32 Alignment) { diff --git a/sycl/plugins/opencl/pi_opencl.cpp b/sycl/plugins/opencl/pi_opencl.cpp index 13193318f7ef2..91f5e6fd3e0b5 100644 --- a/sycl/plugins/opencl/pi_opencl.cpp +++ b/sycl/plugins/opencl/pi_opencl.cpp @@ -1086,6 +1086,9 @@ pi_result piextProgramCreateWithNativeHandle(pi_native_handle nativeHandle, pi_result piSamplerCreate(pi_context context, const pi_sampler_properties *sampler_properties, + const float minMipmapLevelClamp, + const float maxMipmapLevelClamp, + const float maxAnisotropy, pi_sampler *result_sampler) { // Initialize properties according to OpenCL 2.1 spec. pi_result error_code; diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index 46a4fa72c8a1a..9f1af37ea9b8b 100755 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -4,7 +4,7 @@ if (NOT DEFINED UNIFIED_RUNTIME_LIBRARY OR NOT DEFINED UNIFIED_RUNTIME_INCLUDE_D include(FetchContent) set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") - set(UNIFIED_RUNTIME_TAG 7e16bb37cbb12450637e595749c3617151cbe851) + set(UNIFIED_RUNTIME_TAG 78aebac8bc304566cf7fb1a86ae208e4b20831ae) message(STATUS "Will fetch Unified Runtime from ${UNIFIED_RUNTIME_REPO}") FetchContent_Declare(unified-runtime @@ -140,6 +140,8 @@ if ("cuda" IN_LIST SYCL_ENABLE_PLUGINS) "ur/adapters/cuda/enqueue.cpp" "ur/adapters/cuda/event.cpp" "ur/adapters/cuda/event.hpp" + "ur/adapters/cuda/image.cpp" + "ur/adapters/cuda/image.hpp" "ur/adapters/cuda/kernel.cpp" "ur/adapters/cuda/kernel.hpp" "ur/adapters/cuda/memory.cpp" diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index 346fa1dcf9923..df1c0324b9006 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -1112,6 +1112,66 @@ inline pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, InfoType = UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP; break; } + case PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT: { + InfoType = UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT: { + InfoType = UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT: { + InfoType = UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_IMAGE_PITCH_ALIGN: { + InfoType = UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH: { + InfoType = UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT: { + InfoType = UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH: { + InfoType = UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_SUPPORT: { + InfoType = UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT: { + InfoType = UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY: { + InfoType = UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT: { + InfoType = UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT: { + InfoType = UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT: { + InfoType = UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT: { + InfoType = UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP; + break; + } + case PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT: { + InfoType = UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP; + break; + } default: return PI_ERROR_UNKNOWN; }; @@ -2739,6 +2799,141 @@ static void pi2urImageDesc(const pi_image_format *ImageFormat, UrDesc->arraySize = ImageDesc->image_array_size; } +static void ur2piImageFormat(const ur_image_format_t *UrFormat, + pi_image_format *PiFormat) { + switch (UrFormat->channelOrder) { + case UR_IMAGE_CHANNEL_ORDER_A: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_A; + break; + } + case UR_IMAGE_CHANNEL_ORDER_R: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_R; + break; + } + case UR_IMAGE_CHANNEL_ORDER_RG: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RG; + break; + } + case UR_IMAGE_CHANNEL_ORDER_RA: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RA; + break; + } + case UR_IMAGE_CHANNEL_ORDER_RGB: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RGB; + break; + } + case UR_IMAGE_CHANNEL_ORDER_RGBA: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RGBA; + break; + } + case UR_IMAGE_CHANNEL_ORDER_BGRA: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_BGRA; + break; + } + case UR_IMAGE_CHANNEL_ORDER_ARGB: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_ARGB; + break; + } + case UR_IMAGE_CHANNEL_ORDER_ABGR: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_ABGR; + break; + } + case UR_IMAGE_CHANNEL_ORDER_INTENSITY: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_INTENSITY; + break; + } + case UR_IMAGE_CHANNEL_ORDER_LUMINANCE: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_LUMINANCE; + break; + } + case UR_IMAGE_CHANNEL_ORDER_RX: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_Rx; + break; + } + case UR_IMAGE_CHANNEL_ORDER_RGX: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RGx; + break; + } + case UR_IMAGE_CHANNEL_ORDER_RGBX: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RGBx; + break; + } + case UR_IMAGE_CHANNEL_ORDER_SRGBA: { + PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_sRGBA; + break; + } + default: { + die("ur2piImageFormat: unsuppported channelOrder."); + } + } + + switch (UrFormat->channelType) { + case UR_IMAGE_CHANNEL_TYPE_SNORM_INT8: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SNORM_INT8; + break; + } + case UR_IMAGE_CHANNEL_TYPE_SNORM_INT16: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SNORM_INT16; + break; + } + case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_INT8; + break; + } + case UR_IMAGE_CHANNEL_TYPE_UNORM_INT16: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_INT16; + break; + } + case UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565; + break; + } + case UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555; + break; + } + case UR_IMAGE_CHANNEL_TYPE_INT_101010: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010; + break; + } + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8; + break; + } + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16; + break; + } + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32; + break; + } + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8; + break; + } + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16; + break; + } + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32; + break; + } + case UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT; + break; + } + case UR_IMAGE_CHANNEL_TYPE_FLOAT: { + PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_FLOAT; + break; + } + default: { + die("ur2piImageFormat: unsuppported channelType."); + } + } +} + inline pi_result piMemImageCreate(pi_context Context, pi_mem_flags Flags, const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, void *HostPtr, @@ -2942,6 +3137,28 @@ inline pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context, return PI_SUCCESS; } +inline pi_result piextUSMPitchedAlloc(void **ResultPtr, size_t *ResultPitch, + pi_context Context, pi_device Device, + pi_usm_mem_properties *Properties, + size_t WidthInBytes, size_t Height, + unsigned int ElementSizeBytes) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + std::ignore = Properties; + ur_usm_desc_t USMDesc{}; + ur_usm_pool_handle_t Pool{}; + + HANDLE_ERRORS(urUSMPitchedAllocExp(UrContext, UrDevice, &USMDesc, Pool, + WidthInBytes, Height, ElementSizeBytes, + ResultPtr, ResultPitch)); + + return PI_SUCCESS; +} + inline pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context, pi_device Device, pi_usm_mem_properties *Properties, @@ -3916,6 +4133,8 @@ inline pi_result piEventRelease(pi_event Event) { // Sampler inline pi_result piSamplerCreate(pi_context Context, const pi_sampler_properties *SamplerProperties, + float MinMipmapLevelClamp, + float MaxMipmapLevelClamp, float MaxAnisotropy, pi_sampler *RetSampler) { PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); @@ -3925,6 +4144,14 @@ inline pi_result piSamplerCreate(pi_context Context, reinterpret_cast(Context); ur_sampler_desc_t UrProps{}; UrProps.stype = UR_STRUCTURE_TYPE_SAMPLER_DESC; + + ur_exp_sampler_mip_properties_t UrMipProps{}; + UrMipProps.stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES; + UrMipProps.minMipmapLevelClamp = MinMipmapLevelClamp; + UrMipProps.maxMipmapLevelClamp = MaxMipmapLevelClamp; + UrMipProps.maxAnisotropy = MaxAnisotropy; + UrProps.pNext = &UrMipProps; + const pi_sampler_properties *CurProperty = SamplerProperties; while (*CurProperty != 0) { switch (*CurProperty) { @@ -3960,6 +4187,17 @@ inline pi_result piSamplerCreate(pi_context Context, UrProps.filterMode = UR_SAMPLER_FILTER_MODE_LINEAR; } break; + case PI_SAMPLER_PROPERTIES_MIP_FILTER_MODE: { + pi_sampler_mip_filter_mode CurValueFilterMode = + ur_cast( + ur_cast(*(++CurProperty))); + + if (CurValueFilterMode == PI_SAMPLER_MIP_FILTER_MODE_NEAREST) + UrMipProps.mipFilterMode = UR_SAMPLER_FILTER_MODE_NEAREST; + else if (CurValueFilterMode == PI_SAMPLER_MIP_FILTER_MODE_LINEAR) + UrMipProps.mipFilterMode = UR_SAMPLER_FILTER_MODE_LINEAR; + } break; + default: break; } @@ -4048,4 +4286,437 @@ inline pi_result piSamplerRelease(pi_sampler Sampler) { // Sampler /////////////////////////////////////////////////////////////////////////////// +// Bindless Images Extension +/////////////////////////////////////////////////////////////////////////////// +inline pi_result piextMemImageAllocate(pi_context Context, pi_device Device, + pi_image_format *ImageFormat, + pi_image_desc *ImageDesc, + pi_image_mem_handle *RetMem) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + + ur_image_format_t UrFormat{}; + ur_image_desc_t UrDesc{}; + pi2urImageDesc(ImageFormat, ImageDesc, &UrFormat, &UrDesc); + + ur_exp_image_mem_handle_t *UrRetMem = + reinterpret_cast(RetMem); + + HANDLE_ERRORS(urBindlessImagesImageAllocateExp(UrContext, UrDevice, &UrFormat, + &UrDesc, UrRetMem)); + + return PI_SUCCESS; +} + +inline pi_result piextMemUnsampledImageCreate( + pi_context Context, pi_device Device, pi_image_mem_handle ImgMem, + pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_mem *RetMem, + pi_image_handle *RetHandle) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + PI_ASSERT(RetMem, PI_ERROR_INVALID_MEM_OBJECT); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_image_mem_handle_t UrImgMem = + reinterpret_cast(ImgMem); + + ur_image_format_t UrFormat{}; + ur_image_desc_t UrDesc{}; + pi2urImageDesc(ImageFormat, ImageDesc, &UrFormat, &UrDesc); + + ur_mem_handle_t *UrRetMem = reinterpret_cast(RetMem); + ur_exp_image_handle_t *UrRetHandle = + reinterpret_cast(RetHandle); + + HANDLE_ERRORS(urBindlessImagesUnsampledImageCreateExp( + UrContext, UrDevice, UrImgMem, &UrFormat, &UrDesc, UrRetMem, + UrRetHandle)); + + return PI_SUCCESS; +} + +inline pi_result piextMemSampledImageCreate( + pi_context Context, pi_device Device, pi_image_mem_handle ImgMem, + pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_sampler Sampler, + pi_mem *RetMem, pi_image_handle *RetHandle) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + PI_ASSERT(RetMem, PI_ERROR_INVALID_MEM_OBJECT); + PI_ASSERT(Sampler, PI_ERROR_INVALID_SAMPLER); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_image_mem_handle_t UrImgMem = + reinterpret_cast(ImgMem); + + ur_image_format_t UrFormat{}; + ur_image_desc_t UrDesc{}; + pi2urImageDesc(ImageFormat, ImageDesc, &UrFormat, &UrDesc); + + ur_sampler_handle_t UrSampler = + reinterpret_cast(Sampler); + ur_mem_handle_t *UrRetMem = reinterpret_cast(RetMem); + ur_exp_image_handle_t *UrRetHandle = + reinterpret_cast(RetHandle); + + HANDLE_ERRORS(urBindlessImagesSampledImageCreateExp( + UrContext, UrDevice, UrImgMem, &UrFormat, &UrDesc, UrSampler, UrRetMem, + UrRetHandle)); + + return PI_SUCCESS; +} + +inline pi_result piextMemMipmapGetLevel(pi_context Context, pi_device Device, + pi_image_mem_handle MipMem, + unsigned int Level, + pi_image_mem_handle *RetMem) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_image_mem_handle_t UrMipMem = + reinterpret_cast(MipMem); + ur_exp_image_mem_handle_t *UrRetMem = + reinterpret_cast(RetMem); + + HANDLE_ERRORS(urBindlessImagesMipmapGetLevelExp(UrContext, UrDevice, UrMipMem, + Level, UrRetMem)); + + return PI_SUCCESS; +} + +inline pi_result piextMemImageFree(pi_context Context, pi_device Device, + pi_image_mem_handle MemoryHandle) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_image_mem_handle_t UrMemoryHandle = + reinterpret_cast(MemoryHandle); + + HANDLE_ERRORS( + urBindlessImagesImageFreeExp(UrContext, UrDevice, UrMemoryHandle)); + + return PI_SUCCESS; +} + +inline pi_result piextMemMipmapFree(pi_context Context, pi_device Device, + pi_image_mem_handle MemoryHandle) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_image_mem_handle_t UrMemoryHandle = + reinterpret_cast(MemoryHandle); + + HANDLE_ERRORS( + urBindlessImagesMipmapFreeExp(UrContext, UrDevice, UrMemoryHandle)); + + return PI_SUCCESS; +} + +static void pi2urImageCopyFlags(const pi_image_copy_flags PiFlags, + ur_exp_image_copy_flags_t *UrFlags) { + switch (PiFlags) { + case PI_IMAGE_COPY_HTOD: + *UrFlags = UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE; + break; + case PI_IMAGE_COPY_DTOH: + *UrFlags = UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST; + break; + case PI_IMAGE_COPY_DTOD: + *UrFlags = UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE; + break; + default: + die("pi2urImageCopyFlags: Unsupported use case"); + } +} + +inline pi_result +piextMemImageCopy(pi_queue Queue, void *DstPtr, void *SrcPtr, + const pi_image_format *ImageFormat, + const pi_image_desc *ImageDesc, + const pi_image_copy_flags Flags, pi_image_offset SrcOffset, + pi_image_offset DstOffset, pi_image_region CopyExtent, + pi_image_region HostExtent, pi_uint32 NumEventsInWaitList, + const pi_event *EventWaitList, pi_event *Event) { + PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE); + + ur_queue_handle_t UrQueue = reinterpret_cast(Queue); + + ur_image_format_t UrFormat{}; + ur_image_desc_t UrDesc{}; + pi2urImageDesc(ImageFormat, ImageDesc, &UrFormat, &UrDesc); + + ur_exp_image_copy_flags_t UrFlags; + pi2urImageCopyFlags(Flags, &UrFlags); + + ur_rect_offset_t UrSrcOffset{SrcOffset->x, SrcOffset->y, SrcOffset->z}; + ur_rect_offset_t UrDstOffset{DstOffset->x, DstOffset->y, DstOffset->z}; + ur_rect_region_t UrCopyExtent{}; + UrCopyExtent.depth = CopyExtent->depth; + UrCopyExtent.height = CopyExtent->height; + UrCopyExtent.width = CopyExtent->width; + ur_rect_region_t UrHostExtent{}; + UrHostExtent.depth = HostExtent->depth; + UrHostExtent.height = HostExtent->height; + UrHostExtent.width = HostExtent->width; + + const ur_event_handle_t *UrEventWaitList = + reinterpret_cast(EventWaitList); + ur_event_handle_t *UrEvent = reinterpret_cast(Event); + + HANDLE_ERRORS(urBindlessImagesImageCopyExp( + UrQueue, DstPtr, SrcPtr, &UrFormat, &UrDesc, UrFlags, UrSrcOffset, + UrDstOffset, UrCopyExtent, UrHostExtent, NumEventsInWaitList, + UrEventWaitList, UrEvent)); + + return PI_SUCCESS; +} + +inline pi_result piextMemUnsampledImageHandleDestroy(pi_context Context, + pi_device Device, + pi_image_handle Handle) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_image_handle_t UrHandle = + reinterpret_cast(Handle); + + HANDLE_ERRORS(urBindlessImagesUnsampledImageHandleDestroyExp( + UrContext, UrDevice, UrHandle)); + + return PI_SUCCESS; +} + +inline pi_result piextMemSampledImageHandleDestroy(pi_context Context, + pi_device Device, + pi_image_handle Handle) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_image_handle_t UrHandle = + reinterpret_cast(Handle); + + HANDLE_ERRORS(urBindlessImagesSampledImageHandleDestroyExp( + UrContext, UrDevice, UrHandle)); + + return PI_SUCCESS; +} + +static void pi2urImageInfoFlags(const pi_image_info PiFlags, + ur_image_info_t *UrFlags) { + switch (PiFlags) { + case PI_IMAGE_INFO_FORMAT: + *UrFlags = UR_IMAGE_INFO_FORMAT; + break; + case PI_IMAGE_INFO_ELEMENT_SIZE: + *UrFlags = UR_IMAGE_INFO_ELEMENT_SIZE; + break; + case PI_IMAGE_INFO_ROW_PITCH: + *UrFlags = UR_IMAGE_INFO_ROW_PITCH; + break; + case PI_IMAGE_INFO_SLICE_PITCH: + *UrFlags = UR_IMAGE_INFO_SLICE_PITCH; + break; + case PI_IMAGE_INFO_WIDTH: + *UrFlags = UR_IMAGE_INFO_WIDTH; + break; + case PI_IMAGE_INFO_HEIGHT: + *UrFlags = UR_IMAGE_INFO_HEIGHT; + break; + case PI_IMAGE_INFO_DEPTH: + *UrFlags = UR_IMAGE_INFO_DEPTH; + break; + default: + die("pi2urImageInfoFlags: Unsupported use case"); + } +} + +inline pi_result piextMemImageGetInfo(pi_image_mem_handle MemHandle, + pi_image_info ParamName, void *ParamValue, + size_t *ParamValueSizeRet) { + ur_exp_image_mem_handle_t UrMemHandle = + reinterpret_cast(MemHandle); + + ur_image_info_t UrParamName{}; + pi2urImageInfoFlags(ParamName, &UrParamName); + + HANDLE_ERRORS(urBindlessImagesImageGetInfoExp(UrMemHandle, UrParamName, + ParamValue, ParamValueSizeRet)); + + if (ParamName == pi_image_info::PI_IMAGE_INFO_FORMAT && ParamValue) { + pi_image_format PiFormat; + ur2piImageFormat(reinterpret_cast(ParamValue), + &PiFormat); + reinterpret_cast(ParamValue)->image_channel_data_type = + PiFormat.image_channel_data_type; + reinterpret_cast(ParamValue)->image_channel_order = + PiFormat.image_channel_order; + if (ParamValueSizeRet) { + *ParamValueSizeRet = sizeof(pi_image_format); + } + } + + return PI_SUCCESS; +} + +inline pi_result piextMemImportOpaqueFD(pi_context Context, pi_device Device, + size_t Size, int FileDescriptor, + pi_interop_mem_handle *RetHandle) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_interop_mem_handle_t *UrRetHandle = + reinterpret_cast(RetHandle); + + HANDLE_ERRORS(urBindlessImagesImportOpaqueFDExp(UrContext, UrDevice, Size, + FileDescriptor, UrRetHandle)); + + return PI_SUCCESS; +} + +inline pi_result piextMemMapExternalArray(pi_context Context, pi_device Device, + pi_image_format *ImageFormat, + pi_image_desc *ImageDesc, + pi_interop_mem_handle MemHandle, + pi_image_mem_handle *RetMem) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + + ur_image_format_t UrFormat{}; + ur_image_desc_t UrDesc{}; + pi2urImageDesc(ImageFormat, ImageDesc, &UrFormat, &UrDesc); + + ur_exp_interop_mem_handle_t UrMemHandle = + reinterpret_cast(MemHandle); + ur_exp_image_mem_handle_t *UrRetMem = + reinterpret_cast(RetMem); + + HANDLE_ERRORS(urBindlessImagesMapExternalArrayExp( + UrContext, UrDevice, &UrFormat, &UrDesc, UrMemHandle, UrRetMem)); + + return PI_SUCCESS; +} + +inline pi_result piextMemReleaseInterop(pi_context Context, pi_device Device, + pi_interop_mem_handle ExtMem) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_interop_mem_handle_t UrExtMem = + reinterpret_cast(ExtMem); + + HANDLE_ERRORS( + urBindlessImagesReleaseInteropExp(UrContext, UrDevice, UrExtMem)); + + return PI_SUCCESS; +} + +inline pi_result +piextImportExternalSemaphoreOpaqueFD(pi_context Context, pi_device Device, + int FileDescriptor, + pi_interop_semaphore_handle *RetHandle) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_interop_semaphore_handle_t *UrRetHandle = + reinterpret_cast(RetHandle); + + HANDLE_ERRORS(urBindlessImagesImportExternalSemaphoreOpaqueFDExp( + UrContext, UrDevice, FileDescriptor, UrRetHandle)); + + return PI_SUCCESS; +} + +inline pi_result +piextDestroyExternalSemaphore(pi_context Context, pi_device Device, + pi_interop_semaphore_handle SemHandle) { + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_device_handle_t UrDevice = reinterpret_cast(Device); + ur_exp_interop_semaphore_handle_t UrSemHandle = + reinterpret_cast(SemHandle); + + HANDLE_ERRORS(urBindlessImagesDestroyExternalSemaphoreExp(UrContext, UrDevice, + UrSemHandle)); + + return PI_SUCCESS; +} + +inline pi_result +piextWaitExternalSemaphore(pi_queue Queue, + pi_interop_semaphore_handle SemHandle, + pi_uint32 NumEventsInWaitList, + const pi_event *EventWaitList, pi_event *Event) { + PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE); + + ur_queue_handle_t UrQueue = reinterpret_cast(Queue); + ur_exp_interop_semaphore_handle_t UrSemHandle = + reinterpret_cast(SemHandle); + const ur_event_handle_t *UrEventWaitList = + reinterpret_cast(EventWaitList); + ur_event_handle_t *UrEvent = reinterpret_cast(Event); + + HANDLE_ERRORS(urBindlessImagesWaitExternalSemaphoreExp( + UrQueue, UrSemHandle, NumEventsInWaitList, UrEventWaitList, UrEvent)); + + return PI_SUCCESS; +} + +inline pi_result +piextSignalExternalSemaphore(pi_queue Queue, + pi_interop_semaphore_handle SemHandle, + pi_uint32 NumEventsInWaitList, + const pi_event *EventWaitList, pi_event *Event) { + PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE); + + ur_queue_handle_t UrQueue = reinterpret_cast(Queue); + ur_exp_interop_semaphore_handle_t UrSemHandle = + reinterpret_cast(SemHandle); + const ur_event_handle_t *UrEventWaitList = + reinterpret_cast(EventWaitList); + ur_event_handle_t *UrEvent = reinterpret_cast(Event); + + HANDLE_ERRORS(urBindlessImagesSignalExternalSemaphoreExp( + UrQueue, UrSemHandle, NumEventsInWaitList, UrEventWaitList, UrEvent)); + + return PI_SUCCESS; +} + } // namespace pi2ur diff --git a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp index 20fe7384a9c63..36ca5596a7acf 100644 --- a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp +++ b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp @@ -866,8 +866,10 @@ __SYCL_EXPORT pi_result piextProgramCreateWithNativeHandle( __SYCL_EXPORT pi_result piSamplerCreate( pi_context Context, const pi_sampler_properties *SamplerProperties, + float minMipmapLevelClamp, float maxMipmapLevelClamp, float maxAnisotropy, pi_sampler *RetSampler) { - return pi2ur::piSamplerCreate(Context, SamplerProperties, RetSampler); + return pi2ur::piSamplerCreate(Context, SamplerProperties, minMipmapLevelClamp, + maxMipmapLevelClamp, maxAnisotropy, RetSampler); } __SYCL_EXPORT pi_result piSamplerGetInfo(pi_sampler Sampler, diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp index 24f9d52a07e46..fa80240f0fc27 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp @@ -873,6 +873,85 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: { return ReturnValue(int32_t{1}); } + case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: { + // On CUDA bindless images are supported + return ReturnValue(true); + } + case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: { + // On CUDA 1D bindless image USM is not supported + // More specifically, linear filtering is not supported + return ReturnValue(false); + } + case UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP: { + // On CUDA 2D bindless image USM is supported + return ReturnValue(true); + } + case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP: { + int32_t tex_pitch_align = 0; + sycl::detail::ur::assertion( + cuDeviceGetAttribute(&tex_pitch_align, + CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT, + hDevice->get()) == CUDA_SUCCESS); + return ReturnValue(tex_pitch_align); + } + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP: { + int32_t tex_max_linear_width = 0; + sycl::detail::ur::assertion( + cuDeviceGetAttribute(&tex_max_linear_width, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH, + hDevice->get()) == CUDA_SUCCESS); + return ReturnValue(tex_max_linear_width); + } + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP: { + int32_t tex_max_linear_height = 0; + sycl::detail::ur::assertion( + cuDeviceGetAttribute( + &tex_max_linear_height, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT, + hDevice->get()) == CUDA_SUCCESS); + return ReturnValue(tex_max_linear_height); + } + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP: { + int32_t tex_max_linear_pitch = 0; + sycl::detail::ur::assertion( + cuDeviceGetAttribute(&tex_max_linear_pitch, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH, + hDevice->get()) == CUDA_SUCCESS); + return ReturnValue(tex_max_linear_pitch); + } + case UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP: { + // CUDA supports mipmaps + return ReturnValue(true); + } + case UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP: { + // CUDA supports anisotropic filtering + return ReturnValue(true); + } + case UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP: { + // CUDA has no query for this, but documentation states max value is 16 + return ReturnValue(16.f); + } + case UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP: { + // CUDA supports creation of images from individual mipmap levels + return ReturnValue(true); + } + + case UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP: { + // CUDA supports importing external memory + return ReturnValue(true); + } + case UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP: { + // CUDA does not support exporting it's own device memory + return ReturnValue(false); + } + case UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP: { + // CUDA supports importing external semaphores + return ReturnValue(true); + } + case UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP: { + // CUDA does not support exporting semaphores or events + return ReturnValue(false); + } case UR_DEVICE_INFO_DEVICE_ID: { int Value = 0; sycl::detail::ur::assertion( diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/enqueue.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/enqueue.cpp index 52c4c3895c4b5..249768861392a 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/enqueue.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/enqueue.cpp @@ -6,6 +6,7 @@ // //===-----------------------------------------------------------------===// +#include "enqueue.hpp" #include "common.hpp" #include "context.hpp" #include "event.hpp" diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/enqueue.hpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/enqueue.hpp new file mode 100644 index 0000000000000..393085ce42eb2 --- /dev/null +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/enqueue.hpp @@ -0,0 +1,16 @@ +//===--------- enqueue.hpp - CUDA Adapter ----------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-----------------------------------------------------------------===// +#pragma once + +#include +#include +#include + +ur_result_t enqueueEventsWait(ur_queue_handle_t CommandQueue, CUstream Stream, + uint32_t NumEventsInWaitList, + const ur_event_handle_t *EventWaitList); diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp new file mode 100644 index 0000000000000..f21fd5c308732 --- /dev/null +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp @@ -0,0 +1,1101 @@ +//===--------- image.cpp - CUDA Adapter ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-----------------------------------------------------------------===// + +#include + +#include "common.hpp" +#include "context.hpp" +#include "enqueue.hpp" +#include "event.hpp" +#include "image.hpp" +#include "memory.hpp" +#include "queue.hpp" +#include "sampler.hpp" +#include "ur/ur.hpp" +#include "ur_api.h" + +ur_result_t urCalculateNumChannels(ur_image_channel_order_t order, + unsigned int *NumChannels) { + ur_result_t Err = UR_RESULT_SUCCESS; + switch (order) { + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_A: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_R: + *NumChannels = 1; + break; + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RG: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RA: + *NumChannels = 2; + break; + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGB: + Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + break; + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGBA: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_ARGB: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_BGRA: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_ABGR: + *NumChannels = 4; + break; + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RX: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGX: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGBX: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_SRGBA: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_INTENSITY: + case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_LUMINANCE: + default: + Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + break; + } + return Err; +} + +/// Convert a UR image format to a CUDA image format and +/// get the pixel size in bytes. +/// /param image_channel_type is the ur_image_channel_type_t. +/// /param return_cuda_format will be set to the equivalent cuda +/// format if not nullptr. +/// /param return_pixel_types_size_bytes will be set to the pixel +/// byte size if not nullptr. +ur_result_t +urToCudaImageChannelFormat(ur_image_channel_type_t image_channel_type, + CUarray_format *return_cuda_format, + size_t *return_pixel_types_size_bytes) { + + CUarray_format cuda_format; + size_t PixelTypeSizeBytes; + ur_result_t Err = UR_RESULT_SUCCESS; + + switch (image_channel_type) { + case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8: + cuda_format = CU_AD_FORMAT_UNORM_INT8X1; + PixelTypeSizeBytes = 1; + break; + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8: + cuda_format = CU_AD_FORMAT_UNSIGNED_INT8; + PixelTypeSizeBytes = 1; + break; + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8: + cuda_format = CU_AD_FORMAT_SIGNED_INT8; + PixelTypeSizeBytes = 1; + break; + case UR_IMAGE_CHANNEL_TYPE_UNORM_INT16: + cuda_format = CU_AD_FORMAT_UNORM_INT16X1; + PixelTypeSizeBytes = 2; + break; + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16: + cuda_format = CU_AD_FORMAT_UNSIGNED_INT16; + PixelTypeSizeBytes = 2; + break; + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16: + cuda_format = CU_AD_FORMAT_SIGNED_INT16; + PixelTypeSizeBytes = 2; + break; + case UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT: + cuda_format = CU_AD_FORMAT_HALF; + PixelTypeSizeBytes = 2; + break; + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32: + cuda_format = CU_AD_FORMAT_UNSIGNED_INT32; + PixelTypeSizeBytes = 4; + break; + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32: + cuda_format = CU_AD_FORMAT_SIGNED_INT32; + PixelTypeSizeBytes = 4; + break; + case UR_IMAGE_CHANNEL_TYPE_FLOAT: + cuda_format = CU_AD_FORMAT_FLOAT; + PixelTypeSizeBytes = 4; + break; + default: + Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + break; + } + + if (return_cuda_format) { + *return_cuda_format = cuda_format; + } + if (return_pixel_types_size_bytes) { + *return_pixel_types_size_bytes = PixelTypeSizeBytes; + } + return Err; +} + +ur_result_t +cudaToUrImageChannelFormat(CUarray_format cuda_format, + ur_image_channel_type_t *return_image_channel_type) { + assert(return_image_channel_type); + ur_result_t Err = UR_RESULT_SUCCESS; + + switch (cuda_format) { + case CU_AD_FORMAT_UNSIGNED_INT8: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8; + break; + case CU_AD_FORMAT_UNSIGNED_INT16: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16; + break; + case CU_AD_FORMAT_UNSIGNED_INT32: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32; + break; + case CU_AD_FORMAT_SIGNED_INT8: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8; + break; + case CU_AD_FORMAT_SIGNED_INT16: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16; + break; + case CU_AD_FORMAT_SIGNED_INT32: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32; + break; + case CU_AD_FORMAT_HALF: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT; + break; + case CU_AD_FORMAT_FLOAT: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_FLOAT; + break; + case CU_AD_FORMAT_UNORM_INT8X1: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNORM_INT8; + break; + case CU_AD_FORMAT_UNORM_INT16X1: + *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNORM_INT16; + break; + default: + Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + break; + } + + return Err; +} + +ur_result_t urTextureCreate(ur_context_handle_t hContext, + ur_sampler_handle_t hSampler, + const ur_image_desc_t *pImageDesc, + CUDA_RESOURCE_DESC ResourceDesc, + ur_exp_image_handle_t *phRetImage) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(phRetImage, UR_RESULT_ERROR_INVALID_NULL_POINTER); + ur_result_t RetErr = UR_RESULT_SUCCESS; + + try { + /// pi_sampler_properties + /// | | + /// ----------------------------------- + /// | 31 30 ... 6 | N/A + /// | 5 | mip filter mode + /// | 4 3 2 | addressing mode + /// | 1 | filter mode + /// | 0 | normalize coords + CUDA_TEXTURE_DESC ImageTexDesc = {}; + CUaddress_mode AddrMode; + uint32_t AddrModeProp = ((hSampler->Props >> 2) & 7); + if (AddrModeProp == (UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE - + UR_SAMPLER_ADDRESSING_MODE_NONE)) { + AddrMode = CU_TR_ADDRESS_MODE_CLAMP; + } else if (AddrModeProp == (UR_SAMPLER_ADDRESSING_MODE_CLAMP - + UR_SAMPLER_ADDRESSING_MODE_NONE)) { + AddrMode = CU_TR_ADDRESS_MODE_BORDER; + } else if (AddrModeProp == (UR_SAMPLER_ADDRESSING_MODE_REPEAT - + UR_SAMPLER_ADDRESSING_MODE_NONE)) { + AddrMode = CU_TR_ADDRESS_MODE_WRAP; + } else if (AddrModeProp == (UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT - + UR_SAMPLER_ADDRESSING_MODE_NONE)) { + AddrMode = CU_TR_ADDRESS_MODE_MIRROR; + } + CUfilter_mode FilterMode; + uint32_t FilterModeProp = ((hSampler->Props >> 1) & 1); + FilterMode = + FilterModeProp ? CU_TR_FILTER_MODE_LINEAR : CU_TR_FILTER_MODE_POINT; + ImageTexDesc.filterMode = FilterMode; + + // Mipmap attributes + CUfilter_mode MipFilterMode; + uint32_t MipFilterModeProp = ((hSampler->Props >> 5) & 1); + MipFilterMode = + MipFilterModeProp ? CU_TR_FILTER_MODE_LINEAR : CU_TR_FILTER_MODE_POINT; + ImageTexDesc.mipmapFilterMode = MipFilterMode; + ImageTexDesc.maxMipmapLevelClamp = hSampler->MaxMipmapLevelClamp; + ImageTexDesc.minMipmapLevelClamp = hSampler->MinMipmapLevelClamp; + ImageTexDesc.maxAnisotropy = hSampler->MaxAnisotropy; + + // The address modes can interfere with other dimensionsenqueueEventsWait + // e.g. 1D texture sampling can be interfered with when setting other + // dimension address modes despite their nonexistence + ImageTexDesc.addressMode[0] = AddrMode; // 1D + ImageTexDesc.addressMode[1] = + pImageDesc->height > 0 ? AddrMode : ImageTexDesc.addressMode[1]; // 2D + ImageTexDesc.addressMode[2] = + pImageDesc->depth > 0 ? AddrMode : ImageTexDesc.addressMode[2]; // 3D + + // flags takes the normalized coordinates setting -- unnormalized is default + ImageTexDesc.flags = (hSampler->Props & 1) ? CU_TRSF_NORMALIZED_COORDINATES + : ImageTexDesc.flags; + + // CUDA default promotes 8-bit and 16-bit integers to float between [0,1] + // This flag prevents this behaviour + ImageTexDesc.flags |= CU_TRSF_READ_AS_INTEGER; + + CUtexObject Texture; + RetErr = UR_CHECK_ERROR( + cuTexObjectCreate(&Texture, &ResourceDesc, &ImageTexDesc, nullptr)); + *phRetImage = (ur_exp_image_handle_t)Texture; + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + const ur_usm_desc_t *pUSMDesc, ur_usm_pool_handle_t pool, + size_t widthInBytes, size_t height, size_t elementSizeBytes, void **ppMem, + size_t *pResultPitch) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(ppMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(pResultPitch, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + std::ignore = pUSMDesc; + std::ignore = pool; + + assert(widthInBytes > 0); + assert(height > 0); + assert(elementSizeBytes > 0); + + // elementSizeBytes can only take on values of 4, 8, or 16 + // small data types need to be minimised to 4 + if (elementSizeBytes < 4) { + elementSizeBytes = 4; + } + assert(elementSizeBytes == 4 || elementSizeBytes == 8 || + elementSizeBytes == 16); + ur_result_t Result = UR_RESULT_SUCCESS; + try { + ScopedContext Active(hDevice->getContext()); + Result = + UR_CHECK_ERROR(cuMemAllocPitch((CUdeviceptr *)ppMem, pResultPitch, + widthInBytes, height, elementSizeBytes)); + } catch (ur_result_t error) { + Result = error; + } + + return Result; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urBindlessImagesUnsampledImageHandleDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_exp_image_handle_t hImage) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(hImage, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + RetErr = UR_CHECK_ERROR(cuSurfObjectDestroy((CUsurfObject)hImage)); + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urBindlessImagesSampledImageHandleDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_exp_image_handle_t hImage) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(hImage, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + RetErr = UR_CHECK_ERROR(cuTexObjectDestroy((CUtexObject)hImage)); + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, + ur_exp_image_mem_handle_t *phImageMem) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(phImageMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + // Populate descriptor + CUDA_ARRAY3D_DESCRIPTOR array_desc = {}; + + RetErr = urCalculateNumChannels(pImageFormat->channelOrder, + &array_desc.NumChannels); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die("urBindlessImagesImageAllocateExp given " + "unsupported channelType"); + } + + RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, + &array_desc.Format, nullptr); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die("urBindlessImagesImageAllocateExp given " + "unsupported channelType"); + } + + array_desc.Flags = 0; // No flags required + array_desc.Width = pImageDesc->width; + if (pImageDesc->type == UR_MEM_TYPE_IMAGE1D) { + array_desc.Height = 0; + array_desc.Depth = 0; + } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE2D) { + array_desc.Height = pImageDesc->height; + array_desc.Depth = 0; + } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE3D) { + array_desc.Height = pImageDesc->height; + array_desc.Depth = pImageDesc->depth; + } + + ScopedContext Active(hDevice->getContext()); + + // Allocate a cuArray + if (pImageDesc->numMipLevel == 1) { + CUarray ImageArray; + + try { + RetErr = UR_CHECK_ERROR(cuArray3DCreate(&ImageArray, &array_desc)); + *phImageMem = (ur_exp_image_mem_handle_t)ImageArray; + } catch (ur_result_t Err) { + cuArrayDestroy(ImageArray); + return Err; + } catch (...) { + cuArrayDestroy(ImageArray); + return UR_RESULT_ERROR_UNKNOWN; + } + } else // Allocate a cuMipmappedArray + { + CUmipmappedArray mip_array; + array_desc.Flags = CUDA_ARRAY3D_SURFACE_LDST; + + try { + RetErr = UR_CHECK_ERROR(cuMipmappedArrayCreate(&mip_array, &array_desc, + pImageDesc->numMipLevel)); + *phImageMem = (ur_exp_image_mem_handle_t)mip_array; + } catch (ur_result_t Err) { + cuMipmappedArrayDestroy(mip_array); + return Err; + } catch (...) { + cuMipmappedArrayDestroy(mip_array); + return UR_RESULT_ERROR_UNKNOWN; + } + } + + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageFreeExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hImageMem) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + ScopedContext Active(hDevice->getContext()); + try { + RetErr = UR_CHECK_ERROR(cuArrayDestroy((CUarray)hImageMem)); + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hImageMem, const ur_image_format_t *pImageFormat, + const ur_image_desc_t *pImageDesc, ur_mem_handle_t *phMem, + ur_exp_image_handle_t *phImage) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(phMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(phImage, UR_RESULT_ERROR_INVALID_NULL_POINTER); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + unsigned int NumChannels = 0; + RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die("urBindlessImagesUnsampledImageCreateExp given " + "unsupported channelType"); + } + + CUarray_format format; + size_t PixelTypeSizeBytes; + RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, &format, + &PixelTypeSizeBytes); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die("urBindlessImagesUnsampledImageCreateExp given " + "unsupported channelType"); + } + + try { + + ScopedContext Active(hDevice->getContext()); + + CUDA_RESOURCE_DESC image_res_desc = {}; + + // We have a CUarray + image_res_desc.resType = CU_RESOURCE_TYPE_ARRAY; + image_res_desc.res.array.hArray = (CUarray)hImageMem; + + // We create surfaces in the unsampled images case as it conforms to how + // CUDA deals with unsampled images + CUsurfObject surface; + RetErr = UR_CHECK_ERROR(cuSurfObjectCreate(&surface, &image_res_desc)); + *phImage = (ur_exp_image_handle_t)surface; + + auto urMemObj = std::unique_ptr(new ur_mem_handle_t_{ + hContext, (CUarray)hImageMem, surface, pImageDesc->type}); + + if (urMemObj == nullptr) { + return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + *phMem = urMemObj.release(); + + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hImageMem, const ur_image_format_t *pImageFormat, + const ur_image_desc_t *pImageDesc, ur_sampler_handle_t hSampler, + ur_mem_handle_t *phMem, ur_exp_image_handle_t *phImage) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(phMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(phImage, UR_RESULT_ERROR_INVALID_NULL_POINTER); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + ScopedContext Active(hDevice->getContext()); + + unsigned int NumChannels = 0; + RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die("urBindlessImagesSampledImageCreateExp given " + "unsupported channelOrder"); + } + + CUarray_format format; + size_t PixelTypeSizeBytes; + RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, &format, + &PixelTypeSizeBytes); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die("urBindlessImagesSampledImageCreateExp given " + "unsupported channelType"); + } + + try { + CUDA_RESOURCE_DESC image_res_desc = {}; + + unsigned int mem_type; + // If this function doesn't return successfully, we assume that hImageMem is + // a CUarray or CUmipmappedArray If this function returns successfully, we + // check whether hImageMem is device memory (even managed memory isn't + // considered shared) + CUresult Err = cuPointerGetAttribute( + &mem_type, CU_POINTER_ATTRIBUTE_MEMORY_TYPE, (CUdeviceptr)hImageMem); + if (Err != CUDA_SUCCESS) { + // We have a CUarray + if (pImageDesc->numMipLevel == 1) { + image_res_desc.resType = CU_RESOURCE_TYPE_ARRAY; + image_res_desc.res.array.hArray = (CUarray)hImageMem; + } + // We have a CUmipmappedArray + else { + image_res_desc.resType = CU_RESOURCE_TYPE_MIPMAPPED_ARRAY; + image_res_desc.res.mipmap.hMipmappedArray = (CUmipmappedArray)hImageMem; + } + } else if (mem_type == CU_MEMORYTYPE_DEVICE) { + // We have a USM pointer + if (pImageDesc->type == UR_MEM_TYPE_IMAGE1D) { + image_res_desc.resType = CU_RESOURCE_TYPE_LINEAR; + image_res_desc.res.linear.devPtr = (CUdeviceptr)hImageMem; + image_res_desc.res.linear.format = format; + image_res_desc.res.linear.numChannels = NumChannels; + image_res_desc.res.linear.sizeInBytes = + pImageDesc->width * PixelTypeSizeBytes * NumChannels; + } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE2D) { + image_res_desc.resType = CU_RESOURCE_TYPE_PITCH2D; + image_res_desc.res.pitch2D.devPtr = (CUdeviceptr)hImageMem; + image_res_desc.res.pitch2D.format = format; + image_res_desc.res.pitch2D.numChannels = NumChannels; + image_res_desc.res.pitch2D.width = pImageDesc->width; + image_res_desc.res.pitch2D.height = pImageDesc->height; + image_res_desc.res.pitch2D.pitchInBytes = pImageDesc->rowPitch; + } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE3D) { + sycl::detail::ur::die("urBindlessImagesSampledImageCreateExp cannot " + "create 3D image from USM"); + } + } else { + sycl::detail::ur::die( + "urBindlessImagesSampledImageCreateExp unknown image memory type"); + } + + RetErr = urTextureCreate(hContext, hSampler, pImageDesc, image_res_desc, + phImage); + + auto urMemObj = std::unique_ptr(new ur_mem_handle_t_{ + hContext, (CUarray)hImageMem, (CUtexObject)*phImage, hSampler, + pImageDesc->type}); + + if (urMemObj == nullptr) { + return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + *phMem = urMemObj.release(); + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( + ur_queue_handle_t hQueue, void *pDst, void *pSrc, + const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, + ur_exp_image_copy_flags_t imageCopyFlags, ur_rect_offset_t srcOffset, + ur_rect_offset_t dstOffset, ur_rect_region_t copyExtent, + ur_rect_region_t hostExtent, uint32_t numEventsInWaitList, + const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { + UR_ASSERT(hQueue, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(pDst, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(pSrc, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + unsigned int NumChannels = 0; + size_t PixelTypeSizeBytes = 0; + + RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die( + "urBindlessImagesImageCopyExp given unsupported channelOrder"); + } + + // We need to get this now in bytes for calculating the total image size later + RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, nullptr, + &PixelTypeSizeBytes); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die( + "urBindlessImagesImageCopyExp given unsupported channelType"); + } + + size_t PixelSizeBytes = PixelTypeSizeBytes * NumChannels; + + try { + ScopedContext Active(hQueue->getContext()); + CUstream Stream = hQueue->getNextTransferStream(); + RetErr = + enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); + // We have to use a different copy function for each image dimensionality + + if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) { + if (pImageDesc->type == UR_MEM_TYPE_IMAGE1D) { + size_t CopyExtentBytes = PixelSizeBytes * copyExtent.width; + char *SrcWithOffset = (char *)pSrc + (srcOffset.x * PixelSizeBytes); + RetErr = UR_CHECK_ERROR( + cuMemcpyHtoAAsync((CUarray)pDst, dstOffset.x * PixelSizeBytes, + (void *)SrcWithOffset, CopyExtentBytes, Stream)); + } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE2D) { + CUDA_MEMCPY2D cpy_desc = {}; + cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST; + cpy_desc.srcHost = pSrc; + cpy_desc.srcXInBytes = srcOffset.x * PixelSizeBytes; + cpy_desc.srcY = srcOffset.y; + cpy_desc.dstXInBytes = dstOffset.x * PixelSizeBytes; + cpy_desc.dstY = dstOffset.y; + cpy_desc.srcPitch = hostExtent.width * PixelSizeBytes; + if (pImageDesc->rowPitch == 0) { + cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY; + cpy_desc.dstArray = (CUarray)pDst; + } else { + // Pitched memory + cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_DEVICE; + cpy_desc.dstDevice = (CUdeviceptr)pDst; + cpy_desc.dstPitch = pImageDesc->rowPitch; + } + cpy_desc.WidthInBytes = PixelSizeBytes * copyExtent.width; + cpy_desc.Height = copyExtent.height; + RetErr = UR_CHECK_ERROR(cuMemcpy2DAsync(&cpy_desc, Stream)); + } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE3D) { + CUDA_MEMCPY3D cpy_desc = {}; + cpy_desc.srcXInBytes = srcOffset.x * PixelSizeBytes; + cpy_desc.srcY = srcOffset.y; + cpy_desc.srcZ = srcOffset.z; + cpy_desc.dstXInBytes = dstOffset.x * PixelSizeBytes; + cpy_desc.dstY = dstOffset.y; + cpy_desc.dstZ = dstOffset.z; + cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST; + cpy_desc.srcHost = pSrc; + cpy_desc.srcPitch = hostExtent.width * PixelSizeBytes; + cpy_desc.srcHeight = hostExtent.height; + cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY; + cpy_desc.dstArray = (CUarray)pDst; + cpy_desc.WidthInBytes = PixelSizeBytes * copyExtent.width; + cpy_desc.Height = copyExtent.height; + cpy_desc.Depth = copyExtent.depth; + RetErr = UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream)); + } + } else if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) { + if (pImageDesc->type == UR_MEM_TYPE_IMAGE1D) { + size_t CopyExtentBytes = PixelSizeBytes * copyExtent.width; + size_t src_offset_bytes = PixelSizeBytes * srcOffset.x; + void *dst_with_offset = + (void *)((char *)pDst + (PixelSizeBytes * dstOffset.x)); + RetErr = UR_CHECK_ERROR( + cuMemcpyAtoHAsync(dst_with_offset, (CUarray)pSrc, src_offset_bytes, + CopyExtentBytes, Stream)); + } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE2D) { + CUDA_MEMCPY2D cpy_desc = {}; + cpy_desc.srcXInBytes = srcOffset.x; + cpy_desc.srcY = srcOffset.y; + cpy_desc.dstXInBytes = dstOffset.x; + cpy_desc.dstY = dstOffset.y; + cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST; + cpy_desc.dstHost = pDst; + if (pImageDesc->rowPitch == 0) { + cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY; + cpy_desc.srcArray = (CUarray)pSrc; + } else { + // Pitched memory + cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_DEVICE; + cpy_desc.srcPitch = pImageDesc->rowPitch; + cpy_desc.srcDevice = (CUdeviceptr)pSrc; + } + cpy_desc.WidthInBytes = PixelSizeBytes * copyExtent.width; + cpy_desc.Height = copyExtent.height; + RetErr = UR_CHECK_ERROR(cuMemcpy2DAsync(&cpy_desc, Stream)); + } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE3D) { + CUDA_MEMCPY3D cpy_desc = {}; + cpy_desc.srcXInBytes = srcOffset.x; + cpy_desc.srcY = srcOffset.y; + cpy_desc.srcZ = srcOffset.z; + cpy_desc.dstXInBytes = dstOffset.x; + cpy_desc.dstY = dstOffset.y; + cpy_desc.dstZ = dstOffset.z; + cpy_desc.srcMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_ARRAY; + cpy_desc.srcArray = (CUarray)pSrc; + cpy_desc.dstMemoryType = CUmemorytype_enum::CU_MEMORYTYPE_HOST; + cpy_desc.dstHost = pDst; + cpy_desc.WidthInBytes = PixelSizeBytes * copyExtent.width; + cpy_desc.Height = copyExtent.height; + cpy_desc.Depth = copyExtent.depth; + RetErr = UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream)); + } + } else if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE) { + /// TODO: implemet device to device copy + } else { + sycl::detail::ur::die("urBindlessImagesImageCopyExp given unsupported " + "image copy imageCopyFlags"); + } + + if (phEvent) { + auto NewEvent = ur_event_handle_t_::makeNative(UR_COMMAND_MEM_IMAGE_COPY, + hQueue, Stream); + NewEvent->record(); + *phEvent = NewEvent; + } + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( + ur_exp_image_mem_handle_t hImageMem, ur_image_info_t propName, + void *pPropValue, size_t *pPropSizeRet) { + UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + + CUDA_ARRAY3D_DESCRIPTOR ArrayDesc; + ur_result_t RetErr = + UR_CHECK_ERROR(cuArray3DGetDescriptor(&ArrayDesc, (CUarray)hImageMem)); + switch (propName) { + case UR_IMAGE_INFO_WIDTH: + if (pPropValue) + *(size_t *)pPropValue = ArrayDesc.Width; + if (pPropSizeRet) + *pPropSizeRet = sizeof(size_t); + break; + case UR_IMAGE_INFO_HEIGHT: + if (pPropValue) + *(size_t *)pPropValue = ArrayDesc.Height; + if (pPropSizeRet) + *pPropSizeRet = sizeof(size_t); + break; + case UR_IMAGE_INFO_DEPTH: + if (pPropValue) + *(size_t *)pPropValue = ArrayDesc.Depth; + if (pPropSizeRet) + *pPropSizeRet = sizeof(size_t); + break; + case UR_IMAGE_INFO_FORMAT: + ur_image_channel_type_t ChannelType; + ur_image_channel_order_t ChannelOrder; + RetErr = cudaToUrImageChannelFormat(ArrayDesc.Format, &ChannelType); + // CUDA does not have a notion of channel "order" in the same way that + // SYCL 1.2.1 does. + switch (ArrayDesc.NumChannels) { + case 1: + ChannelOrder = UR_IMAGE_CHANNEL_ORDER_R; + break; + case 2: + ChannelOrder = UR_IMAGE_CHANNEL_ORDER_RG; + break; + case 4: + ChannelOrder = UR_IMAGE_CHANNEL_ORDER_RGBA; + break; + } + if (pPropValue) { + ((ur_image_format_t *)pPropValue)->channelType = ChannelType; + ((ur_image_format_t *)pPropValue)->channelOrder = ChannelOrder; + } + if (pPropSizeRet) + *pPropSizeRet = sizeof(ur_image_format_t); + break; + default: + RetErr = UR_RESULT_ERROR_INVALID_VALUE; + break; + } + + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hImageMem, uint32_t mipmapLevel, + ur_exp_image_mem_handle_t *phImageMem) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(phImageMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + try { + ScopedContext Active(hDevice->getContext()); + CUarray ImageArray; + RetErr = UR_CHECK_ERROR(cuMipmappedArrayGetLevel( + &ImageArray, (CUmipmappedArray)hImageMem, mipmapLevel)); + *phImageMem = (ur_exp_image_mem_handle_t)ImageArray; + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hMem) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(hMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + ScopedContext Active(hDevice->getContext()); + try { + RetErr = UR_CHECK_ERROR(cuMipmappedArrayDestroy((CUmipmappedArray)hMem)); + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, size_t size, + uint32_t fileDescriptor, ur_exp_interop_mem_handle_t *phInteropMem) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(phInteropMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + try { + ScopedContext Active(hDevice->getContext()); + + CUDA_EXTERNAL_MEMORY_HANDLE_DESC extMemDesc = {}; + extMemDesc.handle.fd = fileDescriptor; + extMemDesc.type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD; + extMemDesc.size = size; + + CUexternalMemory extMem; + UR_CHECK_ERROR(cuImportExternalMemory(&extMem, &extMemDesc)); + *phInteropMem = (ur_exp_interop_mem_handle_t)extMem; + + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, + ur_exp_interop_mem_handle_t hInteropMem, + ur_exp_image_mem_handle_t *phImageMem) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT(hInteropMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(phImageMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + unsigned int NumChannels = 0; + RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die("cuda_piextMemMapExternalArray given " + "unsupported channelOrder\n"); + } + + CUarray_format format; + RetErr = + urToCudaImageChannelFormat(pImageFormat->channelType, &format, nullptr); + if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { + sycl::detail::ur::die("cuda_piextMemMapExternalArray given " + "unsupported channelType\n"); + } + + try { + ScopedContext Active(hDevice->getContext()); + + CUDA_ARRAY3D_DESCRIPTOR ArrayDesc = {}; + ArrayDesc.Width = pImageDesc->width; + ArrayDesc.Height = pImageDesc->height; + ArrayDesc.Depth = pImageDesc->depth; + ArrayDesc.NumChannels = NumChannels; + ArrayDesc.Format = format; + + CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC mipmapDesc = {}; + mipmapDesc.numLevels = 1; + mipmapDesc.arrayDesc = ArrayDesc; + + CUmipmappedArray memMipMap; + RetErr = UR_CHECK_ERROR(cuExternalMemoryGetMappedMipmappedArray( + &memMipMap, (CUexternalMemory)hInteropMem, &mipmapDesc)); + + CUarray memArray; + RetErr = UR_CHECK_ERROR(cuMipmappedArrayGetLevel(&memArray, memMipMap, 0)); + + *phImageMem = (ur_exp_image_mem_handle_t)memArray; + + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesReleaseInteropExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_interop_mem_handle_t hInteropMem) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(hInteropMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + try { + ScopedContext Active(hDevice->getContext()); + RetErr = + UR_CHECK_ERROR(cuDestroyExternalMemory((CUexternalMemory)hInteropMem)); + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urBindlessImagesImportExternalSemaphoreOpaqueFDExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + uint32_t fileDescriptor, + ur_exp_interop_semaphore_handle_t *phInteropSemaphoreHandle) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(phInteropSemaphoreHandle, UR_RESULT_ERROR_INVALID_NULL_POINTER); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + try { + ScopedContext Active(hDevice->getContext()); + + CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC ext_sem_desc = {}; + ext_sem_desc.handle.fd = fileDescriptor; + ext_sem_desc.type = CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD; + + CUexternalSemaphore semaphore; + RetErr = + UR_CHECK_ERROR(cuImportExternalSemaphore(&semaphore, &ext_sem_desc)); + + *phInteropSemaphoreHandle = (ur_exp_interop_semaphore_handle_t)semaphore; + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesDestroyExternalSemaphoreExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_interop_semaphore_handle_t hInteropSemaphore) { + UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), + UR_RESULT_ERROR_INVALID_CONTEXT); + UR_ASSERT(hInteropSemaphore, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + try { + ScopedContext Active(hDevice->getContext()); + RetErr = UR_CHECK_ERROR( + cuDestroyExternalSemaphore((CUexternalSemaphore)hInteropSemaphore)); + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( + ur_queue_handle_t hQueue, ur_exp_interop_semaphore_handle_t hSemaphore, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) { + UR_ASSERT(hQueue, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hSemaphore, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + try { + ScopedContext Active(hQueue->getContext()); + CUstream Stream = hQueue->getNextTransferStream(); + + RetErr = + enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); + + CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS SemWaitParams = {}; + + // Wait for one external semaphore + RetErr = UR_CHECK_ERROR(cuWaitExternalSemaphoresAsync( + (CUexternalSemaphore *)&hSemaphore, &SemWaitParams, 1 /* numExtSems */, + Stream)); + + if (phEvent) { + auto NewEvent = ur_event_handle_t_::makeNative( + UR_COMMAND_INTEROP_SEMAPHORE_WAIT_EXP, hQueue, Stream); + NewEvent->record(); + *phEvent = NewEvent; + } + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + return RetErr; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( + ur_queue_handle_t hQueue, ur_exp_interop_semaphore_handle_t hSemaphore, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) { + UR_ASSERT(hQueue, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_ASSERT(hSemaphore, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + + ur_result_t RetErr = UR_RESULT_SUCCESS; + + try { + ScopedContext Active(hQueue->getContext()); + CUstream Stream = hQueue->getNextTransferStream(); + + RetErr = + enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); + + CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS SemSignalParams = {}; + + // Signal one external semaphore + RetErr = UR_CHECK_ERROR(cuSignalExternalSemaphoresAsync( + (CUexternalSemaphore *)&hSemaphore, &SemSignalParams, + 1 /* numExtSems */, Stream)); + + if (phEvent) { + auto NewEvent = ur_event_handle_t_::makeNative( + UR_COMMAND_INTEROP_SEMAPHORE_SIGNAL_EXP, hQueue, Stream); + NewEvent->record(); + *phEvent = NewEvent; + } + } catch (ur_result_t Err) { + return Err; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; + } + return RetErr; +} diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.hpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.hpp new file mode 100644 index 0000000000000..35d71b01e2022 --- /dev/null +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.hpp @@ -0,0 +1,31 @@ +//===--------- image.hpp - CUDA Adapter ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-----------------------------------------------------------------===// +#pragma once + +#include +#include +#include + +#include "common.hpp" +ur_result_t urCalculateNumChannels(ur_image_channel_order_t order, + unsigned int *num_channels); + +ur_result_t +urToCudaImageChannelFormat(ur_image_channel_type_t image_channel_type, + CUarray_format *return_cuda_format, + size_t *return_pixel_types_size_bytes); + +ur_result_t +cudaToUrImageChannelFormat(CUarray_format cuda_format, + ur_image_channel_type_t *return_image_channel_type); + +ur_result_t urTextureCreate(ur_context_handle_t hContext, + ur_sampler_desc_t SamplerDesc, + const ur_image_desc_t *pImageDesc, + CUDA_RESOURCE_DESC ResourceDesc, + ur_exp_image_handle_t *phRetImage); diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/memory.hpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/memory.hpp index a986607a65d5e..9c55aca4ba643 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/memory.hpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/memory.hpp @@ -23,7 +23,7 @@ struct ur_mem_handle_t_ { /// Reference counting of the handler std::atomic_uint32_t RefCount; - enum class Type { Buffer, Surface } MemType; + enum class Type { Buffer, Surface, Texture } MemType; // Original mem flags passed ur_mem_flags_t MemFlags; @@ -122,6 +122,21 @@ struct ur_mem_handle_t_ { ur_mem_type_t getImageType() const noexcept { return ImageType; } } SurfaceMem; + + struct ImageMem { + CUarray Array; + void *Handle; + ur_mem_type_t ImageType; + ur_sampler_handle_t Sampler; + + CUarray get_array() const noexcept { return Array; } + + void *get_handle() const noexcept { return Handle; } + + ur_mem_type_t get_image_type() const noexcept { return ImageType; } + + ur_sampler_handle_t get_sampler() const noexcept { return Sampler; } + } ImageMem; } Mem; /// Constructs the UR mem handler for a non-typed allocation ("buffer") @@ -159,6 +174,30 @@ struct ur_mem_handle_t_ { urContextRetain(Context); } + /// Constructs the UR allocation for an unsampled image object + ur_mem_handle_t_(ur_context_handle_t Context, CUarray Array, + CUsurfObject Surf, ur_mem_type_t ImageType) + : Context{Context}, RefCount{1}, MemType{Type::Surface} { + + Mem.ImageMem.Array = Array; + Mem.ImageMem.Handle = (void *)Surf; + Mem.ImageMem.ImageType = ImageType; + Mem.ImageMem.Sampler = nullptr; + urContextRetain(Context); + } + + /// Constructs the UR allocation for an sampled image object + ur_mem_handle_t_(ur_context_handle_t Context, CUarray Array, CUtexObject Tex, + ur_sampler_handle_t Sampler, ur_mem_type_t ImageType) + : Context{Context}, RefCount{1}, MemType{Type::Texture} { + + Mem.ImageMem.Array = Array; + Mem.ImageMem.Handle = (void *)Tex; + Mem.ImageMem.ImageType = ImageType; + Mem.ImageMem.Sampler = Sampler; + urContextRetain(Context); + } + ~ur_mem_handle_t_() { if (isBuffer() && isSubBuffer()) { urMemRelease(Mem.BufferMem.Parent); diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.cpp index 36ec89fb9da3c..6ee7bb3400304 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.cpp @@ -25,6 +25,21 @@ urSamplerCreate(ur_context_handle_t hContext, const ur_sampler_desc_t *pDesc, Sampler->Props |= UR_SAMPLER_ADDRESSING_MODE_CLAMP << 2; } + void *pNext = const_cast(pDesc->pNext); + while (pNext != nullptr) { + const ur_base_desc_t *BaseDesc = + reinterpret_cast(pNext); + if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES) { + const ur_exp_sampler_mip_properties_t *SamplerMipProperties = + reinterpret_cast(pNext); + Sampler->MaxMipmapLevelClamp = SamplerMipProperties->maxMipmapLevelClamp; + Sampler->MinMipmapLevelClamp = SamplerMipProperties->minMipmapLevelClamp; + Sampler->MaxAnisotropy = SamplerMipProperties->maxAnisotropy; + Sampler->Props |= SamplerMipProperties->mipFilterMode << 5; + } + pNext = const_cast(BaseDesc->pNext); + } + *phSampler = Sampler.release(); return UR_RESULT_SUCCESS; } diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.hpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.hpp index 6dbbb124ffc3e..38035eaf2b98d 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.hpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.hpp @@ -11,15 +11,24 @@ /// Implementation of samplers for CUDA /// /// Sampler property layout: -/// | 31 30 ... 6 5 | 4 3 2 | 1 | 0 | -/// | N/A | addressing mode | fiter mode | normalize coords | +/// | | +/// ----------------------------------- +/// | 31 30 ... 6 | N/A +/// | 5 | mip filter mode +/// | 4 3 2 | addressing mode +/// | 1 | filter mode +/// | 0 | normalize coords struct ur_sampler_handle_t_ { std::atomic_uint32_t RefCount; uint32_t Props; + float MinMipmapLevelClamp; + float MaxMipmapLevelClamp; + float MaxAnisotropy; ur_context_handle_t Context; ur_sampler_handle_t_(ur_context_handle_t Context) - : RefCount(1), Props(0), Context(Context) {} + : RefCount(1), Props(0), MinMipmapLevelClamp(0.0f), + MaxMipmapLevelClamp(0.0f), MaxAnisotropy(0.0f), Context(Context) {} uint32_t incrementReferenceCount() noexcept { return ++RefCount; } diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/ur_interface_loader.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/ur_interface_loader.cpp index f8e806b0626a0..e7163a1e9d72c 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/ur_interface_loader.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/ur_interface_loader.cpp @@ -258,6 +258,49 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetDeviceProcAddrTable( return UR_RESULT_SUCCESS; } +UR_DLLEXPORT ur_result_t UR_APICALL urGetBindlessImagesExpProcAddrTable( + ur_api_version_t version, ur_bindless_images_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + pDdiTable->pfnUnsampledImageHandleDestroyExp = + urBindlessImagesUnsampledImageHandleDestroyExp; + pDdiTable->pfnSampledImageHandleDestroyExp = + urBindlessImagesSampledImageHandleDestroyExp; + pDdiTable->pfnImageAllocateExp = urBindlessImagesImageAllocateExp; + pDdiTable->pfnImageFreeExp = urBindlessImagesImageFreeExp; + pDdiTable->pfnUnsampledImageCreateExp = + urBindlessImagesUnsampledImageCreateExp; + pDdiTable->pfnSampledImageCreateExp = urBindlessImagesSampledImageCreateExp; + pDdiTable->pfnImageCopyExp = urBindlessImagesImageCopyExp; + pDdiTable->pfnImageGetInfoExp = urBindlessImagesImageGetInfoExp; + pDdiTable->pfnMipmapGetLevelExp = urBindlessImagesMipmapGetLevelExp; + pDdiTable->pfnMipmapFreeExp = urBindlessImagesMipmapFreeExp; + pDdiTable->pfnImportOpaqueFDExp = urBindlessImagesImportOpaqueFDExp; + pDdiTable->pfnMapExternalArrayExp = urBindlessImagesMapExternalArrayExp; + pDdiTable->pfnReleaseInteropExp = urBindlessImagesReleaseInteropExp; + pDdiTable->pfnImportExternalSemaphoreOpaqueFDExp = + urBindlessImagesImportExternalSemaphoreOpaqueFDExp; + pDdiTable->pfnDestroyExternalSemaphoreExp = + urBindlessImagesDestroyExternalSemaphoreExp; + pDdiTable->pfnWaitExternalSemaphoreExp = + urBindlessImagesWaitExternalSemaphoreExp; + pDdiTable->pfnSignalExternalSemaphoreExp = + urBindlessImagesSignalExternalSemaphoreExp; + return UR_RESULT_SUCCESS; +} + +UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( + ur_api_version_t version, ur_usm_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + pDdiTable->pfnPitchedAllocExp = urUSMPitchedAllocExp; + return UR_RESULT_SUCCESS; +} + #if defined(__cplusplus) } // extern "C" #endif diff --git a/sycl/source/detail/sampler_impl.cpp b/sycl/source/detail/sampler_impl.cpp index d942801d722b8..22fddd630d394 100644 --- a/sycl/source/detail/sampler_impl.cpp +++ b/sycl/source/detail/sampler_impl.cpp @@ -17,9 +17,14 @@ namespace detail { sampler_impl::sampler_impl(coordinate_normalization_mode normalizationMode, addressing_mode addressingMode, filtering_mode filteringMode, - const property_list &propList) + mipmap_filtering_mode mipmapFilteringMode, + float minMipmapLevelClamp, float maxMipmapLevelClamp, + float maxAnisotropy, const property_list &propList) : MCoordNormMode(normalizationMode), MAddrMode(addressingMode), - MFiltMode(filteringMode), MPropList(propList) {} + MFiltMode(filteringMode), MMipFiltMode(mipmapFilteringMode), + MMinMipmapLevelClamp(minMipmapLevelClamp), + MMaxMipmapLevelClamp(maxMipmapLevelClamp), MMaxAnisotropy(maxAnisotropy), + MPropList(propList) {} sampler_impl::sampler_impl(cl_sampler clSampler, const context &syclContext) { @@ -64,6 +69,8 @@ sampler_impl::getOrCreateSampler(const context &Context) { static_cast(MAddrMode), PI_SAMPLER_INFO_FILTER_MODE, static_cast(MFiltMode), + PI_SAMPLER_INFO_MIP_FILTER_MODE, + static_cast(MMipFiltMode), 0}; sycl::detail::pi::PiResult errcode_ret = PI_SUCCESS; @@ -71,7 +78,8 @@ sampler_impl::getOrCreateSampler(const context &Context) { const PluginPtr &Plugin = getSyclObjImpl(Context)->getPlugin(); errcode_ret = Plugin->call_nocheck( - getSyclObjImpl(Context)->getHandleRef(), sprops, &resultSampler); + getSyclObjImpl(Context)->getHandleRef(), sprops, MMinMipmapLevelClamp, + MMaxMipmapLevelClamp, MMaxAnisotropy, &resultSampler); if (errcode_ret == PI_ERROR_INVALID_OPERATION) throw feature_not_supported("Images are not supported by this device.", @@ -88,11 +96,25 @@ addressing_mode sampler_impl::get_addressing_mode() const { return MAddrMode; } filtering_mode sampler_impl::get_filtering_mode() const { return MFiltMode; } +mipmap_filtering_mode sampler_impl::get_mipmap_filtering_mode() const { + return MMipFiltMode; +} + coordinate_normalization_mode sampler_impl::get_coordinate_normalization_mode() const { return MCoordNormMode; } +float sampler_impl::get_min_mipmap_level_clamp() const { + return MMinMipmapLevelClamp; +} + +float sampler_impl::get_max_mipmap_level_clamp() const { + return MMaxMipmapLevelClamp; +} + +float sampler_impl::get_max_anisotropy() const { return MMaxAnisotropy; } + } // namespace detail } // __SYCL_INLINE_VER_NAMESPACE(_V1) } // namespace sycl diff --git a/sycl/source/detail/sampler_impl.hpp b/sycl/source/detail/sampler_impl.hpp index 00571c64d6b0d..7f186ce7ca9df 100644 --- a/sycl/source/detail/sampler_impl.hpp +++ b/sycl/source/detail/sampler_impl.hpp @@ -20,6 +20,7 @@ __SYCL_INLINE_VER_NAMESPACE(_V1) { enum class addressing_mode : unsigned int; enum class filtering_mode : unsigned int; +enum class mipmap_filtering_mode : unsigned int; enum class coordinate_normalization_mode : unsigned int; namespace detail { @@ -27,7 +28,9 @@ class __SYCL_EXPORT sampler_impl { public: sampler_impl(coordinate_normalization_mode normalizationMode, addressing_mode addressingMode, filtering_mode filteringMode, - const property_list &propList); + mipmap_filtering_mode mipmapFilteringMode, + float minMipmapLevelClamp, float maxMipmapLevelClamp, + float maxAnisotropy, const property_list &propList); sampler_impl(cl_sampler clSampler, const context &syclContext); @@ -35,8 +38,16 @@ class __SYCL_EXPORT sampler_impl { filtering_mode get_filtering_mode() const; + mipmap_filtering_mode get_mipmap_filtering_mode() const; + coordinate_normalization_mode get_coordinate_normalization_mode() const; + float get_min_mipmap_level_clamp() const; + + float get_max_mipmap_level_clamp() const; + + float get_max_anisotropy() const; + sycl::detail::pi::PiSampler getOrCreateSampler(const context &Context); /// Checks if this sampler_impl has a property of type propertyT. @@ -67,6 +78,10 @@ class __SYCL_EXPORT sampler_impl { coordinate_normalization_mode MCoordNormMode; addressing_mode MAddrMode; filtering_mode MFiltMode; + mipmap_filtering_mode MMipFiltMode; + float MMinMipmapLevelClamp; + float MMaxMipmapLevelClamp; + float MMaxAnisotropy; property_list MPropList; }; diff --git a/sycl/source/sampler.cpp b/sycl/source/sampler.cpp index ebd6d1fdeea95..2f314324596df 100644 --- a/sycl/source/sampler.cpp +++ b/sycl/source/sampler.cpp @@ -17,7 +17,17 @@ sampler::sampler(coordinate_normalization_mode normalizationMode, addressing_mode addressingMode, filtering_mode filteringMode, const property_list &propList) : impl(std::make_shared( - normalizationMode, addressingMode, filteringMode, propList)) {} + normalizationMode, addressingMode, filteringMode, + mipmap_filtering_mode::nearest, 0.0f, 0.0f, 0.0f, propList)) {} + +sampler::sampler(coordinate_normalization_mode normalizationMode, + addressing_mode addressingMode, filtering_mode filteringMode, + mipmap_filtering_mode mipmapFilteringMode, + float minMipmapLevelClamp, float maxMipmapLevelClamp, + float maxAnisotropy, const property_list &propList) + : impl(std::make_shared( + normalizationMode, addressingMode, filteringMode, mipmapFilteringMode, + minMipmapLevelClamp, maxMipmapLevelClamp, maxAnisotropy, propList)) {} sampler::sampler(cl_sampler clSampler, const context &syclContext) : impl(std::make_shared(clSampler, syclContext)) {} @@ -30,11 +40,25 @@ filtering_mode sampler::get_filtering_mode() const { return impl->get_filtering_mode(); } +mipmap_filtering_mode sampler::get_mipmap_filtering_mode() const { + return impl->get_mipmap_filtering_mode(); +} + coordinate_normalization_mode sampler::get_coordinate_normalization_mode() const { return impl->get_coordinate_normalization_mode(); } +float sampler::get_min_mipmap_level_clamp() const { + return impl->get_min_mipmap_level_clamp(); +} + +float sampler::get_max_mipmap_level_clamp() const { + return impl->get_max_mipmap_level_clamp(); +} + +float sampler::get_max_anisotropy() const { return impl->get_max_anisotropy(); } + bool sampler::operator==(const sampler &rhs) const { return (impl == rhs.impl); } diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index fdb09458c4d6e..f63bbc03ff4d8 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3821,9 +3821,9 @@ _ZN4sycl3_V16detail12compile_implERKNS0_13kernel_bundleILNS0_12bundle_stateE0EEE _ZN4sycl3_V16detail12isOutOfRangeENS0_3vecIiLi4EEENS0_15addressing_modeENS0_5rangeILi3EEE _ZN4sycl3_V16detail12make_contextEmRKSt8functionIFvNS0_14exception_listEEENS0_7backendE _ZN4sycl3_V16detail12sampler_impl18getOrCreateSamplerERKNS0_7contextE -_ZN4sycl3_V16detail12sampler_implC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE +_ZN4sycl3_V16detail12sampler_implC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeENS0_21mipmap_filtering_modeEfffRKNS0_13property_listE _ZN4sycl3_V16detail12sampler_implC1EP11_cl_samplerRKNS0_7contextE -_ZN4sycl3_V16detail12sampler_implC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE +_ZN4sycl3_V16detail12sampler_implC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeENS0_21mipmap_filtering_modeEfffRKNS0_13property_listE _ZN4sycl3_V16detail12sampler_implC2EP11_cl_samplerRKNS0_7contextE _ZN4sycl3_V16detail12sampler_implD1Ev _ZN4sycl3_V16detail12sampler_implD2Ev @@ -4038,8 +4038,10 @@ _ZN4sycl3_V17handlerC1ESt10shared_ptrINS0_6detail10queue_implEEb _ZN4sycl3_V17handlerC2ESt10shared_ptrINS0_3ext6oneapi12experimental6detail10graph_implEE _ZN4sycl3_V17handlerC2ESt10shared_ptrINS0_6detail10queue_implEES5_S5_b _ZN4sycl3_V17handlerC2ESt10shared_ptrINS0_6detail10queue_implEEb +_ZN4sycl3_V17samplerC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeENS0_21mipmap_filtering_modeEfffRKNS0_13property_listE _ZN4sycl3_V17samplerC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE _ZN4sycl3_V17samplerC1EP11_cl_samplerRKNS0_7contextE +_ZN4sycl3_V17samplerC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeENS0_21mipmap_filtering_modeEfffRKNS0_13property_listE _ZN4sycl3_V17samplerC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE _ZN4sycl3_V17samplerC2EP11_cl_samplerRKNS0_7contextE _ZN4sycl3_V18platform13get_platformsEv @@ -4262,7 +4264,11 @@ _ZNK4sycl3_V16detail12buffer_plain15getNativeVectorENS0_7backendE _ZNK4sycl3_V16detail12buffer_plain22get_allocator_internalEv _ZNK4sycl3_V16detail12buffer_plain7getSizeEv _ZNK4sycl3_V16detail12sampler_impl18get_filtering_modeEv +_ZNK4sycl3_V16detail12sampler_impl18get_max_anisotropyEv _ZNK4sycl3_V16detail12sampler_impl19get_addressing_modeEv +_ZNK4sycl3_V16detail12sampler_impl25get_mipmap_filtering_modeEv +_ZNK4sycl3_V16detail12sampler_impl26get_max_mipmap_level_clampEv +_ZNK4sycl3_V16detail12sampler_impl26get_min_mipmap_level_clampEv _ZNK4sycl3_V16detail12sampler_impl33get_coordinate_normalization_modeEv _ZNK4sycl3_V16detail16AccessorBaseHost11getElemSizeEv _ZNK4sycl3_V16detail16AccessorBaseHost11getPropListEv @@ -4603,7 +4609,11 @@ _ZNK4sycl3_V17sampler12has_propertyINS0_8property7context4cuda19use_primary_cont _ZNK4sycl3_V17sampler12has_propertyINS0_8property7no_initEEEbv _ZNK4sycl3_V17sampler12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv _ZNK4sycl3_V17sampler18get_filtering_modeEv +_ZNK4sycl3_V17sampler18get_max_anisotropyEv _ZNK4sycl3_V17sampler19get_addressing_modeEv +_ZNK4sycl3_V17sampler25get_mipmap_filtering_modeEv +_ZNK4sycl3_V17sampler26get_max_mipmap_level_clampEv +_ZNK4sycl3_V17sampler26get_min_mipmap_level_clampEv _ZNK4sycl3_V17sampler33get_coordinate_normalization_modeEv _ZNK4sycl3_V17samplereqERKS1_ _ZNK4sycl3_V17samplerneERKS1_ diff --git a/sycl/unittests/helpers/PiMockPlugin.hpp b/sycl/unittests/helpers/PiMockPlugin.hpp index b9f5fcc1778dc..2ad810b46f56b 100644 --- a/sycl/unittests/helpers/PiMockPlugin.hpp +++ b/sycl/unittests/helpers/PiMockPlugin.hpp @@ -432,6 +432,137 @@ inline pi_result mock_piMemImageCreate(pi_context context, pi_mem_flags flags, return PI_SUCCESS; } +inline pi_result +mock_piextMemUnsampledImageHandleDestroy(pi_context context, pi_device device, + pi_image_handle handle) { + return PI_SUCCESS; +} + +inline pi_result +mock_piextMemSampledImageHandleDestroy(pi_context context, pi_device device, + pi_image_handle handle) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemImageAllocate(pi_context context, + pi_device device, + pi_image_format *image_format, + pi_image_desc *image_desc, + pi_image_mem_handle *ret_mem) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemMipmapGetLevel(pi_context context, + pi_device device, + pi_image_mem_handle mip_mem, + unsigned int level, + pi_image_mem_handle *ret_mem) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemImageFree(pi_context context, pi_device device, + pi_image_mem_handle memory_handle) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemMipmapFree(pi_context context, pi_device device, + pi_image_mem_handle memory_handle) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemUnsampledImageCreate( + pi_context context, pi_device device, pi_image_mem_handle img_mem, + pi_image_format *image_format, pi_image_desc *desc, pi_mem *ret_mem, + pi_image_handle *ret_handle) { + return PI_SUCCESS; +} + +inline pi_result +mock_piextMemImportOpaqueFD(pi_context context, pi_device device, size_t size, + int file_descriptor, + pi_interop_mem_handle *ret_handle) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemMapExternalArray(pi_context context, + pi_device device, + pi_image_format *image_format, + pi_image_desc *image_desc, + pi_interop_mem_handle mem_handle, + pi_image_mem_handle *ret_mem) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemReleaseInterop(pi_context context, + pi_device device, + pi_interop_mem_handle ext_mem) { + return PI_SUCCESS; +} + +inline pi_result mock_piextImportExternalSemaphoreOpaqueFD( + pi_context context, pi_device device, int file_descriptor, + pi_interop_semaphore_handle *ret_handle) { + return PI_SUCCESS; +} + +inline pi_result +mock_piextDestroyExternalSemaphore(pi_context context, pi_device device, + pi_interop_semaphore_handle sem_handle) { + return PI_SUCCESS; +} + +inline pi_result mock_piextWaitExternalSemaphore( + pi_queue command_queue, pi_interop_semaphore_handle sem_handle, + pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, + pi_event *event) { + return PI_SUCCESS; +} + +inline pi_result mock_piextSignalExternalSemaphore( + pi_queue command_queue, pi_interop_semaphore_handle sem_handle, + pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, + pi_event *event) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemUnsampledImageCreateInterop( + pi_context context, pi_device device, pi_image_format *image_format, + pi_image_desc *desc, pi_interop_mem_handle ext_mem_handle, + pi_image_handle *ret_img_handle) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemSampledImageCreateInterop( + pi_context context, pi_device device, pi_image_format *image_format, + pi_image_desc *desc, pi_sampler sampler, + pi_interop_mem_handle ext_mem_handle, pi_image_handle *ret_img_handle) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemSampledImageCreate( + pi_context context, pi_device device, pi_image_mem_handle img_mem, + pi_image_format *image_format, pi_image_desc *desc, pi_sampler sampler, + pi_mem *ret_mem, pi_image_handle *ret_handle) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemImageCopy( + pi_queue command_queue, void *dst_ptr, void *src_ptr, + const pi_image_format *image_format, const pi_image_desc *image_desc, + const pi_image_copy_flags flags, pi_image_offset src_offset, + pi_image_offset dst_offset, pi_image_region copy_extent, + pi_image_region host_extent, pi_uint32 num_events_in_wait_list, + const pi_event *event_wait_list, pi_event *event) { + return PI_SUCCESS; +} + +inline pi_result mock_piextMemImageGetInfo(const pi_image_mem_handle mem_handle, + pi_image_info param_name, + void *param_value, + size_t *param_value_size_ret) { + return PI_SUCCESS; +} + inline pi_result mock_piMemGetInfo(pi_mem mem, pi_mem_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret) { @@ -801,10 +932,10 @@ mock_piextEventCreateWithNativeHandle(pi_native_handle nativeHandle, // // Sampler // -inline pi_result -mock_piSamplerCreate(pi_context context, - const pi_sampler_properties *sampler_properties, - pi_sampler *result_sampler) { +inline pi_result mock_piSamplerCreate( + pi_context context, const pi_sampler_properties *sampler_properties, + const float minMipmapLevelClamp, const float maxMipmapLevelClamp, + const float maxAnisotropy, pi_sampler *result_sampler) { *result_sampler = createDummyHandle(); return PI_SUCCESS; } @@ -1039,6 +1170,16 @@ inline pi_result mock_piextUSMSharedAlloc(void **result_ptr, pi_context context, return PI_SUCCESS; } +inline pi_result mock_piextUSMPitchedAlloc(void **result_ptr, + size_t *result_pitch, + pi_context context, pi_device device, + pi_usm_mem_properties *properties, + size_t width_in_bytes, size_t height, + unsigned int element_size_bytes) { + *result_ptr = createDummyHandle(width_in_bytes * height); + return PI_SUCCESS; +} + inline pi_result mock_piextUSMFree(pi_context context, void *ptr) { return PI_SUCCESS; } From 109414b497323a0924bba39d539386ad8393edab Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Thu, 29 Jun 2023 10:34:40 +0100 Subject: [PATCH 02/19] Address Feedback * [[maybe_unused]] flag added to pi_level_zero * pi_hip piSamplerCreate updated for API change * Macro used for image format switch cases * Added punctuation to comments --- sycl/CMakeLists.txt | 2 +- sycl/plugins/hip/pi_hip.cpp | 9 + sycl/plugins/level_zero/pi_level_zero.cpp | 170 ++++++++++-------- sycl/plugins/unified_runtime/pi2ur.hpp | 168 +++++------------ .../ur/adapters/cuda/device.cpp | 24 +-- .../ur/adapters/cuda/image.cpp | 19 +- 6 files changed, 179 insertions(+), 213 deletions(-) diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index 0d807b5873002..e5fa4f9a4d0d7 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -36,7 +36,7 @@ set(SYCL_MAJOR_VERSION 7) set(SYCL_MINOR_VERSION 0) set(SYCL_PATCH_VERSION 0) -set(SYCL_DEV_ABI_VERSION 5) +set(SYCL_DEV_ABI_VERSION 6) if (SYCL_ADD_DEV_VERSION_POSTFIX) set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}") endif() diff --git a/sycl/plugins/hip/pi_hip.cpp b/sycl/plugins/hip/pi_hip.cpp index 5ad0279b217f6..29f5c239beafe 100644 --- a/sycl/plugins/hip/pi_hip.cpp +++ b/sycl/plugins/hip/pi_hip.cpp @@ -4176,6 +4176,9 @@ pi_result hip_piextEventCreateWithNativeHandle(pi_native_handle nativeHandle, /// /// \param[in] context The context the sampler is created for. /// \param[in] sampler_properties The properties for the sampler. +/// \param[in] minMipmapLevelClamp The minimum mipmap clamp level. +/// \param[in] maxMipmapLevelClamp The maximum mipmap clamp level. +/// \param[in] maxAnisotropy The maximum anisotropy. /// \param[out] result_sampler Set to the resulting sampler object. /// /// \return PI_SUCCESS on success. PI_ERROR_INVALID_VALUE if given an invalid @@ -4183,7 +4186,13 @@ pi_result hip_piextEventCreateWithNativeHandle(pi_native_handle nativeHandle, /// or if there is multiple of properties from the same category. pi_result hip_piSamplerCreate(pi_context context, const pi_sampler_properties *sampler_properties, + const float minMipmapLevelClamp, + const float maxMipmapLevelClamp, + const float maxAnisotropy, pi_sampler *result_sampler) { + (void)minMipmapLevelClamp; + (void)maxMipmapLevelClamp; + (void)maxAnisotropy; std::unique_ptr<_pi_sampler> retImplSampl{new _pi_sampler(context)}; bool propSeen[3] = {false, false, false}; diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index c8be3d334d52e..d952d0cf091d5 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -390,9 +390,10 @@ pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName, ParamValueSizeRet); } -pi_result piextMemUnsampledImageHandleDestroy(pi_context context, - pi_device device, - pi_image_handle handle) { +pi_result +piextMemUnsampledImageHandleDestroy([[maybe_unused]] pi_context context, + [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_image_handle handle) { assert(context != nullptr); assert(device != nullptr); @@ -405,9 +406,10 @@ pi_result piextMemUnsampledImageHandleDestroy(pi_context context, return retErr; } -pi_result piextMemSampledImageHandleDestroy(pi_context context, - pi_device device, - pi_image_handle handle) { +pi_result +piextMemSampledImageHandleDestroy([[maybe_unused]] pi_context context, + [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_image_handle handle) { assert(context != nullptr); assert(device != nullptr); @@ -420,10 +422,11 @@ pi_result piextMemSampledImageHandleDestroy(pi_context context, return retErr; } -pi_result piextMemImageAllocate(pi_context context, pi_device device, - pi_image_format *image_format, - pi_image_desc *image_desc, - pi_image_mem_handle *ret_mem) { +pi_result piextMemImageAllocate([[maybe_unused]] pi_context context, + [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_image_format *image_format, + [[maybe_unused]] pi_image_desc *image_desc, + [[maybe_unused]] pi_image_mem_handle *ret_mem) { assert(context != nullptr); assert(device != nullptr); @@ -437,10 +440,12 @@ pi_result piextMemImageAllocate(pi_context context, pi_device device, return retErr; } -pi_result piextMemMipmapGetLevel(pi_context context, pi_device device, - pi_image_mem_handle mip_mem, - unsigned int level, - pi_image_mem_handle *ret_mem) { +pi_result +piextMemMipmapGetLevel([[maybe_unused]] pi_context context, + [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_image_mem_handle mip_mem, + [[maybe_unused]] unsigned int level, + [[maybe_unused]] pi_image_mem_handle *ret_mem) { assert(context != nullptr); assert(device != nullptr); @@ -452,8 +457,10 @@ pi_result piextMemMipmapGetLevel(pi_context context, pi_device device, return retErr; } -pi_result piextMemImageFree(pi_context context, pi_device device, - pi_image_mem_handle memory_handle) { +pi_result +piextMemImageFree([[maybe_unused]] pi_context context, + [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_image_mem_handle memory_handle) { assert(context != nullptr); assert(device != nullptr); @@ -465,8 +472,10 @@ pi_result piextMemImageFree(pi_context context, pi_device device, return retErr; } -pi_result piextMemMipmapFree(pi_context context, pi_device device, - pi_image_mem_handle memory_handle) { +pi_result +piextMemMipmapFree([[maybe_unused]] pi_context context, + [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_image_mem_handle memory_handle) { assert(context != nullptr); assert(device != nullptr); @@ -478,11 +487,12 @@ pi_result piextMemMipmapFree(pi_context context, pi_device device, return retErr; } -pi_result piextMemUnsampledImageCreate(pi_context context, pi_device device, - pi_image_mem_handle img_mem, - pi_image_format *image_format, - pi_image_desc *desc, pi_mem *ret_mem, - pi_image_handle *ret_handle) { +pi_result piextMemUnsampledImageCreate( + [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_image_mem_handle img_mem, + [[maybe_unused]] pi_image_format *image_format, + [[maybe_unused]] pi_image_desc *desc, [[maybe_unused]] pi_mem *ret_mem, + [[maybe_unused]] pi_image_handle *ret_handle) { assert(context != nullptr); assert(device != nullptr); @@ -496,9 +506,10 @@ pi_result piextMemUnsampledImageCreate(pi_context context, pi_device device, return retErr; } -pi_result piextMemImportOpaqueFD(pi_context context, pi_device device, - size_t size, int file_descriptor, - pi_interop_mem_handle *ret_handle) { +pi_result piextMemImportOpaqueFD( + [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, + [[maybe_unused]] size_t size, [[maybe_unused]] int file_descriptor, + [[maybe_unused]] pi_interop_mem_handle *ret_handle) { assert(context); assert(device); assert(file_descriptor); @@ -509,10 +520,10 @@ pi_result piextMemImportOpaqueFD(pi_context context, pi_device device, return retErr; } -pi_result -piextImportExternalSemaphoreOpaqueFD(pi_context context, pi_device device, - int file_descriptor, - pi_interop_semaphore_handle *ret_handle) { +pi_result piextImportExternalSemaphoreOpaqueFD( + [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, + [[maybe_unused]] int file_descriptor, + [[maybe_unused]] pi_interop_semaphore_handle *ret_handle) { assert(context); assert(device); assert(ret_handle); @@ -522,9 +533,9 @@ piextImportExternalSemaphoreOpaqueFD(pi_context context, pi_device device, return retErr; } -pi_result -piextDestroyExternalSemaphore(pi_context context, pi_device device, - pi_interop_semaphore_handle sem_handle) { +pi_result piextDestroyExternalSemaphore( + [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_interop_semaphore_handle sem_handle) { assert(context); assert(device); assert(sem_handle); @@ -534,11 +545,12 @@ piextDestroyExternalSemaphore(pi_context context, pi_device device, return retErr; } -pi_result piextWaitExternalSemaphore(pi_queue command_queue, - pi_interop_semaphore_handle sem_handle, - pi_uint32 num_events_in_wait_list, - const pi_event *event_wait_list, - pi_event *event) { +pi_result piextWaitExternalSemaphore( + [[maybe_unused]] pi_queue command_queue, + [[maybe_unused]] pi_interop_semaphore_handle sem_handle, + [[maybe_unused]] pi_uint32 num_events_in_wait_list, + [[maybe_unused]] const pi_event *event_wait_list, + [[maybe_unused]] pi_event *event) { assert(command_queue); assert(sem_handle); die("piextWaitExternalSemaphore not implemented on level zero " @@ -547,11 +559,12 @@ pi_result piextWaitExternalSemaphore(pi_queue command_queue, return retErr; } -pi_result piextSignalExternalSemaphore(pi_queue command_queue, - pi_interop_semaphore_handle sem_handle, - pi_uint32 num_events_in_wait_list, - const pi_event *event_wait_list, - pi_event *event) { +pi_result piextSignalExternalSemaphore( + [[maybe_unused]] pi_queue command_queue, + [[maybe_unused]] pi_interop_semaphore_handle sem_handle, + [[maybe_unused]] pi_uint32 num_events_in_wait_list, + [[maybe_unused]] const pi_event *event_wait_list, + [[maybe_unused]] pi_event *event) { assert(command_queue); assert(sem_handle); die("piextSignalExternalSemaphore not implemented on level zero " @@ -560,11 +573,13 @@ pi_result piextSignalExternalSemaphore(pi_queue command_queue, return retErr; } -pi_result piextMemMapExternalArray(pi_context context, pi_device device, - pi_image_format *image_format, - pi_image_desc *image_desc, - pi_interop_mem_handle mem_handle, - pi_image_mem_handle *ret_mem) { +pi_result +piextMemMapExternalArray([[maybe_unused]] pi_context context, + [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_image_format *image_format, + [[maybe_unused]] pi_image_desc *image_desc, + [[maybe_unused]] pi_interop_mem_handle mem_handle, + [[maybe_unused]] pi_image_mem_handle *ret_mem) { assert(context); assert(device); assert(image_format); @@ -578,8 +593,10 @@ pi_result piextMemMapExternalArray(pi_context context, pi_device device, return retErr; } -pi_result piextMemReleaseInterop(pi_context context, pi_device device, - pi_interop_mem_handle ext_mem) { +pi_result +piextMemReleaseInterop([[maybe_unused]] pi_context context, + [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_interop_mem_handle ext_mem) { assert(context); assert(ext_mem); @@ -588,12 +605,13 @@ pi_result piextMemReleaseInterop(pi_context context, pi_device device, return retErr; } -pi_result piextMemSampledImageCreate(pi_context context, pi_device device, - pi_image_mem_handle img_mem, - pi_image_format *format, - pi_image_desc *desc, pi_sampler sampler, - pi_mem *ret_mem, - pi_image_handle *ret_handle) { +pi_result piextMemSampledImageCreate( + [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_image_mem_handle img_mem, + [[maybe_unused]] pi_image_format *format, + [[maybe_unused]] pi_image_desc *desc, [[maybe_unused]] pi_sampler sampler, + [[maybe_unused]] pi_mem *ret_mem, + [[maybe_unused]] pi_image_handle *ret_handle) { assert(context != nullptr); assert(device != nullptr); assert(img_mem != nullptr); @@ -606,13 +624,20 @@ pi_result piextMemSampledImageCreate(pi_context context, pi_device device, return retErr; } -pi_result piextMemImageCopy( - pi_queue command_queue, void *dst_ptr, void *src_ptr, - const pi_image_format *image_format, const pi_image_desc *image_desc, - const pi_image_copy_flags flags, pi_image_offset src_offset, - pi_image_offset dst_offset, pi_image_region copy_extent, - pi_image_region host_extent, pi_uint32 num_events_in_wait_list, - const pi_event *event_wait_list, pi_event *event) { +pi_result +piextMemImageCopy([[maybe_unused]] pi_queue command_queue, + [[maybe_unused]] void *dst_ptr, + [[maybe_unused]] void *src_ptr, + [[maybe_unused]] const pi_image_format *image_format, + [[maybe_unused]] const pi_image_desc *image_desc, + [[maybe_unused]] const pi_image_copy_flags flags, + [[maybe_unused]] pi_image_offset src_offset, + [[maybe_unused]] pi_image_offset dst_offset, + [[maybe_unused]] pi_image_region copy_extent, + [[maybe_unused]] pi_image_region host_extent, + [[maybe_unused]] pi_uint32 num_events_in_wait_list, + [[maybe_unused]] const pi_event *event_wait_list, + [[maybe_unused]] pi_event *event) { assert(command_queue != nullptr); assert(dst_ptr != nullptr); assert(src_ptr != nullptr); @@ -623,9 +648,11 @@ pi_result piextMemImageCopy( return retErr; } -pi_result piextMemImageGetInfo(const pi_image_mem_handle mem_handle, - pi_image_info param_name, void *param_value, - size_t *param_value_size_ret) { +pi_result +piextMemImageGetInfo([[maybe_unused]] const pi_image_mem_handle mem_handle, + [[maybe_unused]] pi_image_info param_name, + [[maybe_unused]] void *param_value, + [[maybe_unused]] size_t *param_value_size_ret) { assert(mem_handle); die("piextMemImageGetInfo not implemented on level zero backend.\n"); @@ -1006,11 +1033,12 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context, Size, Alignment); } -pi_result piextUSMPitchedAlloc(void **result_ptr, size_t *result_pitch, - pi_context context, pi_device device, - pi_usm_mem_properties *properties, - size_t width_in_bytes, size_t height, - unsigned int element_size_bytes) { +pi_result piextUSMPitchedAlloc( + [[maybe_unused]] void **result_ptr, [[maybe_unused]] size_t *result_pitch, + [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, + [[maybe_unused]] pi_usm_mem_properties *properties, + [[maybe_unused]] size_t width_in_bytes, [[maybe_unused]] size_t height, + [[maybe_unused]] unsigned int element_size_bytes) { die("piextUSMPitchedAlloc: not implemented"); assert(result_ptr != nullptr); diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index df1c0324b9006..e87eaf7cce5e2 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -2802,132 +2802,60 @@ static void pi2urImageDesc(const pi_image_format *ImageFormat, static void ur2piImageFormat(const ur_image_format_t *UrFormat, pi_image_format *PiFormat) { switch (UrFormat->channelOrder) { - case UR_IMAGE_CHANNEL_ORDER_A: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_A; - break; - } - case UR_IMAGE_CHANNEL_ORDER_R: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_R; - break; - } - case UR_IMAGE_CHANNEL_ORDER_RG: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RG; - break; - } - case UR_IMAGE_CHANNEL_ORDER_RA: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RA; - break; - } - case UR_IMAGE_CHANNEL_ORDER_RGB: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RGB; - break; - } - case UR_IMAGE_CHANNEL_ORDER_RGBA: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RGBA; - break; - } - case UR_IMAGE_CHANNEL_ORDER_BGRA: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_BGRA; - break; - } - case UR_IMAGE_CHANNEL_ORDER_ARGB: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_ARGB; - break; - } - case UR_IMAGE_CHANNEL_ORDER_ABGR: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_ABGR; - break; - } - case UR_IMAGE_CHANNEL_ORDER_INTENSITY: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_INTENSITY; - break; - } - case UR_IMAGE_CHANNEL_ORDER_LUMINANCE: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_LUMINANCE; - break; - } - case UR_IMAGE_CHANNEL_ORDER_RX: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_Rx; - break; - } - case UR_IMAGE_CHANNEL_ORDER_RGX: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RGx; - break; - } - case UR_IMAGE_CHANNEL_ORDER_RGBX: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_RGBx; - break; - } - case UR_IMAGE_CHANNEL_ORDER_SRGBA: { - PiFormat->image_channel_order = PI_IMAGE_CHANNEL_ORDER_sRGBA; - break; - } +#define MAP(FROM, TO) \ + case FROM: { \ + PiFormat->image_channel_order = TO; \ + break; \ + } + MAP(UR_IMAGE_CHANNEL_ORDER_A, PI_IMAGE_CHANNEL_ORDER_A) + MAP(UR_IMAGE_CHANNEL_ORDER_R, PI_IMAGE_CHANNEL_ORDER_R) + MAP(UR_IMAGE_CHANNEL_ORDER_RG, PI_IMAGE_CHANNEL_ORDER_RG) + MAP(UR_IMAGE_CHANNEL_ORDER_RA, PI_IMAGE_CHANNEL_ORDER_RA) + MAP(UR_IMAGE_CHANNEL_ORDER_RGB, PI_IMAGE_CHANNEL_ORDER_RGB) + MAP(UR_IMAGE_CHANNEL_ORDER_RGBA, PI_IMAGE_CHANNEL_ORDER_RGBA) + MAP(UR_IMAGE_CHANNEL_ORDER_BGRA, PI_IMAGE_CHANNEL_ORDER_BGRA) + MAP(UR_IMAGE_CHANNEL_ORDER_ARGB, PI_IMAGE_CHANNEL_ORDER_ARGB) + MAP(UR_IMAGE_CHANNEL_ORDER_ABGR, PI_IMAGE_CHANNEL_ORDER_ABGR) + MAP(UR_IMAGE_CHANNEL_ORDER_INTENSITY, PI_IMAGE_CHANNEL_ORDER_INTENSITY) + MAP(UR_IMAGE_CHANNEL_ORDER_LUMINANCE, PI_IMAGE_CHANNEL_ORDER_LUMINANCE) + MAP(UR_IMAGE_CHANNEL_ORDER_RX, PI_IMAGE_CHANNEL_ORDER_Rx) + MAP(UR_IMAGE_CHANNEL_ORDER_RGX, PI_IMAGE_CHANNEL_ORDER_RGx) + MAP(UR_IMAGE_CHANNEL_ORDER_RGBX, PI_IMAGE_CHANNEL_ORDER_RGBx) + MAP(UR_IMAGE_CHANNEL_ORDER_SRGBA, PI_IMAGE_CHANNEL_ORDER_sRGBA) +#undef MAP default: { die("ur2piImageFormat: unsuppported channelOrder."); } } switch (UrFormat->channelType) { - case UR_IMAGE_CHANNEL_TYPE_SNORM_INT8: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SNORM_INT8; - break; - } - case UR_IMAGE_CHANNEL_TYPE_SNORM_INT16: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SNORM_INT16; - break; - } - case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_INT8; - break; - } - case UR_IMAGE_CHANNEL_TYPE_UNORM_INT16: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_INT16; - break; - } - case UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565; - break; - } - case UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555; - break; - } - case UR_IMAGE_CHANNEL_TYPE_INT_101010: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010; - break; - } - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8; - break; - } - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16; - break; - } - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32; - break; - } - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8; - break; - } - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16; - break; - } - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32; - break; - } - case UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT; - break; - } - case UR_IMAGE_CHANNEL_TYPE_FLOAT: { - PiFormat->image_channel_data_type = PI_IMAGE_CHANNEL_TYPE_FLOAT; - break; - } +#define MAP(FROM, TO) \ + case FROM: { \ + PiFormat->image_channel_data_type = TO; \ + break; \ + } + MAP(UR_IMAGE_CHANNEL_TYPE_SNORM_INT8, PI_IMAGE_CHANNEL_TYPE_SNORM_INT8) + MAP(UR_IMAGE_CHANNEL_TYPE_SNORM_INT16, PI_IMAGE_CHANNEL_TYPE_SNORM_INT16) + MAP(UR_IMAGE_CHANNEL_TYPE_UNORM_INT8, PI_IMAGE_CHANNEL_TYPE_UNORM_INT8) + MAP(UR_IMAGE_CHANNEL_TYPE_UNORM_INT16, PI_IMAGE_CHANNEL_TYPE_UNORM_INT16) + MAP(UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565, + PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565) + MAP(UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555, + PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555) + MAP(UR_IMAGE_CHANNEL_TYPE_INT_101010, + PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010) + MAP(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8, PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8) + MAP(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16, PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16) + MAP(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32, PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32) + MAP(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8, + PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8) + MAP(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16, + PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16) + MAP(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32, + PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32) + MAP(UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT, PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT) + MAP(UR_IMAGE_CHANNEL_TYPE_FLOAT, PI_IMAGE_CHANNEL_TYPE_FLOAT) +#undef MAP default: { die("ur2piImageFormat: unsuppported channelType."); } diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp index fa80240f0fc27..a4f1539bcc1dd 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp @@ -874,16 +874,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, return ReturnValue(int32_t{1}); } case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: { - // On CUDA bindless images are supported + // On CUDA bindless images are supported. return ReturnValue(true); } case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: { - // On CUDA 1D bindless image USM is not supported - // More specifically, linear filtering is not supported + // On CUDA 1D bindless image USM is not supported. + // More specifically, linear filtering is not supported. return ReturnValue(false); } case UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP: { - // On CUDA 2D bindless image USM is supported + // On CUDA 2D bindless image USM is supported. return ReturnValue(true); } case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP: { @@ -920,36 +920,36 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, return ReturnValue(tex_max_linear_pitch); } case UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP: { - // CUDA supports mipmaps + // CUDA supports mipmaps. return ReturnValue(true); } case UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP: { - // CUDA supports anisotropic filtering + // CUDA supports anisotropic filtering. return ReturnValue(true); } case UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP: { - // CUDA has no query for this, but documentation states max value is 16 + // CUDA has no query for this, but documentation states max value is 16. return ReturnValue(16.f); } case UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP: { - // CUDA supports creation of images from individual mipmap levels + // CUDA supports creation of images from individual mipmap levels. return ReturnValue(true); } case UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP: { - // CUDA supports importing external memory + // CUDA supports importing external memory. return ReturnValue(true); } case UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP: { - // CUDA does not support exporting it's own device memory + // CUDA does not support exporting it's own device memory. return ReturnValue(false); } case UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP: { - // CUDA supports importing external semaphores + // CUDA supports importing external semaphores. return ReturnValue(true); } case UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP: { - // CUDA does not support exporting semaphores or events + // CUDA does not support exporting semaphores or events. return ReturnValue(false); } case UR_DEVICE_INFO_DEVICE_ID: { diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp index f21fd5c308732..6ba96460c4008 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp @@ -222,7 +222,7 @@ ur_result_t urTextureCreate(ur_context_handle_t hContext, // The address modes can interfere with other dimensionsenqueueEventsWait // e.g. 1D texture sampling can be interfered with when setting other - // dimension address modes despite their nonexistence + // dimension address modes despite their nonexistence. ImageTexDesc.addressMode[0] = AddrMode; // 1D ImageTexDesc.addressMode[1] = pImageDesc->height > 0 ? AddrMode : ImageTexDesc.addressMode[1]; // 2D @@ -234,7 +234,7 @@ ur_result_t urTextureCreate(ur_context_handle_t hContext, : ImageTexDesc.flags; // CUDA default promotes 8-bit and 16-bit integers to float between [0,1] - // This flag prevents this behaviour + // This flag prevents this behaviour. ImageTexDesc.flags |= CU_TRSF_READ_AS_INTEGER; CUtexObject Texture; @@ -266,8 +266,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp( assert(height > 0); assert(elementSizeBytes > 0); - // elementSizeBytes can only take on values of 4, 8, or 16 - // small data types need to be minimised to 4 + // elementSizeBytes can only take on values of 4, 8, or 16. + // small data types need to be minimised to 4. if (elementSizeBytes < 4) { elementSizeBytes = 4; } @@ -463,7 +463,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( image_res_desc.res.array.hArray = (CUarray)hImageMem; // We create surfaces in the unsampled images case as it conforms to how - // CUDA deals with unsampled images + // CUDA deals with unsampled images. CUsurfObject surface; RetErr = UR_CHECK_ERROR(cuSurfObjectCreate(&surface, &image_res_desc)); *phImage = (ur_exp_image_handle_t)surface; @@ -525,9 +525,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( unsigned int mem_type; // If this function doesn't return successfully, we assume that hImageMem is - // a CUarray or CUmipmappedArray If this function returns successfully, we + // a CUarray or CUmipmappedArray. If this function returns successfully, we // check whether hImageMem is device memory (even managed memory isn't - // considered shared) + // considered shared). CUresult Err = cuPointerGetAttribute( &mem_type, CU_POINTER_ATTRIBUTE_MEMORY_TYPE, (CUdeviceptr)hImageMem); if (Err != CUDA_SUCCESS) { @@ -612,7 +612,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( "urBindlessImagesImageCopyExp given unsupported channelOrder"); } - // We need to get this now in bytes for calculating the total image size later + // We need to get this now in bytes for calculating the total image size + // later. RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, nullptr, &PixelTypeSizeBytes); if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { @@ -627,7 +628,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( CUstream Stream = hQueue->getNextTransferStream(); RetErr = enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); - // We have to use a different copy function for each image dimensionality + // We have to use a different copy function for each image dimensionality. if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) { if (pImageDesc->type == UR_MEM_TYPE_IMAGE1D) { From f4b06f256bfe5ee38aad8d0e5d50330f86374191 Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Thu, 29 Jun 2023 14:24:39 +0100 Subject: [PATCH 03/19] Add piext functions to pi_esimd_emulator --- .../esimd_emulator/pi_esimd_emulator.cpp | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp b/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp index 123b86ef28a70..ee0308057bcc1 100644 --- a/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp +++ b/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp @@ -1978,6 +1978,12 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context, return PI_SUCCESS; } +pi_result piextUSMPitchedAlloc(void **, size_t *, pi_context, pi_device, + pi_usm_mem_properties *, size_t, size_t, + unsigned int) { + DIE_NO_IMPLEMENTATION; +} + pi_result piextUSMFree(pi_context Context, void *Ptr) { if (Context == nullptr) { return PI_ERROR_INVALID_CONTEXT; @@ -2160,6 +2166,96 @@ pi_result piPluginInit(pi_plugin *PluginInit) { return PI_SUCCESS; } +pi_result piextMemUnsampledImageHandleDestroy(pi_context, pi_device, + pi_image_handle) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemSampledImageHandleDestroy(pi_context, pi_device, + pi_image_handle) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemImageAllocate(pi_context, pi_device, pi_image_format *, + pi_image_desc *, pi_image_mem_handle *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemMipmapGetLevel(pi_context, pi_device, pi_image_mem_handle, + unsigned int, pi_image_mem_handle *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemImageFree(pi_context, pi_device, pi_image_mem_handle) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemMipmapFree(pi_context, pi_device, pi_image_mem_handle) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemUnsampledImageCreate(pi_context, pi_device, + pi_image_mem_handle, pi_image_format *, + pi_image_desc *, pi_mem *, + pi_image_handle *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemSampledImageCreate(pi_context, pi_device, pi_image_mem_handle, + pi_image_format *, pi_image_desc *, + pi_sampler, pi_mem *, pi_image_handle *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemImageCopy(pi_queue, void *, void *, const pi_image_format *, + const pi_image_desc *, const pi_image_copy_flags, + pi_image_offset, pi_image_offset, pi_image_region, + pi_image_region, pi_uint32, const pi_event *, + pi_event *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemImageGetInfo(const pi_image_mem_handle, pi_image_info, void *, + size_t *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemImportOpaqueFD(pi_context, pi_device, size_t, int, + pi_interop_mem_handle *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemMapExternalArray(pi_context, pi_device, pi_image_format *, + pi_image_desc *, pi_interop_mem_handle, + pi_image_mem_handle *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextMemReleaseInterop(pi_context, pi_device, pi_interop_mem_handle) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextImportExternalSemaphoreOpaqueFD(pi_context, pi_device, int, + pi_interop_semaphore_handle *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextDestroyExternalSemaphore(pi_context, pi_device, + pi_interop_semaphore_handle) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextWaitExternalSemaphore(pi_queue, pi_interop_semaphore_handle, + pi_uint32, const pi_event *, pi_event *) { + DIE_NO_IMPLEMENTATION; +} + +pi_result piextSignalExternalSemaphore(pi_queue, pi_interop_semaphore_handle, + pi_uint32, const pi_event *, + pi_event *) { + DIE_NO_IMPLEMENTATION; +} + #ifdef _WIN32 #define __SYCL_PLUGIN_DLL_NAME "pi_esimd_emulator.dll" #include "../common_win_pi_trace/common_win_pi_trace.hpp" From 031107f60bdaeb3deac63c76451c38b89e09543e Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Thu, 29 Jun 2023 14:47:32 +0100 Subject: [PATCH 04/19] Update Level Zero symbol dump file --- sycl/test/abi/pi_level_zero_symbol_check.dump | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sycl/test/abi/pi_level_zero_symbol_check.dump b/sycl/test/abi/pi_level_zero_symbol_check.dump index 5c536543cd057..de350ffdfa425 100644 --- a/sycl/test/abi/pi_level_zero_symbol_check.dump +++ b/sycl/test/abi/pi_level_zero_symbol_check.dump @@ -86,6 +86,7 @@ piclProgramCreateWithSource piextContextCreateWithNativeHandle piextContextGetNativeHandle piextContextSetExtendedDeleter +piextDestroyExternalSemaphore piextDeviceCreateWithNativeHandle piextDeviceGetNativeHandle piextDeviceSelectBinary @@ -94,6 +95,7 @@ piextEnqueueWriteHostPipe piextEventCreateWithNativeHandle piextEventGetNativeHandle piextGetDeviceFunctionPointer +piextImportExternalSemaphoreOpaqueFD piextKernelCreateWithNativeHandle piextKernelGetNativeHandle piextKernelSetArgMemObj @@ -101,7 +103,20 @@ piextKernelSetArgPointer piextKernelSetArgSampler piextMemCreateWithNativeHandle piextMemGetNativeHandle +piextMemImageAllocate +piextMemImageCopy piextMemImageCreateWithNativeHandle +piextMemImageFree +piextMemImageGetInfo +piextMemImportOpaqueFD +piextMemMapExternalArray +piextMemMipmapFree +piextMemMipmapGetLevel +piextMemReleaseInterop +piextMemSampledImageCreate +piextMemSampledImageHandleDestroy +piextMemUnsampledImageCreate +piextMemUnsampledImageHandleDestroy piextPlatformCreateWithNativeHandle piextPlatformGetNativeHandle piextPluginGetOpaqueData @@ -111,6 +126,7 @@ piextProgramSetSpecializationConstant piextQueueCreate piextQueueCreateWithNativeHandle piextQueueGetNativeHandle +piextSignalExternalSemaphore piextUSMDeviceAlloc piextUSMEnqueueFill2D piextUSMEnqueueMemAdvise @@ -122,4 +138,6 @@ piextUSMEnqueuePrefetch piextUSMFree piextUSMGetMemAllocInfo piextUSMHostAlloc +piextUSMPitchedAlloc piextUSMSharedAlloc +piextWaitExternalSemaphore From d3a35c017ea7be7e5c47a80a59136bca6e6a17dc Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Fri, 30 Jun 2023 10:24:24 +0100 Subject: [PATCH 05/19] Address Feedback * Remove changes to sampler * Macros used for switch cases * Replaced instances of `assert` with `UR_ASSERT` * Return error instead of die on unsupported image format * Update _PI_H_VERSION_MINOR and add note * Remove no longer used PI_COMMAND_TYPE additions - replaced by UR * Move PI API additions to bottom of pi.def * Update PiMockPlugin --- sycl/include/sycl/detail/pi.def | 38 +- sycl/include/sycl/detail/pi.h | 72 +- sycl/include/sycl/sampler.hpp | 19 - sycl/plugins/cuda/pi_cuda.cpp | 2 + .../esimd_emulator/pi_esimd_emulator.cpp | 8 +- sycl/plugins/level_zero/pi_level_zero.cpp | 25 +- sycl/plugins/opencl/pi_opencl.cpp | 3 - sycl/plugins/unified_runtime/pi2ur.hpp | 675 +++++++----------- .../unified_runtime/pi_unified_runtime.cpp | 4 +- .../ur/adapters/cuda/image.cpp | 156 ++-- sycl/source/detail/sampler_impl.cpp | 28 +- sycl/source/detail/sampler_impl.hpp | 17 +- sycl/source/sampler.cpp | 26 +- sycl/test/abi/pi_level_zero_symbol_check.dump | 1 + sycl/test/abi/sycl_symbols_linux.dump | 103 ++- sycl/unittests/helpers/PiMockPlugin.hpp | 16 +- 16 files changed, 545 insertions(+), 648 deletions(-) diff --git a/sycl/include/sycl/detail/pi.def b/sycl/include/sycl/detail/pi.def index 8d9de2318afd3..0bc3dbe7bc839 100644 --- a/sycl/include/sycl/detail/pi.def +++ b/sycl/include/sycl/detail/pi.def @@ -126,7 +126,6 @@ _PI_API(piEnqueueMemUnmap) _PI_API(piextUSMHostAlloc) _PI_API(piextUSMDeviceAlloc) _PI_API(piextUSMSharedAlloc) -_PI_API(piextUSMPitchedAlloc) _PI_API(piextUSMFree) _PI_API(piextUSMEnqueueMemset) _PI_API(piextUSMEnqueueMemcpy) @@ -142,9 +141,29 @@ _PI_API(piextKernelSetArgSampler) _PI_API(piextPluginGetOpaqueData) +_PI_API(piPluginGetLastError) + +_PI_API(piTearDown) + + +_PI_API(piextUSMEnqueueFill2D) +_PI_API(piextUSMEnqueueMemset2D) +_PI_API(piextUSMEnqueueMemcpy2D) + +_PI_API(piGetDeviceAndHostTimer) + +// Device global variable +_PI_API(piextEnqueueDeviceGlobalVariableWrite) +_PI_API(piextEnqueueDeviceGlobalVariableRead) + +_PI_API(piPluginGetBackendOption) + +_PI_API(piextUSMPitchedAlloc) + // Bindless Images _PI_API(piextMemUnsampledImageHandleDestroy) _PI_API(piextMemSampledImageHandleDestroy) +_PI_API(piextBindlessImageSamplerCreate) _PI_API(piextMemImageAllocate) _PI_API(piextMemImageFree) _PI_API(piextMemUnsampledImageCreate) @@ -163,21 +182,4 @@ _PI_API(piextDestroyExternalSemaphore) _PI_API(piextWaitExternalSemaphore) _PI_API(piextSignalExternalSemaphore) -_PI_API(piPluginGetLastError) - -_PI_API(piTearDown) - - -_PI_API(piextUSMEnqueueFill2D) -_PI_API(piextUSMEnqueueMemset2D) -_PI_API(piextUSMEnqueueMemcpy2D) - -_PI_API(piGetDeviceAndHostTimer) - -// Device global variable -_PI_API(piextEnqueueDeviceGlobalVariableWrite) -_PI_API(piextEnqueueDeviceGlobalVariableRead) - -_PI_API(piPluginGetBackendOption) - #undef _PI_API diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index d7e18fe5cff5d..ca6bf62c04b6c 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -92,11 +92,55 @@ // 12.30 Added PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT device info query. // 12.31 Added PI_EXT_CODEPLAY_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP device // info query. -// 12.32 Removed backwards compatibility of piextQueueCreateWithNativeHandle and +// 13.32 Removed backwards compatibility of piextQueueCreateWithNativeHandle and // piextQueueGetNativeHandle +// 13.33 Adding support for experimental bindless images. This includes +// - Added device info queries +// - Device queries for bindless image support +// - PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT +// - PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT +// - PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT +// - PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT +// - Device queries for pitched USM allocations +// - PI_EXT_ONEAPI_DEVICE_INFO_IMAGE_PITCH_ALIGN +// - PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH +// - PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT +// - PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH +// - Device queries for mipmap image support +// - PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_SUPPORT +// - PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT +// - PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY +// - PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT +// - Device queries for interop memory support +// - PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT +// - PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT +// - PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT +// - PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT +// - Added PI_IMAGE_INFO_DEPTH to _pi_image_info +// - Added _pi_image_copy_flags enum to determine direction of copy +// - Added new extension functions +// - piextBindlessImageSamplerCreate +// - piextUSMPitchedAlloc +// - piextMemUnsampledImageHandleDestroy +// - piextMemSampledImageHandleDestroy +// - piextMemImageAllocate +// - piextMemImageFree +// - piextMemUnsampledImageCreate +// - piextMemSampledImageCreate +// - piextMemImageCopy +// - piextMemImageGetInfo +// - piextMemMipmapGetLevel +// - piextMemMipmapFree +// - piextMemImportOpaqueFD +// - piextMemMapExternalArray +// - piextMemReleaseInterop +// - piextImportExternalSemaphoreOpaqueFD +// - piextDestroyExternalSemaphore +// - piextWaitExternalSemaphore +// - piextSignalExternalSemaphore #define _PI_H_VERSION_MAJOR 13 -#define _PI_H_VERSION_MINOR 32 +#define _PI_H_VERSION_MINOR 33 #define _PI_STRING_HELPER(a) #a #define _PI_CONCAT(a, b) _PI_STRING_HELPER(a.b) @@ -493,10 +537,7 @@ typedef enum { PI_COMMAND_TYPE_SVM_MEMFILL = 0x120B, PI_COMMAND_TYPE_SVM_MAP = 0x120C, PI_COMMAND_TYPE_SVM_UNMAP = 0x120D, - PI_COMMAND_TYPE_INTEROP_SEMAPHORE_WAIT = 0x120E, - PI_COMMAND_TYPE_INTEROP_SEMAPHORE_SIGNAL = 0x120F, PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_READ = 0x418E, - PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_WRITE = 0x418F, } _pi_command_type; typedef enum { @@ -596,11 +637,6 @@ typedef enum { PI_SAMPLER_FILTER_MODE_LINEAR = 0x1141, } _pi_sampler_filter_mode; -typedef enum { - PI_SAMPLER_MIP_FILTER_MODE_NEAREST = 0x1142, - PI_SAMPLER_MIP_FILTER_MODE_LINEAR = 0x1143, -} _pi_sampler_mip_filter_mode; - using pi_context_properties = intptr_t; using pi_device_exec_capabilities = pi_bitfield; @@ -721,7 +757,6 @@ using pi_image_channel_type = _pi_image_channel_type; using pi_buffer_create_type = _pi_buffer_create_type; using pi_sampler_addressing_mode = _pi_sampler_addressing_mode; using pi_sampler_filter_mode = _pi_sampler_filter_mode; -using pi_sampler_mip_filter_mode = _pi_sampler_mip_filter_mode; using pi_sampler_info = _pi_sampler_info; using pi_event_status = _pi_event_status; using pi_program_build_info = _pi_program_build_info; @@ -1629,7 +1664,6 @@ __SYCL_EXPORT pi_result piextEventCreateWithNativeHandle( // __SYCL_EXPORT pi_result piSamplerCreate( pi_context context, const pi_sampler_properties *sampler_properties, - float minMipmapLevelClamp, float maxMipmapLevelClamp, float maxAnisotropy, pi_sampler *result_sampler); __SYCL_EXPORT pi_result piSamplerGetInfo(pi_sampler sampler, @@ -2245,6 +2279,20 @@ __SYCL_EXPORT pi_result piextMemSampledImageCreate( pi_image_format *image_format, pi_image_desc *image_desc, pi_sampler sampler, pi_mem *ret_mem, pi_image_handle *ret_handle); +/// API to create samplers for bindless images. +/// +/// \param context is the pi_context +/// \param device is the pi_device +/// \param sampler_properties is the pointer to the sampler properties bitfield +/// \param min_mipmap_level_clamp is the minimum mipmap level to sample from +/// \param max_mipmap_level_clamp is the maximum mipmap level to sample from +/// \param max_anisotropy is the maximum anisotropic ratio +/// \param result_sampler is the returned sampler +__SYCL_EXPORT pi_result piextBindlessImageSamplerCreate( + pi_context context, const pi_sampler_properties *sampler_properties, + float min_mipmap_level_clamp, float max_mipmap_level_clamp, + float max_anisotropy, pi_sampler *result_sampler); + /// API to copy image data Host to Device or Device to Host /// /// \param queue is the queue to submit to diff --git a/sycl/include/sycl/sampler.hpp b/sycl/include/sycl/sampler.hpp index 7860cdaab9c1b..24e94b4c157b2 100644 --- a/sycl/include/sycl/sampler.hpp +++ b/sycl/include/sycl/sampler.hpp @@ -30,11 +30,6 @@ enum class filtering_mode : unsigned int { linear = PI_SAMPLER_FILTER_MODE_LINEAR }; -enum class mipmap_filtering_mode : unsigned int { - nearest = PI_SAMPLER_MIP_FILTER_MODE_NEAREST, - linear = PI_SAMPLER_MIP_FILTER_MODE_LINEAR -}; - enum class coordinate_normalization_mode : unsigned int { normalized = 1, unnormalized = 0 @@ -74,12 +69,6 @@ class __SYCL_EXPORT __SYCL_SPECIAL_CLASS __SYCL_TYPE(sampler) sampler { addressing_mode addressingMode, filtering_mode filteringMode, const property_list &propList = {}); - sampler(coordinate_normalization_mode normalizationMode, - addressing_mode addressingMode, filtering_mode filteringMode, - mipmap_filtering_mode mipmapFilteringMode, float minMipmapLevelClamp, - float maxMipmapLevelClamp, float maxAnisotropy, - const property_list &propList = {}); - #ifdef __SYCL_INTERNAL_API sampler(cl_sampler clSampler, const context &syclContext); #endif @@ -113,16 +102,8 @@ class __SYCL_EXPORT __SYCL_SPECIAL_CLASS __SYCL_TYPE(sampler) sampler { filtering_mode get_filtering_mode() const; - mipmap_filtering_mode get_mipmap_filtering_mode() const; - coordinate_normalization_mode get_coordinate_normalization_mode() const; - float get_min_mipmap_level_clamp() const; - - float get_max_mipmap_level_clamp() const; - - float get_max_anisotropy() const; - private: #ifdef __SYCL_DEVICE_ONLY__ detail::sampler_impl impl; diff --git a/sycl/plugins/cuda/pi_cuda.cpp b/sycl/plugins/cuda/pi_cuda.cpp index 01a66bfb309cb..f811f2b72cd9d 100644 --- a/sycl/plugins/cuda/pi_cuda.cpp +++ b/sycl/plugins/cuda/pi_cuda.cpp @@ -196,6 +196,8 @@ pi_result piPluginInit(pi_plugin *PluginInit) { _PI_CL(piextMemImageFree, pi2ur::piextMemImageFree) _PI_CL(piextMemUnsampledImageCreate, pi2ur::piextMemUnsampledImageCreate) _PI_CL(piextMemSampledImageCreate, pi2ur::piextMemSampledImageCreate) + _PI_CL(piextBindlessImageSamplerCreate, + pi2ur::piextBindlessImageSamplerCreate) _PI_CL(piextMemImageCopy, pi2ur::piextMemImageCopy) _PI_CL(piextMemImageGetInfo, pi2ur::piextMemImageGetInfo) diff --git a/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp b/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp index ee0308057bcc1..b0a8565546535 100644 --- a/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp +++ b/sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp @@ -1553,7 +1553,7 @@ pi_result piextEventCreateWithNativeHandle(pi_native_handle, pi_context, bool, DIE_NO_IMPLEMENTATION; } pi_result piSamplerCreate(pi_context, const pi_sampler_properties *, - const float, const float, const float, pi_sampler *) { + pi_sampler *) { DIE_NO_IMPLEMENTATION; } @@ -1830,6 +1830,12 @@ pi_result piEnqueueMemImageWrite(pi_queue, pi_mem, pi_bool, pi_image_offset, DIE_NO_IMPLEMENTATION; } +pi_result piextBindlessImageSamplerCreate(pi_context, + const pi_sampler_properties *, float, + float, float, pi_sampler *) { + DIE_NO_IMPLEMENTATION; +} + pi_result piEnqueueMemImageCopy(pi_queue, pi_mem, pi_mem, pi_image_offset, pi_image_offset, pi_image_region, pi_uint32, const pi_event *, pi_event *) { diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index d952d0cf091d5..1d3dcd3ecd767 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -624,6 +624,24 @@ pi_result piextMemSampledImageCreate( return retErr; } +pi_result piextBindlessImageSamplerCreate( + [[maybe_unused]] pi_context context, + [[maybe_unused]] const pi_sampler_properties *sampler_properties, + [[maybe_unused]] float min_mipmap_level_clamp, + [[maybe_unused]] float max_mipmap_level_clamp, + [[maybe_unused]] float max_anisotropy, + [[maybe_unused]] pi_sampler *result_sampler) { + assert(context != nullptr); + assert(sampler_properties != nullptr); + assert(result_sampler != nullptr); + + die("piextBindlessImageSamplerCreate not implemented on level zero " + "backend.\n"); + // No image formats are supported! + pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; + return retErr; +} + pi_result piextMemImageCopy([[maybe_unused]] pi_queue command_queue, [[maybe_unused]] void *dst_ptr, @@ -781,11 +799,8 @@ pi_result piextEventCreateWithNativeHandle(pi_native_handle NativeHandle, // pi_result piSamplerCreate(pi_context Context, const pi_sampler_properties *SamplerProperties, - const float minMipmapLevelClamp, - const float maxMipmapLevelClamp, - const float maxAnisotropy, pi_sampler *RetSampler) { - return pi2ur::piSamplerCreate(Context, SamplerProperties, minMipmapLevelClamp, - maxMipmapLevelClamp, maxAnisotropy, RetSampler); + pi_sampler *RetSampler) { + return pi2ur::piSamplerCreate(Context, SamplerProperties, RetSampler); } pi_result piSamplerGetInfo(pi_sampler Sampler, pi_sampler_info ParamName, diff --git a/sycl/plugins/opencl/pi_opencl.cpp b/sycl/plugins/opencl/pi_opencl.cpp index 91f5e6fd3e0b5..13193318f7ef2 100644 --- a/sycl/plugins/opencl/pi_opencl.cpp +++ b/sycl/plugins/opencl/pi_opencl.cpp @@ -1086,9 +1086,6 @@ pi_result piextProgramCreateWithNativeHandle(pi_native_handle nativeHandle, pi_result piSamplerCreate(pi_context context, const pi_sampler_properties *sampler_properties, - const float minMipmapLevelClamp, - const float maxMipmapLevelClamp, - const float maxAnisotropy, pi_sampler *result_sampler) { // Initialize properties according to OpenCL 2.1 spec. pi_result error_code; diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index e87eaf7cce5e2..d99fd2674dfcf 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -786,392 +786,198 @@ inline pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, ur_device_info_t InfoType; switch (ParamName) { - case PI_DEVICE_INFO_TYPE: - InfoType = UR_DEVICE_INFO_TYPE; - break; - case PI_DEVICE_INFO_PARENT_DEVICE: - InfoType = UR_DEVICE_INFO_PARENT_DEVICE; - break; - case PI_DEVICE_INFO_PLATFORM: - InfoType = UR_DEVICE_INFO_PLATFORM; - break; - case PI_DEVICE_INFO_VENDOR_ID: - InfoType = UR_DEVICE_INFO_VENDOR_ID; - break; - case PI_DEVICE_INFO_UUID: - InfoType = UR_DEVICE_INFO_UUID; - break; - case PI_DEVICE_INFO_ATOMIC_64: - InfoType = UR_DEVICE_INFO_ATOMIC_64; - break; - case PI_DEVICE_INFO_EXTENSIONS: - InfoType = UR_DEVICE_INFO_EXTENSIONS; - break; - case PI_DEVICE_INFO_NAME: - InfoType = UR_DEVICE_INFO_NAME; - break; - case PI_DEVICE_INFO_COMPILER_AVAILABLE: - InfoType = UR_DEVICE_INFO_COMPILER_AVAILABLE; - break; - case PI_DEVICE_INFO_LINKER_AVAILABLE: - InfoType = UR_DEVICE_INFO_LINKER_AVAILABLE; - break; - case PI_DEVICE_INFO_MAX_COMPUTE_UNITS: - InfoType = UR_DEVICE_INFO_MAX_COMPUTE_UNITS; - break; - case PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS: - InfoType = UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS; - break; - case PI_DEVICE_INFO_MAX_WORK_GROUP_SIZE: - InfoType = UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE; - break; - case PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES: - InfoType = UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES; - break; - case PI_DEVICE_INFO_MAX_CLOCK_FREQUENCY: - InfoType = UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY; - break; - case PI_DEVICE_INFO_ADDRESS_BITS: - InfoType = UR_DEVICE_INFO_ADDRESS_BITS; - break; - case PI_DEVICE_INFO_MAX_MEM_ALLOC_SIZE: - InfoType = UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE; - break; - case PI_DEVICE_INFO_GLOBAL_MEM_SIZE: - InfoType = UR_DEVICE_INFO_GLOBAL_MEM_SIZE; - break; - case PI_DEVICE_INFO_LOCAL_MEM_SIZE: - InfoType = UR_DEVICE_INFO_LOCAL_MEM_SIZE; - break; - case PI_DEVICE_INFO_IMAGE_SUPPORT: - InfoType = UR_DEVICE_INFO_IMAGE_SUPPORTED; - break; - case PI_DEVICE_INFO_HOST_UNIFIED_MEMORY: - InfoType = UR_DEVICE_INFO_HOST_UNIFIED_MEMORY; - break; - case PI_DEVICE_INFO_AVAILABLE: - InfoType = UR_DEVICE_INFO_AVAILABLE; - break; - case PI_DEVICE_INFO_VENDOR: - InfoType = UR_DEVICE_INFO_VENDOR; - break; - case PI_DEVICE_INFO_DRIVER_VERSION: - InfoType = UR_DEVICE_INFO_DRIVER_VERSION; - break; - case PI_DEVICE_INFO_VERSION: - InfoType = UR_DEVICE_INFO_VERSION; - break; - case PI_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES: - InfoType = UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES; - break; - case PI_DEVICE_INFO_REFERENCE_COUNT: - InfoType = UR_DEVICE_INFO_REFERENCE_COUNT; - break; - case PI_DEVICE_INFO_PARTITION_PROPERTIES: - InfoType = UR_DEVICE_INFO_SUPPORTED_PARTITIONS; - break; - case PI_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN: - InfoType = UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN; - break; - case PI_DEVICE_INFO_PARTITION_TYPE: - InfoType = UR_DEVICE_INFO_PARTITION_TYPE; - break; - case PI_DEVICE_INFO_OPENCL_C_VERSION: - InfoType = UR_EXT_DEVICE_INFO_OPENCL_C_VERSION; - break; - case PI_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC: - InfoType = UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC; - break; - case PI_DEVICE_INFO_PRINTF_BUFFER_SIZE: - InfoType = UR_DEVICE_INFO_PRINTF_BUFFER_SIZE; - break; - case PI_DEVICE_INFO_PROFILE: - InfoType = UR_DEVICE_INFO_PROFILE; - break; - case PI_DEVICE_INFO_BUILT_IN_KERNELS: - InfoType = UR_DEVICE_INFO_BUILT_IN_KERNELS; - break; - case PI_DEVICE_INFO_QUEUE_PROPERTIES: - InfoType = UR_DEVICE_INFO_QUEUE_PROPERTIES; - break; - case PI_DEVICE_INFO_EXECUTION_CAPABILITIES: - InfoType = UR_DEVICE_INFO_EXECUTION_CAPABILITIES; - break; - case PI_DEVICE_INFO_ENDIAN_LITTLE: - InfoType = UR_DEVICE_INFO_ENDIAN_LITTLE; - break; - case PI_DEVICE_INFO_ERROR_CORRECTION_SUPPORT: - InfoType = UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT; - break; - case PI_DEVICE_INFO_PROFILING_TIMER_RESOLUTION: - InfoType = UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION; - break; - case PI_DEVICE_INFO_LOCAL_MEM_TYPE: - InfoType = UR_DEVICE_INFO_LOCAL_MEM_TYPE; - break; - case PI_DEVICE_INFO_MAX_CONSTANT_ARGS: - InfoType = UR_DEVICE_INFO_MAX_CONSTANT_ARGS; - break; - case PI_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE: - InfoType = UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE; - break; - case PI_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE: - InfoType = UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE; - break; - case PI_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE: - InfoType = UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE; - break; - case PI_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE: - InfoType = UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE; - break; - case PI_DEVICE_INFO_MAX_PARAMETER_SIZE: - InfoType = UR_DEVICE_INFO_MAX_PARAMETER_SIZE; - break; - case PI_DEVICE_INFO_MEM_BASE_ADDR_ALIGN: - InfoType = UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN; - break; - case PI_DEVICE_INFO_MAX_SAMPLERS: - InfoType = UR_DEVICE_INFO_MAX_SAMPLERS; - break; - case PI_DEVICE_INFO_MAX_READ_IMAGE_ARGS: - InfoType = UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS; - break; - case PI_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS: - InfoType = UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS; - break; - case PI_DEVICE_INFO_SINGLE_FP_CONFIG: - InfoType = UR_DEVICE_INFO_SINGLE_FP_CONFIG; - break; - case PI_DEVICE_INFO_HALF_FP_CONFIG: - InfoType = UR_DEVICE_INFO_HALF_FP_CONFIG; - break; - case PI_DEVICE_INFO_DOUBLE_FP_CONFIG: - InfoType = UR_DEVICE_INFO_DOUBLE_FP_CONFIG; - break; - case PI_DEVICE_INFO_IMAGE2D_MAX_WIDTH: - InfoType = UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH; - break; - case PI_DEVICE_INFO_IMAGE2D_MAX_HEIGHT: - InfoType = UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT; - break; - case PI_DEVICE_INFO_IMAGE3D_MAX_WIDTH: - InfoType = UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH; - break; - case PI_DEVICE_INFO_IMAGE3D_MAX_HEIGHT: - InfoType = UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT; - break; - case PI_DEVICE_INFO_IMAGE3D_MAX_DEPTH: - InfoType = UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH; - break; - case PI_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE: - InfoType = UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE; - break; - case PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR: - InfoType = UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR; - break; - case PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR: - InfoType = UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR; - break; - case PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT: - InfoType = UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT; - break; - case PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT: - InfoType = UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT; - break; - case PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT: - InfoType = UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT; - break; - case PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT: - InfoType = UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT; - break; - case PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG: - InfoType = UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG; - break; - case PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG: - InfoType = UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG; - break; - case PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT: - InfoType = UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT; - break; - case PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT: - InfoType = UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT; - break; - case PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE: - InfoType = UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE; - break; - case PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE: - InfoType = UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE; - break; - case PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF: - InfoType = UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF; - break; - case PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF: - InfoType = UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF; - break; - case PI_DEVICE_INFO_MAX_NUM_SUB_GROUPS: - InfoType = UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS; - break; - case PI_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS: - InfoType = UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS; - break; - case PI_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: - InfoType = UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL; - break; - case PI_DEVICE_INFO_IL_VERSION: - InfoType = UR_DEVICE_INFO_IL_VERSION; - break; - case PI_DEVICE_INFO_USM_HOST_SUPPORT: - InfoType = UR_DEVICE_INFO_USM_HOST_SUPPORT; - break; - case PI_DEVICE_INFO_USM_DEVICE_SUPPORT: - InfoType = UR_DEVICE_INFO_USM_DEVICE_SUPPORT; - break; - case PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT: - InfoType = UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT; - break; - case PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT: - InfoType = UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT; - break; - case PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT: - InfoType = UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT; - break; - case PI_DEVICE_INFO_PCI_ADDRESS: - InfoType = UR_DEVICE_INFO_PCI_ADDRESS; - break; - case PI_DEVICE_INFO_GPU_EU_COUNT: - InfoType = UR_DEVICE_INFO_GPU_EU_COUNT; - break; - case PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH: - InfoType = UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH; - break; - case PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE: - InfoType = UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE; - break; - case PI_DEVICE_INFO_BUILD_ON_SUBDEVICE: - InfoType = UR_DEVICE_INFO_BUILD_ON_SUBDEVICE; - break; - case PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D: - InfoType = UR_DEVICE_INFO_MAX_WORK_GROUPS_3D; - break; - case PI_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE: - InfoType = UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE; - break; - case PI_DEVICE_INFO_DEVICE_ID: - InfoType = UR_DEVICE_INFO_DEVICE_ID; - break; - case PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY: - InfoType = UR_DEVICE_INFO_GLOBAL_MEM_FREE; - break; - case PI_EXT_INTEL_DEVICE_INFO_MEMORY_CLOCK_RATE: - InfoType = UR_DEVICE_INFO_MEMORY_CLOCK_RATE; - break; - case PI_EXT_INTEL_DEVICE_INFO_MEMORY_BUS_WIDTH: - InfoType = UR_DEVICE_INFO_MEMORY_BUS_WIDTH; - break; - case PI_EXT_INTEL_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: - InfoType = UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES; - break; - case PI_DEVICE_INFO_GPU_SLICES: - InfoType = UR_DEVICE_INFO_GPU_EU_SLICES; - break; - case PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE: - InfoType = UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE; - break; - case PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU: - InfoType = UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU; - break; - case PI_DEVICE_INFO_MAX_MEM_BANDWIDTH: - InfoType = UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH; - break; - case PI_EXT_ONEAPI_DEVICE_INFO_BFLOAT16_MATH_FUNCTIONS: - InfoType = UR_DEVICE_INFO_BFLOAT16; - break; - case PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: - InfoType = UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES; - break; - case PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: - InfoType = UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES; - break; - case PI_EXT_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: - InfoType = UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES; - break; - case PI_EXT_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: - InfoType = UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES; - break; - case PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT: - InfoType = UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT; - break; - case PI_DEVICE_INFO_IMAGE_SRGB: - InfoType = UR_DEVICE_INFO_IMAGE_SRGB; - break; - case PI_DEVICE_INFO_BACKEND_VERSION: { - InfoType = UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION; - break; - } - case PI_EXT_CODEPLAY_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP: { - InfoType = UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT: { - InfoType = UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT: { - InfoType = UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT: { - InfoType = UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_IMAGE_PITCH_ALIGN: { - InfoType = UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH: { - InfoType = UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT: { - InfoType = UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH: { - InfoType = UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_SUPPORT: { - InfoType = UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT: { - InfoType = UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY: { - InfoType = UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT: { - InfoType = UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT: { - InfoType = UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT: { - InfoType = UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT: { - InfoType = UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP; - break; - } - case PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT: { - InfoType = UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP; - break; +#define MAP(FROM, TO) \ + case FROM: { \ + InfoType = TO; \ + break; \ } + MAP(PI_DEVICE_INFO_TYPE, UR_DEVICE_INFO_TYPE) + MAP(PI_DEVICE_INFO_PARENT_DEVICE, UR_DEVICE_INFO_PARENT_DEVICE) + MAP(PI_DEVICE_INFO_PLATFORM, UR_DEVICE_INFO_PLATFORM) + MAP(PI_DEVICE_INFO_VENDOR_ID, UR_DEVICE_INFO_VENDOR_ID) + MAP(PI_DEVICE_INFO_UUID, UR_DEVICE_INFO_UUID) + MAP(PI_DEVICE_INFO_ATOMIC_64, UR_DEVICE_INFO_ATOMIC_64) + MAP(PI_DEVICE_INFO_EXTENSIONS, UR_DEVICE_INFO_EXTENSIONS) + MAP(PI_DEVICE_INFO_NAME, UR_DEVICE_INFO_NAME) + MAP(PI_DEVICE_INFO_COMPILER_AVAILABLE, UR_DEVICE_INFO_COMPILER_AVAILABLE) + MAP(PI_DEVICE_INFO_LINKER_AVAILABLE, UR_DEVICE_INFO_LINKER_AVAILABLE) + MAP(PI_DEVICE_INFO_MAX_COMPUTE_UNITS, UR_DEVICE_INFO_MAX_COMPUTE_UNITS) + MAP(PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS, + UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS) + MAP(PI_DEVICE_INFO_MAX_WORK_GROUP_SIZE, UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE) + MAP(PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES, UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES) + MAP(PI_DEVICE_INFO_MAX_CLOCK_FREQUENCY, UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY) + MAP(PI_DEVICE_INFO_ADDRESS_BITS, UR_DEVICE_INFO_ADDRESS_BITS) + MAP(PI_DEVICE_INFO_MAX_MEM_ALLOC_SIZE, UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE) + MAP(PI_DEVICE_INFO_GLOBAL_MEM_SIZE, UR_DEVICE_INFO_GLOBAL_MEM_SIZE) + MAP(PI_DEVICE_INFO_LOCAL_MEM_SIZE, UR_DEVICE_INFO_LOCAL_MEM_SIZE) + MAP(PI_DEVICE_INFO_IMAGE_SUPPORT, UR_DEVICE_INFO_IMAGE_SUPPORTED) + MAP(PI_DEVICE_INFO_HOST_UNIFIED_MEMORY, UR_DEVICE_INFO_HOST_UNIFIED_MEMORY) + MAP(PI_DEVICE_INFO_AVAILABLE, UR_DEVICE_INFO_AVAILABLE) + MAP(PI_DEVICE_INFO_VENDOR, UR_DEVICE_INFO_VENDOR) + MAP(PI_DEVICE_INFO_DRIVER_VERSION, UR_DEVICE_INFO_DRIVER_VERSION) + MAP(PI_DEVICE_INFO_VERSION, UR_DEVICE_INFO_VERSION) + MAP(PI_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES, + UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES) + MAP(PI_DEVICE_INFO_REFERENCE_COUNT, UR_DEVICE_INFO_REFERENCE_COUNT) + MAP(PI_DEVICE_INFO_PARTITION_PROPERTIES, + UR_DEVICE_INFO_SUPPORTED_PARTITIONS) + MAP(PI_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN, + UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN) + MAP(PI_DEVICE_INFO_PARTITION_TYPE, UR_DEVICE_INFO_PARTITION_TYPE) + MAP(PI_DEVICE_INFO_OPENCL_C_VERSION, UR_EXT_DEVICE_INFO_OPENCL_C_VERSION) + MAP(PI_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC, + UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC) + MAP(PI_DEVICE_INFO_PRINTF_BUFFER_SIZE, UR_DEVICE_INFO_PRINTF_BUFFER_SIZE) + MAP(PI_DEVICE_INFO_PROFILE, UR_DEVICE_INFO_PROFILE) + MAP(PI_DEVICE_INFO_BUILT_IN_KERNELS, UR_DEVICE_INFO_BUILT_IN_KERNELS) + MAP(PI_DEVICE_INFO_QUEUE_PROPERTIES, UR_DEVICE_INFO_QUEUE_PROPERTIES) + MAP(PI_DEVICE_INFO_EXECUTION_CAPABILITIES, + UR_DEVICE_INFO_EXECUTION_CAPABILITIES) + MAP(PI_DEVICE_INFO_ENDIAN_LITTLE, UR_DEVICE_INFO_ENDIAN_LITTLE) + MAP(PI_DEVICE_INFO_ERROR_CORRECTION_SUPPORT, + UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT) + MAP(PI_DEVICE_INFO_PROFILING_TIMER_RESOLUTION, + UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION) + MAP(PI_DEVICE_INFO_LOCAL_MEM_TYPE, UR_DEVICE_INFO_LOCAL_MEM_TYPE) + MAP(PI_DEVICE_INFO_MAX_CONSTANT_ARGS, UR_DEVICE_INFO_MAX_CONSTANT_ARGS) + MAP(PI_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE, + UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE) + MAP(PI_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE, + UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE) + MAP(PI_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE, + UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE) + MAP(PI_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE, + UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE) + MAP(PI_DEVICE_INFO_MAX_PARAMETER_SIZE, UR_DEVICE_INFO_MAX_PARAMETER_SIZE) + MAP(PI_DEVICE_INFO_MEM_BASE_ADDR_ALIGN, UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN) + MAP(PI_DEVICE_INFO_MAX_SAMPLERS, UR_DEVICE_INFO_MAX_SAMPLERS) + MAP(PI_DEVICE_INFO_MAX_READ_IMAGE_ARGS, UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS) + MAP(PI_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS, + UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS) + MAP(PI_DEVICE_INFO_SINGLE_FP_CONFIG, UR_DEVICE_INFO_SINGLE_FP_CONFIG) + MAP(PI_DEVICE_INFO_HALF_FP_CONFIG, UR_DEVICE_INFO_HALF_FP_CONFIG) + MAP(PI_DEVICE_INFO_DOUBLE_FP_CONFIG, UR_DEVICE_INFO_DOUBLE_FP_CONFIG) + MAP(PI_DEVICE_INFO_IMAGE2D_MAX_WIDTH, UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH) + MAP(PI_DEVICE_INFO_IMAGE2D_MAX_HEIGHT, UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT) + MAP(PI_DEVICE_INFO_IMAGE3D_MAX_WIDTH, UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH) + MAP(PI_DEVICE_INFO_IMAGE3D_MAX_HEIGHT, UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT) + MAP(PI_DEVICE_INFO_IMAGE3D_MAX_DEPTH, UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH) + MAP(PI_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE, + UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE) + MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR) + MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR) + MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT) + MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT) + MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT) + MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT) + MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG) + MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG) + MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT) + MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT) + MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE) + MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE) + MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF) + MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF) + MAP(PI_DEVICE_INFO_MAX_NUM_SUB_GROUPS, UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS) + MAP(PI_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS, + UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS) + MAP(PI_DEVICE_INFO_SUB_GROUP_SIZES_INTEL, + UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL) + MAP(PI_DEVICE_INFO_IL_VERSION, UR_DEVICE_INFO_IL_VERSION) + MAP(PI_DEVICE_INFO_USM_HOST_SUPPORT, UR_DEVICE_INFO_USM_HOST_SUPPORT) + MAP(PI_DEVICE_INFO_USM_DEVICE_SUPPORT, UR_DEVICE_INFO_USM_DEVICE_SUPPORT) + MAP(PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT, + UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT) + MAP(PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT, + UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT) + MAP(PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT, + UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT) + MAP(PI_DEVICE_INFO_PCI_ADDRESS, UR_DEVICE_INFO_PCI_ADDRESS) + MAP(PI_DEVICE_INFO_GPU_EU_COUNT, UR_DEVICE_INFO_GPU_EU_COUNT) + MAP(PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH, UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH) + MAP(PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE, + UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE) + MAP(PI_DEVICE_INFO_BUILD_ON_SUBDEVICE, UR_DEVICE_INFO_BUILD_ON_SUBDEVICE) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D, + UR_DEVICE_INFO_MAX_WORK_GROUPS_3D) + MAP(PI_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE, + UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE) + MAP(PI_DEVICE_INFO_DEVICE_ID, UR_DEVICE_INFO_DEVICE_ID) + MAP(PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY, UR_DEVICE_INFO_GLOBAL_MEM_FREE) + MAP(PI_EXT_INTEL_DEVICE_INFO_MEMORY_CLOCK_RATE, + UR_DEVICE_INFO_MEMORY_CLOCK_RATE) + MAP(PI_EXT_INTEL_DEVICE_INFO_MEMORY_BUS_WIDTH, + UR_DEVICE_INFO_MEMORY_BUS_WIDTH) + MAP(PI_EXT_INTEL_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES, + UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES) + MAP(PI_DEVICE_INFO_GPU_SLICES, UR_DEVICE_INFO_GPU_EU_SLICES) + MAP(PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE, + UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE) + MAP(PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU, + UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU) + MAP(PI_DEVICE_INFO_MAX_MEM_BANDWIDTH, UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_BFLOAT16_MATH_FUNCTIONS, + UR_DEVICE_INFO_BFLOAT16) + MAP(PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES, + UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES) + MAP(PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES, + UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES) + MAP(PI_EXT_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES, + UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES) + MAP(PI_EXT_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES, + UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES) + MAP(PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT, + UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT) + MAP(PI_DEVICE_INFO_IMAGE_SRGB, UR_DEVICE_INFO_IMAGE_SRGB) + MAP(PI_DEVICE_INFO_BACKEND_VERSION, UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION) + MAP(PI_EXT_CODEPLAY_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP, + UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT, + UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT, + UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT, + UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_IMAGE_PITCH_ALIGN, + UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH, + UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT, + UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH, + UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_SUPPORT, + UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT, + UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY, + UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT, + UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT, + UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT, + UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT, + UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT, + UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP) +#undef MAP default: return PI_ERROR_UNKNOWN; }; @@ -4061,8 +3867,6 @@ inline pi_result piEventRelease(pi_event Event) { // Sampler inline pi_result piSamplerCreate(pi_context Context, const pi_sampler_properties *SamplerProperties, - float MinMipmapLevelClamp, - float MaxMipmapLevelClamp, float MaxAnisotropy, pi_sampler *RetSampler) { PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); @@ -4073,13 +3877,6 @@ inline pi_result piSamplerCreate(pi_context Context, ur_sampler_desc_t UrProps{}; UrProps.stype = UR_STRUCTURE_TYPE_SAMPLER_DESC; - ur_exp_sampler_mip_properties_t UrMipProps{}; - UrMipProps.stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES; - UrMipProps.minMipmapLevelClamp = MinMipmapLevelClamp; - UrMipProps.maxMipmapLevelClamp = MaxMipmapLevelClamp; - UrMipProps.maxAnisotropy = MaxAnisotropy; - UrProps.pNext = &UrMipProps; - const pi_sampler_properties *CurProperty = SamplerProperties; while (*CurProperty != 0) { switch (*CurProperty) { @@ -4115,17 +3912,6 @@ inline pi_result piSamplerCreate(pi_context Context, UrProps.filterMode = UR_SAMPLER_FILTER_MODE_LINEAR; } break; - case PI_SAMPLER_PROPERTIES_MIP_FILTER_MODE: { - pi_sampler_mip_filter_mode CurValueFilterMode = - ur_cast( - ur_cast(*(++CurProperty))); - - if (CurValueFilterMode == PI_SAMPLER_MIP_FILTER_MODE_NEAREST) - UrMipProps.mipFilterMode = UR_SAMPLER_FILTER_MODE_NEAREST; - else if (CurValueFilterMode == PI_SAMPLER_MIP_FILTER_MODE_LINEAR) - UrMipProps.mipFilterMode = UR_SAMPLER_FILTER_MODE_LINEAR; - } break; - default: break; } @@ -4301,6 +4087,85 @@ inline pi_result piextMemSampledImageCreate( return PI_SUCCESS; } +inline pi_result piextBindlessImageSamplerCreate( + pi_context Context, const pi_sampler_properties *SamplerProperties, + float MinMipmapLevelClamp, float MaxMipmapLevelClamp, float MaxAnisotropy, + pi_sampler *RetSampler) { + + PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); + PI_ASSERT(RetSampler, PI_ERROR_INVALID_VALUE); + + ur_context_handle_t UrContext = + reinterpret_cast(Context); + ur_sampler_desc_t UrProps{}; + UrProps.stype = UR_STRUCTURE_TYPE_SAMPLER_DESC; + + ur_exp_sampler_mip_properties_t UrMipProps{}; + UrMipProps.stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES; + UrMipProps.minMipmapLevelClamp = MinMipmapLevelClamp; + UrMipProps.maxMipmapLevelClamp = MaxMipmapLevelClamp; + UrMipProps.maxAnisotropy = MaxAnisotropy; + UrProps.pNext = &UrMipProps; + + const pi_sampler_properties *CurProperty = SamplerProperties; + while (*CurProperty != 0) { + switch (*CurProperty) { + case PI_SAMPLER_PROPERTIES_NORMALIZED_COORDS: { + UrProps.normalizedCoords = ur_cast(*(++CurProperty)); + } break; + + case PI_SAMPLER_PROPERTIES_ADDRESSING_MODE: { + pi_sampler_addressing_mode CurValueAddressingMode = + ur_cast( + ur_cast(*(++CurProperty))); + + if (CurValueAddressingMode == PI_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT) + UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT; + else if (CurValueAddressingMode == PI_SAMPLER_ADDRESSING_MODE_REPEAT) + UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_REPEAT; + else if (CurValueAddressingMode == + PI_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE) + UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE; + else if (CurValueAddressingMode == PI_SAMPLER_ADDRESSING_MODE_CLAMP) + UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_CLAMP; + else if (CurValueAddressingMode == PI_SAMPLER_ADDRESSING_MODE_NONE) + UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_NONE; + } break; + + case PI_SAMPLER_PROPERTIES_FILTER_MODE: { + pi_sampler_filter_mode CurValueFilterMode = + ur_cast(ur_cast(*(++CurProperty))); + + if (CurValueFilterMode == PI_SAMPLER_FILTER_MODE_NEAREST) + UrProps.filterMode = UR_SAMPLER_FILTER_MODE_NEAREST; + else if (CurValueFilterMode == PI_SAMPLER_FILTER_MODE_LINEAR) + UrProps.filterMode = UR_SAMPLER_FILTER_MODE_LINEAR; + } break; + + case PI_SAMPLER_PROPERTIES_MIP_FILTER_MODE: { + pi_sampler_filter_mode CurValueFilterMode = + ur_cast(ur_cast(*(++CurProperty))); + + if (CurValueFilterMode == PI_SAMPLER_FILTER_MODE_NEAREST) + UrMipProps.mipFilterMode = UR_SAMPLER_FILTER_MODE_NEAREST; + else if (CurValueFilterMode == PI_SAMPLER_FILTER_MODE_LINEAR) + UrMipProps.mipFilterMode = UR_SAMPLER_FILTER_MODE_LINEAR; + } break; + + default: + break; + } + CurProperty++; + } + + ur_sampler_handle_t *UrSampler = + reinterpret_cast(RetSampler); + + HANDLE_ERRORS(urSamplerCreate(UrContext, &UrProps, UrSampler)); + + return PI_SUCCESS; +} + inline pi_result piextMemMipmapGetLevel(pi_context Context, pi_device Device, pi_image_mem_handle MipMem, unsigned int Level, diff --git a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp index 36ca5596a7acf..20fe7384a9c63 100644 --- a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp +++ b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp @@ -866,10 +866,8 @@ __SYCL_EXPORT pi_result piextProgramCreateWithNativeHandle( __SYCL_EXPORT pi_result piSamplerCreate( pi_context Context, const pi_sampler_properties *SamplerProperties, - float minMipmapLevelClamp, float maxMipmapLevelClamp, float maxAnisotropy, pi_sampler *RetSampler) { - return pi2ur::piSamplerCreate(Context, SamplerProperties, minMipmapLevelClamp, - maxMipmapLevelClamp, maxAnisotropy, RetSampler); + return pi2ur::piSamplerCreate(Context, SamplerProperties, RetSampler); } __SYCL_EXPORT pi_result piSamplerGetInfo(pi_sampler Sampler, diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp index 6ba96460c4008..7f97c090e8886 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp @@ -70,46 +70,23 @@ urToCudaImageChannelFormat(ur_image_channel_type_t image_channel_type, ur_result_t Err = UR_RESULT_SUCCESS; switch (image_channel_type) { - case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8: - cuda_format = CU_AD_FORMAT_UNORM_INT8X1; - PixelTypeSizeBytes = 1; - break; - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8: - cuda_format = CU_AD_FORMAT_UNSIGNED_INT8; - PixelTypeSizeBytes = 1; - break; - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8: - cuda_format = CU_AD_FORMAT_SIGNED_INT8; - PixelTypeSizeBytes = 1; - break; - case UR_IMAGE_CHANNEL_TYPE_UNORM_INT16: - cuda_format = CU_AD_FORMAT_UNORM_INT16X1; - PixelTypeSizeBytes = 2; - break; - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16: - cuda_format = CU_AD_FORMAT_UNSIGNED_INT16; - PixelTypeSizeBytes = 2; - break; - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16: - cuda_format = CU_AD_FORMAT_SIGNED_INT16; - PixelTypeSizeBytes = 2; - break; - case UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT: - cuda_format = CU_AD_FORMAT_HALF; - PixelTypeSizeBytes = 2; - break; - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32: - cuda_format = CU_AD_FORMAT_UNSIGNED_INT32; - PixelTypeSizeBytes = 4; - break; - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32: - cuda_format = CU_AD_FORMAT_SIGNED_INT32; - PixelTypeSizeBytes = 4; - break; - case UR_IMAGE_CHANNEL_TYPE_FLOAT: - cuda_format = CU_AD_FORMAT_FLOAT; - PixelTypeSizeBytes = 4; - break; +#define CASE(FROM, TO, SIZE) \ + case FROM: { \ + cuda_format = TO; \ + PixelTypeSizeBytes = SIZE; \ + break; \ + } + CASE(UR_IMAGE_CHANNEL_TYPE_UNORM_INT8, CU_AD_FORMAT_UNORM_INT8X1, 1) + CASE(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8, CU_AD_FORMAT_UNSIGNED_INT8, 1) + CASE(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8, CU_AD_FORMAT_SIGNED_INT8, 1) + CASE(UR_IMAGE_CHANNEL_TYPE_UNORM_INT16, CU_AD_FORMAT_UNORM_INT16X1, 2) + CASE(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16, CU_AD_FORMAT_UNSIGNED_INT16, 2) + CASE(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16, CU_AD_FORMAT_SIGNED_INT16, 2) + CASE(UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT, CU_AD_FORMAT_HALF, 2) + CASE(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32, CU_AD_FORMAT_UNSIGNED_INT32, 4) + CASE(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32, CU_AD_FORMAT_SIGNED_INT32, 4) + CASE(UR_IMAGE_CHANNEL_TYPE_FLOAT, CU_AD_FORMAT_FLOAT, 4) +#undef CASE default: Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; break; @@ -127,40 +104,26 @@ urToCudaImageChannelFormat(ur_image_channel_type_t image_channel_type, ur_result_t cudaToUrImageChannelFormat(CUarray_format cuda_format, ur_image_channel_type_t *return_image_channel_type) { - assert(return_image_channel_type); + UR_ASSERT(return_image_channel_type, UR_RESULT_ERROR_INVALID_NULL_POINTER); ur_result_t Err = UR_RESULT_SUCCESS; switch (cuda_format) { - case CU_AD_FORMAT_UNSIGNED_INT8: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8; - break; - case CU_AD_FORMAT_UNSIGNED_INT16: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16; - break; - case CU_AD_FORMAT_UNSIGNED_INT32: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32; - break; - case CU_AD_FORMAT_SIGNED_INT8: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8; - break; - case CU_AD_FORMAT_SIGNED_INT16: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16; - break; - case CU_AD_FORMAT_SIGNED_INT32: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32; - break; - case CU_AD_FORMAT_HALF: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT; - break; - case CU_AD_FORMAT_FLOAT: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_FLOAT; - break; - case CU_AD_FORMAT_UNORM_INT8X1: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNORM_INT8; - break; - case CU_AD_FORMAT_UNORM_INT16X1: - *return_image_channel_type = UR_IMAGE_CHANNEL_TYPE_UNORM_INT16; - break; +#define MAP(FROM, TO) \ + case FROM: { \ + *return_image_channel_type = TO; \ + break; \ + } + MAP(CU_AD_FORMAT_UNSIGNED_INT8, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8); + MAP(CU_AD_FORMAT_UNSIGNED_INT16, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16); + MAP(CU_AD_FORMAT_UNSIGNED_INT32, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32); + MAP(CU_AD_FORMAT_SIGNED_INT8, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8); + MAP(CU_AD_FORMAT_SIGNED_INT16, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16); + MAP(CU_AD_FORMAT_SIGNED_INT32, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32); + MAP(CU_AD_FORMAT_HALF, UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT); + MAP(CU_AD_FORMAT_FLOAT, UR_IMAGE_CHANNEL_TYPE_FLOAT); + MAP(CU_AD_FORMAT_UNORM_INT8X1, UR_IMAGE_CHANNEL_TYPE_UNORM_INT8); + MAP(CU_AD_FORMAT_UNORM_INT16X1, UR_IMAGE_CHANNEL_TYPE_UNORM_INT16); +#undef MAP default: Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; break; @@ -262,17 +225,18 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp( std::ignore = pUSMDesc; std::ignore = pool; - assert(widthInBytes > 0); - assert(height > 0); - assert(elementSizeBytes > 0); + UR_ASSERT((widthInBytes > 0), UR_RESULT_ERROR_INVALID_VALUE); + UR_ASSERT((height > 0), UR_RESULT_ERROR_INVALID_VALUE); + UR_ASSERT((elementSizeBytes > 0), UR_RESULT_ERROR_INVALID_VALUE); // elementSizeBytes can only take on values of 4, 8, or 16. // small data types need to be minimised to 4. if (elementSizeBytes < 4) { elementSizeBytes = 4; } - assert(elementSizeBytes == 4 || elementSizeBytes == 8 || - elementSizeBytes == 16); + UR_ASSERT((elementSizeBytes == 4 || elementSizeBytes == 8 || + elementSizeBytes == 16), + UR_RESULT_ERROR_INVALID_VALUE); ur_result_t Result = UR_RESULT_SUCCESS; try { ScopedContext Active(hDevice->getContext()); @@ -438,18 +402,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( unsigned int NumChannels = 0; RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die("urBindlessImagesUnsampledImageCreateExp given " - "unsupported channelType"); + if (RetErr != UR_RESULT_SUCCESS) { + return RetErr; } CUarray_format format; size_t PixelTypeSizeBytes; RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, &format, &PixelTypeSizeBytes); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die("urBindlessImagesUnsampledImageCreateExp given " - "unsupported channelType"); + if (RetErr != UR_RESULT_SUCCESS) { + return RetErr; } try { @@ -506,18 +468,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( unsigned int NumChannels = 0; RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die("urBindlessImagesSampledImageCreateExp given " - "unsupported channelOrder"); + if (RetErr != UR_RESULT_SUCCESS) { + return RetErr; } CUarray_format format; size_t PixelTypeSizeBytes; RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, &format, &PixelTypeSizeBytes); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die("urBindlessImagesSampledImageCreateExp given " - "unsupported channelType"); + if (RetErr != UR_RESULT_SUCCESS) { + return RetErr; } try { @@ -607,18 +567,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( size_t PixelTypeSizeBytes = 0; RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die( - "urBindlessImagesImageCopyExp given unsupported channelOrder"); + if (RetErr != UR_RESULT_SUCCESS) { + return RetErr; } // We need to get this now in bytes for calculating the total image size // later. RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, nullptr, &PixelTypeSizeBytes); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die( - "urBindlessImagesImageCopyExp given unsupported channelType"); + if (RetErr != UR_RESULT_SUCCESS) { + return RetErr; } size_t PixelSizeBytes = PixelTypeSizeBytes * NumChannels; @@ -904,17 +862,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( unsigned int NumChannels = 0; RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die("cuda_piextMemMapExternalArray given " - "unsupported channelOrder\n"); + if (RetErr != UR_RESULT_SUCCESS) { + return RetErr; } CUarray_format format; RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, &format, nullptr); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die("cuda_piextMemMapExternalArray given " - "unsupported channelType\n"); + if (RetErr != UR_RESULT_SUCCESS) { + return RetErr; } try { diff --git a/sycl/source/detail/sampler_impl.cpp b/sycl/source/detail/sampler_impl.cpp index 22fddd630d394..d942801d722b8 100644 --- a/sycl/source/detail/sampler_impl.cpp +++ b/sycl/source/detail/sampler_impl.cpp @@ -17,14 +17,9 @@ namespace detail { sampler_impl::sampler_impl(coordinate_normalization_mode normalizationMode, addressing_mode addressingMode, filtering_mode filteringMode, - mipmap_filtering_mode mipmapFilteringMode, - float minMipmapLevelClamp, float maxMipmapLevelClamp, - float maxAnisotropy, const property_list &propList) + const property_list &propList) : MCoordNormMode(normalizationMode), MAddrMode(addressingMode), - MFiltMode(filteringMode), MMipFiltMode(mipmapFilteringMode), - MMinMipmapLevelClamp(minMipmapLevelClamp), - MMaxMipmapLevelClamp(maxMipmapLevelClamp), MMaxAnisotropy(maxAnisotropy), - MPropList(propList) {} + MFiltMode(filteringMode), MPropList(propList) {} sampler_impl::sampler_impl(cl_sampler clSampler, const context &syclContext) { @@ -69,8 +64,6 @@ sampler_impl::getOrCreateSampler(const context &Context) { static_cast(MAddrMode), PI_SAMPLER_INFO_FILTER_MODE, static_cast(MFiltMode), - PI_SAMPLER_INFO_MIP_FILTER_MODE, - static_cast(MMipFiltMode), 0}; sycl::detail::pi::PiResult errcode_ret = PI_SUCCESS; @@ -78,8 +71,7 @@ sampler_impl::getOrCreateSampler(const context &Context) { const PluginPtr &Plugin = getSyclObjImpl(Context)->getPlugin(); errcode_ret = Plugin->call_nocheck( - getSyclObjImpl(Context)->getHandleRef(), sprops, MMinMipmapLevelClamp, - MMaxMipmapLevelClamp, MMaxAnisotropy, &resultSampler); + getSyclObjImpl(Context)->getHandleRef(), sprops, &resultSampler); if (errcode_ret == PI_ERROR_INVALID_OPERATION) throw feature_not_supported("Images are not supported by this device.", @@ -96,25 +88,11 @@ addressing_mode sampler_impl::get_addressing_mode() const { return MAddrMode; } filtering_mode sampler_impl::get_filtering_mode() const { return MFiltMode; } -mipmap_filtering_mode sampler_impl::get_mipmap_filtering_mode() const { - return MMipFiltMode; -} - coordinate_normalization_mode sampler_impl::get_coordinate_normalization_mode() const { return MCoordNormMode; } -float sampler_impl::get_min_mipmap_level_clamp() const { - return MMinMipmapLevelClamp; -} - -float sampler_impl::get_max_mipmap_level_clamp() const { - return MMaxMipmapLevelClamp; -} - -float sampler_impl::get_max_anisotropy() const { return MMaxAnisotropy; } - } // namespace detail } // __SYCL_INLINE_VER_NAMESPACE(_V1) } // namespace sycl diff --git a/sycl/source/detail/sampler_impl.hpp b/sycl/source/detail/sampler_impl.hpp index 7f186ce7ca9df..00571c64d6b0d 100644 --- a/sycl/source/detail/sampler_impl.hpp +++ b/sycl/source/detail/sampler_impl.hpp @@ -20,7 +20,6 @@ __SYCL_INLINE_VER_NAMESPACE(_V1) { enum class addressing_mode : unsigned int; enum class filtering_mode : unsigned int; -enum class mipmap_filtering_mode : unsigned int; enum class coordinate_normalization_mode : unsigned int; namespace detail { @@ -28,9 +27,7 @@ class __SYCL_EXPORT sampler_impl { public: sampler_impl(coordinate_normalization_mode normalizationMode, addressing_mode addressingMode, filtering_mode filteringMode, - mipmap_filtering_mode mipmapFilteringMode, - float minMipmapLevelClamp, float maxMipmapLevelClamp, - float maxAnisotropy, const property_list &propList); + const property_list &propList); sampler_impl(cl_sampler clSampler, const context &syclContext); @@ -38,16 +35,8 @@ class __SYCL_EXPORT sampler_impl { filtering_mode get_filtering_mode() const; - mipmap_filtering_mode get_mipmap_filtering_mode() const; - coordinate_normalization_mode get_coordinate_normalization_mode() const; - float get_min_mipmap_level_clamp() const; - - float get_max_mipmap_level_clamp() const; - - float get_max_anisotropy() const; - sycl::detail::pi::PiSampler getOrCreateSampler(const context &Context); /// Checks if this sampler_impl has a property of type propertyT. @@ -78,10 +67,6 @@ class __SYCL_EXPORT sampler_impl { coordinate_normalization_mode MCoordNormMode; addressing_mode MAddrMode; filtering_mode MFiltMode; - mipmap_filtering_mode MMipFiltMode; - float MMinMipmapLevelClamp; - float MMaxMipmapLevelClamp; - float MMaxAnisotropy; property_list MPropList; }; diff --git a/sycl/source/sampler.cpp b/sycl/source/sampler.cpp index 2f314324596df..ebd6d1fdeea95 100644 --- a/sycl/source/sampler.cpp +++ b/sycl/source/sampler.cpp @@ -17,17 +17,7 @@ sampler::sampler(coordinate_normalization_mode normalizationMode, addressing_mode addressingMode, filtering_mode filteringMode, const property_list &propList) : impl(std::make_shared( - normalizationMode, addressingMode, filteringMode, - mipmap_filtering_mode::nearest, 0.0f, 0.0f, 0.0f, propList)) {} - -sampler::sampler(coordinate_normalization_mode normalizationMode, - addressing_mode addressingMode, filtering_mode filteringMode, - mipmap_filtering_mode mipmapFilteringMode, - float minMipmapLevelClamp, float maxMipmapLevelClamp, - float maxAnisotropy, const property_list &propList) - : impl(std::make_shared( - normalizationMode, addressingMode, filteringMode, mipmapFilteringMode, - minMipmapLevelClamp, maxMipmapLevelClamp, maxAnisotropy, propList)) {} + normalizationMode, addressingMode, filteringMode, propList)) {} sampler::sampler(cl_sampler clSampler, const context &syclContext) : impl(std::make_shared(clSampler, syclContext)) {} @@ -40,25 +30,11 @@ filtering_mode sampler::get_filtering_mode() const { return impl->get_filtering_mode(); } -mipmap_filtering_mode sampler::get_mipmap_filtering_mode() const { - return impl->get_mipmap_filtering_mode(); -} - coordinate_normalization_mode sampler::get_coordinate_normalization_mode() const { return impl->get_coordinate_normalization_mode(); } -float sampler::get_min_mipmap_level_clamp() const { - return impl->get_min_mipmap_level_clamp(); -} - -float sampler::get_max_mipmap_level_clamp() const { - return impl->get_max_mipmap_level_clamp(); -} - -float sampler::get_max_anisotropy() const { return impl->get_max_anisotropy(); } - bool sampler::operator==(const sampler &rhs) const { return (impl == rhs.impl); } diff --git a/sycl/test/abi/pi_level_zero_symbol_check.dump b/sycl/test/abi/pi_level_zero_symbol_check.dump index de350ffdfa425..5b22d763b7971 100644 --- a/sycl/test/abi/pi_level_zero_symbol_check.dump +++ b/sycl/test/abi/pi_level_zero_symbol_check.dump @@ -83,6 +83,7 @@ piSamplerRelease piSamplerRetain piTearDown piclProgramCreateWithSource +piextBindlessImageSamplerCreate piextContextCreateWithNativeHandle piextContextGetNativeHandle piextContextSetExtendedDeleter diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index f63bbc03ff4d8..88b44562f5c9a 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3661,6 +3661,50 @@ _ZN4sycl3_V13ext6oneapi10level_zero10make_queueERKNS0_7contextERKNS0_6deviceEmbb _ZN4sycl3_V13ext6oneapi10level_zero11make_deviceERKNS0_8platformEm _ZN4sycl3_V13ext6oneapi10level_zero12make_contextERKSt6vectorINS0_6deviceESaIS5_EEmb _ZN4sycl3_V13ext6oneapi10level_zero13make_platformEm +_ZN4sycl3_V13ext6oneapi12experimental12create_imageENS3_16image_mem_handleERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental12create_imageENS3_16image_mem_handleERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental12create_imageENS3_16image_mem_handleERKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental12create_imageENS3_16image_mem_handleERKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental12create_imageEPvmRKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental12create_imageEPvmRKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental12create_imageERNS3_9image_memERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental12create_imageERNS3_9image_memERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental12create_imageERNS3_9image_memERKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental12create_imageERNS3_9image_memERKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental14free_image_memENS3_16image_mem_handleERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental14free_image_memENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental15alloc_image_memERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental15alloc_image_memERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental15free_mipmap_memENS3_16image_mem_handleERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental15free_mipmap_memENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental15get_image_rangeENS3_16image_mem_handleERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental15get_image_rangeENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental16alloc_mipmap_memERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental16alloc_mipmap_memERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental20destroy_image_handleERNS3_20sampled_image_handleERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental20destroy_image_handleERNS3_20sampled_image_handleERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental20destroy_image_handleERNS3_22unsampled_image_handleERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental20destroy_image_handleERNS3_22unsampled_image_handleERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental20pitched_alloc_deviceEPmRKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental20pitched_alloc_deviceEPmRKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental20pitched_alloc_deviceEPmmmjRKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental20pitched_alloc_deviceEPmmmjRKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental22get_image_channel_typeENS3_16image_mem_handleERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental22get_image_channel_typeENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental22get_image_num_channelsENS3_16image_mem_handleERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental22get_image_num_channelsENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental22import_external_memoryINS3_15external_mem_fdEEENS3_18interop_mem_handleENS3_23external_mem_descriptorIT_EERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental22import_external_memoryINS3_15external_mem_fdEEENS3_18interop_mem_handleENS3_23external_mem_descriptorIT_EERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental23release_external_memoryENS3_18interop_mem_handleERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental23release_external_memoryENS3_18interop_mem_handleERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental24get_mip_level_mem_handleENS3_16image_mem_handleEjRKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental24get_mip_level_mem_handleENS3_16image_mem_handleEjRKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental25import_external_semaphoreINS3_21external_semaphore_fdEEENS3_24interop_semaphore_handleENS3_29external_semaphore_descriptorIT_EERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental25import_external_semaphoreINS3_21external_semaphore_fdEEENS3_24interop_semaphore_handleENS3_29external_semaphore_descriptorIT_EERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental25map_external_memory_arrayENS3_18interop_mem_handleERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental25map_external_memory_arrayENS3_18interop_mem_handleERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental26destroy_external_semaphoreENS3_24interop_semaphore_handleERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental26destroy_external_semaphoreENS3_24interop_semaphore_handleERKNS0_6deviceERKNS0_7contextE _ZN4sycl3_V13ext6oneapi12experimental6detail24executable_command_graph12finalizeImplEv _ZN4sycl3_V13ext6oneapi12experimental6detail24executable_command_graph6updateERKNS3_13command_graphILNS3_11graph_stateE0EEE _ZN4sycl3_V13ext6oneapi12experimental6detail24executable_command_graphC1ERKSt10shared_ptrINS4_10graph_implEERKNS0_7contextE @@ -3675,6 +3719,15 @@ _ZN4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph7addImplES _ZN4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph9make_edgeERNS3_4nodeES7_ _ZN4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graphC1ERKNS0_7contextERKNS0_6deviceERKNS0_13property_listE _ZN4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graphC2ERKNS0_7contextERKNS0_6deviceERKNS0_13property_listE +_ZN4sycl3_V13ext6oneapi12experimental9image_memC1EOS4_ +_ZN4sycl3_V13ext6oneapi12experimental9image_memC1ERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental9image_memC1ERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental9image_memC2EOS4_ +_ZN4sycl3_V13ext6oneapi12experimental9image_memC2ERKNS3_16image_descriptorERKNS0_5queueE +_ZN4sycl3_V13ext6oneapi12experimental9image_memC2ERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE +_ZN4sycl3_V13ext6oneapi12experimental9image_memD1Ev +_ZN4sycl3_V13ext6oneapi12experimental9image_memD2Ev +_ZN4sycl3_V13ext6oneapi12experimental9image_memaSEOS4_ _ZN4sycl3_V13ext6oneapi15filter_selectorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _ZN4sycl3_V13ext6oneapi15filter_selectorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _ZN4sycl3_V13ext8codeplay12experimental14fusion_wrapper12start_fusionEv @@ -3821,9 +3874,9 @@ _ZN4sycl3_V16detail12compile_implERKNS0_13kernel_bundleILNS0_12bundle_stateE0EEE _ZN4sycl3_V16detail12isOutOfRangeENS0_3vecIiLi4EEENS0_15addressing_modeENS0_5rangeILi3EEE _ZN4sycl3_V16detail12make_contextEmRKSt8functionIFvNS0_14exception_listEEENS0_7backendE _ZN4sycl3_V16detail12sampler_impl18getOrCreateSamplerERKNS0_7contextE -_ZN4sycl3_V16detail12sampler_implC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeENS0_21mipmap_filtering_modeEfffRKNS0_13property_listE +_ZN4sycl3_V16detail12sampler_implC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE _ZN4sycl3_V16detail12sampler_implC1EP11_cl_samplerRKNS0_7contextE -_ZN4sycl3_V16detail12sampler_implC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeENS0_21mipmap_filtering_modeEfffRKNS0_13property_listE +_ZN4sycl3_V16detail12sampler_implC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE _ZN4sycl3_V16detail12sampler_implC2EP11_cl_samplerRKNS0_7contextE _ZN4sycl3_V16detail12sampler_implD1Ev _ZN4sycl3_V16detail12sampler_implD2Ev @@ -3838,6 +3891,7 @@ _ZN4sycl3_V16detail13MemoryManager16allocateMemImageESt10shared_ptrINS1_12contex _ZN4sycl3_V16detail13MemoryManager17allocateMemBufferESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEPvbmRKS3_INS1_10event_implEERKS5_RKNS0_13property_listERP9_pi_event _ZN4sycl3_V16detail13MemoryManager18allocateHostMemoryEPNS1_11SYCLMemObjIEPvbmRKNS0_13property_listE _ZN4sycl3_V16detail13MemoryManager19allocateImageObjectESt10shared_ptrINS1_12context_implEEPvbRK14_pi_image_descRK16_pi_image_formatRKNS0_13property_listE +_ZN4sycl3_V16detail13MemoryManager19copy_image_bindlessEPvSt10shared_ptrINS1_10queue_implEES3_RK14_pi_image_descRK16_pi_image_format20_pi_image_copy_flags22pi_image_offset_structSE_22pi_image_region_structSF_RKSt6vectorIP9_pi_eventSaISI_EEPSI_ _ZN4sycl3_V16detail13MemoryManager20allocateBufferObjectESt10shared_ptrINS1_12context_implEEPvbmRKNS0_13property_listE _ZN4sycl3_V16detail13MemoryManager20allocateMemSubBufferESt10shared_ptrINS1_12context_implEEPvmmNS0_5rangeILi3EEESt6vectorIS3_INS1_10event_implEESaISB_EERP9_pi_event _ZN4sycl3_V16detail13MemoryManager21copy_to_device_globalEPKvbSt10shared_ptrINS1_10queue_implEEmmS4_RKSt6vectorIP9_pi_eventSaISA_EEPSA_ @@ -3996,6 +4050,12 @@ _ZN4sycl3_V17handler10mem_adviseEPKvmi _ZN4sycl3_V17handler10processArgEPvRKNS0_6detail19kernel_param_kind_tEimRmbb _ZN4sycl3_V17handler12addReductionERKSt10shared_ptrIKvE _ZN4sycl3_V17handler13getKernelNameB5cxx11Ev +_ZN4sycl3_V17handler15ext_oneapi_copyENS0_3ext6oneapi12experimental16image_mem_handleENS0_5rangeILi3EEERKNS4_16image_descriptorEPvS7_S7_S7_ +_ZN4sycl3_V17handler15ext_oneapi_copyENS0_3ext6oneapi12experimental16image_mem_handleEPvRKNS4_16image_descriptorE +_ZN4sycl3_V17handler15ext_oneapi_copyEPvNS0_3ext6oneapi12experimental16image_mem_handleERKNS5_16image_descriptorE +_ZN4sycl3_V17handler15ext_oneapi_copyEPvNS0_5rangeILi3EEES2_S4_RKNS0_3ext6oneapi12experimental16image_descriptorEmS4_S4_ +_ZN4sycl3_V17handler15ext_oneapi_copyEPvNS0_5rangeILi3EEES4_NS0_3ext6oneapi12experimental16image_mem_handleES4_RKNS7_16image_descriptorES4_ +_ZN4sycl3_V17handler15ext_oneapi_copyEPvS2_RKNS0_3ext6oneapi12experimental16image_descriptorEm _ZN4sycl3_V17handler16ext_oneapi_graphENS0_3ext6oneapi12experimental13command_graphILNS4_11graph_stateE1EEE _ZN4sycl3_V17handler17supportsUSMFill2DEv _ZN4sycl3_V17handler17use_kernel_bundleERKNS0_13kernel_bundleILNS0_12bundle_stateE2EEE @@ -4027,6 +4087,8 @@ _ZN4sycl3_V17handler28extractArgsAndReqsFromLambdaEPcmPKNS0_6detail19kernel_para _ZN4sycl3_V17handler28memcpyToHostOnlyDeviceGlobalEPKvS3_mbmm _ZN4sycl3_V17handler28setStateExplicitKernelBundleEv _ZN4sycl3_V17handler30memcpyFromHostOnlyDeviceGlobalEPvPKvbmm +_ZN4sycl3_V17handler34ext_oneapi_wait_external_semaphoreENS0_3ext6oneapi12experimental24interop_semaphore_handleE +_ZN4sycl3_V17handler36ext_oneapi_signal_external_semaphoreENS0_3ext6oneapi12experimental24interop_semaphore_handleE _ZN4sycl3_V17handler6memcpyEPvPKvm _ZN4sycl3_V17handler6memsetEPvim _ZN4sycl3_V17handler7barrierERKSt6vectorINS0_5eventESaIS3_EE @@ -4038,10 +4100,8 @@ _ZN4sycl3_V17handlerC1ESt10shared_ptrINS0_6detail10queue_implEEb _ZN4sycl3_V17handlerC2ESt10shared_ptrINS0_3ext6oneapi12experimental6detail10graph_implEE _ZN4sycl3_V17handlerC2ESt10shared_ptrINS0_6detail10queue_implEES5_S5_b _ZN4sycl3_V17handlerC2ESt10shared_ptrINS0_6detail10queue_implEEb -_ZN4sycl3_V17samplerC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeENS0_21mipmap_filtering_modeEfffRKNS0_13property_listE _ZN4sycl3_V17samplerC1ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE _ZN4sycl3_V17samplerC1EP11_cl_samplerRKNS0_7contextE -_ZN4sycl3_V17samplerC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeENS0_21mipmap_filtering_modeEfffRKNS0_13property_listE _ZN4sycl3_V17samplerC2ENS0_29coordinate_normalization_modeENS0_15addressing_modeENS0_14filtering_modeERKNS0_13property_listE _ZN4sycl3_V17samplerC2EP11_cl_samplerRKNS0_7contextE _ZN4sycl3_V18platform13get_platformsEv @@ -4101,6 +4161,12 @@ _ZNK4sycl3_V115interop_handler14GetNativeQueueERi _ZNK4sycl3_V116default_selectorclERKNS0_6deviceE _ZNK4sycl3_V120accelerator_selectorclERKNS0_6deviceE _ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph8finalizeERKNS0_13property_listE +_ZNK4sycl3_V13ext6oneapi12experimental9image_mem16get_channel_typeEv +_ZNK4sycl3_V13ext6oneapi12experimental9image_mem16get_num_channelsEv +_ZNK4sycl3_V13ext6oneapi12experimental9image_mem17get_channel_orderEv +_ZNK4sycl3_V13ext6oneapi12experimental9image_mem24get_mip_level_mem_handleEj +_ZNK4sycl3_V13ext6oneapi12experimental9image_mem8get_typeEv +_ZNK4sycl3_V13ext6oneapi12experimental9image_mem9get_rangeEv _ZNK4sycl3_V13ext6oneapi15filter_selector13select_deviceEv _ZNK4sycl3_V13ext6oneapi15filter_selector5resetEv _ZNK4sycl3_V13ext6oneapi15filter_selectorclERKNS0_6deviceE @@ -4173,7 +4239,12 @@ _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext5intel4info6device9device_idE _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi1EEEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi2EEEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi3EEEEENT_11return_typeEv +_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device17image_pitch_alignEEENT_11return_typeEv +_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device21mipmap_max_anisotropyEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device22max_global_work_groupsEEENT_11return_typeEv +_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device22max_image_linear_pitchEEENT_11return_typeEv +_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device22max_image_linear_widthEEENT_11return_typeEv +_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device23max_image_linear_heightEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext8codeplay12experimental4info6device15supports_fusionEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext8codeplay12experimental4info6device28max_registers_per_work_groupEEENT_11return_typeEv _ZNK4sycl3_V16detail11image_plain10getSamplerEv @@ -4264,11 +4335,7 @@ _ZNK4sycl3_V16detail12buffer_plain15getNativeVectorENS0_7backendE _ZNK4sycl3_V16detail12buffer_plain22get_allocator_internalEv _ZNK4sycl3_V16detail12buffer_plain7getSizeEv _ZNK4sycl3_V16detail12sampler_impl18get_filtering_modeEv -_ZNK4sycl3_V16detail12sampler_impl18get_max_anisotropyEv _ZNK4sycl3_V16detail12sampler_impl19get_addressing_modeEv -_ZNK4sycl3_V16detail12sampler_impl25get_mipmap_filtering_modeEv -_ZNK4sycl3_V16detail12sampler_impl26get_max_mipmap_level_clampEv -_ZNK4sycl3_V16detail12sampler_impl26get_min_mipmap_level_clampEv _ZNK4sycl3_V16detail12sampler_impl33get_coordinate_normalization_modeEv _ZNK4sycl3_V16detail16AccessorBaseHost11getElemSizeEv _ZNK4sycl3_V16detail16AccessorBaseHost11getPropListEv @@ -4348,7 +4415,12 @@ _ZNK4sycl3_V16device8get_infoINS0_3ext5intel4info6device9device_idEEENS0_6detail _ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi1EEEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi2EEEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi3EEEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device17image_pitch_alignEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device21mipmap_max_anisotropyEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device22max_global_work_groupsEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device22max_image_linear_pitchEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device22max_image_linear_widthEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device23max_image_linear_heightEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext8codeplay12experimental4info6device15supports_fusionEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext8codeplay12experimental4info6device28max_registers_per_work_groupEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device10extensionsEEENS0_6detail19is_device_info_descIT_E11return_typeEv @@ -4373,6 +4445,7 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device16double_fp_configEEENS0_6detail19 _ZNK4sycl3_V16device8get_infoINS0_4info6device16is_endian_littleEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device16opencl_c_versionEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device16single_fp_configEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device17ext_oneapi_mipmapEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device17image2d_max_widthEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device17image3d_max_depthEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device17image3d_max_widthEEENS0_6detail19is_device_info_descIT_E11return_typeEv @@ -4422,6 +4495,7 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device25native_vector_width_floatEEENS0_ _ZNK4sycl3_V16device8get_infoINS0_4info6device25native_vector_width_shortEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device25partition_max_sub_devicesEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device26ext_intel_device_info_uuidEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device26ext_oneapi_bindless_imagesEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device26global_mem_cache_line_sizeEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device26kernel_kernel_pipe_supportEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device26native_vector_width_doubleEEENS0_6detail19is_device_info_descIT_E11return_typeEv @@ -4434,6 +4508,7 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device27preferred_interop_user_syncEEENS _ZNK4sycl3_V16device8get_infoINS0_4info6device27preferred_vector_width_charEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device27preferred_vector_width_halfEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device27preferred_vector_width_longEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device28ext_oneapi_mipmap_anisotropyEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device28preferred_vector_width_floatEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device28preferred_vector_width_shortEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device29ext_oneapi_max_work_groups_1dEEENS0_6detail19is_device_info_descIT_E11return_typeEv @@ -4446,11 +4521,19 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device31atomic_fence_scope_capabilitiesE _ZNK4sycl3_V16device8get_infoINS0_4info6device31ext_intel_gpu_hw_threads_per_euEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device32atomic_memory_order_capabilitiesEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device32atomic_memory_scope_capabilitiesEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device32ext_oneapi_interop_memory_exportEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device32ext_oneapi_interop_memory_importEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_intel_gpu_subslices_per_sliceEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_oneapi_bindless_images_1d_usmEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_oneapi_bindless_images_2d_usmEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_oneapi_max_global_work_groupsEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_oneapi_mipmap_level_referenceEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device33usm_restricted_shared_allocationsEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device34ext_oneapi_bfloat16_math_functionsEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device35ext_intel_gpu_eu_count_per_subsliceEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device35ext_oneapi_interop_semaphore_exportEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device35ext_oneapi_interop_semaphore_importEEENS0_6detail19is_device_info_descIT_E11return_typeEv +_ZNK4sycl3_V16device8get_infoINS0_4info6device37ext_oneapi_bindless_images_shared_usmEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device38sub_group_independent_forward_progressEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device4nameEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device6vendorEEENS0_6detail19is_device_info_descIT_E11return_typeEv @@ -4609,11 +4692,7 @@ _ZNK4sycl3_V17sampler12has_propertyINS0_8property7context4cuda19use_primary_cont _ZNK4sycl3_V17sampler12has_propertyINS0_8property7no_initEEEbv _ZNK4sycl3_V17sampler12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv _ZNK4sycl3_V17sampler18get_filtering_modeEv -_ZNK4sycl3_V17sampler18get_max_anisotropyEv _ZNK4sycl3_V17sampler19get_addressing_modeEv -_ZNK4sycl3_V17sampler25get_mipmap_filtering_modeEv -_ZNK4sycl3_V17sampler26get_max_mipmap_level_clampEv -_ZNK4sycl3_V17sampler26get_min_mipmap_level_clampEv _ZNK4sycl3_V17sampler33get_coordinate_normalization_modeEv _ZNK4sycl3_V17samplereqERKS1_ _ZNK4sycl3_V17samplerneERKS1_ diff --git a/sycl/unittests/helpers/PiMockPlugin.hpp b/sycl/unittests/helpers/PiMockPlugin.hpp index 2ad810b46f56b..abe41fd7e934d 100644 --- a/sycl/unittests/helpers/PiMockPlugin.hpp +++ b/sycl/unittests/helpers/PiMockPlugin.hpp @@ -546,6 +546,14 @@ inline pi_result mock_piextMemSampledImageCreate( return PI_SUCCESS; } +inline pi_result mock_piextBindlessImageSamplerCreate( + pi_context context, const pi_sampler_properties *sampler_properties, + const float minMipmapLevelClamp, const float maxMipmapLevelClamp, + const float maxAnisotropy, pi_sampler *result_sampler) { + *result_sampler = createDummyHandle(); + return PI_SUCCESS; +} + inline pi_result mock_piextMemImageCopy( pi_queue command_queue, void *dst_ptr, void *src_ptr, const pi_image_format *image_format, const pi_image_desc *image_desc, @@ -932,10 +940,10 @@ mock_piextEventCreateWithNativeHandle(pi_native_handle nativeHandle, // // Sampler // -inline pi_result mock_piSamplerCreate( - pi_context context, const pi_sampler_properties *sampler_properties, - const float minMipmapLevelClamp, const float maxMipmapLevelClamp, - const float maxAnisotropy, pi_sampler *result_sampler) { +inline pi_result +mock_piSamplerCreate(pi_context context, + const pi_sampler_properties *sampler_properties, + pi_sampler *result_sampler) { *result_sampler = createDummyHandle(); return PI_SUCCESS; } From 6e794589a075ec367dc0748f1bcc05ce45163287 Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Tue, 4 Jul 2023 09:27:40 +0100 Subject: [PATCH 06/19] Address Feedback * Create UR_CHECK_ERROR for UR error codes * Replaced instances of `assert` with `UR_ASSERT` * Return error instead of die on unsupported image format --- .../ur/adapters/cuda/common.cpp | 23 +++++ .../ur/adapters/cuda/common.hpp | 3 + .../ur/adapters/cuda/image.cpp | 88 +++++++----------- sycl/test/abi/sycl_symbols_linux.dump | 89 ------------------- 4 files changed, 57 insertions(+), 146 deletions(-) diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/common.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/common.cpp index 86975e5097257..abf34bba50ed9 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/common.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/common.cpp @@ -62,6 +62,29 @@ ur_result_t checkErrorUR(CUresult Result, const char *Function, int Line, throw mapErrorUR(Result); } +ur_result_t checkErrorUR(ur_result_t Result, const char *Function, int Line, + const char *File) { + if (Result == UR_RESULT_SUCCESS) { + return UR_RESULT_SUCCESS; + } + + if (std::getenv("SYCL_PI_SUPPRESS_ERROR_MESSAGE") == nullptr) { + std::stringstream SS; + SS << "\nUR ERROR:" + << "\n\tValue: " << Result + << "\n\tFunction: " << Function << "\n\tSource Location: " << File + << ":" << Line << "\n" + << std::endl; + std::cerr << SS.str(); + } + + if (std::getenv("PI_CUDA_ABORT") != nullptr) { + std::abort(); + } + + throw Result; +} + std::string getCudaVersionString() { int driver_version = 0; cuDriverGetVersion(&driver_version); diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/common.hpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/common.hpp index 5cfa609018b29..82d385fb41103 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/common.hpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/common.hpp @@ -23,6 +23,9 @@ ur_result_t mapErrorUR(CUresult Result); ur_result_t checkErrorUR(CUresult Result, const char *Function, int Line, const char *File); +ur_result_t checkErrorUR(ur_result_t Result, const char *Function, int Line, + const char *File); + #define UR_CHECK_ERROR(Result) \ checkErrorUR(Result, __func__, __LINE__, __FILE__) diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp index 7f97c090e8886..2504eb0b4802c 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp @@ -297,19 +297,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( // Populate descriptor CUDA_ARRAY3D_DESCRIPTOR array_desc = {}; - RetErr = urCalculateNumChannels(pImageFormat->channelOrder, - &array_desc.NumChannels); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die("urBindlessImagesImageAllocateExp given " - "unsupported channelType"); - } + RetErr = UR_CHECK_ERROR(urCalculateNumChannels(pImageFormat->channelOrder, + &array_desc.NumChannels)); - RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, - &array_desc.Format, nullptr); - if (RetErr == UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED) { - sycl::detail::ur::die("urBindlessImagesImageAllocateExp given " - "unsupported channelType"); - } + RetErr = UR_CHECK_ERROR(urToCudaImageChannelFormat( + pImageFormat->channelType, &array_desc.Format, nullptr)); array_desc.Flags = 0; // No flags required array_desc.Width = pImageDesc->width; @@ -401,18 +393,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( ur_result_t RetErr = UR_RESULT_SUCCESS; unsigned int NumChannels = 0; - RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); - if (RetErr != UR_RESULT_SUCCESS) { - return RetErr; - } + RetErr = UR_CHECK_ERROR( + urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels)); CUarray_format format; size_t PixelTypeSizeBytes; - RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, &format, - &PixelTypeSizeBytes); - if (RetErr != UR_RESULT_SUCCESS) { - return RetErr; - } + RetErr = UR_CHECK_ERROR(urToCudaImageChannelFormat( + pImageFormat->channelType, &format, &PixelTypeSizeBytes)); try { @@ -467,18 +454,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( ScopedContext Active(hDevice->getContext()); unsigned int NumChannels = 0; - RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); - if (RetErr != UR_RESULT_SUCCESS) { - return RetErr; - } + RetErr = UR_CHECK_ERROR( + urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels)); CUarray_format format; size_t PixelTypeSizeBytes; - RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, &format, - &PixelTypeSizeBytes); - if (RetErr != UR_RESULT_SUCCESS) { - return RetErr; - } + RetErr = UR_CHECK_ERROR(urToCudaImageChannelFormat( + pImageFormat->channelType, &format, &PixelTypeSizeBytes)); try { CUDA_RESOURCE_DESC image_res_desc = {}; @@ -519,12 +501,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( image_res_desc.res.pitch2D.height = pImageDesc->height; image_res_desc.res.pitch2D.pitchInBytes = pImageDesc->rowPitch; } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE3D) { - sycl::detail::ur::die("urBindlessImagesSampledImageCreateExp cannot " - "create 3D image from USM"); + // Cannot create 3D image from USM. + return UR_RESULT_ERROR_INVALID_VALUE; } } else { - sycl::detail::ur::die( - "urBindlessImagesSampledImageCreateExp unknown image memory type"); + // Unknown image memory type. + return UR_RESULT_ERROR_INVALID_VALUE; } RetErr = urTextureCreate(hContext, hSampler, pImageDesc, image_res_desc, @@ -560,24 +542,23 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( UR_ASSERT(pSrc, UR_RESULT_ERROR_INVALID_NULL_POINTER); UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); + UR_ASSERT((imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE || + imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST || + imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE), + UR_RESULT_ERROR_INVALID_VALUE); ur_result_t RetErr = UR_RESULT_SUCCESS; unsigned int NumChannels = 0; size_t PixelTypeSizeBytes = 0; - RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); - if (RetErr != UR_RESULT_SUCCESS) { - return RetErr; - } + RetErr = UR_CHECK_ERROR( + urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels)); // We need to get this now in bytes for calculating the total image size // later. - RetErr = urToCudaImageChannelFormat(pImageFormat->channelType, nullptr, - &PixelTypeSizeBytes); - if (RetErr != UR_RESULT_SUCCESS) { - return RetErr; - } + RetErr = UR_CHECK_ERROR(urToCudaImageChannelFormat( + pImageFormat->channelType, nullptr, &PixelTypeSizeBytes)); size_t PixelSizeBytes = PixelTypeSizeBytes * NumChannels; @@ -681,13 +662,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( cpy_desc.Depth = copyExtent.depth; RetErr = UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream)); } - } else if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE) { - /// TODO: implemet device to device copy } else { - sycl::detail::ur::die("urBindlessImagesImageCopyExp given unsupported " - "image copy imageCopyFlags"); + /// imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE + /// TODO: implemet device to device copy + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - if (phEvent) { auto NewEvent = ur_event_handle_t_::makeNative(UR_COMMAND_MEM_IMAGE_COPY, hQueue, Stream); @@ -861,17 +840,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( ur_result_t RetErr = UR_RESULT_SUCCESS; unsigned int NumChannels = 0; - RetErr = urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels); - if (RetErr != UR_RESULT_SUCCESS) { - return RetErr; - } + RetErr = UR_CHECK_ERROR( + urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels)); CUarray_format format; - RetErr = - urToCudaImageChannelFormat(pImageFormat->channelType, &format, nullptr); - if (RetErr != UR_RESULT_SUCCESS) { - return RetErr; - } + RetErr = UR_CHECK_ERROR( + urToCudaImageChannelFormat(pImageFormat->channelType, &format, nullptr)); try { ScopedContext Active(hDevice->getContext()); diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index 88b44562f5c9a..fdb09458c4d6e 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3661,50 +3661,6 @@ _ZN4sycl3_V13ext6oneapi10level_zero10make_queueERKNS0_7contextERKNS0_6deviceEmbb _ZN4sycl3_V13ext6oneapi10level_zero11make_deviceERKNS0_8platformEm _ZN4sycl3_V13ext6oneapi10level_zero12make_contextERKSt6vectorINS0_6deviceESaIS5_EEmb _ZN4sycl3_V13ext6oneapi10level_zero13make_platformEm -_ZN4sycl3_V13ext6oneapi12experimental12create_imageENS3_16image_mem_handleERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental12create_imageENS3_16image_mem_handleERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental12create_imageENS3_16image_mem_handleERKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental12create_imageENS3_16image_mem_handleERKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental12create_imageEPvmRKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental12create_imageEPvmRKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental12create_imageERNS3_9image_memERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental12create_imageERNS3_9image_memERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental12create_imageERNS3_9image_memERKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental12create_imageERNS3_9image_memERKNS3_22bindless_image_samplerERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental14free_image_memENS3_16image_mem_handleERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental14free_image_memENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental15alloc_image_memERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental15alloc_image_memERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental15free_mipmap_memENS3_16image_mem_handleERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental15free_mipmap_memENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental15get_image_rangeENS3_16image_mem_handleERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental15get_image_rangeENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental16alloc_mipmap_memERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental16alloc_mipmap_memERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental20destroy_image_handleERNS3_20sampled_image_handleERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental20destroy_image_handleERNS3_20sampled_image_handleERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental20destroy_image_handleERNS3_22unsampled_image_handleERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental20destroy_image_handleERNS3_22unsampled_image_handleERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental20pitched_alloc_deviceEPmRKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental20pitched_alloc_deviceEPmRKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental20pitched_alloc_deviceEPmmmjRKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental20pitched_alloc_deviceEPmmmjRKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental22get_image_channel_typeENS3_16image_mem_handleERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental22get_image_channel_typeENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental22get_image_num_channelsENS3_16image_mem_handleERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental22get_image_num_channelsENS3_16image_mem_handleERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental22import_external_memoryINS3_15external_mem_fdEEENS3_18interop_mem_handleENS3_23external_mem_descriptorIT_EERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental22import_external_memoryINS3_15external_mem_fdEEENS3_18interop_mem_handleENS3_23external_mem_descriptorIT_EERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental23release_external_memoryENS3_18interop_mem_handleERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental23release_external_memoryENS3_18interop_mem_handleERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental24get_mip_level_mem_handleENS3_16image_mem_handleEjRKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental24get_mip_level_mem_handleENS3_16image_mem_handleEjRKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental25import_external_semaphoreINS3_21external_semaphore_fdEEENS3_24interop_semaphore_handleENS3_29external_semaphore_descriptorIT_EERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental25import_external_semaphoreINS3_21external_semaphore_fdEEENS3_24interop_semaphore_handleENS3_29external_semaphore_descriptorIT_EERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental25map_external_memory_arrayENS3_18interop_mem_handleERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental25map_external_memory_arrayENS3_18interop_mem_handleERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental26destroy_external_semaphoreENS3_24interop_semaphore_handleERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental26destroy_external_semaphoreENS3_24interop_semaphore_handleERKNS0_6deviceERKNS0_7contextE _ZN4sycl3_V13ext6oneapi12experimental6detail24executable_command_graph12finalizeImplEv _ZN4sycl3_V13ext6oneapi12experimental6detail24executable_command_graph6updateERKNS3_13command_graphILNS3_11graph_stateE0EEE _ZN4sycl3_V13ext6oneapi12experimental6detail24executable_command_graphC1ERKSt10shared_ptrINS4_10graph_implEERKNS0_7contextE @@ -3719,15 +3675,6 @@ _ZN4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph7addImplES _ZN4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph9make_edgeERNS3_4nodeES7_ _ZN4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graphC1ERKNS0_7contextERKNS0_6deviceERKNS0_13property_listE _ZN4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graphC2ERKNS0_7contextERKNS0_6deviceERKNS0_13property_listE -_ZN4sycl3_V13ext6oneapi12experimental9image_memC1EOS4_ -_ZN4sycl3_V13ext6oneapi12experimental9image_memC1ERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental9image_memC1ERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental9image_memC2EOS4_ -_ZN4sycl3_V13ext6oneapi12experimental9image_memC2ERKNS3_16image_descriptorERKNS0_5queueE -_ZN4sycl3_V13ext6oneapi12experimental9image_memC2ERKNS3_16image_descriptorERKNS0_6deviceERKNS0_7contextE -_ZN4sycl3_V13ext6oneapi12experimental9image_memD1Ev -_ZN4sycl3_V13ext6oneapi12experimental9image_memD2Ev -_ZN4sycl3_V13ext6oneapi12experimental9image_memaSEOS4_ _ZN4sycl3_V13ext6oneapi15filter_selectorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _ZN4sycl3_V13ext6oneapi15filter_selectorC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE _ZN4sycl3_V13ext8codeplay12experimental14fusion_wrapper12start_fusionEv @@ -3891,7 +3838,6 @@ _ZN4sycl3_V16detail13MemoryManager16allocateMemImageESt10shared_ptrINS1_12contex _ZN4sycl3_V16detail13MemoryManager17allocateMemBufferESt10shared_ptrINS1_12context_implEEPNS1_11SYCLMemObjIEPvbmRKS3_INS1_10event_implEERKS5_RKNS0_13property_listERP9_pi_event _ZN4sycl3_V16detail13MemoryManager18allocateHostMemoryEPNS1_11SYCLMemObjIEPvbmRKNS0_13property_listE _ZN4sycl3_V16detail13MemoryManager19allocateImageObjectESt10shared_ptrINS1_12context_implEEPvbRK14_pi_image_descRK16_pi_image_formatRKNS0_13property_listE -_ZN4sycl3_V16detail13MemoryManager19copy_image_bindlessEPvSt10shared_ptrINS1_10queue_implEES3_RK14_pi_image_descRK16_pi_image_format20_pi_image_copy_flags22pi_image_offset_structSE_22pi_image_region_structSF_RKSt6vectorIP9_pi_eventSaISI_EEPSI_ _ZN4sycl3_V16detail13MemoryManager20allocateBufferObjectESt10shared_ptrINS1_12context_implEEPvbmRKNS0_13property_listE _ZN4sycl3_V16detail13MemoryManager20allocateMemSubBufferESt10shared_ptrINS1_12context_implEEPvmmNS0_5rangeILi3EEESt6vectorIS3_INS1_10event_implEESaISB_EERP9_pi_event _ZN4sycl3_V16detail13MemoryManager21copy_to_device_globalEPKvbSt10shared_ptrINS1_10queue_implEEmmS4_RKSt6vectorIP9_pi_eventSaISA_EEPSA_ @@ -4050,12 +3996,6 @@ _ZN4sycl3_V17handler10mem_adviseEPKvmi _ZN4sycl3_V17handler10processArgEPvRKNS0_6detail19kernel_param_kind_tEimRmbb _ZN4sycl3_V17handler12addReductionERKSt10shared_ptrIKvE _ZN4sycl3_V17handler13getKernelNameB5cxx11Ev -_ZN4sycl3_V17handler15ext_oneapi_copyENS0_3ext6oneapi12experimental16image_mem_handleENS0_5rangeILi3EEERKNS4_16image_descriptorEPvS7_S7_S7_ -_ZN4sycl3_V17handler15ext_oneapi_copyENS0_3ext6oneapi12experimental16image_mem_handleEPvRKNS4_16image_descriptorE -_ZN4sycl3_V17handler15ext_oneapi_copyEPvNS0_3ext6oneapi12experimental16image_mem_handleERKNS5_16image_descriptorE -_ZN4sycl3_V17handler15ext_oneapi_copyEPvNS0_5rangeILi3EEES2_S4_RKNS0_3ext6oneapi12experimental16image_descriptorEmS4_S4_ -_ZN4sycl3_V17handler15ext_oneapi_copyEPvNS0_5rangeILi3EEES4_NS0_3ext6oneapi12experimental16image_mem_handleES4_RKNS7_16image_descriptorES4_ -_ZN4sycl3_V17handler15ext_oneapi_copyEPvS2_RKNS0_3ext6oneapi12experimental16image_descriptorEm _ZN4sycl3_V17handler16ext_oneapi_graphENS0_3ext6oneapi12experimental13command_graphILNS4_11graph_stateE1EEE _ZN4sycl3_V17handler17supportsUSMFill2DEv _ZN4sycl3_V17handler17use_kernel_bundleERKNS0_13kernel_bundleILNS0_12bundle_stateE2EEE @@ -4087,8 +4027,6 @@ _ZN4sycl3_V17handler28extractArgsAndReqsFromLambdaEPcmPKNS0_6detail19kernel_para _ZN4sycl3_V17handler28memcpyToHostOnlyDeviceGlobalEPKvS3_mbmm _ZN4sycl3_V17handler28setStateExplicitKernelBundleEv _ZN4sycl3_V17handler30memcpyFromHostOnlyDeviceGlobalEPvPKvbmm -_ZN4sycl3_V17handler34ext_oneapi_wait_external_semaphoreENS0_3ext6oneapi12experimental24interop_semaphore_handleE -_ZN4sycl3_V17handler36ext_oneapi_signal_external_semaphoreENS0_3ext6oneapi12experimental24interop_semaphore_handleE _ZN4sycl3_V17handler6memcpyEPvPKvm _ZN4sycl3_V17handler6memsetEPvim _ZN4sycl3_V17handler7barrierERKSt6vectorINS0_5eventESaIS3_EE @@ -4161,12 +4099,6 @@ _ZNK4sycl3_V115interop_handler14GetNativeQueueERi _ZNK4sycl3_V116default_selectorclERKNS0_6deviceE _ZNK4sycl3_V120accelerator_selectorclERKNS0_6deviceE _ZNK4sycl3_V13ext6oneapi12experimental6detail24modifiable_command_graph8finalizeERKNS0_13property_listE -_ZNK4sycl3_V13ext6oneapi12experimental9image_mem16get_channel_typeEv -_ZNK4sycl3_V13ext6oneapi12experimental9image_mem16get_num_channelsEv -_ZNK4sycl3_V13ext6oneapi12experimental9image_mem17get_channel_orderEv -_ZNK4sycl3_V13ext6oneapi12experimental9image_mem24get_mip_level_mem_handleEj -_ZNK4sycl3_V13ext6oneapi12experimental9image_mem8get_typeEv -_ZNK4sycl3_V13ext6oneapi12experimental9image_mem9get_rangeEv _ZNK4sycl3_V13ext6oneapi15filter_selector13select_deviceEv _ZNK4sycl3_V13ext6oneapi15filter_selector5resetEv _ZNK4sycl3_V13ext6oneapi15filter_selectorclERKNS0_6deviceE @@ -4239,12 +4171,7 @@ _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext5intel4info6device9device_idE _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi1EEEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi2EEEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi3EEEEENT_11return_typeEv -_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device17image_pitch_alignEEENT_11return_typeEv -_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device21mipmap_max_anisotropyEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device22max_global_work_groupsEEENT_11return_typeEv -_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device22max_image_linear_pitchEEENT_11return_typeEv -_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device22max_image_linear_widthEEENT_11return_typeEv -_ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext6oneapi12experimental4info6device23max_image_linear_heightEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext8codeplay12experimental4info6device15supports_fusionEEENT_11return_typeEv _ZNK4sycl3_V16detail11device_impl8get_infoINS0_3ext8codeplay12experimental4info6device28max_registers_per_work_groupEEENT_11return_typeEv _ZNK4sycl3_V16detail11image_plain10getSamplerEv @@ -4415,12 +4342,7 @@ _ZNK4sycl3_V16device8get_infoINS0_3ext5intel4info6device9device_idEEENS0_6detail _ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi1EEEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi2EEEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device15max_work_groupsILi3EEEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device17image_pitch_alignEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device21mipmap_max_anisotropyEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device22max_global_work_groupsEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device22max_image_linear_pitchEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device22max_image_linear_widthEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_3ext6oneapi12experimental4info6device23max_image_linear_heightEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext8codeplay12experimental4info6device15supports_fusionEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_3ext8codeplay12experimental4info6device28max_registers_per_work_groupEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device10extensionsEEENS0_6detail19is_device_info_descIT_E11return_typeEv @@ -4445,7 +4367,6 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device16double_fp_configEEENS0_6detail19 _ZNK4sycl3_V16device8get_infoINS0_4info6device16is_endian_littleEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device16opencl_c_versionEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device16single_fp_configEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device17ext_oneapi_mipmapEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device17image2d_max_widthEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device17image3d_max_depthEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device17image3d_max_widthEEENS0_6detail19is_device_info_descIT_E11return_typeEv @@ -4495,7 +4416,6 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device25native_vector_width_floatEEENS0_ _ZNK4sycl3_V16device8get_infoINS0_4info6device25native_vector_width_shortEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device25partition_max_sub_devicesEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device26ext_intel_device_info_uuidEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device26ext_oneapi_bindless_imagesEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device26global_mem_cache_line_sizeEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device26kernel_kernel_pipe_supportEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device26native_vector_width_doubleEEENS0_6detail19is_device_info_descIT_E11return_typeEv @@ -4508,7 +4428,6 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device27preferred_interop_user_syncEEENS _ZNK4sycl3_V16device8get_infoINS0_4info6device27preferred_vector_width_charEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device27preferred_vector_width_halfEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device27preferred_vector_width_longEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device28ext_oneapi_mipmap_anisotropyEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device28preferred_vector_width_floatEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device28preferred_vector_width_shortEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device29ext_oneapi_max_work_groups_1dEEENS0_6detail19is_device_info_descIT_E11return_typeEv @@ -4521,19 +4440,11 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device31atomic_fence_scope_capabilitiesE _ZNK4sycl3_V16device8get_infoINS0_4info6device31ext_intel_gpu_hw_threads_per_euEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device32atomic_memory_order_capabilitiesEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device32atomic_memory_scope_capabilitiesEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device32ext_oneapi_interop_memory_exportEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device32ext_oneapi_interop_memory_importEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_intel_gpu_subslices_per_sliceEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_oneapi_bindless_images_1d_usmEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_oneapi_bindless_images_2d_usmEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_oneapi_max_global_work_groupsEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device33ext_oneapi_mipmap_level_referenceEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device33usm_restricted_shared_allocationsEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device34ext_oneapi_bfloat16_math_functionsEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device35ext_intel_gpu_eu_count_per_subsliceEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device35ext_oneapi_interop_semaphore_exportEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device35ext_oneapi_interop_semaphore_importEEENS0_6detail19is_device_info_descIT_E11return_typeEv -_ZNK4sycl3_V16device8get_infoINS0_4info6device37ext_oneapi_bindless_images_shared_usmEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device38sub_group_independent_forward_progressEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device4nameEEENS0_6detail19is_device_info_descIT_E11return_typeEv _ZNK4sycl3_V16device8get_infoINS0_4info6device6vendorEEENS0_6detail19is_device_info_descIT_E11return_typeEv From 2a2b002a5efba4dbe98fafe2883b20b5f455be96 Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Tue, 4 Jul 2023 09:56:45 +0100 Subject: [PATCH 07/19] * Remove ABI version increase * Fix piSamplerCreate in pi_hip.cpp --- sycl/CMakeLists.txt | 2 +- sycl/plugins/hip/pi_hip.cpp | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index e5fa4f9a4d0d7..0d807b5873002 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -36,7 +36,7 @@ set(SYCL_MAJOR_VERSION 7) set(SYCL_MINOR_VERSION 0) set(SYCL_PATCH_VERSION 0) -set(SYCL_DEV_ABI_VERSION 6) +set(SYCL_DEV_ABI_VERSION 5) if (SYCL_ADD_DEV_VERSION_POSTFIX) set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}") endif() diff --git a/sycl/plugins/hip/pi_hip.cpp b/sycl/plugins/hip/pi_hip.cpp index 7519f2a247174..ded91d264f46b 100644 --- a/sycl/plugins/hip/pi_hip.cpp +++ b/sycl/plugins/hip/pi_hip.cpp @@ -4179,9 +4179,6 @@ pi_result hip_piextEventCreateWithNativeHandle(pi_native_handle nativeHandle, /// /// \param[in] context The context the sampler is created for. /// \param[in] sampler_properties The properties for the sampler. -/// \param[in] minMipmapLevelClamp The minimum mipmap clamp level. -/// \param[in] maxMipmapLevelClamp The maximum mipmap clamp level. -/// \param[in] maxAnisotropy The maximum anisotropy. /// \param[out] result_sampler Set to the resulting sampler object. /// /// \return PI_SUCCESS on success. PI_ERROR_INVALID_VALUE if given an invalid @@ -4189,13 +4186,7 @@ pi_result hip_piextEventCreateWithNativeHandle(pi_native_handle nativeHandle, /// or if there is multiple of properties from the same category. pi_result hip_piSamplerCreate(pi_context context, const pi_sampler_properties *sampler_properties, - const float minMipmapLevelClamp, - const float maxMipmapLevelClamp, - const float maxAnisotropy, pi_sampler *result_sampler) { - (void)minMipmapLevelClamp; - (void)maxMipmapLevelClamp; - (void)maxAnisotropy; std::unique_ptr<_pi_sampler> retImplSampl{new _pi_sampler(context)}; bool propSeen[3] = {false, false, false}; From 244497b69279253d1af21161fa406b31e429f572 Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Wed, 5 Jul 2023 14:00:51 +0100 Subject: [PATCH 08/19] Address feedback * Punctuation in comments * Macros for switch cases * Return instead of break switch case when nothing else to do * Use auto keyword when calling reinterpret_cast --- sycl/include/sycl/detail/pi.h | 27 +- sycl/plugins/unified_runtime/pi2ur.hpp | 319 ++++++------------ .../ur/adapters/cuda/image.cpp | 31 +- .../ur/adapters/cuda/memory.hpp | 2 +- 4 files changed, 133 insertions(+), 246 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index 78bd222f28ca3..c236382a98716 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -97,7 +97,7 @@ // 14.33 Added new parameter (memory object properties) to // piextKernelSetArgMemObj // 14.34 Added command-buffer extension methods -// 14.35 Adding support for experimental bindless images. This includes +// 14.35 Adding support for experimental bindless images. This includes: // - Added device info queries // - Device queries for bindless image support // - PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT @@ -493,7 +493,7 @@ typedef enum { PI_IMAGE_INFO_SLICE_PITCH = 0x1113, PI_IMAGE_INFO_WIDTH = 0x1114, PI_IMAGE_INFO_HEIGHT = 0x1115, - PI_IMAGE_INFO_DEPTH = 0x1116, + PI_IMAGE_INFO_DEPTH = 0x1116 } _pi_image_info; typedef enum { @@ -543,6 +543,7 @@ typedef enum { PI_COMMAND_TYPE_SVM_UNMAP = 0x120D, PI_COMMAND_TYPE_EXT_COMMAND_BUFFER = 0x12A8, PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_READ = 0x418E, + PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_WRITE = 0x418F } _pi_command_type; typedef enum { @@ -610,7 +611,7 @@ typedef enum { typedef enum { PI_IMAGE_COPY_HTOD = 0, PI_IMAGE_COPY_DTOH = 1, - PI_IMAGE_COPY_DTOD = 2, + PI_IMAGE_COPY_DTOD = 2 } _pi_image_copy_flags; typedef enum { PI_BUFFER_CREATE_TYPE_REGION = 0x1220 } _pi_buffer_create_type; @@ -1922,7 +1923,7 @@ __SYCL_EXPORT pi_result piextUSMSharedAlloc(void **result_ptr, /// \param device is the device the memory will be allocated on /// \param properties are optional allocation properties /// \param width_in_bytes is the width of the allocation in bytes -/// \param height is the height of the allocation +/// \param height is the height of the allocation in rows /// \param element_size_bytes is the size in bytes of an element in the /// allocation __SYCL_EXPORT pi_result piextUSMPitchedAlloc( @@ -2473,7 +2474,7 @@ __SYCL_EXPORT pi_result piextMemImageAllocate(pi_context context, pi_image_desc *image_desc, pi_image_mem_handle *ret_mem); -/// API to retrieve individual image from mipmap +/// API to retrieve individual image from mipmap. /// /// \param context is the pi_context /// \param device is the pi_device @@ -2545,7 +2546,7 @@ __SYCL_EXPORT pi_result piextBindlessImageSamplerCreate( float min_mipmap_level_clamp, float max_mipmap_level_clamp, float max_anisotropy, pi_sampler *result_sampler); -/// API to copy image data Host to Device or Device to Host +/// API to copy image data Host to Device or Device to Host. /// /// \param queue is the queue to submit to /// \param dst_ptr is the location the data will be copied to @@ -2568,7 +2569,7 @@ __SYCL_EXPORT pi_result piextMemImageCopy( pi_image_region host_extent, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event); -/// API to query an image memory handle for specific properties +/// API to query an image memory handle for specific properties. /// /// \param mem_handle is the handle to the image memory /// \param param_name is the queried info name @@ -2578,7 +2579,7 @@ __SYCL_EXPORT pi_result piextMemImageGetInfo( const pi_image_mem_handle mem_handle, pi_image_info param_name, void *param_value, size_t *param_value_size_ret); -/// API to import external memory in the form of a file descriptor +/// API to import external memory in the form of a file descriptor. /// /// \param context is the pi_context /// \param device is the pi_device @@ -2590,7 +2591,7 @@ __SYCL_EXPORT pi_result piextMemImportOpaqueFD(pi_context context, pi_device device, size_t size, int file_descriptor, pi_interop_mem_handle *ret_handle); -/// API to map an interop memory handle to an image memory handle +/// API to map an interop memory handle to an image memory handle. /// /// \param context is the pi_context /// \param device is the pi_device @@ -2612,7 +2613,7 @@ __SYCL_EXPORT pi_result piextMemMapExternalArray( __SYCL_EXPORT pi_result piextMemReleaseInterop( pi_context context, pi_device device, pi_interop_mem_handle memory_handle); -/// API to import an external semaphore in the form of a file descriptor +/// API to import an external semaphore in the form of a file descriptor. /// /// \param context is the pi_context /// \param device is the pi_device @@ -2623,7 +2624,7 @@ __SYCL_EXPORT pi_result piextImportExternalSemaphoreOpaqueFD( pi_context context, pi_device device, int file_descriptor, pi_interop_semaphore_handle *ret_handle); -/// API to destroy the external semaphore handle +/// API to destroy the external semaphore handle. /// /// \param context is the pi_context /// \param device is the pi_device @@ -2633,7 +2634,7 @@ __SYCL_EXPORT pi_result piextDestroyExternalSemaphore(pi_context context, pi_device device, pi_interop_semaphore_handle sem_handle); -/// API to instruct the queue with a non-blocking wait on an external semaphore +/// API to instruct the queue with a non-blocking wait on an external semaphore. /// /// \param command_queue is the queue instructed to wait /// \param sem_handle is the interop semaphore handle @@ -2647,7 +2648,7 @@ __SYCL_EXPORT pi_result piextWaitExternalSemaphore( pi_event *event); /// API to instruct the queue to signal the external semaphore handle once all -/// previous commands have completed execution +/// previous commands have completed execution. /// /// \param command_queue is the queue instructed to signal /// \param sem_handle is the interop semaphore handle to signal diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index 747e6e9797580..9a6aa3a10ad22 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -2454,131 +2454,59 @@ static void pi2urImageDesc(const pi_image_format *ImageFormat, ur_image_desc_t *UrDesc) { switch (ImageFormat->image_channel_data_type) { - case PI_IMAGE_CHANNEL_TYPE_SNORM_INT8: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_SNORM_INT8; - break; - } - case PI_IMAGE_CHANNEL_TYPE_SNORM_INT16: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_SNORM_INT16; - break; - } - case PI_IMAGE_CHANNEL_TYPE_UNORM_INT8: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_UNORM_INT8; - break; - } - case PI_IMAGE_CHANNEL_TYPE_UNORM_INT16: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_UNORM_INT16; - break; - } - case PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565; - break; - } - case PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555; - break; - } - case PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_INT_101010; - break; - } - case PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8; - break; - } - case PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16; - break; - } - case PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32; - break; - } - case PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8; - break; - } - case PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16; - break; - } - case PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32; - break; - } - case PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT; - break; - } - case PI_IMAGE_CHANNEL_TYPE_FLOAT: { - UrFormat->channelType = UR_IMAGE_CHANNEL_TYPE_FLOAT; - break; +#define MAP(FROM, TO) \ + case FROM: { \ + UrFormat->channelType = TO; \ + break; \ } + MAP(PI_IMAGE_CHANNEL_TYPE_SNORM_INT8, UR_IMAGE_CHANNEL_TYPE_SNORM_INT8) + MAP(PI_IMAGE_CHANNEL_TYPE_SNORM_INT16, UR_IMAGE_CHANNEL_TYPE_SNORM_INT16) + MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_INT8, UR_IMAGE_CHANNEL_TYPE_UNORM_INT8) + MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_INT16, UR_IMAGE_CHANNEL_TYPE_UNORM_INT16) + MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565, + UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565) + MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555, + UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555) + MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010, + UR_IMAGE_CHANNEL_TYPE_INT_101010) + MAP(PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8) + MAP(PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16) + MAP(PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32) + MAP(PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8, + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8) + MAP(PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16, + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16) + MAP(PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32, + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32) + MAP(PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT, UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT) + MAP(PI_IMAGE_CHANNEL_TYPE_FLOAT, UR_IMAGE_CHANNEL_TYPE_FLOAT) +#undef MAP default: { die("piMemImageCreate: unsuppported image_channel_data_type."); } } switch (ImageFormat->image_channel_order) { - case PI_IMAGE_CHANNEL_ORDER_A: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_A; - break; - } - case PI_IMAGE_CHANNEL_ORDER_R: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_R; - break; - } - case PI_IMAGE_CHANNEL_ORDER_RG: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_RG; - break; - } - case PI_IMAGE_CHANNEL_ORDER_RA: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_RA; - break; - } - case PI_IMAGE_CHANNEL_ORDER_RGB: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_RGB; - break; - } - case PI_IMAGE_CHANNEL_ORDER_RGBA: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_RGBA; - break; - } - case PI_IMAGE_CHANNEL_ORDER_BGRA: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_BGRA; - break; - } - case PI_IMAGE_CHANNEL_ORDER_ARGB: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_ARGB; - break; - } - case PI_IMAGE_CHANNEL_ORDER_ABGR: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_ABGR; - break; - } - case PI_IMAGE_CHANNEL_ORDER_INTENSITY: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_INTENSITY; - break; - } - case PI_IMAGE_CHANNEL_ORDER_LUMINANCE: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_LUMINANCE; - break; - } - case PI_IMAGE_CHANNEL_ORDER_Rx: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_RX; - break; - } - case PI_IMAGE_CHANNEL_ORDER_RGx: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_RGX; - break; - } - case PI_IMAGE_CHANNEL_ORDER_RGBx: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_RGBX; - break; - } - case PI_IMAGE_CHANNEL_ORDER_sRGBA: { - UrFormat->channelOrder = UR_IMAGE_CHANNEL_ORDER_SRGBA; - break; +#define MAP(FROM, TO) \ + case FROM: { \ + UrFormat->channelOrder = TO; \ + break; \ } + MAP(PI_IMAGE_CHANNEL_ORDER_A, UR_IMAGE_CHANNEL_ORDER_A) + MAP(PI_IMAGE_CHANNEL_ORDER_R, UR_IMAGE_CHANNEL_ORDER_R) + MAP(PI_IMAGE_CHANNEL_ORDER_RG, UR_IMAGE_CHANNEL_ORDER_RG) + MAP(PI_IMAGE_CHANNEL_ORDER_RA, UR_IMAGE_CHANNEL_ORDER_RA) + MAP(PI_IMAGE_CHANNEL_ORDER_RGB, UR_IMAGE_CHANNEL_ORDER_RGB) + MAP(PI_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_ORDER_RGBA) + MAP(PI_IMAGE_CHANNEL_ORDER_BGRA, UR_IMAGE_CHANNEL_ORDER_BGRA) + MAP(PI_IMAGE_CHANNEL_ORDER_ARGB, UR_IMAGE_CHANNEL_ORDER_ARGB) + MAP(PI_IMAGE_CHANNEL_ORDER_ABGR, UR_IMAGE_CHANNEL_ORDER_ABGR) + MAP(PI_IMAGE_CHANNEL_ORDER_INTENSITY, UR_IMAGE_CHANNEL_ORDER_INTENSITY) + MAP(PI_IMAGE_CHANNEL_ORDER_LUMINANCE, UR_IMAGE_CHANNEL_ORDER_LUMINANCE) + MAP(PI_IMAGE_CHANNEL_ORDER_Rx, UR_IMAGE_CHANNEL_ORDER_RX) + MAP(PI_IMAGE_CHANNEL_ORDER_RGx, UR_IMAGE_CHANNEL_ORDER_RGX) + MAP(PI_IMAGE_CHANNEL_ORDER_RGBx, UR_IMAGE_CHANNEL_ORDER_RGBX) + MAP(PI_IMAGE_CHANNEL_ORDER_sRGBA, UR_IMAGE_CHANNEL_ORDER_SRGBA) +#undef MAP default: { die("piMemImageCreate: unsuppported image_channel_data_type."); } @@ -2593,34 +2521,19 @@ static void pi2urImageDesc(const pi_image_format *ImageFormat, UrDesc->rowPitch = ImageDesc->image_row_pitch; UrDesc->slicePitch = ImageDesc->image_slice_pitch; switch (ImageDesc->image_type) { - case PI_MEM_TYPE_BUFFER: { - UrDesc->type = UR_MEM_TYPE_BUFFER; - break; - } - case PI_MEM_TYPE_IMAGE2D: { - UrDesc->type = UR_MEM_TYPE_IMAGE2D; - break; - } - case PI_MEM_TYPE_IMAGE3D: { - UrDesc->type = UR_MEM_TYPE_IMAGE3D; - break; - } - case PI_MEM_TYPE_IMAGE2D_ARRAY: { - UrDesc->type = UR_MEM_TYPE_IMAGE2D_ARRAY; - break; - } - case PI_MEM_TYPE_IMAGE1D: { - UrDesc->type = UR_MEM_TYPE_IMAGE1D; - break; - } - case PI_MEM_TYPE_IMAGE1D_ARRAY: { - UrDesc->type = UR_MEM_TYPE_IMAGE1D_ARRAY; - break; - } - case PI_MEM_TYPE_IMAGE1D_BUFFER: { - UrDesc->type = UR_MEM_TYPE_IMAGE1D_BUFFER; - break; +#define MAP(FROM, TO) \ + case FROM: { \ + UrDesc->type = TO; \ + break; \ } + MAP(PI_MEM_TYPE_BUFFER, UR_MEM_TYPE_BUFFER) + MAP(PI_MEM_TYPE_IMAGE2D, UR_MEM_TYPE_IMAGE2D) + MAP(PI_MEM_TYPE_IMAGE3D, UR_MEM_TYPE_IMAGE3D) + MAP(PI_MEM_TYPE_IMAGE2D_ARRAY, UR_MEM_TYPE_IMAGE2D_ARRAY) + MAP(PI_MEM_TYPE_IMAGE1D, UR_MEM_TYPE_IMAGE1D) + MAP(PI_MEM_TYPE_IMAGE1D_ARRAY, UR_MEM_TYPE_IMAGE1D_ARRAY) + MAP(PI_MEM_TYPE_IMAGE1D_BUFFER, UR_MEM_TYPE_IMAGE1D_BUFFER) +#undef MAP default: { die("piMemImageCreate: unsuppported image_type."); } @@ -2904,9 +2817,8 @@ inline pi_result piextUSMPitchedAlloc(void **ResultPtr, size_t *ResultPitch, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); std::ignore = Properties; ur_usm_desc_t USMDesc{}; ur_usm_pool_handle_t Pool{}; @@ -4282,9 +4194,8 @@ inline pi_result piextMemImageAllocate(pi_context Context, pi_device Device, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); ur_image_format_t UrFormat{}; ur_image_desc_t UrDesc{}; @@ -4307,11 +4218,9 @@ inline pi_result piextMemUnsampledImageCreate( PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); PI_ASSERT(RetMem, PI_ERROR_INVALID_MEM_OBJECT); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); - ur_exp_image_mem_handle_t UrImgMem = - reinterpret_cast(ImgMem); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); + auto UrImgMem = reinterpret_cast(ImgMem); ur_image_format_t UrFormat{}; ur_image_desc_t UrDesc{}; @@ -4337,18 +4246,15 @@ inline pi_result piextMemSampledImageCreate( PI_ASSERT(RetMem, PI_ERROR_INVALID_MEM_OBJECT); PI_ASSERT(Sampler, PI_ERROR_INVALID_SAMPLER); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); - ur_exp_image_mem_handle_t UrImgMem = - reinterpret_cast(ImgMem); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); + auto UrImgMem = reinterpret_cast(ImgMem); ur_image_format_t UrFormat{}; ur_image_desc_t UrDesc{}; pi2urImageDesc(ImageFormat, ImageDesc, &UrFormat, &UrDesc); - ur_sampler_handle_t UrSampler = - reinterpret_cast(Sampler); + auto UrSampler = reinterpret_cast(Sampler); ur_mem_handle_t *UrRetMem = reinterpret_cast(RetMem); ur_exp_image_handle_t *UrRetHandle = reinterpret_cast(RetHandle); @@ -4368,8 +4274,7 @@ inline pi_result piextBindlessImageSamplerCreate( PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(RetSampler, PI_ERROR_INVALID_VALUE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); + auto UrContext = reinterpret_cast(Context); ur_sampler_desc_t UrProps{}; UrProps.stype = UR_STRUCTURE_TYPE_SAMPLER_DESC; @@ -4446,11 +4351,9 @@ inline pi_result piextMemMipmapGetLevel(pi_context Context, pi_device Device, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); - ur_exp_image_mem_handle_t UrMipMem = - reinterpret_cast(MipMem); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); + auto UrMipMem = reinterpret_cast(MipMem); ur_exp_image_mem_handle_t *UrRetMem = reinterpret_cast(RetMem); @@ -4465,10 +4368,9 @@ inline pi_result piextMemImageFree(pi_context Context, pi_device Device, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); - ur_exp_image_mem_handle_t UrMemoryHandle = + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); + auto UrMemoryHandle = reinterpret_cast(MemoryHandle); HANDLE_ERRORS( @@ -4482,10 +4384,9 @@ inline pi_result piextMemMipmapFree(pi_context Context, pi_device Device, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); - ur_exp_image_mem_handle_t UrMemoryHandle = + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); + auto UrMemoryHandle = reinterpret_cast(MemoryHandle); HANDLE_ERRORS( @@ -4521,7 +4422,7 @@ piextMemImageCopy(pi_queue Queue, void *DstPtr, void *SrcPtr, const pi_event *EventWaitList, pi_event *Event) { PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE); - ur_queue_handle_t UrQueue = reinterpret_cast(Queue); + auto UrQueue = reinterpret_cast(Queue); ur_image_format_t UrFormat{}; ur_image_desc_t UrDesc{}; @@ -4559,11 +4460,9 @@ inline pi_result piextMemUnsampledImageHandleDestroy(pi_context Context, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); - ur_exp_image_handle_t UrHandle = - reinterpret_cast(Handle); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); + auto UrHandle = reinterpret_cast(Handle); HANDLE_ERRORS(urBindlessImagesUnsampledImageHandleDestroyExp( UrContext, UrDevice, UrHandle)); @@ -4577,11 +4476,9 @@ inline pi_result piextMemSampledImageHandleDestroy(pi_context Context, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); - ur_exp_image_handle_t UrHandle = - reinterpret_cast(Handle); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); + auto UrHandle = reinterpret_cast(Handle); HANDLE_ERRORS(urBindlessImagesSampledImageHandleDestroyExp( UrContext, UrDevice, UrHandle)); @@ -4621,8 +4518,7 @@ static void pi2urImageInfoFlags(const pi_image_info PiFlags, inline pi_result piextMemImageGetInfo(pi_image_mem_handle MemHandle, pi_image_info ParamName, void *ParamValue, size_t *ParamValueSizeRet) { - ur_exp_image_mem_handle_t UrMemHandle = - reinterpret_cast(MemHandle); + auto UrMemHandle = reinterpret_cast(MemHandle); ur_image_info_t UrParamName{}; pi2urImageInfoFlags(ParamName, &UrParamName); @@ -4652,9 +4548,8 @@ inline pi_result piextMemImportOpaqueFD(pi_context Context, pi_device Device, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); ur_exp_interop_mem_handle_t *UrRetHandle = reinterpret_cast(RetHandle); @@ -4672,16 +4567,14 @@ inline pi_result piextMemMapExternalArray(pi_context Context, pi_device Device, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); ur_image_format_t UrFormat{}; ur_image_desc_t UrDesc{}; pi2urImageDesc(ImageFormat, ImageDesc, &UrFormat, &UrDesc); - ur_exp_interop_mem_handle_t UrMemHandle = - reinterpret_cast(MemHandle); + auto UrMemHandle = reinterpret_cast(MemHandle); ur_exp_image_mem_handle_t *UrRetMem = reinterpret_cast(RetMem); @@ -4696,11 +4589,9 @@ inline pi_result piextMemReleaseInterop(pi_context Context, pi_device Device, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); - ur_exp_interop_mem_handle_t UrExtMem = - reinterpret_cast(ExtMem); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); + auto UrExtMem = reinterpret_cast(ExtMem); HANDLE_ERRORS( urBindlessImagesReleaseInteropExp(UrContext, UrDevice, UrExtMem)); @@ -4715,9 +4606,8 @@ piextImportExternalSemaphoreOpaqueFD(pi_context Context, pi_device Device, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); ur_exp_interop_semaphore_handle_t *UrRetHandle = reinterpret_cast(RetHandle); @@ -4733,10 +4623,9 @@ piextDestroyExternalSemaphore(pi_context Context, pi_device Device, PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT); PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE); - ur_context_handle_t UrContext = - reinterpret_cast(Context); - ur_device_handle_t UrDevice = reinterpret_cast(Device); - ur_exp_interop_semaphore_handle_t UrSemHandle = + auto UrContext = reinterpret_cast(Context); + auto UrDevice = reinterpret_cast(Device); + auto UrSemHandle = reinterpret_cast(SemHandle); HANDLE_ERRORS(urBindlessImagesDestroyExternalSemaphoreExp(UrContext, UrDevice, @@ -4752,8 +4641,8 @@ piextWaitExternalSemaphore(pi_queue Queue, const pi_event *EventWaitList, pi_event *Event) { PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE); - ur_queue_handle_t UrQueue = reinterpret_cast(Queue); - ur_exp_interop_semaphore_handle_t UrSemHandle = + auto UrQueue = reinterpret_cast(Queue); + auto UrSemHandle = reinterpret_cast(SemHandle); const ur_event_handle_t *UrEventWaitList = reinterpret_cast(EventWaitList); @@ -4772,8 +4661,8 @@ piextSignalExternalSemaphore(pi_queue Queue, const pi_event *EventWaitList, pi_event *Event) { PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE); - ur_queue_handle_t UrQueue = reinterpret_cast(Queue); - ur_exp_interop_semaphore_handle_t UrSemHandle = + auto UrQueue = reinterpret_cast(Queue); + auto UrSemHandle = reinterpret_cast(SemHandle); const ur_event_handle_t *UrEventWaitList = reinterpret_cast(EventWaitList); diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp index 2504eb0b4802c..58c0396614d94 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp @@ -26,20 +26,20 @@ ur_result_t urCalculateNumChannels(ur_image_channel_order_t order, case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_A: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_R: *NumChannels = 1; - break; + return Err; case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RG: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RA: *NumChannels = 2; - break; + return Err; case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGB: Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - break; + return Err; case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGBA: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_ARGB: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_BGRA: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_ABGR: *NumChannels = 4; - break; + return Err; case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RX: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGX: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGBX: @@ -48,9 +48,8 @@ ur_result_t urCalculateNumChannels(ur_image_channel_order_t order, case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_LUMINANCE: default: Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - break; + return Err; } - return Err; } /// Convert a UR image format to a CUDA image format and @@ -111,7 +110,7 @@ cudaToUrImageChannelFormat(CUarray_format cuda_format, #define MAP(FROM, TO) \ case FROM: { \ *return_image_channel_type = TO; \ - break; \ + return Err; \ } MAP(CU_AD_FORMAT_UNSIGNED_INT8, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8); MAP(CU_AD_FORMAT_UNSIGNED_INT16, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16); @@ -126,10 +125,8 @@ cudaToUrImageChannelFormat(CUarray_format cuda_format, #undef MAP default: Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - break; + return Err; } - - return Err; } ur_result_t urTextureCreate(ur_context_handle_t hContext, @@ -245,6 +242,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp( widthInBytes, height, elementSizeBytes)); } catch (ur_result_t error) { Result = error; + } catch (...) { + return UR_RESULT_ERROR_UNKNOWN; } return Result; @@ -696,19 +695,19 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( *(size_t *)pPropValue = ArrayDesc.Width; if (pPropSizeRet) *pPropSizeRet = sizeof(size_t); - break; + return RetErr; case UR_IMAGE_INFO_HEIGHT: if (pPropValue) *(size_t *)pPropValue = ArrayDesc.Height; if (pPropSizeRet) *pPropSizeRet = sizeof(size_t); - break; + return RetErr; case UR_IMAGE_INFO_DEPTH: if (pPropValue) *(size_t *)pPropValue = ArrayDesc.Depth; if (pPropSizeRet) *pPropSizeRet = sizeof(size_t); - break; + return RetErr; case UR_IMAGE_INFO_FORMAT: ur_image_channel_type_t ChannelType; ur_image_channel_order_t ChannelOrder; @@ -732,13 +731,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( } if (pPropSizeRet) *pPropSizeRet = sizeof(ur_image_format_t); - break; + return RetErr; default: RetErr = UR_RESULT_ERROR_INVALID_VALUE; - break; + return RetErr; } - - return RetErr; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/memory.hpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/memory.hpp index 9c55aca4ba643..0aa1e90f75ad6 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/memory.hpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/memory.hpp @@ -186,7 +186,7 @@ struct ur_mem_handle_t_ { urContextRetain(Context); } - /// Constructs the UR allocation for an sampled image object + /// Constructs the UR allocation for a sampled image object ur_mem_handle_t_(ur_context_handle_t Context, CUarray Array, CUtexObject Tex, ur_sampler_handle_t Sampler, ur_mem_type_t ImageType) : Context{Context}, RefCount{1}, MemType{Type::Texture} { From 8daf92294c9d527605291ffd8992b2fd1bacfb81 Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Thu, 6 Jul 2023 17:33:28 +0100 Subject: [PATCH 09/19] Address Feedback * Added sampler prop getters * Removed RetErr and opt to return success * Macro for switch case * Format single-line if --- sycl/plugins/unified_runtime/pi2ur.hpp | 34 +-- .../ur/adapters/cuda/image.cpp | 230 ++++++++---------- .../ur/adapters/cuda/sampler.cpp | 8 +- .../ur/adapters/cuda/sampler.hpp | 16 ++ 4 files changed, 128 insertions(+), 160 deletions(-) diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index 9a6aa3a10ad22..35dd6a4c1cc22 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -4489,27 +4489,19 @@ inline pi_result piextMemSampledImageHandleDestroy(pi_context Context, static void pi2urImageInfoFlags(const pi_image_info PiFlags, ur_image_info_t *UrFlags) { switch (PiFlags) { - case PI_IMAGE_INFO_FORMAT: - *UrFlags = UR_IMAGE_INFO_FORMAT; - break; - case PI_IMAGE_INFO_ELEMENT_SIZE: - *UrFlags = UR_IMAGE_INFO_ELEMENT_SIZE; - break; - case PI_IMAGE_INFO_ROW_PITCH: - *UrFlags = UR_IMAGE_INFO_ROW_PITCH; - break; - case PI_IMAGE_INFO_SLICE_PITCH: - *UrFlags = UR_IMAGE_INFO_SLICE_PITCH; - break; - case PI_IMAGE_INFO_WIDTH: - *UrFlags = UR_IMAGE_INFO_WIDTH; - break; - case PI_IMAGE_INFO_HEIGHT: - *UrFlags = UR_IMAGE_INFO_HEIGHT; - break; - case PI_IMAGE_INFO_DEPTH: - *UrFlags = UR_IMAGE_INFO_DEPTH; - break; +#define MAP(FROM, TO) \ + case FROM: { \ + *UrFlags = TO; \ + return;\ + } +MAP(PI_IMAGE_INFO_FORMAT, UR_IMAGE_INFO_FORMAT) +MAP(PI_IMAGE_INFO_ELEMENT_SIZE, UR_IMAGE_INFO_ELEMENT_SIZE) +MAP(PI_IMAGE_INFO_ROW_PITCH, UR_IMAGE_INFO_ROW_PITCH) +MAP(PI_IMAGE_INFO_SLICE_PITCH, UR_IMAGE_INFO_SLICE_PITCH) +MAP(PI_IMAGE_INFO_WIDTH, UR_IMAGE_INFO_WIDTH) +MAP(PI_IMAGE_INFO_HEIGHT, UR_IMAGE_INFO_HEIGHT) +MAP(PI_IMAGE_INFO_DEPTH, UR_IMAGE_INFO_DEPTH) +#undef MAP default: die("pi2urImageInfoFlags: Unsupported use case"); } diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp index 58c0396614d94..e6f084ef31aa6 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp @@ -21,25 +21,23 @@ ur_result_t urCalculateNumChannels(ur_image_channel_order_t order, unsigned int *NumChannels) { - ur_result_t Err = UR_RESULT_SUCCESS; switch (order) { case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_A: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_R: *NumChannels = 1; - return Err; + return UR_RESULT_SUCCESS; case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RG: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RA: *NumChannels = 2; - return Err; + return UR_RESULT_SUCCESS; case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGB: - Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return Err; + return UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGBA: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_ARGB: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_BGRA: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_ABGR: *NumChannels = 4; - return Err; + return UR_RESULT_SUCCESS; case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RX: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGX: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_RGBX: @@ -47,8 +45,7 @@ ur_result_t urCalculateNumChannels(ur_image_channel_order_t order, case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_INTENSITY: case ur_image_channel_order_t::UR_IMAGE_CHANNEL_ORDER_LUMINANCE: default: - Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return Err; + return UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; } } @@ -66,7 +63,6 @@ urToCudaImageChannelFormat(ur_image_channel_type_t image_channel_type, CUarray_format cuda_format; size_t PixelTypeSizeBytes; - ur_result_t Err = UR_RESULT_SUCCESS; switch (image_channel_type) { #define CASE(FROM, TO, SIZE) \ @@ -87,8 +83,7 @@ urToCudaImageChannelFormat(ur_image_channel_type_t image_channel_type, CASE(UR_IMAGE_CHANNEL_TYPE_FLOAT, CU_AD_FORMAT_FLOAT, 4) #undef CASE default: - Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - break; + return UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; } if (return_cuda_format) { @@ -97,20 +92,19 @@ urToCudaImageChannelFormat(ur_image_channel_type_t image_channel_type, if (return_pixel_types_size_bytes) { *return_pixel_types_size_bytes = PixelTypeSizeBytes; } - return Err; + return UR_RESULT_SUCCESS; } ur_result_t cudaToUrImageChannelFormat(CUarray_format cuda_format, ur_image_channel_type_t *return_image_channel_type) { UR_ASSERT(return_image_channel_type, UR_RESULT_ERROR_INVALID_NULL_POINTER); - ur_result_t Err = UR_RESULT_SUCCESS; switch (cuda_format) { #define MAP(FROM, TO) \ case FROM: { \ *return_image_channel_type = TO; \ - return Err; \ + return UR_RESULT_SUCCESS; \ } MAP(CU_AD_FORMAT_UNSIGNED_INT8, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8); MAP(CU_AD_FORMAT_UNSIGNED_INT16, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16); @@ -124,8 +118,7 @@ cudaToUrImageChannelFormat(CUarray_format cuda_format, MAP(CU_AD_FORMAT_UNORM_INT16X1, UR_IMAGE_CHANNEL_TYPE_UNORM_INT16); #undef MAP default: - Err = UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return Err; + return UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; } } @@ -137,7 +130,6 @@ ur_result_t urTextureCreate(ur_context_handle_t hContext, UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); UR_ASSERT(phRetImage, UR_RESULT_ERROR_INVALID_NULL_POINTER); - ur_result_t RetErr = UR_RESULT_SUCCESS; try { /// pi_sampler_properties @@ -150,7 +142,7 @@ ur_result_t urTextureCreate(ur_context_handle_t hContext, /// | 0 | normalize coords CUDA_TEXTURE_DESC ImageTexDesc = {}; CUaddress_mode AddrMode; - uint32_t AddrModeProp = ((hSampler->Props >> 2) & 7); + ur_sampler_addressing_mode_t AddrModeProp = hSampler->getAddressingMode(); if (AddrModeProp == (UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE - UR_SAMPLER_ADDRESSING_MODE_NONE)) { AddrMode = CU_TR_ADDRESS_MODE_CLAMP; @@ -165,14 +157,14 @@ ur_result_t urTextureCreate(ur_context_handle_t hContext, AddrMode = CU_TR_ADDRESS_MODE_MIRROR; } CUfilter_mode FilterMode; - uint32_t FilterModeProp = ((hSampler->Props >> 1) & 1); + ur_sampler_filter_mode_t FilterModeProp = hSampler->getFilterMode(); FilterMode = FilterModeProp ? CU_TR_FILTER_MODE_LINEAR : CU_TR_FILTER_MODE_POINT; ImageTexDesc.filterMode = FilterMode; // Mipmap attributes CUfilter_mode MipFilterMode; - uint32_t MipFilterModeProp = ((hSampler->Props >> 5) & 1); + ur_sampler_filter_mode_t MipFilterModeProp = hSampler->getMipFilterMode(); MipFilterMode = MipFilterModeProp ? CU_TR_FILTER_MODE_LINEAR : CU_TR_FILTER_MODE_POINT; ImageTexDesc.mipmapFilterMode = MipFilterMode; @@ -190,15 +182,16 @@ ur_result_t urTextureCreate(ur_context_handle_t hContext, pImageDesc->depth > 0 ? AddrMode : ImageTexDesc.addressMode[2]; // 3D // flags takes the normalized coordinates setting -- unnormalized is default - ImageTexDesc.flags = (hSampler->Props & 1) ? CU_TRSF_NORMALIZED_COORDINATES - : ImageTexDesc.flags; + ImageTexDesc.flags = (hSampler->isNormalizedCoords()) + ? CU_TRSF_NORMALIZED_COORDINATES + : ImageTexDesc.flags; // CUDA default promotes 8-bit and 16-bit integers to float between [0,1] // This flag prevents this behaviour. ImageTexDesc.flags |= CU_TRSF_READ_AS_INTEGER; CUtexObject Texture; - RetErr = UR_CHECK_ERROR( + UR_CHECK_ERROR( cuTexObjectCreate(&Texture, &ResourceDesc, &ImageTexDesc, nullptr)); *phRetImage = (ur_exp_image_handle_t)Texture; } catch (ur_result_t Err) { @@ -206,7 +199,7 @@ ur_result_t urTextureCreate(ur_context_handle_t hContext, } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp( @@ -259,9 +252,7 @@ urBindlessImagesUnsampledImageHandleDestroyExp(ur_context_handle_t hContext, UR_RESULT_ERROR_INVALID_CONTEXT); UR_ASSERT(hImage, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - ur_result_t RetErr = UR_RESULT_SUCCESS; - RetErr = UR_CHECK_ERROR(cuSurfObjectDestroy((CUsurfObject)hImage)); - return RetErr; + return UR_CHECK_ERROR(cuSurfObjectDestroy((CUsurfObject)hImage)); } UR_APIEXPORT ur_result_t UR_APICALL @@ -274,9 +265,7 @@ urBindlessImagesSampledImageHandleDestroyExp(ur_context_handle_t hContext, UR_RESULT_ERROR_INVALID_CONTEXT); UR_ASSERT(hImage, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - ur_result_t RetErr = UR_RESULT_SUCCESS; - RetErr = UR_CHECK_ERROR(cuTexObjectDestroy((CUtexObject)hImage)); - return RetErr; + return UR_CHECK_ERROR(cuTexObjectDestroy((CUtexObject)hImage)); } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( @@ -291,16 +280,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); UR_ASSERT(phImageMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); - ur_result_t RetErr = UR_RESULT_SUCCESS; - // Populate descriptor CUDA_ARRAY3D_DESCRIPTOR array_desc = {}; - RetErr = UR_CHECK_ERROR(urCalculateNumChannels(pImageFormat->channelOrder, - &array_desc.NumChannels)); + UR_CHECK_ERROR(urCalculateNumChannels(pImageFormat->channelOrder, + &array_desc.NumChannels)); - RetErr = UR_CHECK_ERROR(urToCudaImageChannelFormat( - pImageFormat->channelType, &array_desc.Format, nullptr)); + UR_CHECK_ERROR(urToCudaImageChannelFormat(pImageFormat->channelType, + &array_desc.Format, nullptr)); array_desc.Flags = 0; // No flags required array_desc.Width = pImageDesc->width; @@ -322,7 +309,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( CUarray ImageArray; try { - RetErr = UR_CHECK_ERROR(cuArray3DCreate(&ImageArray, &array_desc)); + UR_CHECK_ERROR(cuArray3DCreate(&ImageArray, &array_desc)); *phImageMem = (ur_exp_image_mem_handle_t)ImageArray; } catch (ur_result_t Err) { cuArrayDestroy(ImageArray); @@ -337,8 +324,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( array_desc.Flags = CUDA_ARRAY3D_SURFACE_LDST; try { - RetErr = UR_CHECK_ERROR(cuMipmappedArrayCreate(&mip_array, &array_desc, - pImageDesc->numMipLevel)); + UR_CHECK_ERROR(cuMipmappedArrayCreate(&mip_array, &array_desc, + pImageDesc->numMipLevel)); *phImageMem = (ur_exp_image_mem_handle_t)mip_array; } catch (ur_result_t Err) { cuMipmappedArrayDestroy(mip_array); @@ -349,7 +336,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( } } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageFreeExp( @@ -361,17 +348,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageFreeExp( UR_RESULT_ERROR_INVALID_CONTEXT); UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - ur_result_t RetErr = UR_RESULT_SUCCESS; - ScopedContext Active(hDevice->getContext()); try { - RetErr = UR_CHECK_ERROR(cuArrayDestroy((CUarray)hImageMem)); + UR_CHECK_ERROR(cuArrayDestroy((CUarray)hImageMem)); } catch (ur_result_t Err) { return Err; } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( @@ -389,16 +374,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( UR_ASSERT(phMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); UR_ASSERT(phImage, UR_RESULT_ERROR_INVALID_NULL_POINTER); - ur_result_t RetErr = UR_RESULT_SUCCESS; - unsigned int NumChannels = 0; - RetErr = UR_CHECK_ERROR( + UR_CHECK_ERROR( urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels)); CUarray_format format; size_t PixelTypeSizeBytes; - RetErr = UR_CHECK_ERROR(urToCudaImageChannelFormat( - pImageFormat->channelType, &format, &PixelTypeSizeBytes)); + UR_CHECK_ERROR(urToCudaImageChannelFormat(pImageFormat->channelType, &format, + &PixelTypeSizeBytes)); try { @@ -413,7 +396,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( // We create surfaces in the unsampled images case as it conforms to how // CUDA deals with unsampled images. CUsurfObject surface; - RetErr = UR_CHECK_ERROR(cuSurfObjectCreate(&surface, &image_res_desc)); + UR_CHECK_ERROR(cuSurfObjectCreate(&surface, &image_res_desc)); *phImage = (ur_exp_image_handle_t)surface; auto urMemObj = std::unique_ptr(new ur_mem_handle_t_{ @@ -431,7 +414,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( @@ -449,17 +432,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( UR_ASSERT(phMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); UR_ASSERT(phImage, UR_RESULT_ERROR_INVALID_NULL_POINTER); - ur_result_t RetErr = UR_RESULT_SUCCESS; ScopedContext Active(hDevice->getContext()); unsigned int NumChannels = 0; - RetErr = UR_CHECK_ERROR( + UR_CHECK_ERROR( urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels)); CUarray_format format; size_t PixelTypeSizeBytes; - RetErr = UR_CHECK_ERROR(urToCudaImageChannelFormat( - pImageFormat->channelType, &format, &PixelTypeSizeBytes)); + UR_CHECK_ERROR(urToCudaImageChannelFormat(pImageFormat->channelType, &format, + &PixelTypeSizeBytes)); try { CUDA_RESOURCE_DESC image_res_desc = {}; @@ -508,8 +490,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( return UR_RESULT_ERROR_INVALID_VALUE; } - RetErr = urTextureCreate(hContext, hSampler, pImageDesc, image_res_desc, - phImage); + UR_CHECK_ERROR(urTextureCreate(hContext, hSampler, pImageDesc, + image_res_desc, phImage)); auto urMemObj = std::unique_ptr(new ur_mem_handle_t_{ hContext, (CUarray)hImageMem, (CUtexObject)*phImage, hSampler, @@ -526,7 +508,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( @@ -546,33 +528,30 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE), UR_RESULT_ERROR_INVALID_VALUE); - ur_result_t RetErr = UR_RESULT_SUCCESS; - unsigned int NumChannels = 0; size_t PixelTypeSizeBytes = 0; - RetErr = UR_CHECK_ERROR( + UR_CHECK_ERROR( urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels)); // We need to get this now in bytes for calculating the total image size // later. - RetErr = UR_CHECK_ERROR(urToCudaImageChannelFormat( - pImageFormat->channelType, nullptr, &PixelTypeSizeBytes)); + UR_CHECK_ERROR(urToCudaImageChannelFormat(pImageFormat->channelType, nullptr, + &PixelTypeSizeBytes)); size_t PixelSizeBytes = PixelTypeSizeBytes * NumChannels; try { ScopedContext Active(hQueue->getContext()); CUstream Stream = hQueue->getNextTransferStream(); - RetErr = - enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); + enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); // We have to use a different copy function for each image dimensionality. if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) { if (pImageDesc->type == UR_MEM_TYPE_IMAGE1D) { size_t CopyExtentBytes = PixelSizeBytes * copyExtent.width; char *SrcWithOffset = (char *)pSrc + (srcOffset.x * PixelSizeBytes); - RetErr = UR_CHECK_ERROR( + UR_CHECK_ERROR( cuMemcpyHtoAAsync((CUarray)pDst, dstOffset.x * PixelSizeBytes, (void *)SrcWithOffset, CopyExtentBytes, Stream)); } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE2D) { @@ -595,7 +574,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( } cpy_desc.WidthInBytes = PixelSizeBytes * copyExtent.width; cpy_desc.Height = copyExtent.height; - RetErr = UR_CHECK_ERROR(cuMemcpy2DAsync(&cpy_desc, Stream)); + UR_CHECK_ERROR(cuMemcpy2DAsync(&cpy_desc, Stream)); } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE3D) { CUDA_MEMCPY3D cpy_desc = {}; cpy_desc.srcXInBytes = srcOffset.x * PixelSizeBytes; @@ -613,7 +592,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( cpy_desc.WidthInBytes = PixelSizeBytes * copyExtent.width; cpy_desc.Height = copyExtent.height; cpy_desc.Depth = copyExtent.depth; - RetErr = UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream)); + UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream)); } } else if (imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) { if (pImageDesc->type == UR_MEM_TYPE_IMAGE1D) { @@ -621,9 +600,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( size_t src_offset_bytes = PixelSizeBytes * srcOffset.x; void *dst_with_offset = (void *)((char *)pDst + (PixelSizeBytes * dstOffset.x)); - RetErr = UR_CHECK_ERROR( - cuMemcpyAtoHAsync(dst_with_offset, (CUarray)pSrc, src_offset_bytes, - CopyExtentBytes, Stream)); + UR_CHECK_ERROR(cuMemcpyAtoHAsync(dst_with_offset, (CUarray)pSrc, + src_offset_bytes, CopyExtentBytes, + Stream)); } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE2D) { CUDA_MEMCPY2D cpy_desc = {}; cpy_desc.srcXInBytes = srcOffset.x; @@ -643,7 +622,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( } cpy_desc.WidthInBytes = PixelSizeBytes * copyExtent.width; cpy_desc.Height = copyExtent.height; - RetErr = UR_CHECK_ERROR(cuMemcpy2DAsync(&cpy_desc, Stream)); + UR_CHECK_ERROR(cuMemcpy2DAsync(&cpy_desc, Stream)); } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE3D) { CUDA_MEMCPY3D cpy_desc = {}; cpy_desc.srcXInBytes = srcOffset.x; @@ -659,7 +638,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( cpy_desc.WidthInBytes = PixelSizeBytes * copyExtent.width; cpy_desc.Height = copyExtent.height; cpy_desc.Depth = copyExtent.depth; - RetErr = UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream)); + UR_CHECK_ERROR(cuMemcpy3DAsync(&cpy_desc, Stream)); } } else { /// imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE @@ -678,7 +657,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( @@ -687,31 +666,36 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); CUDA_ARRAY3D_DESCRIPTOR ArrayDesc; - ur_result_t RetErr = - UR_CHECK_ERROR(cuArray3DGetDescriptor(&ArrayDesc, (CUarray)hImageMem)); + UR_CHECK_ERROR(cuArray3DGetDescriptor(&ArrayDesc, (CUarray)hImageMem)); switch (propName) { case UR_IMAGE_INFO_WIDTH: - if (pPropValue) + if (pPropValue) { *(size_t *)pPropValue = ArrayDesc.Width; - if (pPropSizeRet) + } + if (pPropSizeRet) { *pPropSizeRet = sizeof(size_t); - return RetErr; + } + return UR_RESULT_SUCCESS; case UR_IMAGE_INFO_HEIGHT: - if (pPropValue) + if (pPropValue) { *(size_t *)pPropValue = ArrayDesc.Height; - if (pPropSizeRet) + } + if (pPropSizeRet) { *pPropSizeRet = sizeof(size_t); - return RetErr; + } + return UR_RESULT_SUCCESS; case UR_IMAGE_INFO_DEPTH: - if (pPropValue) + if (pPropValue) { *(size_t *)pPropValue = ArrayDesc.Depth; - if (pPropSizeRet) + } + if (pPropSizeRet) { *pPropSizeRet = sizeof(size_t); - return RetErr; + } + return UR_RESULT_SUCCESS; case UR_IMAGE_INFO_FORMAT: ur_image_channel_type_t ChannelType; ur_image_channel_order_t ChannelOrder; - RetErr = cudaToUrImageChannelFormat(ArrayDesc.Format, &ChannelType); + UR_CHECK_ERROR(cudaToUrImageChannelFormat(ArrayDesc.Format, &ChannelType)); // CUDA does not have a notion of channel "order" in the same way that // SYCL 1.2.1 does. switch (ArrayDesc.NumChannels) { @@ -729,12 +713,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( ((ur_image_format_t *)pPropValue)->channelType = ChannelType; ((ur_image_format_t *)pPropValue)->channelOrder = ChannelOrder; } - if (pPropSizeRet) + if (pPropSizeRet) { *pPropSizeRet = sizeof(ur_image_format_t); - return RetErr; + } + return UR_RESULT_SUCCESS; default: - RetErr = UR_RESULT_ERROR_INVALID_VALUE; - return RetErr; + return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -749,12 +733,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT(phImageMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); - ur_result_t RetErr = UR_RESULT_SUCCESS; - try { ScopedContext Active(hDevice->getContext()); CUarray ImageArray; - RetErr = UR_CHECK_ERROR(cuMipmappedArrayGetLevel( + UR_CHECK_ERROR(cuMipmappedArrayGetLevel( &ImageArray, (CUmipmappedArray)hImageMem, mipmapLevel)); *phImageMem = (ur_exp_image_mem_handle_t)ImageArray; } catch (ur_result_t Err) { @@ -763,7 +745,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( @@ -775,17 +757,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( UR_RESULT_ERROR_INVALID_CONTEXT); UR_ASSERT(hMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - ur_result_t RetErr = UR_RESULT_SUCCESS; - ScopedContext Active(hDevice->getContext()); try { - RetErr = UR_CHECK_ERROR(cuMipmappedArrayDestroy((CUmipmappedArray)hMem)); + UR_CHECK_ERROR(cuMipmappedArrayDestroy((CUmipmappedArray)hMem)); } catch (ur_result_t Err) { return Err; } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( @@ -797,8 +777,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( UR_RESULT_ERROR_INVALID_CONTEXT); UR_ASSERT(phInteropMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); - ur_result_t RetErr = UR_RESULT_SUCCESS; - try { ScopedContext Active(hDevice->getContext()); @@ -817,7 +795,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( @@ -834,14 +812,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( UR_ASSERT(hInteropMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT(phImageMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); - ur_result_t RetErr = UR_RESULT_SUCCESS; - unsigned int NumChannels = 0; - RetErr = UR_CHECK_ERROR( + UR_CHECK_ERROR( urCalculateNumChannels(pImageFormat->channelOrder, &NumChannels)); CUarray_format format; - RetErr = UR_CHECK_ERROR( + UR_CHECK_ERROR( urToCudaImageChannelFormat(pImageFormat->channelType, &format, nullptr)); try { @@ -859,11 +835,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( mipmapDesc.arrayDesc = ArrayDesc; CUmipmappedArray memMipMap; - RetErr = UR_CHECK_ERROR(cuExternalMemoryGetMappedMipmappedArray( + UR_CHECK_ERROR(cuExternalMemoryGetMappedMipmappedArray( &memMipMap, (CUexternalMemory)hInteropMem, &mipmapDesc)); CUarray memArray; - RetErr = UR_CHECK_ERROR(cuMipmappedArrayGetLevel(&memArray, memMipMap, 0)); + UR_CHECK_ERROR(cuMipmappedArrayGetLevel(&memArray, memMipMap, 0)); *phImageMem = (ur_exp_image_mem_handle_t)memArray; @@ -872,7 +848,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesReleaseInteropExp( @@ -884,18 +860,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesReleaseInteropExp( UR_RESULT_ERROR_INVALID_CONTEXT); UR_ASSERT(hInteropMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - ur_result_t RetErr = UR_RESULT_SUCCESS; - try { ScopedContext Active(hDevice->getContext()); - RetErr = - UR_CHECK_ERROR(cuDestroyExternalMemory((CUexternalMemory)hInteropMem)); + UR_CHECK_ERROR(cuDestroyExternalMemory((CUexternalMemory)hInteropMem)); } catch (ur_result_t Err) { return Err; } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL @@ -909,8 +882,6 @@ urBindlessImagesImportExternalSemaphoreOpaqueFDExp( UR_RESULT_ERROR_INVALID_CONTEXT); UR_ASSERT(phInteropSemaphoreHandle, UR_RESULT_ERROR_INVALID_NULL_POINTER); - ur_result_t RetErr = UR_RESULT_SUCCESS; - try { ScopedContext Active(hDevice->getContext()); @@ -919,8 +890,7 @@ urBindlessImagesImportExternalSemaphoreOpaqueFDExp( ext_sem_desc.type = CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD; CUexternalSemaphore semaphore; - RetErr = - UR_CHECK_ERROR(cuImportExternalSemaphore(&semaphore, &ext_sem_desc)); + UR_CHECK_ERROR(cuImportExternalSemaphore(&semaphore, &ext_sem_desc)); *phInteropSemaphoreHandle = (ur_exp_interop_semaphore_handle_t)semaphore; } catch (ur_result_t Err) { @@ -928,7 +898,7 @@ urBindlessImagesImportExternalSemaphoreOpaqueFDExp( } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesDestroyExternalSemaphoreExp( @@ -940,18 +910,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesDestroyExternalSemaphoreExp( UR_RESULT_ERROR_INVALID_CONTEXT); UR_ASSERT(hInteropSemaphore, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - ur_result_t RetErr = UR_RESULT_SUCCESS; - try { ScopedContext Active(hDevice->getContext()); - RetErr = UR_CHECK_ERROR( + UR_CHECK_ERROR( cuDestroyExternalSemaphore((CUexternalSemaphore)hInteropSemaphore)); } catch (ur_result_t Err) { return Err; } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( @@ -961,19 +929,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( UR_ASSERT(hQueue, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT(hSemaphore, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - ur_result_t RetErr = UR_RESULT_SUCCESS; - try { ScopedContext Active(hQueue->getContext()); CUstream Stream = hQueue->getNextTransferStream(); - RetErr = - enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); + enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS SemWaitParams = {}; // Wait for one external semaphore - RetErr = UR_CHECK_ERROR(cuWaitExternalSemaphoresAsync( + UR_CHECK_ERROR(cuWaitExternalSemaphoresAsync( (CUexternalSemaphore *)&hSemaphore, &SemWaitParams, 1 /* numExtSems */, Stream)); @@ -988,7 +953,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( @@ -998,19 +963,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( UR_ASSERT(hQueue, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT(hSemaphore, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - ur_result_t RetErr = UR_RESULT_SUCCESS; - try { ScopedContext Active(hQueue->getContext()); CUstream Stream = hQueue->getNextTransferStream(); - RetErr = - enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); + enqueueEventsWait(hQueue, Stream, numEventsInWaitList, phEventWaitList); CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS SemSignalParams = {}; // Signal one external semaphore - RetErr = UR_CHECK_ERROR(cuSignalExternalSemaphoresAsync( + UR_CHECK_ERROR(cuSignalExternalSemaphoresAsync( (CUexternalSemaphore *)&hSemaphore, &SemSignalParams, 1 /* numExtSems */, Stream)); @@ -1025,5 +987,5 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } - return RetErr; + return UR_RESULT_SUCCESS; } diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.cpp index 6ee7bb3400304..cea8dfc497ed5 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.cpp @@ -56,17 +56,15 @@ urSamplerGetInfo(ur_sampler_handle_t hSampler, ur_sampler_info_t propName, case UR_SAMPLER_INFO_CONTEXT: return ReturnValue(hSampler->Context); case UR_SAMPLER_INFO_NORMALIZED_COORDS: { - bool NormCoordsProp = static_cast(hSampler->Props); + bool NormCoordsProp = hSampler->isNormalizedCoords(); return ReturnValue(NormCoordsProp); } case UR_SAMPLER_INFO_FILTER_MODE: { - auto FilterProp = - static_cast((hSampler->Props >> 1) & 0x1); + ur_sampler_filter_mode_t FilterProp = hSampler->getFilterMode(); return ReturnValue(FilterProp); } case UR_SAMPLER_INFO_ADDRESSING_MODE: { - auto AddressingProp = - static_cast(hSampler->Props >> 2); + ur_sampler_addressing_mode_t AddressingProp = hSampler->getAddressingMode(); return ReturnValue(AddressingProp); } default: diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.hpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.hpp index 38035eaf2b98d..47af74296cb95 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.hpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/sampler.hpp @@ -35,4 +35,20 @@ struct ur_sampler_handle_t_ { uint32_t decrementReferenceCount() noexcept { return --RefCount; } uint32_t getReferenceCount() const noexcept { return RefCount; } + + ur_bool_t isNormalizedCoords() const noexcept { + return static_cast(Props & 0b1); + } + + ur_sampler_filter_mode_t getFilterMode() const noexcept { + return static_cast((Props >> 1) & 0b1); + } + + ur_sampler_addressing_mode_t getAddressingMode() const noexcept { + return static_cast((Props >> 2) & 0b111); + } + + ur_sampler_filter_mode_t getMipFilterMode() const noexcept { + return static_cast((Props >> 5) & 0b1); + } }; From 8833b718fd378c59cd931ca04895f8bacf830aff Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Thu, 6 Jul 2023 17:38:03 +0100 Subject: [PATCH 10/19] Format --- sycl/plugins/unified_runtime/pi2ur.hpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index 35dd6a4c1cc22..b1619155f7e7a 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -4489,18 +4489,18 @@ inline pi_result piextMemSampledImageHandleDestroy(pi_context Context, static void pi2urImageInfoFlags(const pi_image_info PiFlags, ur_image_info_t *UrFlags) { switch (PiFlags) { -#define MAP(FROM, TO) \ - case FROM: { \ - *UrFlags = TO; \ - return;\ - } -MAP(PI_IMAGE_INFO_FORMAT, UR_IMAGE_INFO_FORMAT) -MAP(PI_IMAGE_INFO_ELEMENT_SIZE, UR_IMAGE_INFO_ELEMENT_SIZE) -MAP(PI_IMAGE_INFO_ROW_PITCH, UR_IMAGE_INFO_ROW_PITCH) -MAP(PI_IMAGE_INFO_SLICE_PITCH, UR_IMAGE_INFO_SLICE_PITCH) -MAP(PI_IMAGE_INFO_WIDTH, UR_IMAGE_INFO_WIDTH) -MAP(PI_IMAGE_INFO_HEIGHT, UR_IMAGE_INFO_HEIGHT) -MAP(PI_IMAGE_INFO_DEPTH, UR_IMAGE_INFO_DEPTH) +#define MAP(FROM, TO) \ + case FROM: { \ + *UrFlags = TO; \ + return; \ + } + MAP(PI_IMAGE_INFO_FORMAT, UR_IMAGE_INFO_FORMAT) + MAP(PI_IMAGE_INFO_ELEMENT_SIZE, UR_IMAGE_INFO_ELEMENT_SIZE) + MAP(PI_IMAGE_INFO_ROW_PITCH, UR_IMAGE_INFO_ROW_PITCH) + MAP(PI_IMAGE_INFO_SLICE_PITCH, UR_IMAGE_INFO_SLICE_PITCH) + MAP(PI_IMAGE_INFO_WIDTH, UR_IMAGE_INFO_WIDTH) + MAP(PI_IMAGE_INFO_HEIGHT, UR_IMAGE_INFO_HEIGHT) + MAP(PI_IMAGE_INFO_DEPTH, UR_IMAGE_INFO_DEPTH) #undef MAP default: die("pi2urImageInfoFlags: Unsupported use case"); From 657b0e519a9a72d7c2d1a1154217e0f533ed78c2 Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Fri, 7 Jul 2023 08:56:17 +0100 Subject: [PATCH 11/19] Update UR API * Added device query for bindless image support on shared USM --- sycl/plugins/unified_runtime/CMakeLists.txt | 2 +- sycl/plugins/unified_runtime/pi2ur.hpp | 2 ++ sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index c87bcdc7ab445..d1adab414cacc 100755 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -4,7 +4,7 @@ if (NOT DEFINED UNIFIED_RUNTIME_LIBRARY OR NOT DEFINED UNIFIED_RUNTIME_INCLUDE_D include(FetchContent) set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") - set(UNIFIED_RUNTIME_TAG 78aebac8bc304566cf7fb1a86ae208e4b20831ae) + set(UNIFIED_RUNTIME_TAG 8a3f07a3bcd908ea2fe252824ae7789f2a1adbc1) message(STATUS "Will fetch Unified Runtime from ${UNIFIED_RUNTIME_REPO}") FetchContent_Declare(unified-runtime diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index b1619155f7e7a..afa2ae6ae7ce6 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -950,6 +950,8 @@ inline pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP) MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT, UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP) + MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT, + UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP) MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT, UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP) MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT, diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp index a4f1539bcc1dd..97040599da90f 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp @@ -877,6 +877,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, // On CUDA bindless images are supported. return ReturnValue(true); } + case UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP: { + // On CUDA bindless images can be backed by shared (managed) USM + return ReturnValue(true); + } case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: { // On CUDA 1D bindless image USM is not supported. // More specifically, linear filtering is not supported. From e031c11941f0dca4a794cc214e1b318667d1e19a Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Mon, 10 Jul 2023 09:53:56 +0100 Subject: [PATCH 12/19] Address Feedback * Rename values for pi_image_copy_flags to be more clear * Remove unnecessary assertions before UR * Remove assertions that will be handled by UR valddi * Rename switch case macros to be more specific * Add piext function entries in pi_unified_runtime.cpp --- sycl/include/sycl/detail/pi.h | 13 +- sycl/plugins/level_zero/pi_level_zero.cpp | 76 +- sycl/plugins/unified_runtime/pi2ur.hpp | 672 ++++++++++-------- .../unified_runtime/pi_unified_runtime.cpp | 144 ++++ .../ur/adapters/cuda/image.cpp | 102 +-- 5 files changed, 569 insertions(+), 438 deletions(-) diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h index c236382a98716..34fde3df1c80e 100644 --- a/sycl/include/sycl/detail/pi.h +++ b/sycl/include/sycl/detail/pi.h @@ -609,9 +609,9 @@ typedef enum { } _pi_image_channel_type; typedef enum { - PI_IMAGE_COPY_HTOD = 0, - PI_IMAGE_COPY_DTOH = 1, - PI_IMAGE_COPY_DTOD = 2 + PI_IMAGE_COPY_HOST_TO_DEVICE = 0, + PI_IMAGE_COPY_DEVICE_TO_HOST = 1, + PI_IMAGE_COPY_DEVICE_TO_DEVICE = 2 } _pi_image_copy_flags; typedef enum { PI_BUFFER_CREATE_TYPE_REGION = 0x1220 } _pi_buffer_create_type; @@ -1931,10 +1931,9 @@ __SYCL_EXPORT pi_result piextUSMPitchedAlloc( pi_device device, pi_usm_mem_properties *properties, size_t width_in_bytes, size_t height, unsigned int element_size_bytes); -/// Indicates that the allocated USM memory is no longer needed on the -/// runtime side. The actual freeing of the memory may be done in a blocking -/// or deferred manner, e.g. to avoid issues with indirect memory access -/// from kernels. +/// Indicates that the allocated USM memory is no longer needed on the runtime +/// side. The actual freeing of the memory may be done in a blocking or deferred +/// manner, e.g. to avoid issues with indirect memory access from kernels. /// /// \param context is the pi_context of the allocation /// \param ptr is the memory to be freed diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index 6d45905343a37..40b1fad4fb8ba 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -396,10 +396,6 @@ piextMemUnsampledImageHandleDestroy([[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] pi_image_handle handle) { - assert(context != nullptr); - assert(device != nullptr); - assert(handle != 0); - die("piextMemUnsampledImageHandleDestroy not implemented on level zero " "backend.\n"); pi_result retErr = PI_ERROR_UNKNOWN; @@ -412,10 +408,6 @@ piextMemSampledImageHandleDestroy([[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] pi_image_handle handle) { - assert(context != nullptr); - assert(device != nullptr); - assert(handle != 0); - die("piextMemSampledImageHandleDestroy not implemented on level zero " "backend.\n"); pi_result retErr = PI_ERROR_UNKNOWN; @@ -429,12 +421,6 @@ pi_result piextMemImageAllocate([[maybe_unused]] pi_context context, [[maybe_unused]] pi_image_desc *image_desc, [[maybe_unused]] pi_image_mem_handle *ret_mem) { - assert(context != nullptr); - assert(device != nullptr); - assert(image_desc != nullptr); - assert(image_format != nullptr); - assert(ret_mem != nullptr); - die("piExtMemImageAllocate not implemented on level zero backend.\n"); // No image formats are supported! pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; @@ -448,11 +434,6 @@ piextMemMipmapGetLevel([[maybe_unused]] pi_context context, [[maybe_unused]] unsigned int level, [[maybe_unused]] pi_image_mem_handle *ret_mem) { - assert(context != nullptr); - assert(device != nullptr); - assert(mip_mem != nullptr); - assert(ret_mem != nullptr); - die("piextMemMipmapGetLevel not implemented on level zero backend.\n"); pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; return retErr; @@ -463,10 +444,6 @@ piextMemImageFree([[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] pi_image_mem_handle memory_handle) { - assert(context != nullptr); - assert(device != nullptr); - assert(memory_handle != nullptr); - pi_result retErr = PI_SUCCESS; die("piExtMemImageFree not implemented on level zero backend.\n"); @@ -478,10 +455,6 @@ piextMemMipmapFree([[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] pi_image_mem_handle memory_handle) { - assert(context != nullptr); - assert(device != nullptr); - assert(memory_handle != nullptr); - die("piextMemMipmapFree not implemented on level zero backend.\n"); // No image formats are supported! pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; @@ -495,12 +468,6 @@ pi_result piextMemUnsampledImageCreate( [[maybe_unused]] pi_image_desc *desc, [[maybe_unused]] pi_mem *ret_mem, [[maybe_unused]] pi_image_handle *ret_handle) { - assert(context != nullptr); - assert(device != nullptr); - assert(img_mem != nullptr); - assert(ret_mem != nullptr); - assert(ret_handle != nullptr); - die("piextMemUnsampledImageCreate not implemented on level zero backend.\n"); // No image formats are supported! pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; @@ -511,10 +478,6 @@ pi_result piextMemImportOpaqueFD( [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] size_t size, [[maybe_unused]] int file_descriptor, [[maybe_unused]] pi_interop_mem_handle *ret_handle) { - assert(context); - assert(device); - assert(file_descriptor); - assert(ret_handle); die("piextMemImportOpaqueFD not implemented on level zero backend.\n"); pi_result retErr = PI_ERROR_UNKNOWN; @@ -525,9 +488,7 @@ pi_result piextImportExternalSemaphoreOpaqueFD( [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] int file_descriptor, [[maybe_unused]] pi_interop_semaphore_handle *ret_handle) { - assert(context); - assert(device); - assert(ret_handle); + die("piextImportExternalSemaphoreOpaqueFD not implemented on level zero " "backend.\n"); pi_result retErr = PI_ERROR_UNKNOWN; @@ -537,9 +498,7 @@ pi_result piextImportExternalSemaphoreOpaqueFD( pi_result piextDestroyExternalSemaphore( [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] pi_interop_semaphore_handle sem_handle) { - assert(context); - assert(device); - assert(sem_handle); + die("piextDestroyExternalSemaphore not implemented on level zero " "backend.\n"); pi_result retErr = PI_ERROR_UNKNOWN; @@ -552,8 +511,7 @@ pi_result piextWaitExternalSemaphore( [[maybe_unused]] pi_uint32 num_events_in_wait_list, [[maybe_unused]] const pi_event *event_wait_list, [[maybe_unused]] pi_event *event) { - assert(command_queue); - assert(sem_handle); + die("piextWaitExternalSemaphore not implemented on level zero " "backend.\n"); pi_result retErr = PI_ERROR_UNKNOWN; @@ -566,8 +524,7 @@ pi_result piextSignalExternalSemaphore( [[maybe_unused]] pi_uint32 num_events_in_wait_list, [[maybe_unused]] const pi_event *event_wait_list, [[maybe_unused]] pi_event *event) { - assert(command_queue); - assert(sem_handle); + die("piextSignalExternalSemaphore not implemented on level zero " "backend.\n"); pi_result retErr = PI_ERROR_UNKNOWN; @@ -581,12 +538,6 @@ piextMemMapExternalArray([[maybe_unused]] pi_context context, [[maybe_unused]] pi_image_desc *image_desc, [[maybe_unused]] pi_interop_mem_handle mem_handle, [[maybe_unused]] pi_image_mem_handle *ret_mem) { - assert(context); - assert(device); - assert(image_format); - assert(image_desc); - assert(mem_handle); - assert(ret_mem); die("piextMemMapExternalArray given unsupported image_channel_order.\n"); @@ -598,8 +549,6 @@ pi_result piextMemReleaseInterop([[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] pi_interop_mem_handle ext_mem) { - assert(context); - assert(ext_mem); die("piextMemReleaseInterop not implemented on level zero backend.\n"); pi_result retErr = PI_ERROR_UNKNOWN; @@ -613,11 +562,6 @@ pi_result piextMemSampledImageCreate( [[maybe_unused]] pi_image_desc *desc, [[maybe_unused]] pi_sampler sampler, [[maybe_unused]] pi_mem *ret_mem, [[maybe_unused]] pi_image_handle *ret_handle) { - assert(context != nullptr); - assert(device != nullptr); - assert(img_mem != nullptr); - assert(ret_mem != nullptr); - assert(ret_handle != nullptr); die("piExtMemSampledImageCreate not implemented on level zero backend.\n"); // No image formats are supported! @@ -632,9 +576,6 @@ pi_result piextBindlessImageSamplerCreate( [[maybe_unused]] float max_mipmap_level_clamp, [[maybe_unused]] float max_anisotropy, [[maybe_unused]] pi_sampler *result_sampler) { - assert(context != nullptr); - assert(sampler_properties != nullptr); - assert(result_sampler != nullptr); die("piextBindlessImageSamplerCreate not implemented on level zero " "backend.\n"); @@ -657,9 +598,6 @@ piextMemImageCopy([[maybe_unused]] pi_queue command_queue, [[maybe_unused]] pi_uint32 num_events_in_wait_list, [[maybe_unused]] const pi_event *event_wait_list, [[maybe_unused]] pi_event *event) { - assert(command_queue != nullptr); - assert(dst_ptr != nullptr); - assert(src_ptr != nullptr); die("piExtMemImageCopy not implemented on level zero backend.\n"); // No image formats are supported! @@ -672,7 +610,6 @@ piextMemImageGetInfo([[maybe_unused]] const pi_image_mem_handle mem_handle, [[maybe_unused]] pi_image_info param_name, [[maybe_unused]] void *param_value, [[maybe_unused]] size_t *param_value_size_ret) { - assert(mem_handle); die("piextMemImageGetInfo not implemented on level zero backend.\n"); return PI_SUCCESS; @@ -1055,12 +992,9 @@ pi_result piextUSMPitchedAlloc( [[maybe_unused]] pi_usm_mem_properties *properties, [[maybe_unused]] size_t width_in_bytes, [[maybe_unused]] size_t height, [[maybe_unused]] unsigned int element_size_bytes) { + die("piextUSMPitchedAlloc: not implemented"); - assert(result_ptr != nullptr); - assert(context != nullptr); - assert(device != nullptr); - assert(properties == nullptr || *properties == 0); return {}; } diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index afa2ae6ae7ce6..18084f0fe02ec 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -786,201 +786,264 @@ inline pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, ur_device_info_t InfoType; switch (ParamName) { -#define MAP(FROM, TO) \ +#define PI_TO_UR_MAP_DEVICE_INFO(FROM, TO) \ case FROM: { \ InfoType = TO; \ break; \ } - MAP(PI_DEVICE_INFO_TYPE, UR_DEVICE_INFO_TYPE) - MAP(PI_DEVICE_INFO_PARENT_DEVICE, UR_DEVICE_INFO_PARENT_DEVICE) - MAP(PI_DEVICE_INFO_PLATFORM, UR_DEVICE_INFO_PLATFORM) - MAP(PI_DEVICE_INFO_VENDOR_ID, UR_DEVICE_INFO_VENDOR_ID) - MAP(PI_DEVICE_INFO_UUID, UR_DEVICE_INFO_UUID) - MAP(PI_DEVICE_INFO_ATOMIC_64, UR_DEVICE_INFO_ATOMIC_64) - MAP(PI_DEVICE_INFO_EXTENSIONS, UR_DEVICE_INFO_EXTENSIONS) - MAP(PI_DEVICE_INFO_NAME, UR_DEVICE_INFO_NAME) - MAP(PI_DEVICE_INFO_COMPILER_AVAILABLE, UR_DEVICE_INFO_COMPILER_AVAILABLE) - MAP(PI_DEVICE_INFO_LINKER_AVAILABLE, UR_DEVICE_INFO_LINKER_AVAILABLE) - MAP(PI_DEVICE_INFO_MAX_COMPUTE_UNITS, UR_DEVICE_INFO_MAX_COMPUTE_UNITS) - MAP(PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS, - UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS) - MAP(PI_DEVICE_INFO_MAX_WORK_GROUP_SIZE, UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE) - MAP(PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES, UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES) - MAP(PI_DEVICE_INFO_MAX_CLOCK_FREQUENCY, UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY) - MAP(PI_DEVICE_INFO_ADDRESS_BITS, UR_DEVICE_INFO_ADDRESS_BITS) - MAP(PI_DEVICE_INFO_MAX_MEM_ALLOC_SIZE, UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE) - MAP(PI_DEVICE_INFO_GLOBAL_MEM_SIZE, UR_DEVICE_INFO_GLOBAL_MEM_SIZE) - MAP(PI_DEVICE_INFO_LOCAL_MEM_SIZE, UR_DEVICE_INFO_LOCAL_MEM_SIZE) - MAP(PI_DEVICE_INFO_IMAGE_SUPPORT, UR_DEVICE_INFO_IMAGE_SUPPORTED) - MAP(PI_DEVICE_INFO_HOST_UNIFIED_MEMORY, UR_DEVICE_INFO_HOST_UNIFIED_MEMORY) - MAP(PI_DEVICE_INFO_AVAILABLE, UR_DEVICE_INFO_AVAILABLE) - MAP(PI_DEVICE_INFO_VENDOR, UR_DEVICE_INFO_VENDOR) - MAP(PI_DEVICE_INFO_DRIVER_VERSION, UR_DEVICE_INFO_DRIVER_VERSION) - MAP(PI_DEVICE_INFO_VERSION, UR_DEVICE_INFO_VERSION) - MAP(PI_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES, - UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES) - MAP(PI_DEVICE_INFO_REFERENCE_COUNT, UR_DEVICE_INFO_REFERENCE_COUNT) - MAP(PI_DEVICE_INFO_PARTITION_PROPERTIES, - UR_DEVICE_INFO_SUPPORTED_PARTITIONS) - MAP(PI_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN, - UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN) - MAP(PI_DEVICE_INFO_PARTITION_TYPE, UR_DEVICE_INFO_PARTITION_TYPE) - MAP(PI_DEVICE_INFO_OPENCL_C_VERSION, UR_EXT_DEVICE_INFO_OPENCL_C_VERSION) - MAP(PI_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC, - UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC) - MAP(PI_DEVICE_INFO_PRINTF_BUFFER_SIZE, UR_DEVICE_INFO_PRINTF_BUFFER_SIZE) - MAP(PI_DEVICE_INFO_PROFILE, UR_DEVICE_INFO_PROFILE) - MAP(PI_DEVICE_INFO_BUILT_IN_KERNELS, UR_DEVICE_INFO_BUILT_IN_KERNELS) - MAP(PI_DEVICE_INFO_QUEUE_PROPERTIES, UR_DEVICE_INFO_QUEUE_PROPERTIES) - MAP(PI_DEVICE_INFO_EXECUTION_CAPABILITIES, - UR_DEVICE_INFO_EXECUTION_CAPABILITIES) - MAP(PI_DEVICE_INFO_ENDIAN_LITTLE, UR_DEVICE_INFO_ENDIAN_LITTLE) - MAP(PI_DEVICE_INFO_ERROR_CORRECTION_SUPPORT, - UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT) - MAP(PI_DEVICE_INFO_PROFILING_TIMER_RESOLUTION, - UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION) - MAP(PI_DEVICE_INFO_LOCAL_MEM_TYPE, UR_DEVICE_INFO_LOCAL_MEM_TYPE) - MAP(PI_DEVICE_INFO_MAX_CONSTANT_ARGS, UR_DEVICE_INFO_MAX_CONSTANT_ARGS) - MAP(PI_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE, - UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE) - MAP(PI_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE, - UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE) - MAP(PI_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE, - UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE) - MAP(PI_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE, - UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE) - MAP(PI_DEVICE_INFO_MAX_PARAMETER_SIZE, UR_DEVICE_INFO_MAX_PARAMETER_SIZE) - MAP(PI_DEVICE_INFO_MEM_BASE_ADDR_ALIGN, UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN) - MAP(PI_DEVICE_INFO_MAX_SAMPLERS, UR_DEVICE_INFO_MAX_SAMPLERS) - MAP(PI_DEVICE_INFO_MAX_READ_IMAGE_ARGS, UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS) - MAP(PI_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS, - UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS) - MAP(PI_DEVICE_INFO_SINGLE_FP_CONFIG, UR_DEVICE_INFO_SINGLE_FP_CONFIG) - MAP(PI_DEVICE_INFO_HALF_FP_CONFIG, UR_DEVICE_INFO_HALF_FP_CONFIG) - MAP(PI_DEVICE_INFO_DOUBLE_FP_CONFIG, UR_DEVICE_INFO_DOUBLE_FP_CONFIG) - MAP(PI_DEVICE_INFO_IMAGE2D_MAX_WIDTH, UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH) - MAP(PI_DEVICE_INFO_IMAGE2D_MAX_HEIGHT, UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT) - MAP(PI_DEVICE_INFO_IMAGE3D_MAX_WIDTH, UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH) - MAP(PI_DEVICE_INFO_IMAGE3D_MAX_HEIGHT, UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT) - MAP(PI_DEVICE_INFO_IMAGE3D_MAX_DEPTH, UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH) - MAP(PI_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE, - UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE) - MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR, - UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR) - MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR, - UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR) - MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT, - UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT) - MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT, - UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT) - MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT, - UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT) - MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT, - UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT) - MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG, - UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG) - MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG, - UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG) - MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT, - UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT) - MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT, - UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT) - MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE, - UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE) - MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE, - UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE) - MAP(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF, - UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF) - MAP(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF, - UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF) - MAP(PI_DEVICE_INFO_MAX_NUM_SUB_GROUPS, UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS) - MAP(PI_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS, + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_TYPE, UR_DEVICE_INFO_TYPE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PARENT_DEVICE, + UR_DEVICE_INFO_PARENT_DEVICE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PLATFORM, UR_DEVICE_INFO_PLATFORM) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_VENDOR_ID, UR_DEVICE_INFO_VENDOR_ID) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_UUID, UR_DEVICE_INFO_UUID) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_ATOMIC_64, UR_DEVICE_INFO_ATOMIC_64) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_EXTENSIONS, + UR_DEVICE_INFO_EXTENSIONS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_NAME, UR_DEVICE_INFO_NAME) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_COMPILER_AVAILABLE, + UR_DEVICE_INFO_COMPILER_AVAILABLE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_LINKER_AVAILABLE, + UR_DEVICE_INFO_LINKER_AVAILABLE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_COMPUTE_UNITS, + UR_DEVICE_INFO_MAX_COMPUTE_UNITS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS, + UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_WORK_GROUP_SIZE, + UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES, + UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_CLOCK_FREQUENCY, + UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_ADDRESS_BITS, + UR_DEVICE_INFO_ADDRESS_BITS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_MEM_ALLOC_SIZE, + UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GLOBAL_MEM_SIZE, + UR_DEVICE_INFO_GLOBAL_MEM_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_LOCAL_MEM_SIZE, + UR_DEVICE_INFO_LOCAL_MEM_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IMAGE_SUPPORT, + UR_DEVICE_INFO_IMAGE_SUPPORTED) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_HOST_UNIFIED_MEMORY, + UR_DEVICE_INFO_HOST_UNIFIED_MEMORY) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_AVAILABLE, UR_DEVICE_INFO_AVAILABLE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_VENDOR, UR_DEVICE_INFO_VENDOR) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_DRIVER_VERSION, + UR_DEVICE_INFO_DRIVER_VERSION) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_VERSION, UR_DEVICE_INFO_VERSION) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES, + UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_REFERENCE_COUNT, + UR_DEVICE_INFO_REFERENCE_COUNT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PARTITION_PROPERTIES, + UR_DEVICE_INFO_SUPPORTED_PARTITIONS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN, + UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PARTITION_TYPE, + UR_DEVICE_INFO_PARTITION_TYPE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_OPENCL_C_VERSION, + UR_EXT_DEVICE_INFO_OPENCL_C_VERSION) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC, + UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PRINTF_BUFFER_SIZE, + UR_DEVICE_INFO_PRINTF_BUFFER_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PROFILE, UR_DEVICE_INFO_PROFILE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_BUILT_IN_KERNELS, + UR_DEVICE_INFO_BUILT_IN_KERNELS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_QUEUE_PROPERTIES, + UR_DEVICE_INFO_QUEUE_PROPERTIES) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_EXECUTION_CAPABILITIES, + UR_DEVICE_INFO_EXECUTION_CAPABILITIES) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_ENDIAN_LITTLE, + UR_DEVICE_INFO_ENDIAN_LITTLE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_ERROR_CORRECTION_SUPPORT, + UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PROFILING_TIMER_RESOLUTION, + UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_LOCAL_MEM_TYPE, + UR_DEVICE_INFO_LOCAL_MEM_TYPE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_CONSTANT_ARGS, + UR_DEVICE_INFO_MAX_CONSTANT_ARGS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE, + UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE, + UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE, + UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE, + UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_PARAMETER_SIZE, + UR_DEVICE_INFO_MAX_PARAMETER_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MEM_BASE_ADDR_ALIGN, + UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_SAMPLERS, + UR_DEVICE_INFO_MAX_SAMPLERS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_READ_IMAGE_ARGS, + UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS, + UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_SINGLE_FP_CONFIG, + UR_DEVICE_INFO_SINGLE_FP_CONFIG) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_HALF_FP_CONFIG, + UR_DEVICE_INFO_HALF_FP_CONFIG) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_DOUBLE_FP_CONFIG, + UR_DEVICE_INFO_DOUBLE_FP_CONFIG) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IMAGE2D_MAX_WIDTH, + UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IMAGE2D_MAX_HEIGHT, + UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IMAGE3D_MAX_WIDTH, + UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IMAGE3D_MAX_HEIGHT, + UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IMAGE3D_MAX_DEPTH, + UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE, + UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF, + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF, + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_NUM_SUB_GROUPS, + UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS) + PI_TO_UR_MAP_DEVICE_INFO( + PI_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS, UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS) - MAP(PI_DEVICE_INFO_SUB_GROUP_SIZES_INTEL, - UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL) - MAP(PI_DEVICE_INFO_IL_VERSION, UR_DEVICE_INFO_IL_VERSION) - MAP(PI_DEVICE_INFO_USM_HOST_SUPPORT, UR_DEVICE_INFO_USM_HOST_SUPPORT) - MAP(PI_DEVICE_INFO_USM_DEVICE_SUPPORT, UR_DEVICE_INFO_USM_DEVICE_SUPPORT) - MAP(PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT, - UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT) - MAP(PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT, - UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT) - MAP(PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT, - UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT) - MAP(PI_DEVICE_INFO_PCI_ADDRESS, UR_DEVICE_INFO_PCI_ADDRESS) - MAP(PI_DEVICE_INFO_GPU_EU_COUNT, UR_DEVICE_INFO_GPU_EU_COUNT) - MAP(PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH, UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH) - MAP(PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE, - UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_IP_VERSION, UR_DEVICE_INFO_IP_VERSION) - MAP(PI_DEVICE_INFO_BUILD_ON_SUBDEVICE, UR_DEVICE_INFO_BUILD_ON_SUBDEVICE) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D, - UR_DEVICE_INFO_MAX_WORK_GROUPS_3D) - MAP(PI_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE, - UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE) - MAP(PI_DEVICE_INFO_DEVICE_ID, UR_DEVICE_INFO_DEVICE_ID) - MAP(PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY, UR_DEVICE_INFO_GLOBAL_MEM_FREE) - MAP(PI_EXT_INTEL_DEVICE_INFO_MEMORY_CLOCK_RATE, - UR_DEVICE_INFO_MEMORY_CLOCK_RATE) - MAP(PI_EXT_INTEL_DEVICE_INFO_MEMORY_BUS_WIDTH, - UR_DEVICE_INFO_MEMORY_BUS_WIDTH) - MAP(PI_EXT_INTEL_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES, - UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES) - MAP(PI_DEVICE_INFO_GPU_SLICES, UR_DEVICE_INFO_GPU_EU_SLICES) - MAP(PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE, - UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE) - MAP(PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU, - UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU) - MAP(PI_DEVICE_INFO_MAX_MEM_BANDWIDTH, UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_BFLOAT16_MATH_FUNCTIONS, - UR_DEVICE_INFO_BFLOAT16) - MAP(PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES, + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_SUB_GROUP_SIZES_INTEL, + UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IL_VERSION, + UR_DEVICE_INFO_IL_VERSION) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_USM_HOST_SUPPORT, + UR_DEVICE_INFO_USM_HOST_SUPPORT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_USM_DEVICE_SUPPORT, + UR_DEVICE_INFO_USM_DEVICE_SUPPORT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT, + UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT, + UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT, + UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_PCI_ADDRESS, + UR_DEVICE_INFO_PCI_ADDRESS) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GPU_EU_COUNT, + UR_DEVICE_INFO_GPU_EU_COUNT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH, + UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE, + UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_IP_VERSION, + UR_DEVICE_INFO_IP_VERSION) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_BUILD_ON_SUBDEVICE, + UR_DEVICE_INFO_BUILD_ON_SUBDEVICE) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D, + UR_DEVICE_INFO_MAX_WORK_GROUPS_3D) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE, + UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_DEVICE_ID, UR_DEVICE_INFO_DEVICE_ID) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY, + UR_DEVICE_INFO_GLOBAL_MEM_FREE) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_INTEL_DEVICE_INFO_MEMORY_CLOCK_RATE, + UR_DEVICE_INFO_MEMORY_CLOCK_RATE) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_INTEL_DEVICE_INFO_MEMORY_BUS_WIDTH, + UR_DEVICE_INFO_MEMORY_BUS_WIDTH) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_INTEL_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES, + UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GPU_SLICES, + UR_DEVICE_INFO_GPU_EU_SLICES) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE, + UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU, + UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_MAX_MEM_BANDWIDTH, + UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_BFLOAT16_MATH_FUNCTIONS, + UR_DEVICE_INFO_BFLOAT16) + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES, UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES) - MAP(PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES, + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES, UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES) - MAP(PI_EXT_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES, - UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES) - MAP(PI_EXT_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES, - UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES) - MAP(PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT, - UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT) - MAP(PI_DEVICE_INFO_IMAGE_SRGB, UR_DEVICE_INFO_IMAGE_SRGB) - MAP(PI_DEVICE_INFO_BACKEND_VERSION, UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION) - MAP(PI_EXT_CODEPLAY_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP, + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES, + UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES, + UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT, + UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_IMAGE_SRGB, + UR_DEVICE_INFO_IMAGE_SRGB) + PI_TO_UR_MAP_DEVICE_INFO(PI_DEVICE_INFO_BACKEND_VERSION, + UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION) + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_CODEPLAY_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP, UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT, - UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT, + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT, + UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP) + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT, UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT, + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT, UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT, + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT, UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_IMAGE_PITCH_ALIGN, - UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH, - UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT, - UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH, - UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_SUPPORT, - UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT, + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_IMAGE_PITCH_ALIGN, + UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH, + UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT, + UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH, + UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP) + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_SUPPORT, + UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP) + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT, UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY, - UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT, + PI_TO_UR_MAP_DEVICE_INFO(PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY, + UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP) + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT, UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT, + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT, UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT, + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT, UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT, + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT, UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP) - MAP(PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT, + PI_TO_UR_MAP_DEVICE_INFO( + PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT, UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP) -#undef MAP +#undef PI_TO_UR_MAP_DEVICE_INFO default: return PI_ERROR_UNKNOWN; }; @@ -2456,59 +2519,83 @@ static void pi2urImageDesc(const pi_image_format *ImageFormat, ur_image_desc_t *UrDesc) { switch (ImageFormat->image_channel_data_type) { -#define MAP(FROM, TO) \ +#define PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(FROM, TO) \ case FROM: { \ UrFormat->channelType = TO; \ break; \ } - MAP(PI_IMAGE_CHANNEL_TYPE_SNORM_INT8, UR_IMAGE_CHANNEL_TYPE_SNORM_INT8) - MAP(PI_IMAGE_CHANNEL_TYPE_SNORM_INT16, UR_IMAGE_CHANNEL_TYPE_SNORM_INT16) - MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_INT8, UR_IMAGE_CHANNEL_TYPE_UNORM_INT8) - MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_INT16, UR_IMAGE_CHANNEL_TYPE_UNORM_INT16) - MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565, - UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565) - MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555, - UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555) - MAP(PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010, - UR_IMAGE_CHANNEL_TYPE_INT_101010) - MAP(PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8) - MAP(PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16) - MAP(PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32) - MAP(PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8, - UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8) - MAP(PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16, - UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16) - MAP(PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32, - UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32) - MAP(PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT, UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT) - MAP(PI_IMAGE_CHANNEL_TYPE_FLOAT, UR_IMAGE_CHANNEL_TYPE_FLOAT) -#undef MAP + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_SNORM_INT8, + UR_IMAGE_CHANNEL_TYPE_SNORM_INT8) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_SNORM_INT16, + UR_IMAGE_CHANNEL_TYPE_SNORM_INT16) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_UNORM_INT8, + UR_IMAGE_CHANNEL_TYPE_UNORM_INT8) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_UNORM_INT16, + UR_IMAGE_CHANNEL_TYPE_UNORM_INT16) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565, + UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555, + UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010, + UR_IMAGE_CHANNEL_TYPE_INT_101010) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8, + UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16, + UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32, + UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8, + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16, + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32, + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT, + UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT) + PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(PI_IMAGE_CHANNEL_TYPE_FLOAT, + UR_IMAGE_CHANNEL_TYPE_FLOAT) +#undef PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE default: { die("piMemImageCreate: unsuppported image_channel_data_type."); } } switch (ImageFormat->image_channel_order) { -#define MAP(FROM, TO) \ +#define PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(FROM, TO) \ case FROM: { \ UrFormat->channelOrder = TO; \ break; \ } - MAP(PI_IMAGE_CHANNEL_ORDER_A, UR_IMAGE_CHANNEL_ORDER_A) - MAP(PI_IMAGE_CHANNEL_ORDER_R, UR_IMAGE_CHANNEL_ORDER_R) - MAP(PI_IMAGE_CHANNEL_ORDER_RG, UR_IMAGE_CHANNEL_ORDER_RG) - MAP(PI_IMAGE_CHANNEL_ORDER_RA, UR_IMAGE_CHANNEL_ORDER_RA) - MAP(PI_IMAGE_CHANNEL_ORDER_RGB, UR_IMAGE_CHANNEL_ORDER_RGB) - MAP(PI_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_ORDER_RGBA) - MAP(PI_IMAGE_CHANNEL_ORDER_BGRA, UR_IMAGE_CHANNEL_ORDER_BGRA) - MAP(PI_IMAGE_CHANNEL_ORDER_ARGB, UR_IMAGE_CHANNEL_ORDER_ARGB) - MAP(PI_IMAGE_CHANNEL_ORDER_ABGR, UR_IMAGE_CHANNEL_ORDER_ABGR) - MAP(PI_IMAGE_CHANNEL_ORDER_INTENSITY, UR_IMAGE_CHANNEL_ORDER_INTENSITY) - MAP(PI_IMAGE_CHANNEL_ORDER_LUMINANCE, UR_IMAGE_CHANNEL_ORDER_LUMINANCE) - MAP(PI_IMAGE_CHANNEL_ORDER_Rx, UR_IMAGE_CHANNEL_ORDER_RX) - MAP(PI_IMAGE_CHANNEL_ORDER_RGx, UR_IMAGE_CHANNEL_ORDER_RGX) - MAP(PI_IMAGE_CHANNEL_ORDER_RGBx, UR_IMAGE_CHANNEL_ORDER_RGBX) - MAP(PI_IMAGE_CHANNEL_ORDER_sRGBA, UR_IMAGE_CHANNEL_ORDER_SRGBA) -#undef MAP + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_A, + UR_IMAGE_CHANNEL_ORDER_A) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_R, + UR_IMAGE_CHANNEL_ORDER_R) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_RG, + UR_IMAGE_CHANNEL_ORDER_RG) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_RA, + UR_IMAGE_CHANNEL_ORDER_RA) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_RGB, + UR_IMAGE_CHANNEL_ORDER_RGB) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_RGBA, + UR_IMAGE_CHANNEL_ORDER_RGBA) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_BGRA, + UR_IMAGE_CHANNEL_ORDER_BGRA) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_ARGB, + UR_IMAGE_CHANNEL_ORDER_ARGB) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_ABGR, + UR_IMAGE_CHANNEL_ORDER_ABGR) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_INTENSITY, + UR_IMAGE_CHANNEL_ORDER_INTENSITY) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_LUMINANCE, + UR_IMAGE_CHANNEL_ORDER_LUMINANCE) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_Rx, + UR_IMAGE_CHANNEL_ORDER_RX) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_RGx, + UR_IMAGE_CHANNEL_ORDER_RGX) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_RGBx, + UR_IMAGE_CHANNEL_ORDER_RGBX) + PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(PI_IMAGE_CHANNEL_ORDER_sRGBA, + UR_IMAGE_CHANNEL_ORDER_SRGBA) +#undef PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER default: { die("piMemImageCreate: unsuppported image_channel_data_type."); } @@ -2523,19 +2610,22 @@ static void pi2urImageDesc(const pi_image_format *ImageFormat, UrDesc->rowPitch = ImageDesc->image_row_pitch; UrDesc->slicePitch = ImageDesc->image_slice_pitch; switch (ImageDesc->image_type) { -#define MAP(FROM, TO) \ +#define PI_TO_UR_MAP_IMAGE_TYPE(FROM, TO) \ case FROM: { \ UrDesc->type = TO; \ break; \ } - MAP(PI_MEM_TYPE_BUFFER, UR_MEM_TYPE_BUFFER) - MAP(PI_MEM_TYPE_IMAGE2D, UR_MEM_TYPE_IMAGE2D) - MAP(PI_MEM_TYPE_IMAGE3D, UR_MEM_TYPE_IMAGE3D) - MAP(PI_MEM_TYPE_IMAGE2D_ARRAY, UR_MEM_TYPE_IMAGE2D_ARRAY) - MAP(PI_MEM_TYPE_IMAGE1D, UR_MEM_TYPE_IMAGE1D) - MAP(PI_MEM_TYPE_IMAGE1D_ARRAY, UR_MEM_TYPE_IMAGE1D_ARRAY) - MAP(PI_MEM_TYPE_IMAGE1D_BUFFER, UR_MEM_TYPE_IMAGE1D_BUFFER) -#undef MAP + PI_TO_UR_MAP_IMAGE_TYPE(PI_MEM_TYPE_BUFFER, UR_MEM_TYPE_BUFFER) + PI_TO_UR_MAP_IMAGE_TYPE(PI_MEM_TYPE_IMAGE2D, UR_MEM_TYPE_IMAGE2D) + PI_TO_UR_MAP_IMAGE_TYPE(PI_MEM_TYPE_IMAGE3D, UR_MEM_TYPE_IMAGE3D) + PI_TO_UR_MAP_IMAGE_TYPE(PI_MEM_TYPE_IMAGE2D_ARRAY, + UR_MEM_TYPE_IMAGE2D_ARRAY) + PI_TO_UR_MAP_IMAGE_TYPE(PI_MEM_TYPE_IMAGE1D, UR_MEM_TYPE_IMAGE1D) + PI_TO_UR_MAP_IMAGE_TYPE(PI_MEM_TYPE_IMAGE1D_ARRAY, + UR_MEM_TYPE_IMAGE1D_ARRAY) + PI_TO_UR_MAP_IMAGE_TYPE(PI_MEM_TYPE_IMAGE1D_BUFFER, + UR_MEM_TYPE_IMAGE1D_BUFFER) +#undef PI_TO_UR_MAP_IMAGE_TYPE default: { die("piMemImageCreate: unsuppported image_type."); } @@ -2548,60 +2638,84 @@ static void pi2urImageDesc(const pi_image_format *ImageFormat, static void ur2piImageFormat(const ur_image_format_t *UrFormat, pi_image_format *PiFormat) { switch (UrFormat->channelOrder) { -#define MAP(FROM, TO) \ +#define UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(FROM, TO) \ case FROM: { \ PiFormat->image_channel_order = TO; \ break; \ } - MAP(UR_IMAGE_CHANNEL_ORDER_A, PI_IMAGE_CHANNEL_ORDER_A) - MAP(UR_IMAGE_CHANNEL_ORDER_R, PI_IMAGE_CHANNEL_ORDER_R) - MAP(UR_IMAGE_CHANNEL_ORDER_RG, PI_IMAGE_CHANNEL_ORDER_RG) - MAP(UR_IMAGE_CHANNEL_ORDER_RA, PI_IMAGE_CHANNEL_ORDER_RA) - MAP(UR_IMAGE_CHANNEL_ORDER_RGB, PI_IMAGE_CHANNEL_ORDER_RGB) - MAP(UR_IMAGE_CHANNEL_ORDER_RGBA, PI_IMAGE_CHANNEL_ORDER_RGBA) - MAP(UR_IMAGE_CHANNEL_ORDER_BGRA, PI_IMAGE_CHANNEL_ORDER_BGRA) - MAP(UR_IMAGE_CHANNEL_ORDER_ARGB, PI_IMAGE_CHANNEL_ORDER_ARGB) - MAP(UR_IMAGE_CHANNEL_ORDER_ABGR, PI_IMAGE_CHANNEL_ORDER_ABGR) - MAP(UR_IMAGE_CHANNEL_ORDER_INTENSITY, PI_IMAGE_CHANNEL_ORDER_INTENSITY) - MAP(UR_IMAGE_CHANNEL_ORDER_LUMINANCE, PI_IMAGE_CHANNEL_ORDER_LUMINANCE) - MAP(UR_IMAGE_CHANNEL_ORDER_RX, PI_IMAGE_CHANNEL_ORDER_Rx) - MAP(UR_IMAGE_CHANNEL_ORDER_RGX, PI_IMAGE_CHANNEL_ORDER_RGx) - MAP(UR_IMAGE_CHANNEL_ORDER_RGBX, PI_IMAGE_CHANNEL_ORDER_RGBx) - MAP(UR_IMAGE_CHANNEL_ORDER_SRGBA, PI_IMAGE_CHANNEL_ORDER_sRGBA) -#undef MAP + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_A, + PI_IMAGE_CHANNEL_ORDER_A) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_R, + PI_IMAGE_CHANNEL_ORDER_R) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_RG, + PI_IMAGE_CHANNEL_ORDER_RG) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_RA, + PI_IMAGE_CHANNEL_ORDER_RA) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_RGB, + PI_IMAGE_CHANNEL_ORDER_RGB) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_RGBA, + PI_IMAGE_CHANNEL_ORDER_RGBA) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_BGRA, + PI_IMAGE_CHANNEL_ORDER_BGRA) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_ARGB, + PI_IMAGE_CHANNEL_ORDER_ARGB) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_ABGR, + PI_IMAGE_CHANNEL_ORDER_ABGR) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_INTENSITY, + PI_IMAGE_CHANNEL_ORDER_INTENSITY) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_LUMINANCE, + PI_IMAGE_CHANNEL_ORDER_LUMINANCE) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_RX, + PI_IMAGE_CHANNEL_ORDER_Rx) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_RGX, + PI_IMAGE_CHANNEL_ORDER_RGx) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_RGBX, + PI_IMAGE_CHANNEL_ORDER_RGBx) + UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(UR_IMAGE_CHANNEL_ORDER_SRGBA, + PI_IMAGE_CHANNEL_ORDER_sRGBA) +#undef UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER default: { die("ur2piImageFormat: unsuppported channelOrder."); } } switch (UrFormat->channelType) { -#define MAP(FROM, TO) \ +#define UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(FROM, TO) \ case FROM: { \ PiFormat->image_channel_data_type = TO; \ break; \ } - MAP(UR_IMAGE_CHANNEL_TYPE_SNORM_INT8, PI_IMAGE_CHANNEL_TYPE_SNORM_INT8) - MAP(UR_IMAGE_CHANNEL_TYPE_SNORM_INT16, PI_IMAGE_CHANNEL_TYPE_SNORM_INT16) - MAP(UR_IMAGE_CHANNEL_TYPE_UNORM_INT8, PI_IMAGE_CHANNEL_TYPE_UNORM_INT8) - MAP(UR_IMAGE_CHANNEL_TYPE_UNORM_INT16, PI_IMAGE_CHANNEL_TYPE_UNORM_INT16) - MAP(UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565, - PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565) - MAP(UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555, - PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555) - MAP(UR_IMAGE_CHANNEL_TYPE_INT_101010, - PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010) - MAP(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8, PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8) - MAP(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16, PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16) - MAP(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32, PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32) - MAP(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8, - PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8) - MAP(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16, - PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16) - MAP(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32, - PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32) - MAP(UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT, PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT) - MAP(UR_IMAGE_CHANNEL_TYPE_FLOAT, PI_IMAGE_CHANNEL_TYPE_FLOAT) -#undef MAP + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_SNORM_INT8, + PI_IMAGE_CHANNEL_TYPE_SNORM_INT8) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_SNORM_INT16, + PI_IMAGE_CHANNEL_TYPE_SNORM_INT16) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_UNORM_INT8, + PI_IMAGE_CHANNEL_TYPE_UNORM_INT8) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_UNORM_INT16, + PI_IMAGE_CHANNEL_TYPE_UNORM_INT16) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565, + PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555, + PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_INT_101010, + PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8, + PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16, + PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32, + PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8, + PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16, + PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32, + PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT, + PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT) + UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(UR_IMAGE_CHANNEL_TYPE_FLOAT, + PI_IMAGE_CHANNEL_TYPE_FLOAT) +#undef UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE default: { die("ur2piImageFormat: unsuppported channelType."); } @@ -4400,13 +4514,13 @@ inline pi_result piextMemMipmapFree(pi_context Context, pi_device Device, static void pi2urImageCopyFlags(const pi_image_copy_flags PiFlags, ur_exp_image_copy_flags_t *UrFlags) { switch (PiFlags) { - case PI_IMAGE_COPY_HTOD: + case PI_IMAGE_COPY_HOST_TO_DEVICE: *UrFlags = UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE; break; - case PI_IMAGE_COPY_DTOH: + case PI_IMAGE_COPY_DEVICE_TO_HOST: *UrFlags = UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST; break; - case PI_IMAGE_COPY_DTOD: + case PI_IMAGE_COPY_DEVICE_TO_DEVICE: *UrFlags = UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE; break; default: @@ -4491,19 +4605,19 @@ inline pi_result piextMemSampledImageHandleDestroy(pi_context Context, static void pi2urImageInfoFlags(const pi_image_info PiFlags, ur_image_info_t *UrFlags) { switch (PiFlags) { -#define MAP(FROM, TO) \ +#define PI_TO_UR_IMAGE_INFO(FROM, TO) \ case FROM: { \ *UrFlags = TO; \ return; \ } - MAP(PI_IMAGE_INFO_FORMAT, UR_IMAGE_INFO_FORMAT) - MAP(PI_IMAGE_INFO_ELEMENT_SIZE, UR_IMAGE_INFO_ELEMENT_SIZE) - MAP(PI_IMAGE_INFO_ROW_PITCH, UR_IMAGE_INFO_ROW_PITCH) - MAP(PI_IMAGE_INFO_SLICE_PITCH, UR_IMAGE_INFO_SLICE_PITCH) - MAP(PI_IMAGE_INFO_WIDTH, UR_IMAGE_INFO_WIDTH) - MAP(PI_IMAGE_INFO_HEIGHT, UR_IMAGE_INFO_HEIGHT) - MAP(PI_IMAGE_INFO_DEPTH, UR_IMAGE_INFO_DEPTH) -#undef MAP + PI_TO_UR_IMAGE_INFO(PI_IMAGE_INFO_FORMAT, UR_IMAGE_INFO_FORMAT) + PI_TO_UR_IMAGE_INFO(PI_IMAGE_INFO_ELEMENT_SIZE, UR_IMAGE_INFO_ELEMENT_SIZE) + PI_TO_UR_IMAGE_INFO(PI_IMAGE_INFO_ROW_PITCH, UR_IMAGE_INFO_ROW_PITCH) + PI_TO_UR_IMAGE_INFO(PI_IMAGE_INFO_SLICE_PITCH, UR_IMAGE_INFO_SLICE_PITCH) + PI_TO_UR_IMAGE_INFO(PI_IMAGE_INFO_WIDTH, UR_IMAGE_INFO_WIDTH) + PI_TO_UR_IMAGE_INFO(PI_IMAGE_INFO_HEIGHT, UR_IMAGE_INFO_HEIGHT) + PI_TO_UR_IMAGE_INFO(PI_IMAGE_INFO_DEPTH, UR_IMAGE_INFO_DEPTH) +#undef PI_TO_UR_IMAGE_INFO default: die("pi2urImageInfoFlags: Unsupported use case"); } diff --git a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp index b4680e716ac01..4f66ad7506843 100644 --- a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp +++ b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp @@ -354,6 +354,16 @@ __SYCL_EXPORT pi_result piextUSMSharedAlloc(void **ResultPtr, Size, Alignment); } +__SYCL_EXPORT pi_result piextUSMPitchedAlloc( + void **ResultPtr, size_t *ResultPitch, pi_context Context, pi_device Device, + pi_usm_mem_properties *Properties, size_t WidthInBytes, size_t Height, + unsigned int ElementSizeBytes) { + + return pi2ur::piextUSMPitchedAlloc(ResultPtr, ResultPitch, Context, Device, + Properties, WidthInBytes, Height, + ElementSizeBytes); +} + __SYCL_EXPORT pi_result piextUSMFree(pi_context Context, void *Ptr) { return pi2ur::piextUSMFree(Context, Ptr); } @@ -1101,6 +1111,140 @@ __SYCL_EXPORT pi_result piPluginGetBackendOption(pi_platform platform, backend_option); } +__SYCL_EXPORT pi_result piextMemImageAllocate(pi_context Context, + pi_device Device, + pi_image_format *ImageFormat, + pi_image_desc *ImageDesc, + pi_image_mem_handle *RetMem) { + return pi2ur::piextMemImageAllocate(Context, Device, ImageFormat, ImageDesc, + RetMem); +} + +__SYCL_EXPORT pi_result piextMemUnsampledImageCreate( + pi_context Context, pi_device Device, pi_image_mem_handle ImgMem, + pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_mem *RetMem, + pi_image_handle *RetHandle) { + return pi2ur::piextMemUnsampledImageCreate( + Context, Device, ImgMem, ImageFormat, ImageDesc, RetMem, RetHandle); +} + +__SYCL_EXPORT pi_result piextMemSampledImageCreate( + pi_context Context, pi_device Device, pi_image_mem_handle ImgMem, + pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_sampler Sampler, + pi_mem *RetMem, pi_image_handle *RetHandle) { + return pi2ur::piextMemSampledImageCreate(Context, Device, ImgMem, ImageFormat, + ImageDesc, Sampler, RetMem, + RetHandle); +} + +__SYCL_EXPORT pi_result piextBindlessImageSamplerCreate( + pi_context Context, const pi_sampler_properties *SamplerProperties, + float MinMipmapLevelClamp, float MaxMipmapLevelClamp, float MaxAnisotropy, + pi_sampler *RetSampler) { + return pi2ur::piextBindlessImageSamplerCreate( + Context, SamplerProperties, MinMipmapLevelClamp, MaxMipmapLevelClamp, + MaxAnisotropy, RetSampler); +} + +__SYCL_EXPORT pi_result piextMemMipmapGetLevel(pi_context Context, + pi_device Device, + pi_image_mem_handle MipMem, + unsigned int Level, + pi_image_mem_handle *RetMem) { + return pi2ur::piextMemMipmapGetLevel(Context, Device, MipMem, Level, RetMem); +} + +__SYCL_EXPORT pi_result piextMemImageFree(pi_context Context, pi_device Device, + pi_image_mem_handle MemoryHandle) { + return pi2ur::piextMemImageFree(Context, Device, MemoryHandle); +} + +__SYCL_EXPORT pi_result piextMemMipmapFree(pi_context Context, pi_device Device, + pi_image_mem_handle MemoryHandle) { + return pi2ur::piextMemMipmapFree(Context, Device, MemoryHandle); +} + +__SYCL_EXPORT pi_result piextMemImageCopy( + pi_queue Queue, void *DstPtr, void *SrcPtr, + const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, + const pi_image_copy_flags Flags, pi_image_offset SrcOffset, + pi_image_offset DstOffset, pi_image_region CopyExtent, + pi_image_region HostExtent, pi_uint32 NumEventsInWaitList, + const pi_event *EventWaitList, pi_event *Event) { + return pi2ur::piextMemImageCopy(Queue, DstPtr, SrcPtr, ImageFormat, ImageDesc, + Flags, SrcOffset, DstOffset, CopyExtent, + HostExtent, NumEventsInWaitList, + EventWaitList, Event); +} + +__SYCL_EXPORT pi_result piextMemUnsampledImageHandleDestroy( + pi_context Context, pi_device Device, pi_image_handle Handle) { + return pi2ur::piextMemUnsampledImageHandleDestroy(Context, Device, Handle); +} + +__SYCL_EXPORT pi_result piextMemSampledImageHandleDestroy( + pi_context Context, pi_device Device, pi_image_handle Handle) { + return pi2ur::piextMemSampledImageHandleDestroy(Context, Device, Handle); +} + +__SYCL_EXPORT pi_result piextMemImageGetInfo(pi_image_mem_handle MemHandle, + pi_image_info ParamName, + void *ParamValue, + size_t *ParamValueSizeRet) { + return pi2ur::piextMemImageGetInfo(MemHandle, ParamName, ParamValue, + ParamValueSizeRet); +} + +__SYCL_EXPORT pi_result +piextMemImportOpaqueFD(pi_context Context, pi_device Device, size_t Size, + int FileDescriptor, pi_interop_mem_handle *RetHandle) { + return pi2ur::piextMemImportOpaqueFD(Context, Device, Size, FileDescriptor, + RetHandle); +} + +__SYCL_EXPORT pi_result piextMemMapExternalArray( + pi_context Context, pi_device Device, pi_image_format *ImageFormat, + pi_image_desc *ImageDesc, pi_interop_mem_handle MemHandle, + pi_image_mem_handle *RetMem) { + return pi2ur::piextMemMapExternalArray(Context, Device, ImageFormat, + ImageDesc, MemHandle, RetMem); +} + +__SYCL_EXPORT pi_result piextMemReleaseInterop(pi_context Context, + pi_device Device, + pi_interop_mem_handle ExtMem) { + return pi2ur::piextMemReleaseInterop(Context, Device, ExtMem); +} + +__SYCL_EXPORT pi_result piextImportExternalSemaphoreOpaqueFD( + pi_context Context, pi_device Device, int FileDescriptor, + pi_interop_semaphore_handle *RetHandle) { + return pi2ur::piextImportExternalSemaphoreOpaqueFD(Context, Device, + FileDescriptor, RetHandle); +} + +__SYCL_EXPORT pi_result +piextDestroyExternalSemaphore(pi_context Context, pi_device Device, + pi_interop_semaphore_handle SemHandle) { + return pi2ur::piextDestroyExternalSemaphore(Context, Device, SemHandle); +} + +__SYCL_EXPORT pi_result piextWaitExternalSemaphore( + pi_queue Queue, pi_interop_semaphore_handle SemHandle, + pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, + pi_event *Event) { + return pi2ur::piextWaitExternalSemaphore( + Queue, SemHandle, NumEventsInWaitList, EventWaitList, Event); +} + +__SYCL_EXPORT pi_result piextSignalExternalSemaphore( + pi_queue Queue, pi_interop_semaphore_handle SemHandle, + pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, + pi_event *Event) { + return pi2ur::piextSignalExternalSemaphore( + Queue, SemHandle, NumEventsInWaitList, EventWaitList, Event); +} + // This interface is not in Unified Runtime currently __SYCL_EXPORT pi_result piTearDown(void *PluginParameter) { return pi2ur::piTearDown(PluginParameter); diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp index e6f084ef31aa6..c1a6378fd5810 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp @@ -98,24 +98,33 @@ urToCudaImageChannelFormat(ur_image_channel_type_t image_channel_type, ur_result_t cudaToUrImageChannelFormat(CUarray_format cuda_format, ur_image_channel_type_t *return_image_channel_type) { - UR_ASSERT(return_image_channel_type, UR_RESULT_ERROR_INVALID_NULL_POINTER); switch (cuda_format) { -#define MAP(FROM, TO) \ +#define CUDA_TO_UR_IMAGE_CHANNEL_TYPE(FROM, TO) \ case FROM: { \ *return_image_channel_type = TO; \ return UR_RESULT_SUCCESS; \ } - MAP(CU_AD_FORMAT_UNSIGNED_INT8, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8); - MAP(CU_AD_FORMAT_UNSIGNED_INT16, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16); - MAP(CU_AD_FORMAT_UNSIGNED_INT32, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32); - MAP(CU_AD_FORMAT_SIGNED_INT8, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8); - MAP(CU_AD_FORMAT_SIGNED_INT16, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16); - MAP(CU_AD_FORMAT_SIGNED_INT32, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32); - MAP(CU_AD_FORMAT_HALF, UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT); - MAP(CU_AD_FORMAT_FLOAT, UR_IMAGE_CHANNEL_TYPE_FLOAT); - MAP(CU_AD_FORMAT_UNORM_INT8X1, UR_IMAGE_CHANNEL_TYPE_UNORM_INT8); - MAP(CU_AD_FORMAT_UNORM_INT16X1, UR_IMAGE_CHANNEL_TYPE_UNORM_INT16); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_UNSIGNED_INT8, + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_UNSIGNED_INT16, + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_UNSIGNED_INT32, + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_SIGNED_INT8, + UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_SIGNED_INT16, + UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_SIGNED_INT32, + UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_HALF, + UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_FLOAT, + UR_IMAGE_CHANNEL_TYPE_FLOAT); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_UNORM_INT8X1, + UR_IMAGE_CHANNEL_TYPE_UNORM_INT8); + CUDA_TO_UR_IMAGE_CHANNEL_TYPE(CU_AD_FORMAT_UNORM_INT16X1, + UR_IMAGE_CHANNEL_TYPE_UNORM_INT16); #undef MAP default: return UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; @@ -127,9 +136,6 @@ ur_result_t urTextureCreate(ur_context_handle_t hContext, const ur_image_desc_t *pImageDesc, CUDA_RESOURCE_DESC ResourceDesc, ur_exp_image_handle_t *phRetImage) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(phRetImage, UR_RESULT_ERROR_INVALID_NULL_POINTER); try { /// pi_sampler_properties @@ -207,9 +213,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp( const ur_usm_desc_t *pUSMDesc, ur_usm_pool_handle_t pool, size_t widthInBytes, size_t height, size_t elementSizeBytes, void **ppMem, size_t *pResultPitch) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(ppMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(pResultPitch, UR_RESULT_ERROR_INVALID_NULL_POINTER); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); std::ignore = pUSMDesc; @@ -246,11 +249,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageHandleDestroyExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_handle_t hImage) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(hImage, UR_RESULT_ERROR_INVALID_NULL_HANDLE); return UR_CHECK_ERROR(cuSurfObjectDestroy((CUsurfObject)hImage)); } @@ -259,11 +259,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageHandleDestroyExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_handle_t hImage) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(hImage, UR_RESULT_ERROR_INVALID_NULL_HANDLE); return UR_CHECK_ERROR(cuTexObjectDestroy((CUtexObject)hImage)); } @@ -272,13 +269,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, ur_exp_image_mem_handle_t *phImageMem) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(phImageMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); // Populate descriptor CUDA_ARRAY3D_DESCRIPTOR array_desc = {}; @@ -342,11 +334,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageFreeExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_mem_handle_t hImageMem) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); ScopedContext Active(hDevice->getContext()); try { @@ -364,15 +353,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( ur_exp_image_mem_handle_t hImageMem, const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, ur_mem_handle_t *phMem, ur_exp_image_handle_t *phImage) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(phMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(phImage, UR_RESULT_ERROR_INVALID_NULL_POINTER); unsigned int NumChannels = 0; UR_CHECK_ERROR( @@ -422,15 +404,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( ur_exp_image_mem_handle_t hImageMem, const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, ur_sampler_handle_t hSampler, ur_mem_handle_t *phMem, ur_exp_image_handle_t *phImage) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(phMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(phImage, UR_RESULT_ERROR_INVALID_NULL_POINTER); ScopedContext Active(hDevice->getContext()); @@ -518,11 +493,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( ur_rect_offset_t dstOffset, ur_rect_region_t copyExtent, ur_rect_region_t hostExtent, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - UR_ASSERT(hQueue, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(pDst, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(pSrc, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); UR_ASSERT((imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE || imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST || imageCopyFlags == UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE), @@ -663,7 +633,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( ur_exp_image_mem_handle_t hImageMem, ur_image_info_t propName, void *pPropValue, size_t *pPropSizeRet) { - UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); CUDA_ARRAY3D_DESCRIPTOR ArrayDesc; UR_CHECK_ERROR(cuArray3DGetDescriptor(&ArrayDesc, (CUarray)hImageMem)); @@ -726,12 +695,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_mem_handle_t hImageMem, uint32_t mipmapLevel, ur_exp_image_mem_handle_t *phImageMem) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(hImageMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(phImageMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); try { ScopedContext Active(hDevice->getContext()); @@ -751,11 +716,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_mem_handle_t hMem) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(hMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); ScopedContext Active(hDevice->getContext()); try { @@ -771,11 +733,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, size_t size, uint32_t fileDescriptor, ur_exp_interop_mem_handle_t *phInteropMem) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(phInteropMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); try { ScopedContext Active(hDevice->getContext()); @@ -803,14 +762,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, ur_exp_interop_mem_handle_t hInteropMem, ur_exp_image_mem_handle_t *phImageMem) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(pImageFormat, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(pImageDesc, UR_RESULT_ERROR_INVALID_NULL_POINTER); - UR_ASSERT(hInteropMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(phImageMem, UR_RESULT_ERROR_INVALID_NULL_POINTER); unsigned int NumChannels = 0; UR_CHECK_ERROR( @@ -854,11 +807,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesReleaseInteropExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_interop_mem_handle_t hInteropMem) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(hInteropMem, UR_RESULT_ERROR_INVALID_NULL_HANDLE); try { ScopedContext Active(hDevice->getContext()); @@ -876,11 +826,8 @@ urBindlessImagesImportExternalSemaphoreOpaqueFDExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, uint32_t fileDescriptor, ur_exp_interop_semaphore_handle_t *phInteropSemaphoreHandle) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(phInteropSemaphoreHandle, UR_RESULT_ERROR_INVALID_NULL_POINTER); try { ScopedContext Active(hDevice->getContext()); @@ -904,11 +851,8 @@ urBindlessImagesImportExternalSemaphoreOpaqueFDExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesDestroyExternalSemaphoreExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_interop_semaphore_handle_t hInteropSemaphore) { - UR_ASSERT(hContext, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); - UR_ASSERT(hInteropSemaphore, UR_RESULT_ERROR_INVALID_NULL_HANDLE); try { ScopedContext Active(hDevice->getContext()); @@ -926,8 +870,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( ur_queue_handle_t hQueue, ur_exp_interop_semaphore_handle_t hSemaphore, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - UR_ASSERT(hQueue, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hSemaphore, UR_RESULT_ERROR_INVALID_NULL_HANDLE); try { ScopedContext Active(hQueue->getContext()); @@ -960,8 +902,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( ur_queue_handle_t hQueue, ur_exp_interop_semaphore_handle_t hSemaphore, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - UR_ASSERT(hQueue, UR_RESULT_ERROR_INVALID_NULL_HANDLE); - UR_ASSERT(hSemaphore, UR_RESULT_ERROR_INVALID_NULL_HANDLE); try { ScopedContext Active(hQueue->getContext()); From 5e41d208b1888544a552f072530afeb76fed7ad0 Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Mon, 10 Jul 2023 15:07:22 +0100 Subject: [PATCH 13/19] Address Feedback * Move L0 impl to UR adapter --- sycl/plugins/level_zero/CMakeLists.txt | 6 +- sycl/plugins/level_zero/pi_level_zero.cpp | 286 ++++++------------ sycl/plugins/unified_runtime/CMakeLists.txt | 2 + .../ur/adapters/level_zero/image.cpp | 250 +++++++++++++++ .../ur/adapters/level_zero/image.hpp | 13 + .../level_zero/ur_interface_loader.cpp | 43 +++ .../ur/adapters/level_zero/ur_level_zero.hpp | 1 + 7 files changed, 411 insertions(+), 190 deletions(-) create mode 100644 sycl/plugins/unified_runtime/ur/adapters/level_zero/image.cpp create mode 100644 sycl/plugins/unified_runtime/ur/adapters/level_zero/image.hpp diff --git a/sycl/plugins/level_zero/CMakeLists.txt b/sycl/plugins/level_zero/CMakeLists.txt index 995989eaf4c65..a8b729af89ac9 100755 --- a/sycl/plugins/level_zero/CMakeLists.txt +++ b/sycl/plugins/level_zero/CMakeLists.txt @@ -107,8 +107,9 @@ add_sycl_plugin(level_zero "../unified_runtime/ur/adapters/level_zero/context.hpp" "../unified_runtime/ur/adapters/level_zero/device.hpp" "../unified_runtime/ur/adapters/level_zero/event.hpp" - "../unified_runtime/ur/adapters/level_zero/memory.hpp" + "../unified_runtime/ur/adapters/level_zero/image.hpp" "../unified_runtime/ur/adapters/level_zero/kernel.hpp" + "../unified_runtime/ur/adapters/level_zero/memory.hpp" "../unified_runtime/ur/adapters/level_zero/platform.hpp" "../unified_runtime/ur/adapters/level_zero/program.hpp" "../unified_runtime/ur/adapters/level_zero/queue.hpp" @@ -120,8 +121,9 @@ add_sycl_plugin(level_zero "../unified_runtime/ur/adapters/level_zero/context.cpp" "../unified_runtime/ur/adapters/level_zero/device.cpp" "../unified_runtime/ur/adapters/level_zero/event.cpp" - "../unified_runtime/ur/adapters/level_zero/memory.cpp" + "../unified_runtime/ur/adapters/level_zero/image.cpp" "../unified_runtime/ur/adapters/level_zero/kernel.cpp" + "../unified_runtime/ur/adapters/level_zero/memory.cpp" "../unified_runtime/ur/adapters/level_zero/platform.cpp" "../unified_runtime/ur/adapters/level_zero/program.cpp" "../unified_runtime/ur/adapters/level_zero/queue.cpp" diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index 40b1fad4fb8ba..1890e7930bb5d 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -391,228 +391,138 @@ pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName, ParamValueSizeRet); } -pi_result -piextMemUnsampledImageHandleDestroy([[maybe_unused]] pi_context context, - [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_image_handle handle) { - - die("piextMemUnsampledImageHandleDestroy not implemented on level zero " - "backend.\n"); - pi_result retErr = PI_ERROR_UNKNOWN; - - return retErr; +__SYCL_EXPORT pi_result piextMemImageAllocate(pi_context Context, + pi_device Device, + pi_image_format *ImageFormat, + pi_image_desc *ImageDesc, + pi_image_mem_handle *RetMem) { + return pi2ur::piextMemImageAllocate(Context, Device, ImageFormat, ImageDesc, + RetMem); } -pi_result -piextMemSampledImageHandleDestroy([[maybe_unused]] pi_context context, - [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_image_handle handle) { - - die("piextMemSampledImageHandleDestroy not implemented on level zero " - "backend.\n"); - pi_result retErr = PI_ERROR_UNKNOWN; - - return retErr; +__SYCL_EXPORT pi_result piextMemUnsampledImageCreate( + pi_context Context, pi_device Device, pi_image_mem_handle ImgMem, + pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_mem *RetMem, + pi_image_handle *RetHandle) { + return pi2ur::piextMemUnsampledImageCreate( + Context, Device, ImgMem, ImageFormat, ImageDesc, RetMem, RetHandle); } -pi_result piextMemImageAllocate([[maybe_unused]] pi_context context, - [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_image_format *image_format, - [[maybe_unused]] pi_image_desc *image_desc, - [[maybe_unused]] pi_image_mem_handle *ret_mem) { - - die("piExtMemImageAllocate not implemented on level zero backend.\n"); - // No image formats are supported! - pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return retErr; +__SYCL_EXPORT pi_result piextMemSampledImageCreate( + pi_context Context, pi_device Device, pi_image_mem_handle ImgMem, + pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_sampler Sampler, + pi_mem *RetMem, pi_image_handle *RetHandle) { + return pi2ur::piextMemSampledImageCreate(Context, Device, ImgMem, ImageFormat, + ImageDesc, Sampler, RetMem, + RetHandle); } -pi_result -piextMemMipmapGetLevel([[maybe_unused]] pi_context context, - [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_image_mem_handle mip_mem, - [[maybe_unused]] unsigned int level, - [[maybe_unused]] pi_image_mem_handle *ret_mem) { - - die("piextMemMipmapGetLevel not implemented on level zero backend.\n"); - pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return retErr; +__SYCL_EXPORT pi_result piextBindlessImageSamplerCreate( + pi_context Context, const pi_sampler_properties *SamplerProperties, + float MinMipmapLevelClamp, float MaxMipmapLevelClamp, float MaxAnisotropy, + pi_sampler *RetSampler) { + return pi2ur::piextBindlessImageSamplerCreate( + Context, SamplerProperties, MinMipmapLevelClamp, MaxMipmapLevelClamp, + MaxAnisotropy, RetSampler); } -pi_result -piextMemImageFree([[maybe_unused]] pi_context context, - [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_image_mem_handle memory_handle) { - - pi_result retErr = PI_SUCCESS; - die("piExtMemImageFree not implemented on level zero backend.\n"); - - return retErr; +__SYCL_EXPORT pi_result piextMemMipmapGetLevel(pi_context Context, + pi_device Device, + pi_image_mem_handle MipMem, + unsigned int Level, + pi_image_mem_handle *RetMem) { + return pi2ur::piextMemMipmapGetLevel(Context, Device, MipMem, Level, RetMem); } -pi_result -piextMemMipmapFree([[maybe_unused]] pi_context context, - [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_image_mem_handle memory_handle) { - - die("piextMemMipmapFree not implemented on level zero backend.\n"); - // No image formats are supported! - pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return retErr; +__SYCL_EXPORT pi_result piextMemImageFree(pi_context Context, pi_device Device, + pi_image_mem_handle MemoryHandle) { + return pi2ur::piextMemImageFree(Context, Device, MemoryHandle); } -pi_result piextMemUnsampledImageCreate( - [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_image_mem_handle img_mem, - [[maybe_unused]] pi_image_format *image_format, - [[maybe_unused]] pi_image_desc *desc, [[maybe_unused]] pi_mem *ret_mem, - [[maybe_unused]] pi_image_handle *ret_handle) { - - die("piextMemUnsampledImageCreate not implemented on level zero backend.\n"); - // No image formats are supported! - pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return retErr; +__SYCL_EXPORT pi_result piextMemMipmapFree(pi_context Context, pi_device Device, + pi_image_mem_handle MemoryHandle) { + return pi2ur::piextMemMipmapFree(Context, Device, MemoryHandle); } -pi_result piextMemImportOpaqueFD( - [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, - [[maybe_unused]] size_t size, [[maybe_unused]] int file_descriptor, - [[maybe_unused]] pi_interop_mem_handle *ret_handle) { - - die("piextMemImportOpaqueFD not implemented on level zero backend.\n"); - pi_result retErr = PI_ERROR_UNKNOWN; - return retErr; +__SYCL_EXPORT pi_result piextMemImageCopy( + pi_queue Queue, void *DstPtr, void *SrcPtr, + const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, + const pi_image_copy_flags Flags, pi_image_offset SrcOffset, + pi_image_offset DstOffset, pi_image_region CopyExtent, + pi_image_region HostExtent, pi_uint32 NumEventsInWaitList, + const pi_event *EventWaitList, pi_event *Event) { + return pi2ur::piextMemImageCopy(Queue, DstPtr, SrcPtr, ImageFormat, ImageDesc, + Flags, SrcOffset, DstOffset, CopyExtent, + HostExtent, NumEventsInWaitList, + EventWaitList, Event); } -pi_result piextImportExternalSemaphoreOpaqueFD( - [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, - [[maybe_unused]] int file_descriptor, - [[maybe_unused]] pi_interop_semaphore_handle *ret_handle) { - - die("piextImportExternalSemaphoreOpaqueFD not implemented on level zero " - "backend.\n"); - pi_result retErr = PI_ERROR_UNKNOWN; - return retErr; +__SYCL_EXPORT pi_result piextMemUnsampledImageHandleDestroy( + pi_context Context, pi_device Device, pi_image_handle Handle) { + return pi2ur::piextMemUnsampledImageHandleDestroy(Context, Device, Handle); } -pi_result piextDestroyExternalSemaphore( - [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_interop_semaphore_handle sem_handle) { - - die("piextDestroyExternalSemaphore not implemented on level zero " - "backend.\n"); - pi_result retErr = PI_ERROR_UNKNOWN; - return retErr; +__SYCL_EXPORT pi_result piextMemSampledImageHandleDestroy( + pi_context Context, pi_device Device, pi_image_handle Handle) { + return pi2ur::piextMemSampledImageHandleDestroy(Context, Device, Handle); } -pi_result piextWaitExternalSemaphore( - [[maybe_unused]] pi_queue command_queue, - [[maybe_unused]] pi_interop_semaphore_handle sem_handle, - [[maybe_unused]] pi_uint32 num_events_in_wait_list, - [[maybe_unused]] const pi_event *event_wait_list, - [[maybe_unused]] pi_event *event) { - - die("piextWaitExternalSemaphore not implemented on level zero " - "backend.\n"); - pi_result retErr = PI_ERROR_UNKNOWN; - return retErr; +__SYCL_EXPORT pi_result piextMemImageGetInfo(pi_image_mem_handle MemHandle, + pi_image_info ParamName, + void *ParamValue, + size_t *ParamValueSizeRet) { + return pi2ur::piextMemImageGetInfo(MemHandle, ParamName, ParamValue, + ParamValueSizeRet); } -pi_result piextSignalExternalSemaphore( - [[maybe_unused]] pi_queue command_queue, - [[maybe_unused]] pi_interop_semaphore_handle sem_handle, - [[maybe_unused]] pi_uint32 num_events_in_wait_list, - [[maybe_unused]] const pi_event *event_wait_list, - [[maybe_unused]] pi_event *event) { - - die("piextSignalExternalSemaphore not implemented on level zero " - "backend.\n"); - pi_result retErr = PI_ERROR_UNKNOWN; - return retErr; +__SYCL_EXPORT pi_result +piextMemImportOpaqueFD(pi_context Context, pi_device Device, size_t Size, + int FileDescriptor, pi_interop_mem_handle *RetHandle) { + return pi2ur::piextMemImportOpaqueFD(Context, Device, Size, FileDescriptor, + RetHandle); } -pi_result -piextMemMapExternalArray([[maybe_unused]] pi_context context, - [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_image_format *image_format, - [[maybe_unused]] pi_image_desc *image_desc, - [[maybe_unused]] pi_interop_mem_handle mem_handle, - [[maybe_unused]] pi_image_mem_handle *ret_mem) { - - die("piextMemMapExternalArray given unsupported image_channel_order.\n"); - - pi_result retErr = PI_ERROR_UNKNOWN; - return retErr; +__SYCL_EXPORT pi_result piextMemMapExternalArray( + pi_context Context, pi_device Device, pi_image_format *ImageFormat, + pi_image_desc *ImageDesc, pi_interop_mem_handle MemHandle, + pi_image_mem_handle *RetMem) { + return pi2ur::piextMemMapExternalArray(Context, Device, ImageFormat, + ImageDesc, MemHandle, RetMem); } -pi_result -piextMemReleaseInterop([[maybe_unused]] pi_context context, - [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_interop_mem_handle ext_mem) { - - die("piextMemReleaseInterop not implemented on level zero backend.\n"); - pi_result retErr = PI_ERROR_UNKNOWN; - return retErr; +__SYCL_EXPORT pi_result piextMemReleaseInterop(pi_context Context, + pi_device Device, + pi_interop_mem_handle ExtMem) { + return pi2ur::piextMemReleaseInterop(Context, Device, ExtMem); } -pi_result piextMemSampledImageCreate( - [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_image_mem_handle img_mem, - [[maybe_unused]] pi_image_format *format, - [[maybe_unused]] pi_image_desc *desc, [[maybe_unused]] pi_sampler sampler, - [[maybe_unused]] pi_mem *ret_mem, - [[maybe_unused]] pi_image_handle *ret_handle) { - - die("piExtMemSampledImageCreate not implemented on level zero backend.\n"); - // No image formats are supported! - pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return retErr; +__SYCL_EXPORT pi_result piextImportExternalSemaphoreOpaqueFD( + pi_context Context, pi_device Device, int FileDescriptor, + pi_interop_semaphore_handle *RetHandle) { + return pi2ur::piextImportExternalSemaphoreOpaqueFD(Context, Device, + FileDescriptor, RetHandle); } -pi_result piextBindlessImageSamplerCreate( - [[maybe_unused]] pi_context context, - [[maybe_unused]] const pi_sampler_properties *sampler_properties, - [[maybe_unused]] float min_mipmap_level_clamp, - [[maybe_unused]] float max_mipmap_level_clamp, - [[maybe_unused]] float max_anisotropy, - [[maybe_unused]] pi_sampler *result_sampler) { - - die("piextBindlessImageSamplerCreate not implemented on level zero " - "backend.\n"); - // No image formats are supported! - pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return retErr; +__SYCL_EXPORT pi_result +piextDestroyExternalSemaphore(pi_context Context, pi_device Device, + pi_interop_semaphore_handle SemHandle) { + return pi2ur::piextDestroyExternalSemaphore(Context, Device, SemHandle); } -pi_result -piextMemImageCopy([[maybe_unused]] pi_queue command_queue, - [[maybe_unused]] void *dst_ptr, - [[maybe_unused]] void *src_ptr, - [[maybe_unused]] const pi_image_format *image_format, - [[maybe_unused]] const pi_image_desc *image_desc, - [[maybe_unused]] const pi_image_copy_flags flags, - [[maybe_unused]] pi_image_offset src_offset, - [[maybe_unused]] pi_image_offset dst_offset, - [[maybe_unused]] pi_image_region copy_extent, - [[maybe_unused]] pi_image_region host_extent, - [[maybe_unused]] pi_uint32 num_events_in_wait_list, - [[maybe_unused]] const pi_event *event_wait_list, - [[maybe_unused]] pi_event *event) { - - die("piExtMemImageCopy not implemented on level zero backend.\n"); - // No image formats are supported! - pi_result retErr = PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED; - return retErr; +__SYCL_EXPORT pi_result piextWaitExternalSemaphore( + pi_queue Queue, pi_interop_semaphore_handle SemHandle, + pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, + pi_event *Event) { + return pi2ur::piextWaitExternalSemaphore( + Queue, SemHandle, NumEventsInWaitList, EventWaitList, Event); } -pi_result -piextMemImageGetInfo([[maybe_unused]] const pi_image_mem_handle mem_handle, - [[maybe_unused]] pi_image_info param_name, - [[maybe_unused]] void *param_value, - [[maybe_unused]] size_t *param_value_size_ret) { - - die("piextMemImageGetInfo not implemented on level zero backend.\n"); - return PI_SUCCESS; +__SYCL_EXPORT pi_result piextSignalExternalSemaphore( + pi_queue Queue, pi_interop_semaphore_handle SemHandle, + pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, + pi_event *Event) { + return pi2ur::piextSignalExternalSemaphore( + Queue, SemHandle, NumEventsInWaitList, EventWaitList, Event); } pi_result piKernelGetGroupInfo(pi_kernel Kernel, pi_device Device, diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index b745d212df5f3..ddc3c439ed2ba 100755 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -91,6 +91,8 @@ add_sycl_library("ur_adapter_level_zero" SHARED "ur/adapters/level_zero/context.hpp" "ur/adapters/level_zero/device.hpp" "ur/adapters/level_zero/event.hpp" + "ur/adapters/level_zero/image.cpp" + "ur/adapters/level_zero/image.hpp" "ur/adapters/level_zero/memory.hpp" "ur/adapters/level_zero/kernel.hpp" "ur/adapters/level_zero/platform.hpp" diff --git a/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.cpp new file mode 100644 index 0000000000000..cecb8f4241ca1 --- /dev/null +++ b/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.cpp @@ -0,0 +1,250 @@ +//===--------- image.cpp - Level Zero Adapter ------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-----------------------------------------------------------------===// + +#include "image.hpp" +#include "common.hpp" + +UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + const ur_usm_desc_t *pUSMDesc, ur_usm_pool_handle_t pool, + size_t widthInBytes, size_t height, size_t elementSizeBytes, void **ppMem, + size_t *pResultPitch) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pUSMDesc; + std::ignore = pool; + std::ignore = widthInBytes; + std::ignore = height; + std::ignore = elementSizeBytes; + std::ignore = ppMem; + std::ignore = pResultPitch; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urBindlessImagesUnsampledImageHandleDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_exp_image_handle_t hImage) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hImage; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urBindlessImagesSampledImageHandleDestroyExp(ur_context_handle_t hContext, + ur_device_handle_t hDevice, + ur_exp_image_handle_t hImage) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hImage; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, + ur_exp_image_mem_handle_t *phImageMem) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pImageFormat; + std::ignore = pImageDesc; + std::ignore = phImageMem; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageFreeExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hImageMem) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hImageMem; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hImageMem, const ur_image_format_t *pImageFormat, + const ur_image_desc_t *pImageDesc, ur_mem_handle_t *phMem, + ur_exp_image_handle_t *phImage) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hImageMem; + std::ignore = pImageFormat; + std::ignore = pImageDesc; + std::ignore = phMem; + std::ignore = phImage; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hImageMem, const ur_image_format_t *pImageFormat, + const ur_image_desc_t *pImageDesc, ur_sampler_handle_t hSampler, + ur_mem_handle_t *phMem, ur_exp_image_handle_t *phImage) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hImageMem; + std::ignore = pImageFormat; + std::ignore = pImageDesc; + std::ignore = hSampler; + std::ignore = phMem; + std::ignore = phImage; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( + ur_queue_handle_t hQueue, void *pDst, void *pSrc, + const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, + ur_exp_image_copy_flags_t imageCopyFlags, ur_rect_offset_t srcOffset, + ur_rect_offset_t dstOffset, ur_rect_region_t copyExtent, + ur_rect_region_t hostExtent, uint32_t numEventsInWaitList, + const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { + std::ignore = hQueue; + std::ignore = pDst; + std::ignore = pSrc; + std::ignore = pImageFormat; + std::ignore = pImageDesc; + std::ignore = imageCopyFlags; + std::ignore = srcOffset; + std::ignore = dstOffset; + std::ignore = copyExtent; + std::ignore = hostExtent; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = phEvent; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( + ur_exp_image_mem_handle_t hImageMem, ur_image_info_t propName, + void *pPropValue, size_t *pPropSizeRet) { + std::ignore = hImageMem; + std::ignore = propName; + std::ignore = pPropValue; + std::ignore = pPropSizeRet; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hImageMem, uint32_t mipmapLevel, + ur_exp_image_mem_handle_t *phImageMem) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hImageMem; + std::ignore = mipmapLevel; + std::ignore = phImageMem; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_image_mem_handle_t hMem) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hMem; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, size_t size, + uint32_t fileDescriptor, ur_exp_interop_mem_handle_t *phInteropMem) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = size; + std::ignore = fileDescriptor; + std::ignore = phInteropMem; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, + ur_exp_interop_mem_handle_t hInteropMem, + ur_exp_image_mem_handle_t *phImageMem) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = pImageFormat; + std::ignore = pImageDesc; + std::ignore = hInteropMem; + std::ignore = phImageMem; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesReleaseInteropExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_interop_mem_handle_t hInteropMem) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hInteropMem; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urBindlessImagesImportExternalSemaphoreOpaqueFDExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + uint32_t fileDescriptor, + ur_exp_interop_semaphore_handle_t *phInteropSemaphoreHandle) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = fileDescriptor; + std::ignore = phInteropSemaphoreHandle; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesDestroyExternalSemaphoreExp( + ur_context_handle_t hContext, ur_device_handle_t hDevice, + ur_exp_interop_semaphore_handle_t hInteropSemaphore) { + std::ignore = hContext; + std::ignore = hDevice; + std::ignore = hInteropSemaphore; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( + ur_queue_handle_t hQueue, ur_exp_interop_semaphore_handle_t hSemaphore, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) { + std::ignore = hQueue; + std::ignore = hSemaphore; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = phEvent; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( + ur_queue_handle_t hQueue, ur_exp_interop_semaphore_handle_t hSemaphore, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) { + std::ignore = hQueue; + std::ignore = hSemaphore; + std::ignore = numEventsInWaitList; + std::ignore = phEventWaitList; + std::ignore = phEvent; + urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.hpp b/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.hpp new file mode 100644 index 0000000000000..9ef417318aa00 --- /dev/null +++ b/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.hpp @@ -0,0 +1,13 @@ +//===--------- image.hpp - Level Zero Adapter ------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===-----------------------------------------------------------------===// +#pragma once + +#include +#include +#include +#include diff --git a/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_interface_loader.cpp b/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_interface_loader.cpp index 5cac5f3b99da5..4a39be6af55c2 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_interface_loader.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_interface_loader.cpp @@ -330,3 +330,46 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( return retVal; } + +UR_DLLEXPORT ur_result_t UR_APICALL urGetBindlessImagesExpProcAddrTable( + ur_api_version_t version, ur_bindless_images_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + pDdiTable->pfnUnsampledImageHandleDestroyExp = + urBindlessImagesUnsampledImageHandleDestroyExp; + pDdiTable->pfnSampledImageHandleDestroyExp = + urBindlessImagesSampledImageHandleDestroyExp; + pDdiTable->pfnImageAllocateExp = urBindlessImagesImageAllocateExp; + pDdiTable->pfnImageFreeExp = urBindlessImagesImageFreeExp; + pDdiTable->pfnUnsampledImageCreateExp = + urBindlessImagesUnsampledImageCreateExp; + pDdiTable->pfnSampledImageCreateExp = urBindlessImagesSampledImageCreateExp; + pDdiTable->pfnImageCopyExp = urBindlessImagesImageCopyExp; + pDdiTable->pfnImageGetInfoExp = urBindlessImagesImageGetInfoExp; + pDdiTable->pfnMipmapGetLevelExp = urBindlessImagesMipmapGetLevelExp; + pDdiTable->pfnMipmapFreeExp = urBindlessImagesMipmapFreeExp; + pDdiTable->pfnImportOpaqueFDExp = urBindlessImagesImportOpaqueFDExp; + pDdiTable->pfnMapExternalArrayExp = urBindlessImagesMapExternalArrayExp; + pDdiTable->pfnReleaseInteropExp = urBindlessImagesReleaseInteropExp; + pDdiTable->pfnImportExternalSemaphoreOpaqueFDExp = + urBindlessImagesImportExternalSemaphoreOpaqueFDExp; + pDdiTable->pfnDestroyExternalSemaphoreExp = + urBindlessImagesDestroyExternalSemaphoreExp; + pDdiTable->pfnWaitExternalSemaphoreExp = + urBindlessImagesWaitExternalSemaphoreExp; + pDdiTable->pfnSignalExternalSemaphoreExp = + urBindlessImagesSignalExternalSemaphoreExp; + return UR_RESULT_SUCCESS; +} + +UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( + ur_api_version_t version, ur_usm_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + pDdiTable->pfnPitchedAllocExp = urUSMPitchedAllocExp; + return UR_RESULT_SUCCESS; +} diff --git a/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.hpp b/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.hpp index 1c503134a0e86..754435cdc6c1c 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.hpp +++ b/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.hpp @@ -25,6 +25,7 @@ #include "device.hpp" #include "event.hpp" #include "kernel.hpp" +#include "image.hpp" #include "memory.hpp" #include "platform.hpp" #include "program.hpp" From 1bb9c0e65f0c91c8d83b31d79419c16ec6b517f0 Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Mon, 10 Jul 2023 15:10:11 +0100 Subject: [PATCH 14/19] Format --- .../unified_runtime/ur/adapters/level_zero/ur_level_zero.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.hpp b/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.hpp index 754435cdc6c1c..28db7d9c79ade 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.hpp +++ b/sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.hpp @@ -24,8 +24,8 @@ #include "context.hpp" #include "device.hpp" #include "event.hpp" -#include "kernel.hpp" #include "image.hpp" +#include "kernel.hpp" #include "memory.hpp" #include "platform.hpp" #include "program.hpp" From cc028048bdaff9059112734190854b16bcd598d7 Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Mon, 10 Jul 2023 15:25:24 +0100 Subject: [PATCH 15/19] Address Feedback * Move missed L0 impl to UR adapter --- sycl/plugins/level_zero/pi_level_zero.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sycl/plugins/level_zero/pi_level_zero.cpp b/sycl/plugins/level_zero/pi_level_zero.cpp index 1890e7930bb5d..b30018055fc78 100644 --- a/sycl/plugins/level_zero/pi_level_zero.cpp +++ b/sycl/plugins/level_zero/pi_level_zero.cpp @@ -896,16 +896,14 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context, Size, Alignment); } -pi_result piextUSMPitchedAlloc( - [[maybe_unused]] void **result_ptr, [[maybe_unused]] size_t *result_pitch, - [[maybe_unused]] pi_context context, [[maybe_unused]] pi_device device, - [[maybe_unused]] pi_usm_mem_properties *properties, - [[maybe_unused]] size_t width_in_bytes, [[maybe_unused]] size_t height, - [[maybe_unused]] unsigned int element_size_bytes) { - - die("piextUSMPitchedAlloc: not implemented"); - - return {}; +__SYCL_EXPORT pi_result piextUSMPitchedAlloc( + void **ResultPtr, size_t *ResultPitch, pi_context Context, pi_device Device, + pi_usm_mem_properties *Properties, size_t WidthInBytes, size_t Height, + unsigned int ElementSizeBytes) { + + return pi2ur::piextUSMPitchedAlloc(ResultPtr, ResultPitch, Context, Device, + Properties, WidthInBytes, Height, + ElementSizeBytes); } pi_result piextUSMHostAlloc(void **ResultPtr, pi_context Context, From 9e84262e4fe91d05ad8079c7c00d90d28b628e80 Mon Sep 17 00:00:00 2001 From: Przemek Malon Date: Fri, 14 Jul 2023 13:28:40 +0100 Subject: [PATCH 16/19] [Bindless] Update interop parameters to follow new UR types - Interop handles are now represented by descriptor structs and passed to UR through `pNext` chains, instead of passing `int` file descriptors explicitly. --- sycl/plugins/unified_runtime/CMakeLists.txt | 2 +- sycl/plugins/unified_runtime/pi2ur.hpp | 22 +++++++-- .../ur/adapters/cuda/image.cpp | 45 +++++++++++++++---- .../ur/adapters/level_zero/image.cpp | 9 ++-- 4 files changed, 62 insertions(+), 16 deletions(-) diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index ddc3c439ed2ba..fc38caed9b975 100755 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -4,7 +4,7 @@ if (NOT DEFINED UNIFIED_RUNTIME_LIBRARY OR NOT DEFINED UNIFIED_RUNTIME_INCLUDE_D include(FetchContent) set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") - set(UNIFIED_RUNTIME_TAG 8a3f07a3bcd908ea2fe252824ae7789f2a1adbc1) + set(UNIFIED_RUNTIME_TAG 3c6f02c7a76a0448a83932d93c2dbeff25af70aa) message(STATUS "Will fetch Unified Runtime from ${UNIFIED_RUNTIME_REPO}") FetchContent_Declare(unified-runtime diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index 18084f0fe02ec..983840e54c178 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -4661,8 +4661,16 @@ inline pi_result piextMemImportOpaqueFD(pi_context Context, pi_device Device, ur_exp_interop_mem_handle_t *UrRetHandle = reinterpret_cast(RetHandle); - HANDLE_ERRORS(urBindlessImagesImportOpaqueFDExp(UrContext, UrDevice, Size, - FileDescriptor, UrRetHandle)); + ur_exp_file_descriptor_t PosixFD{}; + PosixFD.stype = UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR; + PosixFD.fd = FileDescriptor; + + ur_exp_interop_mem_desc_t InteropMemDesc{}; + InteropMemDesc.stype = UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC; + InteropMemDesc.pNext = &PosixFD; + + HANDLE_ERRORS(urBindlessImagesImportOpaqueFDExp( + UrContext, UrDevice, Size, &InteropMemDesc, UrRetHandle)); return PI_SUCCESS; } @@ -4719,8 +4727,16 @@ piextImportExternalSemaphoreOpaqueFD(pi_context Context, pi_device Device, ur_exp_interop_semaphore_handle_t *UrRetHandle = reinterpret_cast(RetHandle); + ur_exp_file_descriptor_t PosixFD{}; + PosixFD.stype = UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR; + PosixFD.fd = FileDescriptor; + + ur_exp_interop_semaphore_desc_t InteropSemDesc{}; + InteropSemDesc.stype = UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC; + InteropSemDesc.pNext = &PosixFD; + HANDLE_ERRORS(urBindlessImagesImportExternalSemaphoreOpaqueFDExp( - UrContext, UrDevice, FileDescriptor, UrRetHandle)); + UrContext, UrDevice, &InteropSemDesc, UrRetHandle)); return PI_SUCCESS; } diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp index c1a6378fd5810..85fbdd092d941 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp @@ -732,7 +732,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, size_t size, - uint32_t fileDescriptor, ur_exp_interop_mem_handle_t *phInteropMem) { + ur_exp_interop_mem_desc_t *pInteropMemDesc, + ur_exp_interop_mem_handle_t *phInteropMem) { UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); @@ -740,10 +741,24 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ScopedContext Active(hDevice->getContext()); CUDA_EXTERNAL_MEMORY_HANDLE_DESC extMemDesc = {}; - extMemDesc.handle.fd = fileDescriptor; - extMemDesc.type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD; extMemDesc.size = size; + void *pNext = const_cast(pInteropMemDesc->pNext); + while (pNext != nullptr) { + const ur_base_desc_t *BaseDesc = + reinterpret_cast(pNext); + if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR) { + const ur_exp_file_descriptor_t *FileDescriptor = + reinterpret_cast(pNext); + + extMemDesc.handle.fd = FileDescriptor->fd; + extMemDesc.type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD; + } else if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + pNext = const_cast(BaseDesc->pNext); + } + CUexternalMemory extMem; UR_CHECK_ERROR(cuImportExternalMemory(&extMem, &extMemDesc)); *phInteropMem = (ur_exp_interop_mem_handle_t)extMem; @@ -824,7 +839,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesReleaseInteropExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportExternalSemaphoreOpaqueFDExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, - uint32_t fileDescriptor, + ur_exp_interop_semaphore_desc_t *pInteropSemaphoreDesc, ur_exp_interop_semaphore_handle_t *phInteropSemaphoreHandle) { UR_ASSERT((hContext->getDevice()->get() == hDevice->get()), UR_RESULT_ERROR_INVALID_CONTEXT); @@ -832,12 +847,26 @@ urBindlessImagesImportExternalSemaphoreOpaqueFDExp( try { ScopedContext Active(hDevice->getContext()); - CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC ext_sem_desc = {}; - ext_sem_desc.handle.fd = fileDescriptor; - ext_sem_desc.type = CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD; + CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC extSemDesc = {}; + + void *pNext = const_cast(pInteropSemaphoreDesc->pNext); + while (pNext != nullptr) { + const ur_base_desc_t *BaseDesc = + reinterpret_cast(pNext); + if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR) { + const ur_exp_file_descriptor_t *FileDescriptor = + reinterpret_cast(pNext); + + extSemDesc.handle.fd = FileDescriptor->fd; + extSemDesc.type = CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD; + } else if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + pNext = const_cast(BaseDesc->pNext); + } CUexternalSemaphore semaphore; - UR_CHECK_ERROR(cuImportExternalSemaphore(&semaphore, &ext_sem_desc)); + UR_CHECK_ERROR(cuImportExternalSemaphore(&semaphore, &extSemDesc)); *phInteropSemaphoreHandle = (ur_exp_interop_semaphore_handle_t)semaphore; } catch (ur_result_t Err) { diff --git a/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.cpp b/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.cpp index cecb8f4241ca1..a2e55b9fb5c3a 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/level_zero/image.cpp @@ -165,11 +165,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, size_t size, - uint32_t fileDescriptor, ur_exp_interop_mem_handle_t *phInteropMem) { + ur_exp_interop_mem_desc_t *pInteropMemDesc, + ur_exp_interop_mem_handle_t *phInteropMem) { std::ignore = hContext; std::ignore = hDevice; std::ignore = size; - std::ignore = fileDescriptor; + std::ignore = pInteropMemDesc; std::ignore = phInteropMem; urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; @@ -203,11 +204,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesReleaseInteropExp( UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportExternalSemaphoreOpaqueFDExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, - uint32_t fileDescriptor, + ur_exp_interop_semaphore_desc_t *pInteropSemaphoreDesc, ur_exp_interop_semaphore_handle_t *phInteropSemaphoreHandle) { std::ignore = hContext; std::ignore = hDevice; - std::ignore = fileDescriptor; + std::ignore = pInteropSemaphoreDesc; std::ignore = phInteropSemaphoreHandle; urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; From 5e49a4e8af4baceded809e515ecb2aff38f34efa Mon Sep 17 00:00:00 2001 From: Przemek Malon Date: Fri, 14 Jul 2023 16:55:35 +0100 Subject: [PATCH 17/19] Fix mistake in hip sampler --- sycl/plugins/hip/pi_hip.hpp | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/sycl/plugins/hip/pi_hip.hpp b/sycl/plugins/hip/pi_hip.hpp index b665e864ab12d..3ab21101228fe 100644 --- a/sycl/plugins/hip/pi_hip.hpp +++ b/sycl/plugins/hip/pi_hip.hpp @@ -86,34 +86,8 @@ struct _pi_kernel : ur_kernel_handle_t_ { using ur_kernel_handle_t_::ur_kernel_handle_t_; }; -/// Implementation of samplers for HIP -/// -/// Sampler property layout: -/// | | -/// ----------------------------------- -/// | 31 30 ... 6 | N/A -/// | 5 | mip filter mode -/// | 4 3 2 | addressing mode -/// | 1 | filter mode -/// | 0 | normalize coords struct _pi_sampler : ur_sampler_handle_t_ { using ur_sampler_handle_t_::ur_sampler_handle_t_; - std::atomic_uint32_t refCount_; - pi_uint32 props_; - float minMipmapLevelClamp_; - float maxMipmapLevelClamp_; - float maxAnisotropy_; - pi_context context_; - - _pi_sampler(pi_context context) - : refCount_(1), props_(0), minMipmapLevelClamp_(0.0f), - maxMipmapLevelClamp_(0.0f), maxAnisotropy_(0.0f), context_(context) {} - - pi_uint32 increment_reference_count() noexcept { return ++refCount_; } - - pi_uint32 decrement_reference_count() noexcept { return --refCount_; } - - pi_uint32 get_reference_count() const noexcept { return refCount_; } }; struct _pi_ext_command_buffer : ur_exp_command_buffer_handle_t_ { From 28240c95209daa4b32d652de670b3642f6724e6e Mon Sep 17 00:00:00 2001 From: Przemek Malon Date: Fri, 14 Jul 2023 17:33:45 +0100 Subject: [PATCH 18/19] Remove generated files --- sycl/include/sycl/feature_test.hpp | 95 ------------------------------ sycl/include/sycl/version.hpp | 12 ---- 2 files changed, 107 deletions(-) delete mode 100644 sycl/include/sycl/feature_test.hpp delete mode 100644 sycl/include/sycl/version.hpp diff --git a/sycl/include/sycl/feature_test.hpp b/sycl/include/sycl/feature_test.hpp deleted file mode 100644 index 1dc79975e45c6..0000000000000 --- a/sycl/include/sycl/feature_test.hpp +++ /dev/null @@ -1,95 +0,0 @@ -//==----- feature_test.hpp - SYCL Feature Test Definitions -----*- C++ -*---==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// ===--------------------------------------------------------------------=== // - -// -// IMPORTANT: feature_test.hpp is a generated file - DO NOT EDIT -// original definitions are in feature_test.hpp.in -// - -#pragma once - -#include - -namespace sycl { -__SYCL_INLINE_VER_NAMESPACE(_V1) { - -#ifdef __clang__ -#ifndef __has_extension -#define __has_extension(x) 0 -#endif -#endif - -#define SYCL_BACKEND_OPENCL 1 - -// Feature test macro definitions - -// TODO: Move these feature-test macros to compiler driver. -#define SYCL_EXT_INTEL_DEVICE_INFO 6 -#define SYCL_EXT_INTEL_DEVICE_ARCHITECTURE 1 -#define SYCL_EXT_ONEAPI_SUB_GROUP_MASK 1 -#define SYCL_EXT_ONEAPI_LOCAL_MEMORY 1 -#define SYCL_EXT_ONEAPI_MATRIX 1 -#define SYCL_EXT_ONEAPI_ASSERT 1 -#define SYCL_EXT_ONEAPI_COMPLEX_ALGORITHMS 1 -#define SYCL_EXT_ONEAPI_DISCARD_QUEUE_EVENTS 1 -#define SYCL_EXT_ONEAPI_QUEUE_PRIORITY 1 -#define SYCL_EXT_ONEAPI_ENQUEUE_BARRIER 1 -#define SYCL_EXT_ONEAPI_FREE_FUNCTION_QUERIES 1 -#define SYCL_EXT_ONEAPI_BINDLESS_IMAGES 1 -#define SYCL_EXT_ONEAPI_GROUP_ALGORITHMS 1 -#define SYCL_EXT_ONEAPI_GROUP_SORT 1 -#define SYCL_EXT_ONEAPI_MAX_WORK_GROUP_QUERY 1 -#define SYCL_EXT_ONEAPI_ND_RANGE_REDUCTIONS 1 -#define SYCL_EXT_ONEAPI_DEFAULT_CONTEXT 1 -#define SYCL_EXT_ONEAPI_USE_PINNED_HOST_MEMORY_PROPERTY 1 -#define SYCL_EXT_ONEAPI_SRGB 1 -#define SYCL_EXT_ONEAPI_SUB_GROUP 1 -#define SYCL_EXT_ONEAPI_PROPERTIES 1 -#define SYCL_EXT_ONEAPI_NATIVE_MATH 1 -#define SYCL_EXT_ONEAPI_BFLOAT16_MATH_FUNCTIONS 1 -#define SYCL_EXT_INTEL_DATAFLOW_PIPES 1 -#ifdef __clang__ -#if __has_extension(sycl_extended_atomics) -#define SYCL_EXT_INTEL_EXTENDED_ATOMICS 1 -#endif -#endif -#define SYCL_EXT_INTEL_FPGA_DEVICE_SELECTOR 3 -#define SYCL_EXT_INTEL_FPGA_KERNEL_INTERFACE_PROPERTIES 1 -#define SYCL_EXT_INTEL_FPGA_LSU 1 -#define SYCL_EXT_INTEL_FPGA_REG 1 -#define SYCL_EXT_INTEL_KERNEL_ARGS_RESTRICT 1 -#define SYCL_EXT_INTEL_MEM_CHANNEL_PROPERTY 1 -#define SYCL_EXT_INTEL_USM_ADDRESS_SPACES 2 -#define SYCL_EXT_INTEL_RUNTIME_BUFFER_LOCATION 1 -#define SYCL_EXT_INTEL_QUEUE_INDEX 1 -#define SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO 3 -#define SYCL_EXT_ONEAPI_USM_DEVICE_READ_ONLY 1 -#define SYCL_EXT_ONEAPI_KERNEL_PROPERTIES 1 -#define SYCL_EXT_ONEAPI_QUEUE_EMPTY 1 -#define SYCL_EXT_ONEAPI_USER_DEFINED_REDUCTIONS 1 -#define SYCL_EXT_ONEAPI_WEAK_OBJECT 1 -#define SYCL_EXT_ONEAPI_MEMCPY2D 1 -#define SYCL_BUILD_PI_CUDA 1 -#if SYCL_BUILD_PI_CUDA -#define SYCL_EXT_ONEAPI_BACKEND_CUDA 1 -#endif -#define SYCL_BUILD_PI_ESIMD_EMULATOR 0 -#if SYCL_BUILD_PI_ESIMD_EMULATOR -#define SYCL_EXT_INTEL_BACKEND_ESIMD_EMULATOR 1 -#endif -#define SYCL_BUILD_PI_HIP 0 -#if SYCL_BUILD_PI_HIP -#define SYCL_EXT_ONEAPI_BACKEND_HIP 1 -#endif -#define SYCL_ENABLE_KERNEL_FUSION 0 -#if SYCL_ENABLE_KERNEL_FUSION -#define SYCL_EXT_CODEPLAY_KERNEL_FUSION 1 -#endif - -} // __SYCL_INLINE_VER_NAMESPACE(_V1) -} // namespace sycl diff --git a/sycl/include/sycl/version.hpp b/sycl/include/sycl/version.hpp deleted file mode 100644 index 185814ee69e67..0000000000000 --- a/sycl/include/sycl/version.hpp +++ /dev/null @@ -1,12 +0,0 @@ -//==------ version.hpp --- SYCL compiler version macro ---------*- C++ -*---==// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#define __SYCL_COMPILER_VERSION 20230511 -#define __LIBSYCL_MAJOR_VERSION 6 -#define __LIBSYCL_MINOR_VERSION 2 -#define __LIBSYCL_PATCH_VERSION 0 From 97be70a47819c80ecd8da2c75b8620a50beb50e1 Mon Sep 17 00:00:00 2001 From: Przemek Malon Date: Mon, 17 Jul 2023 10:43:49 +0100 Subject: [PATCH 19/19] Fix assertion in cuda device.cpp --- .../unified_runtime/ur/adapters/cuda/device.cpp | 10 +++++----- sycl/test/abi/pi_level_zero_symbol_check.dump | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp b/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp index f6ed605116674..9144f5f5f0eec 100644 --- a/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp +++ b/sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp @@ -876,7 +876,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, return ReturnValue(true); } case UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP: { - // On CUDA bindless images can be backed by shared (managed) USM + // On CUDA bindless images can be backed by shared (managed) USM. return ReturnValue(true); } case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: { @@ -890,7 +890,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, } case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP: { int32_t tex_pitch_align = 0; - sycl::detail::ur::assertion( + detail::ur::assertion( cuDeviceGetAttribute(&tex_pitch_align, CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT, hDevice->get()) == CUDA_SUCCESS); @@ -898,7 +898,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, } case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP: { int32_t tex_max_linear_width = 0; - sycl::detail::ur::assertion( + detail::ur::assertion( cuDeviceGetAttribute(&tex_max_linear_width, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH, hDevice->get()) == CUDA_SUCCESS); @@ -906,7 +906,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, } case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP: { int32_t tex_max_linear_height = 0; - sycl::detail::ur::assertion( + detail::ur::assertion( cuDeviceGetAttribute( &tex_max_linear_height, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT, @@ -915,7 +915,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, } case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP: { int32_t tex_max_linear_pitch = 0; - sycl::detail::ur::assertion( + detail::ur::assertion( cuDeviceGetAttribute(&tex_max_linear_pitch, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH, hDevice->get()) == CUDA_SUCCESS); diff --git a/sycl/test/abi/pi_level_zero_symbol_check.dump b/sycl/test/abi/pi_level_zero_symbol_check.dump index 4b1f6a3b99083..23077fcc91edf 100644 --- a/sycl/test/abi/pi_level_zero_symbol_check.dump +++ b/sycl/test/abi/pi_level_zero_symbol_check.dump @@ -121,7 +121,6 @@ piextMemGetNativeHandle piextMemImageAllocate piextMemImageCopy piextMemImageCreateWithNativeHandle -piextPeerAccessGetInfo piextMemImageFree piextMemImageGetInfo piextMemImportOpaqueFD @@ -133,6 +132,7 @@ piextMemSampledImageCreate piextMemSampledImageHandleDestroy piextMemUnsampledImageCreate piextMemUnsampledImageHandleDestroy +piextPeerAccessGetInfo piextPlatformCreateWithNativeHandle piextPlatformGetNativeHandle piextPluginGetOpaqueData