From 2652a77ca5943ac161941273fdfc38b1519cae7f Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Thu, 16 Nov 2023 16:56:00 +0000 Subject: [PATCH 1/6] Ifdef HIP 5.6 entry point --- source/adapters/hip/memory.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 3083d47744..ca4649c9de 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -274,7 +274,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, return AllocSize; } else if constexpr (std::is_same_v) { HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; - UR_CHECK_ERROR(hipArray3DGetDescriptor(&ArrayDescriptor, Mem.Array)); +#if HIP_VERSION_MAJOR >= 5 && HIP_VERSION_MINOR >= 6 + UR_CHECK_ERROR( + hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray())); +#else + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +#endif const auto PixelSizeBytes = GetHipFormatPixelSize(ArrayDescriptor.Format) * ArrayDescriptor.NumChannels; @@ -535,10 +540,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory, UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); try { - HIP_ARRAY3D_DESCRIPTOR ArrayInfo; +#if HIP_VERSION_MAJOR >= 5 && HIP_VERSION_MINOR >= 6 UR_CHECK_ERROR(hipArray3DGetDescriptor( - &ArrayInfo, std::get(hMemory->Mem).Array)); + &ArrayInfo, std::get(hMemory->Mem).getArray())); +#else + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +#endif const auto hip2urFormat = [](hipArray_Format HipFormat) -> ur_image_channel_type_t { From 686b3d719f4b05392164547f86a538533370f6ec Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Fri, 17 Nov 2023 08:46:27 +0000 Subject: [PATCH 2/6] Change to HIP_VERSION macro --- source/adapters/hip/memory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index ca4649c9de..0a29e58c27 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -274,7 +274,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, return AllocSize; } else if constexpr (std::is_same_v) { HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; -#if HIP_VERSION_MAJOR >= 5 && HIP_VERSION_MINOR >= 6 +#if HIP_VERSION >= 50600000 UR_CHECK_ERROR( hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray())); #else @@ -541,7 +541,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory, try { HIP_ARRAY3D_DESCRIPTOR ArrayInfo; -#if HIP_VERSION_MAJOR >= 5 && HIP_VERSION_MINOR >= 6 +#if HIP_VERSION >= 50600000 UR_CHECK_ERROR(hipArray3DGetDescriptor( &ArrayInfo, std::get(hMemory->Mem).getArray())); #else From 79457b2e32d71d19cd217f89269a87474cb8085b Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Mon, 27 Nov 2023 15:56:44 +0000 Subject: [PATCH 3/6] Make unsupported top level return --- source/adapters/hip/memory.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 0a29e58c27..a6f219d960 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -264,6 +264,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, switch (MemInfoType) { case UR_MEM_INFO_SIZE: { +#if HIP_VERSION < 50600000 + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +#else try { const auto MemVisitor = [](auto &&Mem) -> size_t { using T = std::decay_t; @@ -274,12 +277,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, return AllocSize; } else if constexpr (std::is_same_v) { HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; -#if HIP_VERSION >= 50600000 UR_CHECK_ERROR( hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray())); -#else - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -#endif const auto PixelSizeBytes = GetHipFormatPixelSize(ArrayDescriptor.Format) * ArrayDescriptor.NumChannels; @@ -301,6 +300,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } +#endif } case UR_MEM_INFO_CONTEXT: { return ReturnValue(hMemory->getContext()); From 1c85750f8f34af3437f33bbe1883ce2457df1bc9 Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Mon, 27 Nov 2023 16:11:39 +0000 Subject: [PATCH 4/6] Make work for buffer case --- source/adapters/hip/memory.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index a6f219d960..99e9b86a13 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -265,8 +265,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, switch (MemInfoType) { case UR_MEM_INFO_SIZE: { #if HIP_VERSION < 50600000 - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -#else + if constexpr (std::is_same_v) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } +#endif try { const auto MemVisitor = [](auto &&Mem) -> size_t { using T = std::decay_t; @@ -276,6 +278,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, UR_CHECK_ERROR(hipMemGetAddressRange(&BasePtr, &AllocSize, Mem.Ptr)); return AllocSize; } else if constexpr (std::is_same_v) { +#if HIP_VERSION < 50600000 + return 0; +#else HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; UR_CHECK_ERROR( hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray())); @@ -288,6 +293,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, (ArrayDescriptor.Height ? ArrayDescriptor.Height : 1) * (ArrayDescriptor.Depth ? ArrayDescriptor.Depth : 1); return ImageSizeBytes; +#endif } else { static_assert(ur_always_false_t, "Not exhaustive visitor!"); } @@ -300,7 +306,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } -#endif } case UR_MEM_INFO_CONTEXT: { return ReturnValue(hMemory->getContext()); From f6c476d314bc19ae6987235e814103bad4a5b6bd Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Mon, 27 Nov 2023 12:13:36 -0500 Subject: [PATCH 5/6] Throw from std::visit --- source/adapters/hip/memory.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 99e9b86a13..899dad5674 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -264,11 +264,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, switch (MemInfoType) { case UR_MEM_INFO_SIZE: { -#if HIP_VERSION < 50600000 - if constexpr (std::is_same_v) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - } -#endif try { const auto MemVisitor = [](auto &&Mem) -> size_t { using T = std::decay_t; @@ -279,7 +274,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, return AllocSize; } else if constexpr (std::is_same_v) { #if HIP_VERSION < 50600000 - return 0; + throw UR_RESULT_ERROR_UNSUPPORTED_FEATURE; #else HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; UR_CHECK_ERROR( From e770fddc4d61a001ca4b3e99555f8c8592e143b3 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 30 Nov 2023 10:59:05 +0000 Subject: [PATCH 6/6] [GHA] Disable Windows L0 clang-cl job --- .github/workflows/cmake.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 665f30b9a9..cb0f92ad17 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -283,10 +283,13 @@ jobs: {name: None, var: ''}, {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} ] - # TODO: building level zero loader on windows-2019 is currently broken + # TODO: building level zero loader on windows-2019 and clang-cl.exe is currently broken exclude: - os: 'windows-2019' adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} + - adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} + compiler: {c: clang-cl.exe, cxx: clang-cl.exe} + build_type: [Debug, Release] compiler: [{c: cl.exe, cxx: cl.exe}, {c: clang-cl.exe, cxx: clang-cl.exe}] runs-on: ${{matrix.os}}