From 51a278e4de4301bae6a54d2f30495145564081b7 Mon Sep 17 00:00:00 2001 From: omarahmed1111 Date: Fri, 15 Mar 2024 16:41:54 +0000 Subject: [PATCH] Remove 2 image memory types that was redundant --- include/ur_api.h | 24 +++---- include/ur_print.hpp | 6 -- scripts/core/exp-bindless-images.yml | 10 +-- scripts/core/memory.yml | 6 +- source/adapters/cuda/memory.cpp | 2 +- source/adapters/hip/memory.cpp | 2 +- source/adapters/level_zero/image.cpp | 2 +- source/adapters/opencl/memory.cpp | 6 -- source/loader/layers/validation/ur_valddi.cpp | 12 ++-- source/loader/ur_libapi.cpp | 12 ++-- source/ur_api.cpp | 12 ++-- .../memory/memory_adapter_cuda.match | 8 +-- test/conformance/memory/urMemImageCreate.cpp | 69 +++++++++++++++---- 13 files changed, 94 insertions(+), 77 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 75b7f9f916..e9f27d093e 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -2417,13 +2417,11 @@ typedef enum ur_mem_flag_t { /////////////////////////////////////////////////////////////////////////////// /// @brief Memory types typedef enum ur_mem_type_t { - UR_MEM_TYPE_BUFFER = 0, ///< Buffer object - UR_MEM_TYPE_IMAGE2D = 1, ///< 2D image object - UR_MEM_TYPE_IMAGE3D = 2, ///< 3D image object - UR_MEM_TYPE_IMAGE2D_ARRAY = 3, ///< 2D image array object - UR_MEM_TYPE_IMAGE1D = 4, ///< 1D image object - UR_MEM_TYPE_IMAGE1D_ARRAY = 5, ///< 1D image array object - UR_MEM_TYPE_IMAGE1D_BUFFER = 6, ///< 1D image buffer object + UR_MEM_TYPE_IMAGE2D = 0, ///< 2D image object + UR_MEM_TYPE_IMAGE3D = 1, ///< 3D image object + UR_MEM_TYPE_IMAGE2D_ARRAY = 2, ///< 2D image array object + UR_MEM_TYPE_IMAGE1D = 3, ///< 1D image object + UR_MEM_TYPE_IMAGE1D_ARRAY = 4, ///< 1D image array object /// @cond UR_MEM_TYPE_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -2553,7 +2551,7 @@ typedef struct ur_image_desc_t { /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION /// - ::UR_RESULT_ERROR_INVALID_HOST_PTR @@ -7348,7 +7346,7 @@ urBindlessImagesSampledImageHandleDestroyExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION UR_APIEXPORT ur_result_t UR_APICALL @@ -7409,7 +7407,7 @@ urBindlessImagesImageFreeExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION UR_APIEXPORT ur_result_t UR_APICALL @@ -7448,7 +7446,7 @@ urBindlessImagesUnsampledImageCreateExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_SAMPLER /// - ::UR_RESULT_ERROR_INVALID_OPERATION @@ -7491,7 +7489,7 @@ urBindlessImagesSampledImageCreateExp( /// - ::UR_RESULT_ERROR_INVALID_QUEUE /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION UR_APIEXPORT ur_result_t UR_APICALL @@ -7652,7 +7650,7 @@ urBindlessImagesImportOpaqueFDExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES diff --git a/include/ur_print.hpp b/include/ur_print.hpp index c45a573d4f..3db3b90e37 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -5293,9 +5293,6 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { /// std::ostream & inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) { switch (value) { - case UR_MEM_TYPE_BUFFER: - os << "UR_MEM_TYPE_BUFFER"; - break; case UR_MEM_TYPE_IMAGE2D: os << "UR_MEM_TYPE_IMAGE2D"; break; @@ -5311,9 +5308,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) { case UR_MEM_TYPE_IMAGE1D_ARRAY: os << "UR_MEM_TYPE_IMAGE1D_ARRAY"; break; - case UR_MEM_TYPE_IMAGE1D_BUFFER: - os << "UR_MEM_TYPE_IMAGE1D_BUFFER"; - break; default: os << "unknown enumerator"; break; diff --git a/scripts/core/exp-bindless-images.yml b/scripts/core/exp-bindless-images.yml index d2e508c4a7..46e2f5bee1 100644 --- a/scripts/core/exp-bindless-images.yml +++ b/scripts/core/exp-bindless-images.yml @@ -328,7 +328,7 @@ returns: - $X_RESULT_ERROR_INVALID_CONTEXT - $X_RESULT_ERROR_INVALID_VALUE - $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: - - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`" + - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`" - $X_RESULT_ERROR_INVALID_IMAGE_SIZE - $X_RESULT_ERROR_INVALID_OPERATION --- #-------------------------------------------------------------------------- @@ -386,7 +386,7 @@ returns: - $X_RESULT_ERROR_INVALID_CONTEXT - $X_RESULT_ERROR_INVALID_VALUE - $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: - - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`" + - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`" - $X_RESULT_ERROR_INVALID_IMAGE_SIZE - $X_RESULT_ERROR_INVALID_OPERATION --- #-------------------------------------------------------------------------- @@ -426,7 +426,7 @@ returns: - $X_RESULT_ERROR_INVALID_CONTEXT - $X_RESULT_ERROR_INVALID_VALUE - $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: - - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`" + - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`" - $X_RESULT_ERROR_INVALID_IMAGE_SIZE - $X_RESULT_ERROR_INVALID_SAMPLER - $X_RESULT_ERROR_INVALID_OPERATION @@ -489,7 +489,7 @@ returns: - $X_RESULT_ERROR_INVALID_QUEUE - $X_RESULT_ERROR_INVALID_VALUE - $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: - - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`" + - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`" - $X_RESULT_ERROR_INVALID_IMAGE_SIZE - $X_RESULT_ERROR_INVALID_OPERATION --- #-------------------------------------------------------------------------- @@ -626,7 +626,7 @@ returns: - $X_RESULT_ERROR_INVALID_CONTEXT - $X_RESULT_ERROR_INVALID_VALUE - $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: - - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`" + - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`" - $X_RESULT_ERROR_INVALID_IMAGE_SIZE - $X_RESULT_ERROR_INVALID_OPERATION - $X_RESULT_ERROR_OUT_OF_RESOURCES diff --git a/scripts/core/memory.yml b/scripts/core/memory.yml index 627c259577..bad463a2da 100644 --- a/scripts/core/memory.yml +++ b/scripts/core/memory.yml @@ -41,8 +41,6 @@ desc: "Memory types" class: $xMem name: $x_mem_type_t etors: - - name: BUFFER - desc: "Buffer object" - name: IMAGE2D desc: "2D image object" - name: IMAGE3D @@ -53,8 +51,6 @@ etors: desc: "1D image object" - name: IMAGE1D_ARRAY desc: "1D image array object" - - name: IMAGE1D_BUFFER - desc: "1D image buffer object" --- #-------------------------------------------------------------------------- type: enum desc: "Memory Information type" @@ -236,7 +232,7 @@ returns: - $X_RESULT_ERROR_INVALID_CONTEXT - $X_RESULT_ERROR_INVALID_VALUE - $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: - - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`" + - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`" - $X_RESULT_ERROR_INVALID_IMAGE_SIZE - $X_RESULT_ERROR_INVALID_OPERATION - $X_RESULT_ERROR_INVALID_HOST_PTR: diff --git a/source/adapters/cuda/memory.cpp b/source/adapters/cuda/memory.cpp index da02fb8806..35c84f38fb 100644 --- a/source/adapters/cuda/memory.cpp +++ b/source/adapters/cuda/memory.cpp @@ -229,7 +229,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreate( UR_ASSERT(pImageDesc->stype == UR_STRUCTURE_TYPE_IMAGE_DESC, UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR); - UR_ASSERT(pImageDesc->type <= UR_MEM_TYPE_IMAGE1D_BUFFER, + UR_ASSERT(pImageDesc->type < UR_MEM_TYPE_IMAGE1D_ARRAY, UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR); UR_ASSERT(pImageDesc->numMipLevel == 0, UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR); diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 47151bbbe6..0087b1a2c0 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -339,7 +339,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreate( UR_ASSERT(pImageDesc->stype == UR_STRUCTURE_TYPE_IMAGE_DESC, UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR); - UR_ASSERT(pImageDesc->type <= UR_MEM_TYPE_IMAGE1D_BUFFER, + UR_ASSERT(pImageDesc->type < UR_MEM_TYPE_IMAGE1D_ARRAY, UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR); UR_ASSERT(pImageDesc->numMipLevel == 0, UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR); diff --git a/source/adapters/level_zero/image.cpp b/source/adapters/level_zero/image.cpp index 0d986de0ad..c432eccda9 100644 --- a/source/adapters/level_zero/image.cpp +++ b/source/adapters/level_zero/image.cpp @@ -764,7 +764,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( UR_RESULT_ERROR_INVALID_NULL_POINTER); UR_ASSERT(!(UR_EXP_IMAGE_COPY_FLAGS_MASK & imageCopyFlags), UR_RESULT_ERROR_INVALID_ENUMERATION); - UR_ASSERT(!(pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type), + UR_ASSERT(!(pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type), UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR); ZeStruct ZeImageDesc; diff --git a/source/adapters/opencl/memory.cpp b/source/adapters/opencl/memory.cpp index 2397e2b5f9..b2476fc420 100644 --- a/source/adapters/opencl/memory.cpp +++ b/source/adapters/opencl/memory.cpp @@ -123,9 +123,6 @@ cl_image_desc mapURImageDescToCL(const ur_image_desc_t *PImageDesc) { cl_adapter::cast(PImageDesc->type); switch (PImageDesc->type) { - case UR_MEM_TYPE_BUFFER: - CLImageDesc.image_type = CL_MEM_OBJECT_BUFFER; - break; case UR_MEM_TYPE_IMAGE2D: CLImageDesc.image_type = CL_MEM_OBJECT_IMAGE2D; break; @@ -141,9 +138,6 @@ cl_image_desc mapURImageDescToCL(const ur_image_desc_t *PImageDesc) { case UR_MEM_TYPE_IMAGE1D_ARRAY: CLImageDesc.image_type = CL_MEM_OBJECT_IMAGE1D_ARRAY; break; - case UR_MEM_TYPE_IMAGE1D_BUFFER: - CLImageDesc.image_type = CL_MEM_OBJECT_IMAGE1D_BUFFER; - break; default: CLImageDesc.image_type = -1; break; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 1ad5cede4d..5ca5d8cabf 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -1067,7 +1067,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreate( return UR_RESULT_ERROR_INVALID_ENUMERATION; } - if (pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type) { + if (pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type) { return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } @@ -6822,7 +6822,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type) { + if (pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type) { return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } } @@ -6936,7 +6936,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type) { + if (pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type) { return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } } @@ -7012,7 +7012,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type) { + if (pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type) { return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } } @@ -7104,7 +7104,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( return UR_RESULT_ERROR_INVALID_ENUMERATION; } - if (pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type) { + if (pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type) { return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } @@ -7357,7 +7357,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type) { + if (pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type) { return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 7802598813..ed74bed210 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -1490,7 +1490,7 @@ ur_result_t UR_APICALL urContextSetExtendedDeleter( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION /// - ::UR_RESULT_ERROR_INVALID_HOST_PTR @@ -6414,7 +6414,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageHandleDestroyExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( @@ -6497,7 +6497,7 @@ ur_result_t UR_APICALL urBindlessImagesImageFreeExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( @@ -6550,7 +6550,7 @@ ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_SAMPLER /// - ::UR_RESULT_ERROR_INVALID_OPERATION @@ -6606,7 +6606,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( /// - ::UR_RESULT_ERROR_INVALID_QUEUE /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION ur_result_t UR_APICALL urBindlessImagesImageCopyExp( @@ -6829,7 +6829,7 @@ ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 7e1e293cc1..a92db59989 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -1285,7 +1285,7 @@ ur_result_t UR_APICALL urContextSetExtendedDeleter( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION /// - ::UR_RESULT_ERROR_INVALID_HOST_PTR @@ -5470,7 +5470,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageHandleDestroyExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( @@ -5538,7 +5538,7 @@ ur_result_t UR_APICALL urBindlessImagesImageFreeExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( @@ -5582,7 +5582,7 @@ ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_SAMPLER /// - ::UR_RESULT_ERROR_INVALID_OPERATION @@ -5630,7 +5630,7 @@ ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( /// - ::UR_RESULT_ERROR_INVALID_QUEUE /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION ur_result_t UR_APICALL urBindlessImagesImageCopyExp( @@ -5813,7 +5813,7 @@ ur_result_t UR_APICALL urBindlessImagesImportOpaqueFDExp( /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR -/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE /// - ::UR_RESULT_ERROR_INVALID_OPERATION /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES diff --git a/test/conformance/memory/memory_adapter_cuda.match b/test/conformance/memory/memory_adapter_cuda.match index fa2b1a0d47..479eff9152 100644 --- a/test/conformance/memory/memory_adapter_cuda.match +++ b/test/conformance/memory/memory_adapter_cuda.match @@ -1,13 +1,7 @@ urMemBufferCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ {{OPT}}urMemGetInfoImageTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_SIZE {{OPT}}urMemGetInfoImageTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_CONTEXT -urMemImageCreateTestWithMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_BUFFER -urMemImageCreateTestWithMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE2D -urMemImageCreateTestWithMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE3D -urMemImageCreateTestWithMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE2D_ARRAY -urMemImageCreateTestWithMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE1D -urMemImageCreateTestWithMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE1D_ARRAY -urMemImageCreateTestWithMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE1D_BUFFER +urMemImageCreateTestWith1DMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE1D_ARRAY {{OPT}}urMemImageGetInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_IMAGE_INFO_FORMAT {{OPT}}urMemImageGetInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_IMAGE_INFO_ELEMENT_SIZE {{OPT}}urMemImageGetInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_IMAGE_INFO_ROW_PITCH diff --git a/test/conformance/memory/urMemImageCreate.cpp b/test/conformance/memory/urMemImageCreate.cpp index 3b61a34557..51b171f390 100644 --- a/test/conformance/memory/urMemImageCreate.cpp +++ b/test/conformance/memory/urMemImageCreate.cpp @@ -24,35 +24,53 @@ static ur_image_desc_t image_desc{ 0 ///< [in] number of samples }; -TEST_P(urMemImageCreateTest, Success) { +using urMemImageCreateTestWith1DMemoryTypeParam = + uur::urContextTestWithParam; + +UUR_TEST_SUITE_P(urMemImageCreateTestWith1DMemoryTypeParam, + ::testing::Values(UR_MEM_TYPE_IMAGE1D, + UR_MEM_TYPE_IMAGE1D_ARRAY), + uur::deviceTestWithParamPrinter); + +TEST_P(urMemImageCreateTestWith1DMemoryTypeParam, Success) { + ur_image_desc_t image_desc_with_param{ + UR_STRUCTURE_TYPE_IMAGE_DESC, ///< [in] type of this structure + nullptr, ///< [in][optional] pointer to extension-specific structure + getParam(), ///< [in] memory object type + 1, ///< [in] image width + 0, ///< [in] image height + 0, ///< [in] image depth + 1, ///< [in] image array size + 0, ///< [in] image row pitch + 0, ///< [in] image slice pitch + 0, ///< [in] number of MIP levels + 0 ///< [in] number of samples + }; + ur_mem_handle_t image_handle = nullptr; ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, - &image_format, &image_desc, nullptr, - &image_handle)); + &image_format, &image_desc_with_param, + nullptr, &image_handle)); ASSERT_NE(nullptr, image_handle); ASSERT_SUCCESS(urMemRelease(image_handle)); } -using urMemImageCreateTestWithMemoryTypeParam = +using urMemImageCreateTestWith2DMemoryTypeParam = uur::urContextTestWithParam; -UUR_TEST_SUITE_P(urMemImageCreateTestWithMemoryTypeParam, - ::testing::Values(UR_MEM_TYPE_BUFFER, UR_MEM_TYPE_IMAGE2D, - UR_MEM_TYPE_IMAGE3D, - UR_MEM_TYPE_IMAGE2D_ARRAY, - UR_MEM_TYPE_IMAGE1D, - UR_MEM_TYPE_IMAGE1D_ARRAY, - UR_MEM_TYPE_IMAGE1D_BUFFER), +UUR_TEST_SUITE_P(urMemImageCreateTestWith2DMemoryTypeParam, + ::testing::Values(UR_MEM_TYPE_IMAGE2D, + UR_MEM_TYPE_IMAGE2D_ARRAY), uur::deviceTestWithParamPrinter); -TEST_P(urMemImageCreateTestWithMemoryTypeParam, Success) { - static ur_image_desc_t image_desc_with_param{ +TEST_P(urMemImageCreateTestWith2DMemoryTypeParam, Success) { + ur_image_desc_t image_desc_with_param{ UR_STRUCTURE_TYPE_IMAGE_DESC, ///< [in] type of this structure nullptr, ///< [in][optional] pointer to extension-specific structure getParam(), ///< [in] memory object type 1, ///< [in] image width 1, ///< [in] image height - 1, ///< [in] image depth + 0, ///< [in] image depth 1, ///< [in] image array size 0, ///< [in] image row pitch 0, ///< [in] image slice pitch @@ -68,6 +86,29 @@ TEST_P(urMemImageCreateTestWithMemoryTypeParam, Success) { ASSERT_SUCCESS(urMemRelease(image_handle)); } +TEST_P(urMemImageCreateTest, SuccessWith3DImageType) { + ur_image_desc_t image_desc_with_param{ + UR_STRUCTURE_TYPE_IMAGE_DESC, ///< [in] type of this structure + nullptr, ///< [in][optional] pointer to extension-specific structure + UR_MEM_TYPE_IMAGE3D, ///< [in] memory object type + 1, ///< [in] image width + 1, ///< [in] image height + 1, ///< [in] image depth + 1, ///< [in] image array size + 0, ///< [in] image row pitch + 0, ///< [in] image slice pitch + 0, ///< [in] number of MIP levels + 0 ///< [in] number of samples + }; + + ur_mem_handle_t image_handle = nullptr; + ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, + &image_format, &image_desc_with_param, + nullptr, &image_handle)); + ASSERT_NE(nullptr, image_handle); + ASSERT_SUCCESS(urMemRelease(image_handle)); +} + TEST_P(urMemImageCreateTest, InvalidNullHandleContext) { ur_mem_handle_t image_handle = nullptr; ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE,