From d8f146132082617f9456a35d34bbc9356ee4656d Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 11:44:53 +0100 Subject: [PATCH 01/30] WIP add mem reference count to spec and modify urMemGetInfo to test for it. Also add missing error condition for urImageCreate in spec --- include/ur_api.h | 11 ++++-- include/ur_print.hpp | 15 +++++++ scripts/core/memory.yml | 6 +++ source/adapters/cuda/memory.cpp | 3 ++ source/adapters/hip/memory.cpp | 7 ++-- source/adapters/level_zero/memory.cpp | 5 ++- source/adapters/level_zero/v2/memory.cpp | 3 ++ source/adapters/opencl/memory.cpp | 2 + source/loader/layers/validation/ur_valddi.cpp | 6 ++- source/loader/ur_libapi.cpp | 3 +- source/ur_api.cpp | 3 +- test/conformance/memory/urMemGetInfo.cpp | 39 +++++++++++++++---- 12 files changed, 85 insertions(+), 18 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 9897d892b6..10117e3aaa 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -2510,8 +2510,12 @@ typedef enum ur_mem_type_t { /////////////////////////////////////////////////////////////////////////////// /// @brief Memory Information type typedef enum ur_mem_info_t { - UR_MEM_INFO_SIZE = 0, ///< [size_t] actual size of of memory object in bytes - UR_MEM_INFO_CONTEXT = 1, ///< [::ur_context_handle_t] context in which the memory object was created + UR_MEM_INFO_SIZE = 0, ///< [size_t] actual size of of memory object in bytes + UR_MEM_INFO_CONTEXT = 1, ///< [::ur_context_handle_t] context in which the memory object was created + UR_MEM_INFO_REFERENCE_COUNT = 2, ///< [uint32_t] Reference count of the memory object. + ///< The reference count returned should be considered immediately stale. + ///< It is unsuitable for general use in applications. This feature is + ///< provided for identifying memory leaks. /// @cond UR_MEM_INFO_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -2645,6 +2649,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_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype` /// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// + `pImageDesc && pImageDesc->numMipLevel != 0` /// + `pImageDesc && pImageDesc->numSamples != 0` @@ -2985,7 +2990,7 @@ urMemImageCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hMemory` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_MEM_INFO_CONTEXT < propName` +/// + `::UR_MEM_INFO_REFERENCE_COUNT < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/include/ur_print.hpp b/include/ur_print.hpp index a908fd9275..d997e3051e 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -5616,6 +5616,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value) { case UR_MEM_INFO_CONTEXT: os << "UR_MEM_INFO_CONTEXT"; break; + case UR_MEM_INFO_REFERENCE_COUNT: + os << "UR_MEM_INFO_REFERENCE_COUNT"; + break; default: os << "unknown enumerator"; break; @@ -5657,6 +5660,18 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_mem_info_t os << ")"; } break; + case UR_MEM_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; default: os << "unknown enumerator"; return UR_RESULT_ERROR_INVALID_ENUMERATION; diff --git a/scripts/core/memory.yml b/scripts/core/memory.yml index 0fde537f37..7cc7467da4 100644 --- a/scripts/core/memory.yml +++ b/scripts/core/memory.yml @@ -62,6 +62,11 @@ etors: desc: "[size_t] actual size of of memory object in bytes" - name: CONTEXT desc: "[$x_context_handle_t] context in which the memory object was created" + - name: REFERENCE_COUNT + desc: | + [uint32_t] Reference count of the memory object. + The reference count returned should be considered immediately stale. + It is unsuitable for general use in applications. This feature is provided for identifying memory leaks. --- #-------------------------------------------------------------------------- type: enum desc: "Image channel order info: number of channels and the channel layout" @@ -241,6 +246,7 @@ returns: - $X_RESULT_ERROR_INVALID_CONTEXT - $X_RESULT_ERROR_INVALID_VALUE - $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: + - "`pImageDesc && UR_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype`" - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`" - "`pImageDesc && pImageDesc->numMipLevel != 0`" - "`pImageDesc && pImageDesc->numSamples != 0`" diff --git a/source/adapters/cuda/memory.cpp b/source/adapters/cuda/memory.cpp index ea55c1669a..8b4db742ac 100644 --- a/source/adapters/cuda/memory.cpp +++ b/source/adapters/cuda/memory.cpp @@ -171,6 +171,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, case UR_MEM_INFO_CONTEXT: { return ReturnValue(hMemory->getContext()); } + case UR_MEM_INFO_REFERENCE_COUNT: { + return ReturnValue(hMemory->getReferenceCount()); + } default: return UR_RESULT_ERROR_INVALID_ENUMERATION; diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index aa7b5f4040..55c6fe05ed 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -231,10 +231,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, size_t propSize, void *pMemInfo, size_t *pPropSizeRet) { - - UR_ASSERT(MemInfoType <= UR_MEM_INFO_CONTEXT, - UR_RESULT_ERROR_INVALID_ENUMERATION); - // FIXME: Only getting info for the first device in the context. This // should be fine in general auto Device = hMemory->getContext()->getDevices()[0]; @@ -286,6 +282,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, case UR_MEM_INFO_CONTEXT: { return ReturnValue(hMemory->getContext()); } + case UR_MEM_INFO_REFERENCE_COUNT: { + return ReturnValue(hMemory->getReferenceCount()); + } default: return UR_RESULT_ERROR_INVALID_ENUMERATION; diff --git a/source/adapters/level_zero/memory.cpp b/source/adapters/level_zero/memory.cpp index bc915517e7..cddf98eaa0 100644 --- a/source/adapters/level_zero/memory.cpp +++ b/source/adapters/level_zero/memory.cpp @@ -1886,8 +1886,11 @@ ur_result_t urMemGetInfo( // Get size of the allocation return ReturnValue(size_t{Buffer->Size}); } + case UR_MEM_INFO_REFERENCE_COUNT: { + return ReturnValue(Buffer->RefCount.load()); + } default: { - die("urMemGetInfo: Parameter is not implemented"); + return UR_RESULT_ERROR_INVALID_ENUMERATION; } } diff --git a/source/adapters/level_zero/v2/memory.cpp b/source/adapters/level_zero/v2/memory.cpp index a64d77b1dd..575cbefb07 100644 --- a/source/adapters/level_zero/v2/memory.cpp +++ b/source/adapters/level_zero/v2/memory.cpp @@ -205,6 +205,9 @@ ur_result_t urMemGetInfo(ur_mem_handle_t hMemory, ur_mem_info_t propName, // Get size of the allocation return returnValue(size_t{hMemory->getSize()}); } + case UR_MEM_INFO_REFERENCE_COUNT: { + return returnValue(hMemory->RefCount.load()); + } default: { return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/source/adapters/opencl/memory.cpp b/source/adapters/opencl/memory.cpp index b2476fc420..201df1f678 100644 --- a/source/adapters/opencl/memory.cpp +++ b/source/adapters/opencl/memory.cpp @@ -186,6 +186,8 @@ cl_int mapURMemInfoToCL(ur_mem_info_t URPropName) { return CL_MEM_SIZE; case UR_MEM_INFO_CONTEXT: return CL_MEM_CONTEXT; + case UR_MEM_INFO_REFERENCE_COUNT: + return CL_MEM_REFERENCE_COUNT; default: return -1; } diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 0911745f03..7325e2f43a 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -1104,6 +1104,10 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreate( return UR_RESULT_ERROR_INVALID_ENUMERATION; } + if (pImageDesc && UR_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype) { + return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; + } + if (pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type) { return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } @@ -1503,7 +1507,7 @@ __urdlllocal ur_result_t UR_APICALL urMemGetInfo( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (UR_MEM_INFO_CONTEXT < propName) { + if (UR_MEM_INFO_REFERENCE_COUNT < propName) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index ca6d4da65d..1dae3e2cd6 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -1539,6 +1539,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_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype` /// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// + `pImageDesc && pImageDesc->numMipLevel != 0` /// + `pImageDesc && pImageDesc->numSamples != 0` @@ -1888,7 +1889,7 @@ ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hMemory` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_MEM_INFO_CONTEXT < propName` +/// + `::UR_MEM_INFO_REFERENCE_COUNT < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/source/ur_api.cpp b/source/ur_api.cpp index cdfdb648af..dab24c2400 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -1340,6 +1340,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_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype` /// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// + `pImageDesc && pImageDesc->numMipLevel != 0` /// + `pImageDesc && pImageDesc->numSamples != 0` @@ -1634,7 +1635,7 @@ ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hMemory` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_MEM_INFO_CONTEXT < propName` +/// + `::UR_MEM_INFO_REFERENCE_COUNT < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/test/conformance/memory/urMemGetInfo.cpp b/test/conformance/memory/urMemGetInfo.cpp index a28b581a26..3f933d39a9 100644 --- a/test/conformance/memory/urMemGetInfo.cpp +++ b/test/conformance/memory/urMemGetInfo.cpp @@ -6,19 +6,21 @@ #include #include -using urMemGetInfoTest = uur::urMemBufferTestWithParam; +using urMemGetInfoTestWithParam = uur::urMemBufferTestWithParam; -static constexpr std::array mem_info_values{ - UR_MEM_INFO_SIZE, UR_MEM_INFO_CONTEXT}; +static constexpr std::array mem_info_values{ + UR_MEM_INFO_SIZE, UR_MEM_INFO_CONTEXT, UR_MEM_INFO_REFERENCE_COUNT}; static std::unordered_map mem_info_size_map = { {UR_MEM_INFO_SIZE, sizeof(size_t)}, {UR_MEM_INFO_CONTEXT, sizeof(ur_context_handle_t)}, + {UR_MEM_INFO_REFERENCE_COUNT, sizeof(uint32_t)}, }; -UUR_TEST_SUITE_P(urMemGetInfoTest, ::testing::ValuesIn(mem_info_values), +UUR_TEST_SUITE_P(urMemGetInfoTestWithParam, + ::testing::ValuesIn(mem_info_values), uur::deviceTestWithParamPrinter); -TEST_P(urMemGetInfoTest, Success) { +TEST_P(urMemGetInfoTestWithParam, Success) { ur_mem_info_t info = getParam(); size_t size; ASSERT_SUCCESS(urMemGetInfo(buffer, info, 0, nullptr, &size)); @@ -44,11 +46,20 @@ TEST_P(urMemGetInfoTest, Success) { ASSERT_GE(*returned_size, allocation_size); break; } + case UR_MEM_INFO_REFERENCE_COUNT: { + const size_t ReferenceCount = + *reinterpret_cast(info_data.data()); + ASSERT_GT(ReferenceCount, 0); + break; + } default: break; } } +using urMemGetInfoTest = uur::urMemBufferTest; +UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemGetInfoTest); + TEST_P(urMemGetInfoTest, InvalidNullHandleMemory) { size_t mem_size = 0; ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, @@ -108,16 +119,30 @@ TEST_P(urMemGetInfoImageTest, Success) { std::vector info_data(size); ASSERT_SUCCESS(urMemGetInfo(image, info, size, info_data.data(), nullptr)); - if (info == UR_MEM_INFO_SIZE) { + switch (info) { + case UR_MEM_INFO_SIZE: { const size_t ExpectedPixelSize = sizeof(float) * 4 /*NumChannels*/; const size_t ExpectedImageSize = ExpectedPixelSize * desc.arraySize * desc.width * desc.height * desc.depth; const size_t ImageSizeBytes = *reinterpret_cast(info_data.data()); ASSERT_EQ(ImageSizeBytes, ExpectedImageSize); - } else if (info == UR_MEM_INFO_CONTEXT) { + break; + } + case UR_MEM_INFO_CONTEXT: { ur_context_handle_t InfoContext = *reinterpret_cast(info_data.data()); ASSERT_EQ(InfoContext, context); + break; + } + case UR_MEM_INFO_REFERENCE_COUNT: { + const size_t ReferenceCount = + *reinterpret_cast(info_data.data()); + ASSERT_GT(ReferenceCount, 0); + break; + } + + default: + break; } } From f3e3c6d04462ffde1d7cb63e870d5648549ed4be Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 12:37:36 +0100 Subject: [PATCH 02/30] wip remove InvalidImageDescStype entry from opencl match as test now passes. rename urMemGetInfo tests and add ref count entry to native cpu match file --- test/conformance/memory/memory_adapter_native_cpu.match | 8 ++++---- test/conformance/memory/memory_adapter_opencl.match | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/conformance/memory/memory_adapter_native_cpu.match b/test/conformance/memory/memory_adapter_native_cpu.match index 5bdd88804b..35d00f1ba3 100644 --- a/test/conformance/memory/memory_adapter_native_cpu.match +++ b/test/conformance/memory/memory_adapter_native_cpu.match @@ -1,10 +1,10 @@ {{NONDETERMINISTIC}} urMemBufferPartitionTest.InvalidValueCreateType/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} -urMemGetInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_SIZE -urMemGetInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_CONTEXT -urMemGetInfoTest.InvalidSizeSmall/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidSizeSmall/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_CONTEXT +urMemGetInfoTestWithParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_SIZE +urMemGetInfoTestWithParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_CONTEXT +urMemGetInfoTestWithParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_REFERENCE_COUNT +urMemGetInfoTest.InvalidSizeSmall/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_SNORM_INT8 urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_SNORM_INT16 urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_UNORM_INT8 diff --git a/test/conformance/memory/memory_adapter_opencl.match b/test/conformance/memory/memory_adapter_opencl.match index b57e3876d0..e69de29bb2 100644 --- a/test/conformance/memory/memory_adapter_opencl.match +++ b/test/conformance/memory/memory_adapter_opencl.match @@ -1,2 +0,0 @@ -{{NONDETERMINISTIC}} -urMemImageCreateTest.InvalidImageDescStype/Intel_R__OpenCL___{{.*}} From 533d2f17354a59609b713df57da85b63fb2f2161 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 12:52:35 +0100 Subject: [PATCH 03/30] wip remove assert from L0 urMemGetInfo and update match file --- source/adapters/level_zero/memory.cpp | 4 ---- test/conformance/memory/memory_adapter_level_zero.match | 1 - 2 files changed, 5 deletions(-) diff --git a/source/adapters/level_zero/memory.cpp b/source/adapters/level_zero/memory.cpp index cddf98eaa0..3a51cf6cc6 100644 --- a/source/adapters/level_zero/memory.cpp +++ b/source/adapters/level_zero/memory.cpp @@ -1871,9 +1871,6 @@ ur_result_t urMemGetInfo( size_t *PropSizeRet ///< [out][optional] pointer to the actual size in ///< bytes of data queried by pMemInfo. ) { - UR_ASSERT(MemInfoType == UR_MEM_INFO_CONTEXT || !Memory->isImage(), - UR_RESULT_ERROR_INVALID_VALUE); - auto Buffer = reinterpret_cast<_ur_buffer *>(Memory); std::shared_lock Lock(Buffer->Mutex); UrReturnHelper ReturnValue(PropSize, MemInfo, PropSizeRet); @@ -1884,7 +1881,6 @@ ur_result_t urMemGetInfo( } case UR_MEM_INFO_SIZE: { // Get size of the allocation - return ReturnValue(size_t{Buffer->Size}); } case UR_MEM_INFO_REFERENCE_COUNT: { return ReturnValue(Buffer->RefCount.load()); diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index f09638fd08..0d02c380aa 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -1,5 +1,4 @@ {{NONDETERMINISTIC}} urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -{{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE {{Segmentation fault|Aborted}} From a2ac9491d2bc63d0eb3caf9a128677ed2e9e3000 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 13:02:41 +0100 Subject: [PATCH 04/30] wip update l0 v2 match file for get info ref count --- test/conformance/memory/memory_adapter_level_zero_v2.match | 1 + 1 file changed, 1 insertion(+) diff --git a/test/conformance/memory/memory_adapter_level_zero_v2.match b/test/conformance/memory/memory_adapter_level_zero_v2.match index 284dcab4b0..5eeefa20bc 100644 --- a/test/conformance/memory/memory_adapter_level_zero_v2.match +++ b/test/conformance/memory/memory_adapter_level_zero_v2.match @@ -4,6 +4,7 @@ urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ {{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE {{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_CONTEXT +{{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_REFERENCE_COUNT {{OPT}}urMemImageCreateTestWithImageFormatParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_SNORM_INT8 {{OPT}}urMemImageCreateTestWithImageFormatParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_SNORM_INT16 {{OPT}}urMemImageCreateTestWithImageFormatParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_UNORM_INT8 From cf88b41c9c02d78a98c00742a2710d3a56d210d3 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 15:07:08 +0100 Subject: [PATCH 05/30] wip trigger ci --- test/conformance/memory/urMemRelease.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/conformance/memory/urMemRelease.cpp b/test/conformance/memory/urMemRelease.cpp index 3e84142638..95852d6dbc 100644 --- a/test/conformance/memory/urMemRelease.cpp +++ b/test/conformance/memory/urMemRelease.cpp @@ -16,3 +16,4 @@ TEST_P(urMemReleaseTest, InvalidNullHandleMem) { ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, urMemRelease(nullptr)); } +// temp From 79e9e96e8f9d04e24f1dd4ab7f2e4a54a38f287a Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 16:18:33 +0100 Subject: [PATCH 06/30] wip add in missing returnvalue for getinfo size and replace entry to match file for urmemgetinfoimagetest info query --- source/adapters/level_zero/memory.cpp | 1 + test/conformance/memory/memory_adapter_level_zero.match | 1 + 2 files changed, 2 insertions(+) diff --git a/source/adapters/level_zero/memory.cpp b/source/adapters/level_zero/memory.cpp index 3a51cf6cc6..43868f0d6d 100644 --- a/source/adapters/level_zero/memory.cpp +++ b/source/adapters/level_zero/memory.cpp @@ -1881,6 +1881,7 @@ ur_result_t urMemGetInfo( } case UR_MEM_INFO_SIZE: { // Get size of the allocation + return ReturnValue(size_t{Buffer->Size}); } case UR_MEM_INFO_REFERENCE_COUNT: { return ReturnValue(Buffer->RefCount.load()); diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index 0d02c380aa..f09638fd08 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -1,4 +1,5 @@ {{NONDETERMINISTIC}} urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +{{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE {{Segmentation fault|Aborted}} From fa4f20a241a31a9a45ed09cb1610cbe9f75ad2f1 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 16:36:04 +0100 Subject: [PATCH 07/30] wip partition test with match entries for nativecpu and l0 --- .../memory/memory_adapter_level_zero.match | 2 ++ .../memory/memory_adapter_native_cpu.match | 2 ++ .../memory/urMemBufferPartition.cpp | 25 ++++++++++++++----- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index f09638fd08..40a35021b1 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -1,4 +1,6 @@ {{NONDETERMINISTIC}} +urMemBufferPartitionTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}__UR_MEM_FLAG_WRITE_ONLY +urMemBufferPartitionTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}__UR_MEM_FLAG_READ_ONLY urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ {{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE diff --git a/test/conformance/memory/memory_adapter_native_cpu.match b/test/conformance/memory/memory_adapter_native_cpu.match index 35d00f1ba3..0449f2e830 100644 --- a/test/conformance/memory/memory_adapter_native_cpu.match +++ b/test/conformance/memory/memory_adapter_native_cpu.match @@ -1,4 +1,6 @@ {{NONDETERMINISTIC}} +urMemBufferPartitionTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_FLAG_WRITE_ONLY +urMemBufferPartitionTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_FLAG_READ_ONLY urMemBufferPartitionTest.InvalidValueCreateType/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemGetInfoTestWithParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_SIZE diff --git a/test/conformance/memory/urMemBufferPartition.cpp b/test/conformance/memory/urMemBufferPartition.cpp index 01ab7f8c62..fca20693c7 100644 --- a/test/conformance/memory/urMemBufferPartition.cpp +++ b/test/conformance/memory/urMemBufferPartition.cpp @@ -6,19 +6,32 @@ #include "uur/fixtures.h" #include "uur/raii.h" -using urMemBufferPartitionTest = uur::urMemBufferTest; -UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemBufferPartitionTest); +using urMemBufferPartitionWithFlagsTest = + uur::urContextTestWithParam; +UUR_TEST_SUITE_P(urMemBufferPartitionWithFlagsTest, + ::testing::Values(UR_MEM_FLAG_READ_WRITE, + UR_MEM_FLAG_WRITE_ONLY, + UR_MEM_FLAG_READ_ONLY), + uur::deviceTestWithParamPrinter); -TEST_P(urMemBufferPartitionTest, Success) { - ur_buffer_region_t region{UR_STRUCTURE_TYPE_BUFFER_REGION, nullptr, 0, - 1024}; +TEST_P(urMemBufferPartitionWithFlagsTest, Success) { + uur::raii::Mem buffer = nullptr; + + ASSERT_SUCCESS( + urMemBufferCreate(context, getParam(), 1024, nullptr, buffer.ptr())); + ASSERT_NE(nullptr, buffer); + + ur_buffer_region_t region{UR_STRUCTURE_TYPE_BUFFER_REGION, nullptr, 0, 512}; uur::raii::Mem partition = nullptr; - ASSERT_SUCCESS(urMemBufferPartition(buffer, UR_MEM_FLAG_READ_WRITE, + ASSERT_SUCCESS(urMemBufferPartition(buffer, getParam(), UR_BUFFER_CREATE_TYPE_REGION, ®ion, partition.ptr())); ASSERT_NE(partition, nullptr); } +using urMemBufferPartitionTest = uur::urMemBufferTest; +UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemBufferPartitionTest); + TEST_P(urMemBufferPartitionTest, InvalidNullHandleBuffer) { ur_buffer_region_t region{UR_STRUCTURE_TYPE_BUFFER_REGION, nullptr, 0, 1024}; From 596461a5b776b6d42162e61d615cea10e2f1d051 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 17:22:12 +0100 Subject: [PATCH 08/30] wip membuffercreatenative --- .../memory/memory_adapter_cuda.match | 5 ++ .../memory/memory_adapter_hip.match | 5 ++ .../memory/memory_adapter_level_zero_v2.match | 6 ++ .../memory/memory_adapter_native_cpu.match | 5 ++ .../urMemBufferCreateWithNativeHandle.cpp | 85 ++++++++++++++++--- 5 files changed, 95 insertions(+), 11 deletions(-) diff --git a/test/conformance/memory/memory_adapter_cuda.match b/test/conformance/memory/memory_adapter_cuda.match index c5b70e8559..d0f8f132d6 100644 --- a/test/conformance/memory/memory_adapter_cuda.match +++ b/test/conformance/memory/memory_adapter_cuda.match @@ -2,3 +2,8 @@ urMemImageCreateTest.InvalidSize/NVIDIA_CUDA_BACKEND___{{.*}}_ {{OPT}}urMemImageCremBufferCrateTestWith1DMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE1D_ARRAY {{OPT}}urMemImageCreateTestWith2DMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE2D_ARRAY +urMemBufferCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/NVIDIA_CUDA_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithUnwnedNativeHandle/NVIDIA_CUDA_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/NVIDIA_CUDA_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/NVIDIA_CUDA_BACKEND___{{.*}} diff --git a/test/conformance/memory/memory_adapter_hip.match b/test/conformance/memory/memory_adapter_hip.match index 589542df7f..b02e5a89cc 100644 --- a/test/conformance/memory/memory_adapter_hip.match +++ b/test/conformance/memory/memory_adapter_hip.match @@ -2,3 +2,8 @@ urMemImageCreateTest.InvalidSize/AMD_HIP_BACKEND___{{.*}} urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}} urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.Success/AMD_HIP_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/AMD_HIP_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithUnwnedNativeHandle/AMD_HIP_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/AMD_HIP_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/AMD_HIP_BACKEND___{{.*}} diff --git a/test/conformance/memory/memory_adapter_level_zero_v2.match b/test/conformance/memory/memory_adapter_level_zero_v2.match index 5eeefa20bc..41cdc04a70 100644 --- a/test/conformance/memory/memory_adapter_level_zero_v2.match +++ b/test/conformance/memory/memory_adapter_level_zero_v2.match @@ -279,3 +279,9 @@ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI {{OPT}}urMemImageGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_INFO_WIDTH {{OPT}}urMemImageGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_INFO_HEIGHT {{OPT}}urMemImageGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_INFO_DEPTH +urMemBufferCreateWithNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithUnwnedNativeHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} + diff --git a/test/conformance/memory/memory_adapter_native_cpu.match b/test/conformance/memory/memory_adapter_native_cpu.match index 35d00f1ba3..32a91d8c29 100644 --- a/test/conformance/memory/memory_adapter_native_cpu.match +++ b/test/conformance/memory/memory_adapter_native_cpu.match @@ -232,3 +232,8 @@ urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_C urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_IMAGE_CHANNEL_ORDER_SRGBA__UR_IMAGE_CHANNEL_TYPE_FLOAT urMemReleaseTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemRetainTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} +urMemBufferCreateWithNativeHandleTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithUnwnedNativeHandle/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} +urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} +urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} diff --git a/test/conformance/memory/urMemBufferCreateWithNativeHandle.cpp b/test/conformance/memory/urMemBufferCreateWithNativeHandle.cpp index 80afbd5f7c..745eeea18f 100644 --- a/test/conformance/memory/urMemBufferCreateWithNativeHandle.cpp +++ b/test/conformance/memory/urMemBufferCreateWithNativeHandle.cpp @@ -10,23 +10,15 @@ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemBufferCreateWithNativeHandleTest); TEST_P(urMemBufferCreateWithNativeHandleTest, Success) { ur_native_handle_t hNativeMem = 0; - { - UUR_ASSERT_SUCCESS_OR_UNSUPPORTED( - urMemGetNativeHandle(buffer, device, &hNativeMem)); - } + ASSERT_SUCCESS(urMemGetNativeHandle(buffer, device, &hNativeMem)); // We cannot assume anything about a native_handle, not even if it's // `nullptr` since this could be a valid representation within a backend. // We can however convert the native_handle back into a unified-runtime handle // and perform some query on it to verify that it works. ur_mem_handle_t mem = nullptr; - ur_mem_native_properties_t props = { - /*.stype =*/UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES, - /*.pNext =*/nullptr, - /*.isNativeHandleOwned =*/false, - }; - UUR_ASSERT_SUCCESS_OR_UNSUPPORTED( - urMemBufferCreateWithNativeHandle(hNativeMem, context, &props, &mem)); + ASSERT_SUCCESS( + urMemBufferCreateWithNativeHandle(hNativeMem, context, nullptr, &mem)); ASSERT_NE(mem, nullptr); size_t alloc_size = 0; @@ -35,3 +27,74 @@ TEST_P(urMemBufferCreateWithNativeHandleTest, Success) { ASSERT_SUCCESS(urMemRelease(mem)); } + +TEST_P(urMemBufferCreateWithNativeHandleTest, SuccessWithOwnedNativeHandle) { + ur_native_handle_t native_handle = 0; + ASSERT_SUCCESS(urMemGetNativeHandle(buffer, device, &native_handle)); + + ur_mem_handle_t mem = nullptr; + ur_mem_native_properties_t props = { + /*.stype =*/UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES, + /*.pNext =*/nullptr, + /*.isNativeHandleOwned =*/true, + }; + ASSERT_SUCCESS(urMemBufferCreateWithNativeHandle(native_handle, context, + &props, &mem)); + ASSERT_NE(nullptr, mem); + + ur_context_handle_t mem_context = nullptr; + ASSERT_SUCCESS(urMemGetInfo(mem, UR_MEM_INFO_CONTEXT, + sizeof(ur_context_handle_t), &mem_context, + nullptr)); + ASSERT_EQ(context, mem_context); +} + +TEST_P(urMemBufferCreateWithNativeHandleTest, SuccessWithUnOwnedNativeHandle) { + ur_native_handle_t native_handle = 0; + ASSERT_SUCCESS(urMemGetNativeHandle(buffer, device, &native_handle)); + + ur_mem_handle_t mem = nullptr; + ur_mem_native_properties_t props = { + /*.stype =*/UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES, + /*.pNext =*/nullptr, + /*.isNativeHandleOwned =*/false, + }; + ASSERT_SUCCESS(urMemBufferCreateWithNativeHandle(native_handle, context, + &props, &mem)); + ASSERT_NE(nullptr, mem); + + ur_context_handle_t mem_context = nullptr; + ASSERT_SUCCESS(urMemGetInfo(mem, UR_MEM_INFO_CONTEXT, + sizeof(ur_context_handle_t), &mem_context, + nullptr)); + ASSERT_EQ(context, mem_context); +} + +TEST_P(urMemBufferCreateWithNativeHandleTest, InvalidNullHandle) { + ur_native_handle_t hNativeMem = 0; + ASSERT_SUCCESS(urMemGetNativeHandle(buffer, device, &hNativeMem)); + + ur_mem_handle_t mem = nullptr; + ur_mem_native_properties_t props = { + /*.stype =*/UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES, + /*.pNext =*/nullptr, + /*.isNativeHandleOwned =*/false, + }; + ASSERT_EQ( + urMemBufferCreateWithNativeHandle(hNativeMem, nullptr, &props, &mem), + UR_RESULT_ERROR_INVALID_NULL_HANDLE); +} + +TEST_P(urMemBufferCreateWithNativeHandleTest, InvalidNullPointer) { + ur_native_handle_t hNativeMem = 0; + ASSERT_SUCCESS(urMemGetNativeHandle(buffer, device, &hNativeMem)); + + ur_mem_native_properties_t props = { + /*.stype =*/UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES, + /*.pNext =*/nullptr, + /*.isNativeHandleOwned =*/false, + }; + ASSERT_EQ( + urMemBufferCreateWithNativeHandle(hNativeMem, context, &props, nullptr), + UR_RESULT_ERROR_INVALID_NULL_POINTER); +} From f1458877f2c630c09fac311d9f3d10d0b4b4a57f Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 11:44:53 +0100 Subject: [PATCH 09/30] WIP add mem reference count to spec and modify urMemGetInfo to test for it. Also add missing error condition for urImageCreate in spec --- include/ur_api.h | 11 ++++-- include/ur_print.hpp | 15 +++++++ scripts/core/memory.yml | 6 +++ source/adapters/cuda/memory.cpp | 3 ++ source/adapters/hip/memory.cpp | 7 ++-- source/adapters/level_zero/memory.cpp | 5 ++- source/adapters/level_zero/v2/memory.cpp | 3 ++ source/adapters/opencl/memory.cpp | 2 + source/loader/layers/validation/ur_valddi.cpp | 6 ++- source/loader/ur_libapi.cpp | 3 +- source/ur_api.cpp | 3 +- test/conformance/memory/urMemGetInfo.cpp | 39 +++++++++++++++---- 12 files changed, 85 insertions(+), 18 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 9897d892b6..10117e3aaa 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -2510,8 +2510,12 @@ typedef enum ur_mem_type_t { /////////////////////////////////////////////////////////////////////////////// /// @brief Memory Information type typedef enum ur_mem_info_t { - UR_MEM_INFO_SIZE = 0, ///< [size_t] actual size of of memory object in bytes - UR_MEM_INFO_CONTEXT = 1, ///< [::ur_context_handle_t] context in which the memory object was created + UR_MEM_INFO_SIZE = 0, ///< [size_t] actual size of of memory object in bytes + UR_MEM_INFO_CONTEXT = 1, ///< [::ur_context_handle_t] context in which the memory object was created + UR_MEM_INFO_REFERENCE_COUNT = 2, ///< [uint32_t] Reference count of the memory object. + ///< The reference count returned should be considered immediately stale. + ///< It is unsuitable for general use in applications. This feature is + ///< provided for identifying memory leaks. /// @cond UR_MEM_INFO_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -2645,6 +2649,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_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype` /// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// + `pImageDesc && pImageDesc->numMipLevel != 0` /// + `pImageDesc && pImageDesc->numSamples != 0` @@ -2985,7 +2990,7 @@ urMemImageCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hMemory` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_MEM_INFO_CONTEXT < propName` +/// + `::UR_MEM_INFO_REFERENCE_COUNT < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/include/ur_print.hpp b/include/ur_print.hpp index a908fd9275..d997e3051e 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -5616,6 +5616,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value) { case UR_MEM_INFO_CONTEXT: os << "UR_MEM_INFO_CONTEXT"; break; + case UR_MEM_INFO_REFERENCE_COUNT: + os << "UR_MEM_INFO_REFERENCE_COUNT"; + break; default: os << "unknown enumerator"; break; @@ -5657,6 +5660,18 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_mem_info_t os << ")"; } break; + case UR_MEM_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; default: os << "unknown enumerator"; return UR_RESULT_ERROR_INVALID_ENUMERATION; diff --git a/scripts/core/memory.yml b/scripts/core/memory.yml index 0fde537f37..7cc7467da4 100644 --- a/scripts/core/memory.yml +++ b/scripts/core/memory.yml @@ -62,6 +62,11 @@ etors: desc: "[size_t] actual size of of memory object in bytes" - name: CONTEXT desc: "[$x_context_handle_t] context in which the memory object was created" + - name: REFERENCE_COUNT + desc: | + [uint32_t] Reference count of the memory object. + The reference count returned should be considered immediately stale. + It is unsuitable for general use in applications. This feature is provided for identifying memory leaks. --- #-------------------------------------------------------------------------- type: enum desc: "Image channel order info: number of channels and the channel layout" @@ -241,6 +246,7 @@ returns: - $X_RESULT_ERROR_INVALID_CONTEXT - $X_RESULT_ERROR_INVALID_VALUE - $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: + - "`pImageDesc && UR_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype`" - "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`" - "`pImageDesc && pImageDesc->numMipLevel != 0`" - "`pImageDesc && pImageDesc->numSamples != 0`" diff --git a/source/adapters/cuda/memory.cpp b/source/adapters/cuda/memory.cpp index ea55c1669a..8b4db742ac 100644 --- a/source/adapters/cuda/memory.cpp +++ b/source/adapters/cuda/memory.cpp @@ -171,6 +171,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, case UR_MEM_INFO_CONTEXT: { return ReturnValue(hMemory->getContext()); } + case UR_MEM_INFO_REFERENCE_COUNT: { + return ReturnValue(hMemory->getReferenceCount()); + } default: return UR_RESULT_ERROR_INVALID_ENUMERATION; diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index aa7b5f4040..55c6fe05ed 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -231,10 +231,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, size_t propSize, void *pMemInfo, size_t *pPropSizeRet) { - - UR_ASSERT(MemInfoType <= UR_MEM_INFO_CONTEXT, - UR_RESULT_ERROR_INVALID_ENUMERATION); - // FIXME: Only getting info for the first device in the context. This // should be fine in general auto Device = hMemory->getContext()->getDevices()[0]; @@ -286,6 +282,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, case UR_MEM_INFO_CONTEXT: { return ReturnValue(hMemory->getContext()); } + case UR_MEM_INFO_REFERENCE_COUNT: { + return ReturnValue(hMemory->getReferenceCount()); + } default: return UR_RESULT_ERROR_INVALID_ENUMERATION; diff --git a/source/adapters/level_zero/memory.cpp b/source/adapters/level_zero/memory.cpp index bc915517e7..cddf98eaa0 100644 --- a/source/adapters/level_zero/memory.cpp +++ b/source/adapters/level_zero/memory.cpp @@ -1886,8 +1886,11 @@ ur_result_t urMemGetInfo( // Get size of the allocation return ReturnValue(size_t{Buffer->Size}); } + case UR_MEM_INFO_REFERENCE_COUNT: { + return ReturnValue(Buffer->RefCount.load()); + } default: { - die("urMemGetInfo: Parameter is not implemented"); + return UR_RESULT_ERROR_INVALID_ENUMERATION; } } diff --git a/source/adapters/level_zero/v2/memory.cpp b/source/adapters/level_zero/v2/memory.cpp index a64d77b1dd..575cbefb07 100644 --- a/source/adapters/level_zero/v2/memory.cpp +++ b/source/adapters/level_zero/v2/memory.cpp @@ -205,6 +205,9 @@ ur_result_t urMemGetInfo(ur_mem_handle_t hMemory, ur_mem_info_t propName, // Get size of the allocation return returnValue(size_t{hMemory->getSize()}); } + case UR_MEM_INFO_REFERENCE_COUNT: { + return returnValue(hMemory->RefCount.load()); + } default: { return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/source/adapters/opencl/memory.cpp b/source/adapters/opencl/memory.cpp index b2476fc420..201df1f678 100644 --- a/source/adapters/opencl/memory.cpp +++ b/source/adapters/opencl/memory.cpp @@ -186,6 +186,8 @@ cl_int mapURMemInfoToCL(ur_mem_info_t URPropName) { return CL_MEM_SIZE; case UR_MEM_INFO_CONTEXT: return CL_MEM_CONTEXT; + case UR_MEM_INFO_REFERENCE_COUNT: + return CL_MEM_REFERENCE_COUNT; default: return -1; } diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 0911745f03..7325e2f43a 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -1104,6 +1104,10 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreate( return UR_RESULT_ERROR_INVALID_ENUMERATION; } + if (pImageDesc && UR_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype) { + return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; + } + if (pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type) { return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } @@ -1503,7 +1507,7 @@ __urdlllocal ur_result_t UR_APICALL urMemGetInfo( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (UR_MEM_INFO_CONTEXT < propName) { + if (UR_MEM_INFO_REFERENCE_COUNT < propName) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index ca6d4da65d..1dae3e2cd6 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -1539,6 +1539,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_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype` /// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// + `pImageDesc && pImageDesc->numMipLevel != 0` /// + `pImageDesc && pImageDesc->numSamples != 0` @@ -1888,7 +1889,7 @@ ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hMemory` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_MEM_INFO_CONTEXT < propName` +/// + `::UR_MEM_INFO_REFERENCE_COUNT < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/source/ur_api.cpp b/source/ur_api.cpp index cdfdb648af..dab24c2400 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -1340,6 +1340,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_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype` /// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` /// + `pImageDesc && pImageDesc->numMipLevel != 0` /// + `pImageDesc && pImageDesc->numSamples != 0` @@ -1634,7 +1635,7 @@ ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hMemory` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_MEM_INFO_CONTEXT < propName` +/// + `::UR_MEM_INFO_REFERENCE_COUNT < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/test/conformance/memory/urMemGetInfo.cpp b/test/conformance/memory/urMemGetInfo.cpp index a28b581a26..3f933d39a9 100644 --- a/test/conformance/memory/urMemGetInfo.cpp +++ b/test/conformance/memory/urMemGetInfo.cpp @@ -6,19 +6,21 @@ #include #include -using urMemGetInfoTest = uur::urMemBufferTestWithParam; +using urMemGetInfoTestWithParam = uur::urMemBufferTestWithParam; -static constexpr std::array mem_info_values{ - UR_MEM_INFO_SIZE, UR_MEM_INFO_CONTEXT}; +static constexpr std::array mem_info_values{ + UR_MEM_INFO_SIZE, UR_MEM_INFO_CONTEXT, UR_MEM_INFO_REFERENCE_COUNT}; static std::unordered_map mem_info_size_map = { {UR_MEM_INFO_SIZE, sizeof(size_t)}, {UR_MEM_INFO_CONTEXT, sizeof(ur_context_handle_t)}, + {UR_MEM_INFO_REFERENCE_COUNT, sizeof(uint32_t)}, }; -UUR_TEST_SUITE_P(urMemGetInfoTest, ::testing::ValuesIn(mem_info_values), +UUR_TEST_SUITE_P(urMemGetInfoTestWithParam, + ::testing::ValuesIn(mem_info_values), uur::deviceTestWithParamPrinter); -TEST_P(urMemGetInfoTest, Success) { +TEST_P(urMemGetInfoTestWithParam, Success) { ur_mem_info_t info = getParam(); size_t size; ASSERT_SUCCESS(urMemGetInfo(buffer, info, 0, nullptr, &size)); @@ -44,11 +46,20 @@ TEST_P(urMemGetInfoTest, Success) { ASSERT_GE(*returned_size, allocation_size); break; } + case UR_MEM_INFO_REFERENCE_COUNT: { + const size_t ReferenceCount = + *reinterpret_cast(info_data.data()); + ASSERT_GT(ReferenceCount, 0); + break; + } default: break; } } +using urMemGetInfoTest = uur::urMemBufferTest; +UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemGetInfoTest); + TEST_P(urMemGetInfoTest, InvalidNullHandleMemory) { size_t mem_size = 0; ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, @@ -108,16 +119,30 @@ TEST_P(urMemGetInfoImageTest, Success) { std::vector info_data(size); ASSERT_SUCCESS(urMemGetInfo(image, info, size, info_data.data(), nullptr)); - if (info == UR_MEM_INFO_SIZE) { + switch (info) { + case UR_MEM_INFO_SIZE: { const size_t ExpectedPixelSize = sizeof(float) * 4 /*NumChannels*/; const size_t ExpectedImageSize = ExpectedPixelSize * desc.arraySize * desc.width * desc.height * desc.depth; const size_t ImageSizeBytes = *reinterpret_cast(info_data.data()); ASSERT_EQ(ImageSizeBytes, ExpectedImageSize); - } else if (info == UR_MEM_INFO_CONTEXT) { + break; + } + case UR_MEM_INFO_CONTEXT: { ur_context_handle_t InfoContext = *reinterpret_cast(info_data.data()); ASSERT_EQ(InfoContext, context); + break; + } + case UR_MEM_INFO_REFERENCE_COUNT: { + const size_t ReferenceCount = + *reinterpret_cast(info_data.data()); + ASSERT_GT(ReferenceCount, 0); + break; + } + + default: + break; } } From a8f54d07a6c1b7c0e11bf0f2a98b6f83017cf491 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 12:37:36 +0100 Subject: [PATCH 10/30] wip remove InvalidImageDescStype entry from opencl match as test now passes. rename urMemGetInfo tests and add ref count entry to native cpu match file --- test/conformance/memory/memory_adapter_native_cpu.match | 8 ++++---- test/conformance/memory/memory_adapter_opencl.match | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/conformance/memory/memory_adapter_native_cpu.match b/test/conformance/memory/memory_adapter_native_cpu.match index 5bdd88804b..35d00f1ba3 100644 --- a/test/conformance/memory/memory_adapter_native_cpu.match +++ b/test/conformance/memory/memory_adapter_native_cpu.match @@ -1,10 +1,10 @@ {{NONDETERMINISTIC}} urMemBufferPartitionTest.InvalidValueCreateType/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} -urMemGetInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_SIZE -urMemGetInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_CONTEXT -urMemGetInfoTest.InvalidSizeSmall/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidSizeSmall/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_CONTEXT +urMemGetInfoTestWithParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_SIZE +urMemGetInfoTestWithParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_CONTEXT +urMemGetInfoTestWithParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_REFERENCE_COUNT +urMemGetInfoTest.InvalidSizeSmall/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_SNORM_INT8 urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_SNORM_INT16 urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_UNORM_INT8 diff --git a/test/conformance/memory/memory_adapter_opencl.match b/test/conformance/memory/memory_adapter_opencl.match index b57e3876d0..e69de29bb2 100644 --- a/test/conformance/memory/memory_adapter_opencl.match +++ b/test/conformance/memory/memory_adapter_opencl.match @@ -1,2 +0,0 @@ -{{NONDETERMINISTIC}} -urMemImageCreateTest.InvalidImageDescStype/Intel_R__OpenCL___{{.*}} From 0a07804a304b13261ca0101dcaef5c13c9df4a2f Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 12:52:35 +0100 Subject: [PATCH 11/30] wip remove assert from L0 urMemGetInfo and update match file --- source/adapters/level_zero/memory.cpp | 4 ---- test/conformance/memory/memory_adapter_level_zero.match | 1 - 2 files changed, 5 deletions(-) diff --git a/source/adapters/level_zero/memory.cpp b/source/adapters/level_zero/memory.cpp index cddf98eaa0..3a51cf6cc6 100644 --- a/source/adapters/level_zero/memory.cpp +++ b/source/adapters/level_zero/memory.cpp @@ -1871,9 +1871,6 @@ ur_result_t urMemGetInfo( size_t *PropSizeRet ///< [out][optional] pointer to the actual size in ///< bytes of data queried by pMemInfo. ) { - UR_ASSERT(MemInfoType == UR_MEM_INFO_CONTEXT || !Memory->isImage(), - UR_RESULT_ERROR_INVALID_VALUE); - auto Buffer = reinterpret_cast<_ur_buffer *>(Memory); std::shared_lock Lock(Buffer->Mutex); UrReturnHelper ReturnValue(PropSize, MemInfo, PropSizeRet); @@ -1884,7 +1881,6 @@ ur_result_t urMemGetInfo( } case UR_MEM_INFO_SIZE: { // Get size of the allocation - return ReturnValue(size_t{Buffer->Size}); } case UR_MEM_INFO_REFERENCE_COUNT: { return ReturnValue(Buffer->RefCount.load()); diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index f09638fd08..0d02c380aa 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -1,5 +1,4 @@ {{NONDETERMINISTIC}} urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -{{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE {{Segmentation fault|Aborted}} From 464b5853ad56419c1988533a9a8eb40cad53b843 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 13:02:41 +0100 Subject: [PATCH 12/30] wip update l0 v2 match file for get info ref count --- test/conformance/memory/memory_adapter_level_zero_v2.match | 1 + 1 file changed, 1 insertion(+) diff --git a/test/conformance/memory/memory_adapter_level_zero_v2.match b/test/conformance/memory/memory_adapter_level_zero_v2.match index 284dcab4b0..5eeefa20bc 100644 --- a/test/conformance/memory/memory_adapter_level_zero_v2.match +++ b/test/conformance/memory/memory_adapter_level_zero_v2.match @@ -4,6 +4,7 @@ urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ {{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE {{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_CONTEXT +{{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_REFERENCE_COUNT {{OPT}}urMemImageCreateTestWithImageFormatParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_SNORM_INT8 {{OPT}}urMemImageCreateTestWithImageFormatParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_SNORM_INT16 {{OPT}}urMemImageCreateTestWithImageFormatParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_CHANNEL_ORDER_A__UR_IMAGE_CHANNEL_TYPE_UNORM_INT8 From d62018d5fa394d5242a133682a5735187818003d Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 15:07:08 +0100 Subject: [PATCH 13/30] wip trigger ci --- test/conformance/memory/urMemRelease.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/conformance/memory/urMemRelease.cpp b/test/conformance/memory/urMemRelease.cpp index 3e84142638..95852d6dbc 100644 --- a/test/conformance/memory/urMemRelease.cpp +++ b/test/conformance/memory/urMemRelease.cpp @@ -16,3 +16,4 @@ TEST_P(urMemReleaseTest, InvalidNullHandleMem) { ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, urMemRelease(nullptr)); } +// temp From bd62f2a6ed3bfa8de35b3196e4092545d5fe60d4 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 16:18:33 +0100 Subject: [PATCH 14/30] wip add in missing returnvalue for getinfo size and replace entry to match file for urmemgetinfoimagetest info query --- source/adapters/level_zero/memory.cpp | 1 + test/conformance/memory/memory_adapter_level_zero.match | 1 + 2 files changed, 2 insertions(+) diff --git a/source/adapters/level_zero/memory.cpp b/source/adapters/level_zero/memory.cpp index 3a51cf6cc6..43868f0d6d 100644 --- a/source/adapters/level_zero/memory.cpp +++ b/source/adapters/level_zero/memory.cpp @@ -1881,6 +1881,7 @@ ur_result_t urMemGetInfo( } case UR_MEM_INFO_SIZE: { // Get size of the allocation + return ReturnValue(size_t{Buffer->Size}); } case UR_MEM_INFO_REFERENCE_COUNT: { return ReturnValue(Buffer->RefCount.load()); diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index 0d02c380aa..f09638fd08 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -1,4 +1,5 @@ {{NONDETERMINISTIC}} urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +{{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE {{Segmentation fault|Aborted}} From c139f391191c83527d5514459d2b5095146a5d9b Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 12:52:35 +0100 Subject: [PATCH 15/30] wip remove assert from L0 urMemGetInfo and update match file --- source/adapters/level_zero/memory.cpp | 1 - test/conformance/memory/memory_adapter_level_zero.match | 1 - 2 files changed, 2 deletions(-) diff --git a/source/adapters/level_zero/memory.cpp b/source/adapters/level_zero/memory.cpp index 43868f0d6d..3a51cf6cc6 100644 --- a/source/adapters/level_zero/memory.cpp +++ b/source/adapters/level_zero/memory.cpp @@ -1881,7 +1881,6 @@ ur_result_t urMemGetInfo( } case UR_MEM_INFO_SIZE: { // Get size of the allocation - return ReturnValue(size_t{Buffer->Size}); } case UR_MEM_INFO_REFERENCE_COUNT: { return ReturnValue(Buffer->RefCount.load()); diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index f09638fd08..0d02c380aa 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -1,5 +1,4 @@ {{NONDETERMINISTIC}} urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -{{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE {{Segmentation fault|Aborted}} From 4a33e70769eb0cbaeb1c8c7cd1c4a9cea95838ef Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 16 Oct 2024 14:51:09 +0100 Subject: [PATCH 16/30] wip add ref count tests to mem release/retain --- test/conformance/memory/urMemRelease.cpp | 22 +++++++++++++++++++++- test/conformance/memory/urMemRetain.cpp | 24 +++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/test/conformance/memory/urMemRelease.cpp b/test/conformance/memory/urMemRelease.cpp index 95852d6dbc..730b6aa854 100644 --- a/test/conformance/memory/urMemRelease.cpp +++ b/test/conformance/memory/urMemRelease.cpp @@ -16,4 +16,24 @@ TEST_P(urMemReleaseTest, InvalidNullHandleMem) { ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, urMemRelease(nullptr)); } -// temp + +TEST_P(urMemReleaseTest, CheckReferenceCount) { + uint32_t referenceCount = 0; + ASSERT_SUCCESS(urMemGetInfo(buffer, UR_MEM_INFO_REFERENCE_COUNT, + sizeof(referenceCount), &referenceCount, + nullptr)); + ASSERT_EQ(referenceCount, 1); + + ASSERT_SUCCESS(urMemRetain(buffer)); + ASSERT_SUCCESS(urMemGetInfo(buffer, UR_MEM_INFO_REFERENCE_COUNT, + sizeof(referenceCount), &referenceCount, + nullptr)); + ASSERT_EQ(referenceCount, 2); + + ASSERT_SUCCESS(urMemRelease(buffer)); + + ASSERT_SUCCESS(urMemGetInfo(buffer, UR_MEM_INFO_REFERENCE_COUNT, + sizeof(referenceCount), &referenceCount, + nullptr)); + ASSERT_EQ(referenceCount, 1); +} diff --git a/test/conformance/memory/urMemRetain.cpp b/test/conformance/memory/urMemRetain.cpp index 895d68097e..a58896a91b 100644 --- a/test/conformance/memory/urMemRetain.cpp +++ b/test/conformance/memory/urMemRetain.cpp @@ -9,9 +9,31 @@ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemRetainTest); TEST_P(urMemRetainTest, Success) { ASSERT_SUCCESS(urMemRetain(buffer)); - EXPECT_SUCCESS(urMemRelease(buffer)); + ASSERT_SUCCESS(urMemRelease(buffer)); } TEST_P(urMemRetainTest, InvalidNullHandleMem) { ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, urMemRetain(nullptr)); } + +TEST_P(urMemRetainTest, CheckReferenceCount) { + uint32_t referenceCount = 0; + ASSERT_SUCCESS(urMemGetInfo(buffer, UR_MEM_INFO_REFERENCE_COUNT, + sizeof(referenceCount), &referenceCount, + nullptr)); + ASSERT_EQ(referenceCount, 1); + + { ASSERT_SUCCESS(urMemRetain(buffer)); } + + ASSERT_SUCCESS(urMemGetInfo(buffer, UR_MEM_INFO_REFERENCE_COUNT, + sizeof(referenceCount), &referenceCount, + nullptr)); + ASSERT_EQ(referenceCount, 2); + + ASSERT_SUCCESS(urMemRelease(buffer)); + + ASSERT_SUCCESS(urMemGetInfo(buffer, UR_MEM_INFO_REFERENCE_COUNT, + sizeof(referenceCount), &referenceCount, + nullptr)); + ASSERT_EQ(referenceCount, 1); +} From 87b6c376d8371e6a5aa3cda71391268e0d6b4c55 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Thu, 17 Oct 2024 11:12:35 +0100 Subject: [PATCH 17/30] wip remove duplicate mem info reference count from l0 and add release/retain ref count test to native cpu match files --- test/conformance/memory/memory_adapter_native_cpu.match | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/conformance/memory/memory_adapter_native_cpu.match b/test/conformance/memory/memory_adapter_native_cpu.match index 35d00f1ba3..34528c7594 100644 --- a/test/conformance/memory/memory_adapter_native_cpu.match +++ b/test/conformance/memory/memory_adapter_native_cpu.match @@ -232,3 +232,5 @@ urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_C urMemImageCreateTestWithImageFormatParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_IMAGE_CHANNEL_ORDER_SRGBA__UR_IMAGE_CHANNEL_TYPE_FLOAT urMemReleaseTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemRetainTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} +urMemReleaseTest.CheckReferenceCount/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} +urMemRetainTest.CheckReferenceCount/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} From 8c98c6825481e5d96929a409746083fc3382a23a Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Fri, 18 Oct 2024 09:36:35 +0100 Subject: [PATCH 18/30] wip replace conflicting l0 match line --- test/conformance/memory/memory_adapter_level_zero.match | 1 + 1 file changed, 1 insertion(+) diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index 0d02c380aa..f09638fd08 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -1,4 +1,5 @@ {{NONDETERMINISTIC}} urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +{{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE {{Segmentation fault|Aborted}} From 3b1ecd1b11f33cb52b6f01a39ddf5ea8738e391b Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Fri, 18 Oct 2024 15:39:22 +0100 Subject: [PATCH 19/30] wip revert removal of l0 mem info size --- source/adapters/level_zero/memory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/adapters/level_zero/memory.cpp b/source/adapters/level_zero/memory.cpp index 3a51cf6cc6..43868f0d6d 100644 --- a/source/adapters/level_zero/memory.cpp +++ b/source/adapters/level_zero/memory.cpp @@ -1881,6 +1881,7 @@ ur_result_t urMemGetInfo( } case UR_MEM_INFO_SIZE: { // Get size of the allocation + return ReturnValue(size_t{Buffer->Size}); } case UR_MEM_INFO_REFERENCE_COUNT: { return ReturnValue(Buffer->RefCount.load()); From acbff77b34f798b4f366df50c241e11f7c3f577b Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Fri, 18 Oct 2024 17:00:08 +0100 Subject: [PATCH 20/30] wip remove opencl match file entirely --- test/conformance/memory/memory_adapter_opencl.match | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/conformance/memory/memory_adapter_opencl.match diff --git a/test/conformance/memory/memory_adapter_opencl.match b/test/conformance/memory/memory_adapter_opencl.match deleted file mode 100644 index e69de29bb2..0000000000 From 102fd28f0231ff916727d7d0fed072b84c69d518 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Fri, 18 Oct 2024 17:17:40 +0100 Subject: [PATCH 21/30] wip rename match entry files for urMemBufferPartitionWithFlagsTest --- test/conformance/memory/memory_adapter_level_zero.match | 4 ++-- test/conformance/memory/memory_adapter_level_zero_v2.match | 2 +- test/conformance/memory/memory_adapter_native_cpu.match | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index 40a35021b1..4a6d13f7a3 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -1,6 +1,6 @@ {{NONDETERMINISTIC}} -urMemBufferPartitionTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}__UR_MEM_FLAG_WRITE_ONLY -urMemBufferPartitionTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}__UR_MEM_FLAG_READ_ONLY +urMemBufferPartitionWithFlagsTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}__UR_MEM_FLAG_WRITE_ONLY +urMemBufferPartitionWithFlagsTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}__UR_MEM_FLAG_READ_ONLY urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ {{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE diff --git a/test/conformance/memory/memory_adapter_level_zero_v2.match b/test/conformance/memory/memory_adapter_level_zero_v2.match index 5eeefa20bc..6c3e28ec9e 100644 --- a/test/conformance/memory/memory_adapter_level_zero_v2.match +++ b/test/conformance/memory/memory_adapter_level_zero_v2.match @@ -1,5 +1,5 @@ {{NONDETERMINISTIC}} -urMemBufferPartitionTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urMemBufferPartitionWithFlagsTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ {{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE diff --git a/test/conformance/memory/memory_adapter_native_cpu.match b/test/conformance/memory/memory_adapter_native_cpu.match index e7d466691f..cb08becd85 100644 --- a/test/conformance/memory/memory_adapter_native_cpu.match +++ b/test/conformance/memory/memory_adapter_native_cpu.match @@ -1,6 +1,6 @@ {{NONDETERMINISTIC}} -urMemBufferPartitionTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_FLAG_WRITE_ONLY -urMemBufferPartitionTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_FLAG_READ_ONLY +urMemBufferPartitionWithFlagsTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_FLAG_WRITE_ONLY +urMemBufferPartitionWithFlagsTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_FLAG_READ_ONLY urMemBufferPartitionTest.InvalidValueCreateType/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemGetInfoTestWithParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}__UR_MEM_INFO_SIZE From 391f559818745b6e96b80847ede526ae9ff1472b Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Fri, 18 Oct 2024 17:45:35 +0100 Subject: [PATCH 22/30] wip try to fix l0v2 match --- test/conformance/memory/memory_adapter_level_zero_v2.match | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/conformance/memory/memory_adapter_level_zero_v2.match b/test/conformance/memory/memory_adapter_level_zero_v2.match index 6c3e28ec9e..6147d4bd5b 100644 --- a/test/conformance/memory/memory_adapter_level_zero_v2.match +++ b/test/conformance/memory/memory_adapter_level_zero_v2.match @@ -1,5 +1,7 @@ {{NONDETERMINISTIC}} -urMemBufferPartitionWithFlagsTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urMemBufferPartitionWithFlagsTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_FLAG_WRITE_ONLY +urMemBufferPartitionWithFlagsTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_FLAG_READ_ONLY +urMemBufferPartitionWithFlagsTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_FLAG_READ_WRITE urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ {{OPT}}urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE From ac768d8d0a004415740ba9fc5e867441a1382ac0 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Mon, 21 Oct 2024 12:01:53 +0100 Subject: [PATCH 23/30] wip fix tpyo in match files for SuccessWithUnOwnedNativeHandle --- test/conformance/memory/memory_adapter_cuda.match | 2 +- test/conformance/memory/memory_adapter_hip.match | 2 +- test/conformance/memory/memory_adapter_level_zero_v2.match | 2 +- test/conformance/memory/memory_adapter_native_cpu.match | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/conformance/memory/memory_adapter_cuda.match b/test/conformance/memory/memory_adapter_cuda.match index d0f8f132d6..5fd528912e 100644 --- a/test/conformance/memory/memory_adapter_cuda.match +++ b/test/conformance/memory/memory_adapter_cuda.match @@ -4,6 +4,6 @@ urMemImageCreateTest.InvalidSize/NVIDIA_CUDA_BACKEND___{{.*}}_ {{OPT}}urMemImageCreateTestWith2DMemoryTypeParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_TYPE_IMAGE2D_ARRAY urMemBufferCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/NVIDIA_CUDA_BACKEND___{{.*}} -urMemBufferCreateWithNativeHandleTest.SuccessWithUnwnedNativeHandle/NVIDIA_CUDA_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/NVIDIA_CUDA_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/NVIDIA_CUDA_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/NVIDIA_CUDA_BACKEND___{{.*}} diff --git a/test/conformance/memory/memory_adapter_hip.match b/test/conformance/memory/memory_adapter_hip.match index b02e5a89cc..b63cb16e6c 100644 --- a/test/conformance/memory/memory_adapter_hip.match +++ b/test/conformance/memory/memory_adapter_hip.match @@ -4,6 +4,6 @@ urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}} urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.Success/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/AMD_HIP_BACKEND___{{.*}} -urMemBufferCreateWithNativeHandleTest.SuccessWithUnwnedNativeHandle/AMD_HIP_BACKEND___{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/AMD_HIP_BACKEND___{{.*}} diff --git a/test/conformance/memory/memory_adapter_level_zero_v2.match b/test/conformance/memory/memory_adapter_level_zero_v2.match index 8f9be5b528..cb85569893 100644 --- a/test/conformance/memory/memory_adapter_level_zero_v2.match +++ b/test/conformance/memory/memory_adapter_level_zero_v2.match @@ -283,7 +283,7 @@ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI {{OPT}}urMemImageGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_IMAGE_INFO_DEPTH urMemBufferCreateWithNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} -urMemBufferCreateWithNativeHandleTest.SuccessWithUnwnedNativeHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} diff --git a/test/conformance/memory/memory_adapter_native_cpu.match b/test/conformance/memory/memory_adapter_native_cpu.match index de25412dde..f22ebcc2e9 100644 --- a/test/conformance/memory/memory_adapter_native_cpu.match +++ b/test/conformance/memory/memory_adapter_native_cpu.match @@ -238,6 +238,6 @@ urMemReleaseTest.CheckReferenceCount/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemRetainTest.CheckReferenceCount/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemBufferCreateWithNativeHandleTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} -urMemBufferCreateWithNativeHandleTest.SuccessWithUnwnedNativeHandle/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} +urMemBufferCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}} From 128d0667f75ee1130d2274f2323a015c2e3f5dcf Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Mon, 21 Oct 2024 15:08:03 +0100 Subject: [PATCH 24/30] wip remove unvalid ptr/handle for mem buff native tests for cuda and hip --- test/conformance/memory/memory_adapter_cuda.match | 2 -- test/conformance/memory/memory_adapter_hip.match | 2 -- 2 files changed, 4 deletions(-) diff --git a/test/conformance/memory/memory_adapter_cuda.match b/test/conformance/memory/memory_adapter_cuda.match index 5fd528912e..bc36329e55 100644 --- a/test/conformance/memory/memory_adapter_cuda.match +++ b/test/conformance/memory/memory_adapter_cuda.match @@ -5,5 +5,3 @@ urMemImageCreateTest.InvalidSize/NVIDIA_CUDA_BACKEND___{{.*}}_ urMemBufferCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/NVIDIA_CUDA_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/NVIDIA_CUDA_BACKEND___{{.*}} -urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/NVIDIA_CUDA_BACKEND___{{.*}} -urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/NVIDIA_CUDA_BACKEND___{{.*}} diff --git a/test/conformance/memory/memory_adapter_hip.match b/test/conformance/memory/memory_adapter_hip.match index b63cb16e6c..908748f116 100644 --- a/test/conformance/memory/memory_adapter_hip.match +++ b/test/conformance/memory/memory_adapter_hip.match @@ -5,5 +5,3 @@ urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.Success/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/AMD_HIP_BACKEND___{{.*}} -urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/AMD_HIP_BACKEND___{{.*}} -urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/AMD_HIP_BACKEND___{{.*}} From 2d49d1bc9db0bc5e2e42e09f5b4c6a93cdf4f0a7 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Mon, 21 Oct 2024 16:00:58 +0100 Subject: [PATCH 25/30] wip add tests for extra invalid host ptr for ur mem buffer create --- test/conformance/memory/urMemBufferCreate.cpp | 64 +++++++++++++------ 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/test/conformance/memory/urMemBufferCreate.cpp b/test/conformance/memory/urMemBufferCreate.cpp index 2e9b46114d..df90c4b63a 100644 --- a/test/conformance/memory/urMemBufferCreate.cpp +++ b/test/conformance/memory/urMemBufferCreate.cpp @@ -31,6 +31,19 @@ TEST_P(urMemBufferCreateWithFlagsTest, InvalidNullHandleContext) { urMemBufferCreate(nullptr, getParam(), 4096, nullptr, buffer.ptr())); } +TEST_P(urMemBufferCreateWithFlagsTest, InvalidNullPointerBuffer) { + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_NULL_POINTER, + urMemBufferCreate(context, getParam(), 4096, nullptr, nullptr)); +} + +TEST_P(urMemBufferCreateWithFlagsTest, InvalidBufferSizeZero) { + uur::raii::Mem buffer = nullptr; + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_BUFFER_SIZE, + urMemBufferCreate(context, getParam(), 0, nullptr, buffer.ptr())); +} + using urMemBufferCreateTest = uur::urContextTest; UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemBufferCreateTest); @@ -41,6 +54,37 @@ TEST_P(urMemBufferCreateTest, InvalidEnumerationFlags) { nullptr, buffer.ptr())); } +TEST_P(urMemBufferCreateTest, InvalidHostPtrNullProperties) { + uur::raii::Mem buffer = nullptr; + ur_mem_flags_t flags = + UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER; + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_HOST_PTR, + urMemBufferCreate(context, flags, 4096, nullptr, buffer.ptr())); +} + +TEST_P(urMemBufferCreateTest, InvalidHostPtrNullHost) { + uur::raii::Mem buffer = nullptr; + ur_mem_flags_t flags = + UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER; + ur_buffer_properties_t properties; + properties.pHost = nullptr; + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_HOST_PTR, + urMemBufferCreate(context, flags, 4096, &properties, buffer.ptr())); +} + +TEST_P(urMemBufferCreateTest, InvalidHostPtrValidHost) { + uur::raii::Mem buffer = nullptr; + ur_mem_flags_t flags = 0; + ur_buffer_properties_t properties; + int data = 42; + properties.pHost = &data; + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_HOST_PTR, + urMemBufferCreate(context, flags, 4096, &properties, buffer.ptr())); +} + using urMemBufferCreateWithHostPtrFlagsTest = urMemBufferCreateTestWithFlagsParam; UUR_TEST_SUITE_P(urMemBufferCreateWithHostPtrFlagsTest, @@ -59,23 +103,3 @@ TEST_P(urMemBufferCreateWithHostPtrFlagsTest, SUCCESS) { ASSERT_SUCCESS(urMemBufferCreate(context, getParam(), 4096, &properties, buffer.ptr())); } - -TEST_P(urMemBufferCreateWithHostPtrFlagsTest, InvalidHostPtr) { - uur::raii::Mem buffer = nullptr; - ASSERT_EQ_RESULT( - UR_RESULT_ERROR_INVALID_HOST_PTR, - urMemBufferCreate(context, getParam(), 4096, nullptr, buffer.ptr())); -} - -TEST_P(urMemBufferCreateWithFlagsTest, InvalidNullPointerBuffer) { - ASSERT_EQ_RESULT( - UR_RESULT_ERROR_INVALID_NULL_POINTER, - urMemBufferCreate(context, getParam(), 4096, nullptr, nullptr)); -} - -TEST_P(urMemBufferCreateWithFlagsTest, InvalidBufferSizeZero) { - uur::raii::Mem buffer = nullptr; - ASSERT_EQ_RESULT( - UR_RESULT_ERROR_INVALID_BUFFER_SIZE, - urMemBufferCreate(context, getParam(), 0, nullptr, buffer.ptr())); -} From 0907ffa1b2333d7c04befec13a967741d1ba4e26 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Mon, 21 Oct 2024 16:15:12 +0100 Subject: [PATCH 26/30] wip add tests for extra invalid host ptr for ur mem image create --- test/conformance/memory/urMemImageCreate.cpp | 26 ++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/test/conformance/memory/urMemImageCreate.cpp b/test/conformance/memory/urMemImageCreate.cpp index 28d5d9c4e3..0061f5fdcb 100644 --- a/test/conformance/memory/urMemImageCreate.cpp +++ b/test/conformance/memory/urMemImageCreate.cpp @@ -286,6 +286,25 @@ TEST_P(urMemImageCreateTest, InvalidImageDescSlicePitch) { nullptr, image_handle.ptr())); } +TEST_P(urMemImageCreateTest, InvalidHostPtrNullHost) { + uur::raii::Mem image_handle = nullptr; + ur_mem_flags_t flags = UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER; + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_HOST_PTR, + urMemImageCreate(context, flags, &image_format, + &image_desc, nullptr, + image_handle.ptr())); +} + +TEST_P(urMemImageCreateTest, InvalidHostPtrValidHost) { + uur::raii::Mem image_handle = nullptr; + ur_mem_flags_t flags = 0; + int data = 42; + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_HOST_PTR, + urMemImageCreate(context, flags, &image_format, + &image_desc, &data, + image_handle.ptr())); +} + using urMemImageCreateWithHostPtrFlagsTest = urMemImageCreateTestWithParam; @@ -307,10 +326,3 @@ TEST_P(urMemImageCreateWithHostPtrFlagsTest, Success) { ASSERT_NE(nullptr, image_handle.ptr()); } -TEST_P(urMemImageCreateWithHostPtrFlagsTest, InvalidHostPtr) { - uur::raii::Mem image_handle = nullptr; - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_HOST_PTR, - urMemImageCreate(context, getParam(), &image_format, - &image_desc, nullptr, - image_handle.ptr())); -} From 0f805e06c6f74a9acf702c33309dd66058d97429 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Mon, 21 Oct 2024 17:34:28 +0100 Subject: [PATCH 27/30] wip img create native --- source/adapters/hip/memory.cpp | 16 ++++++---- .../adapters/opencl/ur_interface_loader.cpp | 1 + .../urMemImageCreateWithNativeHandle.cpp | 31 ++++++++++++++----- .../testing/include/uur/fixtures.h | 9 ++++-- 4 files changed, 41 insertions(+), 16 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 55c6fe05ed..93d8450862 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -315,14 +315,18 @@ urMemGetNativeHandle(ur_mem_handle_t hMem, ur_device_handle_t Device, return UR_RESULT_ERROR_INVALID_MEM_OBJECT; } } - *phNativeMem = reinterpret_cast( - std::get(hMem->Mem).getPtr(Device)); -#elif defined(__HIP_PLATFORM_AMD__) - *phNativeMem = reinterpret_cast( - std::get(hMem->Mem).getPtr(Device)); -#else +#elif !defined(__HIP_PLATFORM_AMD__) #error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__"); #endif + if (std::holds_alternative(hMem->Mem)) { + *phNativeMem = reinterpret_cast( + std::get(hMem->Mem).getPtr(Device)); + } else if (std::holds_alternative(hMem->Mem)) { + *phNativeMem = reinterpret_cast( + std::get(hMem->Mem).getSurface(Device)); + } else { + return UR_RESULT_ERROR_INVALID_MEM_OBJECT; + } return UR_RESULT_SUCCESS; } diff --git a/source/adapters/opencl/ur_interface_loader.cpp b/source/adapters/opencl/ur_interface_loader.cpp index 6cd69d84d3..5d4649236b 100644 --- a/source/adapters/opencl/ur_interface_loader.cpp +++ b/source/adapters/opencl/ur_interface_loader.cpp @@ -154,6 +154,7 @@ urGetMemProcAddrTable(ur_api_version_t Version, ur_mem_dditable_t *pDdiTable) { pDdiTable->pfnBufferPartition = urMemBufferPartition; pDdiTable->pfnBufferCreateWithNativeHandle = urMemBufferCreateWithNativeHandle; + pDdiTable->pfnImageCreateWithNativeHandle = urMemImageCreateWithNativeHandle; pDdiTable->pfnGetInfo = urMemGetInfo; pDdiTable->pfnGetNativeHandle = urMemGetNativeHandle; pDdiTable->pfnImageCreate = urMemImageCreate; diff --git a/test/conformance/memory/urMemImageCreateWithNativeHandle.cpp b/test/conformance/memory/urMemImageCreateWithNativeHandle.cpp index 3404b4203f..c33cc814a3 100644 --- a/test/conformance/memory/urMemImageCreateWithNativeHandle.cpp +++ b/test/conformance/memory/urMemImageCreateWithNativeHandle.cpp @@ -10,15 +10,11 @@ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urMemImageCreateWithNativeHandleTest); TEST_P(urMemImageCreateWithNativeHandleTest, Success) { ur_native_handle_t native_handle = 0; - if (urMemGetNativeHandle(image, device, &native_handle)) { - GTEST_SKIP(); - } + ASSERT_SUCCESS(urMemGetNativeHandle(image, device, &native_handle)); ur_mem_handle_t mem = nullptr; - ASSERT_EQ_RESULT( - UR_RESULT_ERROR_INVALID_NULL_HANDLE, - urMemImageCreateWithNativeHandle(native_handle, context, &image_format, - &image_desc, nullptr, &mem)); + ASSERT_SUCCESS(urMemImageCreateWithNativeHandle( + native_handle, context, &image_format, &image_desc, nullptr, &mem)); ASSERT_NE(nullptr, mem); ur_context_handle_t mem_context = nullptr; @@ -27,3 +23,24 @@ TEST_P(urMemImageCreateWithNativeHandleTest, Success) { nullptr)); ASSERT_EQ(context, mem_context); } + +TEST_P(urMemImageCreateWithNativeHandleTest, InvalidNullHandle) { + ur_native_handle_t native_handle = 0; + ASSERT_SUCCESS(urMemGetNativeHandle(image, device, &native_handle)); + + ur_mem_handle_t mem = nullptr; + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_NULL_HANDLE, + urMemImageCreateWithNativeHandle(native_handle, nullptr, &image_format, + &image_desc, nullptr, &mem)); +} + +TEST_P(urMemImageCreateWithNativeHandleTest, InvalidNullPointer) { + ur_native_handle_t native_handle = 0; + ASSERT_SUCCESS(urMemGetNativeHandle(image, device, &native_handle)); + + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_NULL_POINTER, + urMemImageCreateWithNativeHandle(native_handle, context, &image_format, + &image_desc, nullptr, nullptr)); +} diff --git a/test/conformance/testing/include/uur/fixtures.h b/test/conformance/testing/include/uur/fixtures.h index b853164fb6..ec52ad054d 100644 --- a/test/conformance/testing/include/uur/fixtures.h +++ b/test/conformance/testing/include/uur/fixtures.h @@ -205,6 +205,9 @@ struct urMemImageTest : urContextTest { if (!imageSupported) { GTEST_SKIP(); } + ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, + &image_format, &image_desc, nullptr, + &image)); } void TearDown() override { @@ -215,7 +218,7 @@ struct urMemImageTest : urContextTest { } ur_image_format_t image_format = { - /*.channelOrder =*/UR_IMAGE_CHANNEL_ORDER_ARGB, + /*.channelOrder =*/UR_IMAGE_CHANNEL_ORDER_RGBA, /*.channelType =*/UR_IMAGE_CHANNEL_TYPE_UNORM_INT8, }; ur_image_desc_t image_desc = { @@ -226,8 +229,8 @@ struct urMemImageTest : urContextTest { /*.height =*/16, /*.depth =*/1, /*.arraySize =*/1, - /*.rowPitch =*/16 * sizeof(char[4]), - /*.slicePitch =*/16 * 16 * sizeof(char[4]), + /*.rowPitch =*/0, + /*.slicePitch =*/0, /*.numMipLevel =*/0, /*.numSamples =*/0, }; From ac4726ebcd52d215b6cf893ea6963a7b71d725e4 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 23 Oct 2024 10:15:43 +0100 Subject: [PATCH 28/30] wip fix formatting image create --- test/conformance/memory/urMemImageCreate.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/conformance/memory/urMemImageCreate.cpp b/test/conformance/memory/urMemImageCreate.cpp index 0061f5fdcb..bfb4f6e719 100644 --- a/test/conformance/memory/urMemImageCreate.cpp +++ b/test/conformance/memory/urMemImageCreate.cpp @@ -288,7 +288,8 @@ TEST_P(urMemImageCreateTest, InvalidImageDescSlicePitch) { TEST_P(urMemImageCreateTest, InvalidHostPtrNullHost) { uur::raii::Mem image_handle = nullptr; - ur_mem_flags_t flags = UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER; + ur_mem_flags_t flags = + UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER; ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_HOST_PTR, urMemImageCreate(context, flags, &image_format, &image_desc, nullptr, @@ -301,8 +302,7 @@ TEST_P(urMemImageCreateTest, InvalidHostPtrValidHost) { int data = 42; ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_HOST_PTR, urMemImageCreate(context, flags, &image_format, - &image_desc, &data, - image_handle.ptr())); + &image_desc, &data, image_handle.ptr())); } using urMemImageCreateWithHostPtrFlagsTest = @@ -325,4 +325,3 @@ TEST_P(urMemImageCreateWithHostPtrFlagsTest, Success) { image_handle.ptr())); ASSERT_NE(nullptr, image_handle.ptr()); } - From 21d4e9afda33103ee81d9221b80163bb648fe6ea Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 23 Oct 2024 11:33:07 +0100 Subject: [PATCH 29/30] wip update match files for hip and l0v2 for img create native --- test/conformance/memory/memory_adapter_hip.match | 1 + test/conformance/memory/memory_adapter_level_zero_v2.match | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/conformance/memory/memory_adapter_hip.match b/test/conformance/memory/memory_adapter_hip.match index 908748f116..4c83995b4f 100644 --- a/test/conformance/memory/memory_adapter_hip.match +++ b/test/conformance/memory/memory_adapter_hip.match @@ -5,3 +5,4 @@ urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.Success/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/AMD_HIP_BACKEND___{{.*}} urMemBufferCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/AMD_HIP_BACKEND___{{.*}} +urMemImageCreateWithNativeHandleTest.Success/AMD_HIP_BACKEND___{{.*}} diff --git a/test/conformance/memory/memory_adapter_level_zero_v2.match b/test/conformance/memory/memory_adapter_level_zero_v2.match index cb85569893..c65e0e47a6 100644 --- a/test/conformance/memory/memory_adapter_level_zero_v2.match +++ b/test/conformance/memory/memory_adapter_level_zero_v2.match @@ -286,4 +286,6 @@ urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/Intel_R__oneA urMemBufferCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} - +urMemImageCreateWithNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +urMemImageCreateWithNativeHandleTest.InvalidNullHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +urMemImageCreateWithNativeHandleTest.InvalidNullPointer/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} From 75bbcd1241bbf9b2e3c2f806b940804d594d23ca Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 23 Oct 2024 11:50:09 +0100 Subject: [PATCH 30/30] wip add opt to l0v2 mem img create match lines --- test/conformance/memory/memory_adapter_level_zero_v2.match | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/conformance/memory/memory_adapter_level_zero_v2.match b/test/conformance/memory/memory_adapter_level_zero_v2.match index c65e0e47a6..a0a5823fbc 100644 --- a/test/conformance/memory/memory_adapter_level_zero_v2.match +++ b/test/conformance/memory/memory_adapter_level_zero_v2.match @@ -286,6 +286,6 @@ urMemBufferCreateWithNativeHandleTest.SuccessWithOwnedNativeHandle/Intel_R__oneA urMemBufferCreateWithNativeHandleTest.SuccessWithUnOwnedNativeHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} urMemBufferCreateWithNativeHandleTest.InvalidNullPointer/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} -urMemImageCreateWithNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} -urMemImageCreateWithNativeHandleTest.InvalidNullHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} -urMemImageCreateWithNativeHandleTest.InvalidNullPointer/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +{{OPT}}urMemImageCreateWithNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +{{OPT}}urMemImageCreateWithNativeHandleTest.InvalidNullHandle/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}} +{{OPT}}urMemImageCreateWithNativeHandleTest.InvalidNullPointer/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}