From 0c7746816b15c04ed234e3beeb6e9e2c1a137c6b Mon Sep 17 00:00:00 2001 From: mianowski Date: Wed, 8 Jul 2026 20:17:44 +0200 Subject: [PATCH 01/10] UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION returned for CUDA and level_zero to conform with ur_api --- .../source/adapters/cuda/device.cpp | 4 +-- .../source/adapters/level_zero/device.cpp | 4 +-- .../conformance/device/urDeviceGetInfo.cpp | 35 +++++++++++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/unified-runtime/source/adapters/cuda/device.cpp b/unified-runtime/source/adapters/cuda/device.cpp index d3e62e4670c7d..4a694b75af70a 100644 --- a/unified-runtime/source/adapters/cuda/device.cpp +++ b/unified-runtime/source/adapters/cuda/device.cpp @@ -1239,7 +1239,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, } if (isAllZeros) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; } std::array Name{}; @@ -1256,7 +1256,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, // If nodeMask has not changed, return unsupported. if (nodeMask == 0) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; } return ReturnValue(nodeMask); diff --git a/unified-runtime/source/adapters/level_zero/device.cpp b/unified-runtime/source/adapters/level_zero/device.cpp index 638df58eea1c3..ef92fff9b037f 100644 --- a/unified-runtime/source/adapters/level_zero/device.cpp +++ b/unified-runtime/source/adapters/level_zero/device.cpp @@ -1546,7 +1546,7 @@ ur_result_t urDeviceGetInfo( const auto &LUID = LuidDesc.luid.id; return ReturnValue(LUID, sizeof(LUID)); } else { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; } } case UR_DEVICE_INFO_NODE_MASK: { @@ -1568,7 +1568,7 @@ ur_result_t urDeviceGetInfo( return ReturnValue(LuidDesc.nodeMask); } else { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; } } case UR_DEVICE_INFO_CLOCK_SUB_GROUP_SUPPORT_EXP: { diff --git a/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp b/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp index ef2b980e7d8bc..7210fc9d4ee98 100644 --- a/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp +++ b/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp @@ -2683,6 +2683,41 @@ TEST_P(urDeviceGetInfoTest, SuccessMinPowerLimit) { property_value); } +TEST_P(urDeviceGetInfoTest, SuccessLuid) { + size_t property_size = 0; + const ur_device_info_t property_name = UR_DEVICE_INFO_LUID; + + ASSERT_SUCCESS_OR_OPTIONAL_QUERY( + urDeviceGetInfo(device, property_name, 0, nullptr, &property_size), + property_name); + ASSERT_EQ(property_size, sizeof(std::array)); + + std::array property_value{}; + ASSERT_SUCCESS(urDeviceGetInfo(device, property_name, property_size, + property_value.data(), nullptr)); + + std::array returned_value{}; + ASSERT_SUCCESS(urDeviceGetInfo(device, property_name, property_size, + returned_value.data(), nullptr)); + ASSERT_EQ(property_value, returned_value); +} + +TEST_P(urDeviceGetInfoTest, SuccessNodeMask) { + size_t property_size = 0; + const ur_device_info_t property_name = UR_DEVICE_INFO_NODE_MASK; + + ASSERT_SUCCESS_OR_OPTIONAL_QUERY( + urDeviceGetInfo(device, property_name, 0, nullptr, &property_size), + property_name); + ASSERT_EQ(property_size, sizeof(uint32_t)); + + uint32_t property_value = 0; + ASSERT_QUERY_RETURNS_VALUE(urDeviceGetInfo(device, property_name, + property_size, &property_value, + nullptr), + property_value); +} + TEST_P(urDeviceGetInfoTest, InvalidNullHandleDevice) { ur_device_type_t device_type; ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, From b29138aae2a9b01caa18921be02c79a827bc4ced Mon Sep 17 00:00:00 2001 From: mianowski Date: Tue, 14 Jul 2026 10:00:32 +0200 Subject: [PATCH 02/10] Try to correct tests --- unified-runtime/test/conformance/testing/include/uur/checks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified-runtime/test/conformance/testing/include/uur/checks.h b/unified-runtime/test/conformance/testing/include/uur/checks.h index 05c7d2d7e0b6a..2d3d78156a148 100644 --- a/unified-runtime/test/conformance/testing/include/uur/checks.h +++ b/unified-runtime/test/conformance/testing/include/uur/checks.h @@ -98,7 +98,7 @@ inline bool stringPropertyIsValid(const char *property, do { \ auto result = CALL; \ if (result != UR_RESULT_SUCCESS) { \ - ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION); \ + ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_FEATURE); \ ASSERT_TRUE(uur::isQueryOptional(QUERY)); \ GTEST_SKIP() << "Query " << #QUERY \ << " is not supported by this adapter"; \ From 151238e7eb7f1066d76ab6006988ad8858d59bb0 Mon Sep 17 00:00:00 2001 From: mianowski Date: Tue, 14 Jul 2026 10:25:14 +0200 Subject: [PATCH 03/10] revert --- unified-runtime/test/conformance/testing/include/uur/checks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified-runtime/test/conformance/testing/include/uur/checks.h b/unified-runtime/test/conformance/testing/include/uur/checks.h index 05c7d2d7e0b6a..2d3d78156a148 100644 --- a/unified-runtime/test/conformance/testing/include/uur/checks.h +++ b/unified-runtime/test/conformance/testing/include/uur/checks.h @@ -98,7 +98,7 @@ inline bool stringPropertyIsValid(const char *property, do { \ auto result = CALL; \ if (result != UR_RESULT_SUCCESS) { \ - ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION); \ + ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_FEATURE); \ ASSERT_TRUE(uur::isQueryOptional(QUERY)); \ GTEST_SKIP() << "Query " << #QUERY \ << " is not supported by this adapter"; \ From 4ad9ac486434793f545760248264dca616fd8115 Mon Sep 17 00:00:00 2001 From: mianowski Date: Tue, 14 Jul 2026 10:36:27 +0200 Subject: [PATCH 04/10] UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION when ZE_RESULT_ERROR_UNSUPPORTED_FEATURE --- .../source/adapters/level_zero/device.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/unified-runtime/source/adapters/level_zero/device.cpp b/unified-runtime/source/adapters/level_zero/device.cpp index ef92fff9b037f..5618709ec01aa 100644 --- a/unified-runtime/source/adapters/level_zero/device.cpp +++ b/unified-runtime/source/adapters/level_zero/device.cpp @@ -1541,7 +1541,13 @@ ur_result_t urDeviceGetInfo( LuidDesc.stype = ZE_STRUCTURE_TYPE_DEVICE_LUID_EXT_PROPERTIES; DeviceProp.pNext = (void *)&LuidDesc; - ZE2UR_CALL(zeDeviceGetProperties, (ZeDevice, &DeviceProp)); + const auto ZeResult = zeDeviceGetProperties(ZeDevice, &DeviceProp); + if (ZeResult == ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) { + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + } + if (ZeResult != ZE_RESULT_SUCCESS) { + return ze2urResult(ZeResult); + } const auto &LUID = LuidDesc.luid.id; return ReturnValue(LUID, sizeof(LUID)); @@ -1564,7 +1570,13 @@ ur_result_t urDeviceGetInfo( LuidDesc.stype = ZE_STRUCTURE_TYPE_DEVICE_LUID_EXT_PROPERTIES; DeviceProp.pNext = (void *)&LuidDesc; - ZE2UR_CALL(zeDeviceGetProperties, (ZeDevice, &DeviceProp)); + const auto ZeResult = zeDeviceGetProperties(ZeDevice, &DeviceProp); + if (ZeResult == ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) { + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + } + if (ZeResult != ZE_RESULT_SUCCESS) { + return ze2urResult(ZeResult); + } return ReturnValue(LuidDesc.nodeMask); } else { From e5424f49ee1acf988740405657c38f82d85b397d Mon Sep 17 00:00:00 2001 From: Grzegorz Mianowski Date: Fri, 17 Jul 2026 09:19:55 +0200 Subject: [PATCH 05/10] Clang-format --- unified-runtime/test/conformance/testing/include/uur/checks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified-runtime/test/conformance/testing/include/uur/checks.h b/unified-runtime/test/conformance/testing/include/uur/checks.h index 2d3d78156a148..a8c9d71a792fb 100644 --- a/unified-runtime/test/conformance/testing/include/uur/checks.h +++ b/unified-runtime/test/conformance/testing/include/uur/checks.h @@ -98,7 +98,7 @@ inline bool stringPropertyIsValid(const char *property, do { \ auto result = CALL; \ if (result != UR_RESULT_SUCCESS) { \ - ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_FEATURE); \ + ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_FEATURE); \ ASSERT_TRUE(uur::isQueryOptional(QUERY)); \ GTEST_SKIP() << "Query " << #QUERY \ << " is not supported by this adapter"; \ From c555b0848fb6efe358d8aa9639eab057a0eb6e08 Mon Sep 17 00:00:00 2001 From: Grzegorz Mianowski Date: Fri, 17 Jul 2026 12:47:02 +0200 Subject: [PATCH 06/10] Try to correct tests --- unified-runtime/source/adapters/cuda/device.cpp | 12 ++++++++++-- .../source/adapters/level_zero/device.cpp | 17 +++++++++++++++++ .../source/adapters/opencl/device.cpp | 4 ++-- .../test/conformance/device/urDeviceGetInfo.cpp | 4 ++-- .../conformance/testing/include/uur/checks.h | 17 +++++++++++++++++ 5 files changed, 48 insertions(+), 6 deletions(-) diff --git a/unified-runtime/source/adapters/cuda/device.cpp b/unified-runtime/source/adapters/cuda/device.cpp index 4a694b75af70a..bcd6c511a7141 100644 --- a/unified-runtime/source/adapters/cuda/device.cpp +++ b/unified-runtime/source/adapters/cuda/device.cpp @@ -1229,7 +1229,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, // std::array. For details about this extension, // see sycl/doc/extensions/supported/sycl_ext_intel_device_info.md. std::array LUID{}; - cuDeviceGetLuid(LUID.data(), nullptr, hDevice->get()); + auto LuidResult = cuDeviceGetLuid(LUID.data(), nullptr, hDevice->get()); + if (LuidResult == CUDA_ERROR_NOT_SUPPORTED) { + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + } + UR_CHECK_ERROR(LuidResult); bool isAllZeros = true; for (char num : LUID) { @@ -1252,7 +1256,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, // uint32_t. For details about this extension, // see sycl/doc/extensions/supported/sycl_ext_intel_device_info.md. uint32_t nodeMask = 0; - cuDeviceGetLuid(nullptr, &nodeMask, hDevice->get()); + auto NodeMaskResult = cuDeviceGetLuid(nullptr, &nodeMask, hDevice->get()); + if (NodeMaskResult == CUDA_ERROR_NOT_SUPPORTED) { + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + } + UR_CHECK_ERROR(NodeMaskResult); // If nodeMask has not changed, return unsupported. if (nodeMask == 0) { diff --git a/unified-runtime/source/adapters/level_zero/device.cpp b/unified-runtime/source/adapters/level_zero/device.cpp index 5618709ec01aa..6669f4c9f7e5f 100644 --- a/unified-runtime/source/adapters/level_zero/device.cpp +++ b/unified-runtime/source/adapters/level_zero/device.cpp @@ -1550,6 +1550,18 @@ ur_result_t urDeviceGetInfo( } const auto &LUID = LuidDesc.luid.id; + // If the LUID is all zeros the extension is present but not usable + // on this platform (e.g. Linux). + bool isAllZeros = true; + for (auto byte : LUID) { + if (byte != 0) { + isAllZeros = false; + break; + } + } + if (isAllZeros) { + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + } return ReturnValue(LUID, sizeof(LUID)); } else { return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; @@ -1578,6 +1590,11 @@ ur_result_t urDeviceGetInfo( return ze2urResult(ZeResult); } + // If the node mask is zero the extension is present but not usable + // on this platform (e.g. Linux). + if (LuidDesc.nodeMask == 0) { + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + } return ReturnValue(LuidDesc.nodeMask); } else { return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; diff --git a/unified-runtime/source/adapters/opencl/device.cpp b/unified-runtime/source/adapters/opencl/device.cpp index 637f537fa91e2..aa1a589677a59 100644 --- a/unified-runtime/source/adapters/opencl/device.cpp +++ b/unified-runtime/source/adapters/opencl/device.cpp @@ -1488,11 +1488,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; } - cl_int nodeMask = 0; + cl_uint nodeMask = 0; CL_RETURN_ON_FAILURE(clGetDeviceInfo(Device->CLDevice, CL_DEVICE_NODE_MASK_KHR, - sizeof(cl_int), &nodeMask, nullptr)); + sizeof(cl_uint), &nodeMask, nullptr)); return ReturnValue(nodeMask); } diff --git a/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp b/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp index 7210fc9d4ee98..f5a6838828455 100644 --- a/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp +++ b/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp @@ -2687,7 +2687,7 @@ TEST_P(urDeviceGetInfoTest, SuccessLuid) { size_t property_size = 0; const ur_device_info_t property_name = UR_DEVICE_INFO_LUID; - ASSERT_SUCCESS_OR_OPTIONAL_QUERY( + ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY( urDeviceGetInfo(device, property_name, 0, nullptr, &property_size), property_name); ASSERT_EQ(property_size, sizeof(std::array)); @@ -2706,7 +2706,7 @@ TEST_P(urDeviceGetInfoTest, SuccessNodeMask) { size_t property_size = 0; const ur_device_info_t property_name = UR_DEVICE_INFO_NODE_MASK; - ASSERT_SUCCESS_OR_OPTIONAL_QUERY( + ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY( urDeviceGetInfo(device, property_name, 0, nullptr, &property_size), property_name); ASSERT_EQ(property_size, sizeof(uint32_t)); diff --git a/unified-runtime/test/conformance/testing/include/uur/checks.h b/unified-runtime/test/conformance/testing/include/uur/checks.h index a8c9d71a792fb..b7febe2800e1c 100644 --- a/unified-runtime/test/conformance/testing/include/uur/checks.h +++ b/unified-runtime/test/conformance/testing/include/uur/checks.h @@ -106,6 +106,23 @@ inline bool stringPropertyIsValid(const char *property, } while (0) #endif +// Like ASSERT_SUCCESS_OR_OPTIONAL_QUERY but enforces that unsupported optional +// device-info enumerations report UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION (not +// UR_RESULT_ERROR_UNSUPPORTED_FEATURE). Use this for device-info queries whose +// absence is property-specific rather than a general feature absence. +#ifndef ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY +#define ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY(CALL, QUERY) \ + do { \ + auto result = CALL; \ + if (result != UR_RESULT_SUCCESS) { \ + ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION); \ + ASSERT_TRUE(uur::isQueryOptional(QUERY)); \ + GTEST_SKIP() << "Query " << #QUERY \ + << " is not supported by this adapter"; \ + } \ + } while (0) +#endif + inline std::ostream &operator<<(std::ostream &out, const ur_device_handle_t &device) { out << uur::GetDeviceName(device); From 884561194fed9548312df37e9673099a1c9ecca1 Mon Sep 17 00:00:00 2001 From: Grzegorz Mianowski Date: Fri, 17 Jul 2026 13:47:50 +0200 Subject: [PATCH 07/10] format --- unified-runtime/test/conformance/testing/include/uur/checks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified-runtime/test/conformance/testing/include/uur/checks.h b/unified-runtime/test/conformance/testing/include/uur/checks.h index b7febe2800e1c..e333e59764c76 100644 --- a/unified-runtime/test/conformance/testing/include/uur/checks.h +++ b/unified-runtime/test/conformance/testing/include/uur/checks.h @@ -111,7 +111,7 @@ inline bool stringPropertyIsValid(const char *property, // UR_RESULT_ERROR_UNSUPPORTED_FEATURE). Use this for device-info queries whose // absence is property-specific rather than a general feature absence. #ifndef ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY -#define ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY(CALL, QUERY) \ +#define ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY(CALL, QUERY) \ do { \ auto result = CALL; \ if (result != UR_RESULT_SUCCESS) { \ From 9e9ce605d92705df676ba4d4c732184c3369baa4 Mon Sep 17 00:00:00 2001 From: Grzegorz Mianowski Date: Fri, 17 Jul 2026 14:31:28 +0200 Subject: [PATCH 08/10] Correct tests --- .../test/conformance/kernel/urKernelGetGroupInfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unified-runtime/test/conformance/kernel/urKernelGetGroupInfo.cpp b/unified-runtime/test/conformance/kernel/urKernelGetGroupInfo.cpp index afaaf87293a82..76121dbee55aa 100644 --- a/unified-runtime/test/conformance/kernel/urKernelGetGroupInfo.cpp +++ b/unified-runtime/test/conformance/kernel/urKernelGetGroupInfo.cpp @@ -71,7 +71,7 @@ TEST_P(urKernelGetGroupInfoMaxWorkGroupSizeTest, UR_KERNEL_GROUP_INFO_COMPILE_MAX_WORK_GROUP_SIZE; size_t property_size = 0; - ASSERT_SUCCESS_OR_OPTIONAL_QUERY( + ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY( urKernelGetGroupInfo(kernel, device, property_name, 0, nullptr, &property_size), property_name); @@ -91,7 +91,7 @@ TEST_P(urKernelGetGroupInfoMaxWorkGroupSizeTest, UR_KERNEL_GROUP_INFO_COMPILE_MAX_LINEAR_WORK_GROUP_SIZE; size_t property_size = 0; - ASSERT_SUCCESS_OR_OPTIONAL_QUERY( + ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY( urKernelGetGroupInfo(kernel, device, property_name, 0, nullptr, &property_size), property_name); From 3c34434192378f859e0cf6050450c465ab5543b7 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Mon, 20 Jul 2026 17:15:51 +0200 Subject: [PATCH 09/10] [WIP] Optional query test update --- .../source/adapters/cuda/device.cpp | 19 +++++++------------ .../conformance/device/urDeviceGetInfo.cpp | 4 ++-- .../kernel/urKernelGetGroupInfo.cpp | 4 ++-- .../conformance/testing/include/uur/checks.h | 17 ----------------- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/unified-runtime/source/adapters/cuda/device.cpp b/unified-runtime/source/adapters/cuda/device.cpp index bcd6c511a7141..2ba846157f415 100644 --- a/unified-runtime/source/adapters/cuda/device.cpp +++ b/unified-runtime/source/adapters/cuda/device.cpp @@ -1229,16 +1229,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, // std::array. For details about this extension, // see sycl/doc/extensions/supported/sycl_ext_intel_device_info.md. std::array LUID{}; - auto LuidResult = cuDeviceGetLuid(LUID.data(), nullptr, hDevice->get()); - if (LuidResult == CUDA_ERROR_NOT_SUPPORTED) { - return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; - } - UR_CHECK_ERROR(LuidResult); + unsigned int nodeMask = 0; + UR_CHECK_ERROR(cuDeviceGetLuid(LUID.data(), &nodeMask, hDevice->get())); bool isAllZeros = true; for (char num : LUID) { if (num != 0) { isAllZeros = false; + break; } } @@ -1255,14 +1253,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, // Intel extension for device node mask. This returns the node mask as // uint32_t. For details about this extension, // see sycl/doc/extensions/supported/sycl_ext_intel_device_info.md. - uint32_t nodeMask = 0; - auto NodeMaskResult = cuDeviceGetLuid(nullptr, &nodeMask, hDevice->get()); - if (NodeMaskResult == CUDA_ERROR_NOT_SUPPORTED) { - return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; - } - UR_CHECK_ERROR(NodeMaskResult); + std::array LUID{}; + unsigned int nodeMask = 0; + UR_CHECK_ERROR(cuDeviceGetLuid(LUID.data(), &nodeMask, hDevice->get())); - // If nodeMask has not changed, return unsupported. + // If nodeMask is zero, the feature is not supported on this platform if (nodeMask == 0) { return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; } diff --git a/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp b/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp index f5a6838828455..7210fc9d4ee98 100644 --- a/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp +++ b/unified-runtime/test/conformance/device/urDeviceGetInfo.cpp @@ -2687,7 +2687,7 @@ TEST_P(urDeviceGetInfoTest, SuccessLuid) { size_t property_size = 0; const ur_device_info_t property_name = UR_DEVICE_INFO_LUID; - ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY( + ASSERT_SUCCESS_OR_OPTIONAL_QUERY( urDeviceGetInfo(device, property_name, 0, nullptr, &property_size), property_name); ASSERT_EQ(property_size, sizeof(std::array)); @@ -2706,7 +2706,7 @@ TEST_P(urDeviceGetInfoTest, SuccessNodeMask) { size_t property_size = 0; const ur_device_info_t property_name = UR_DEVICE_INFO_NODE_MASK; - ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY( + ASSERT_SUCCESS_OR_OPTIONAL_QUERY( urDeviceGetInfo(device, property_name, 0, nullptr, &property_size), property_name); ASSERT_EQ(property_size, sizeof(uint32_t)); diff --git a/unified-runtime/test/conformance/kernel/urKernelGetGroupInfo.cpp b/unified-runtime/test/conformance/kernel/urKernelGetGroupInfo.cpp index 76121dbee55aa..afaaf87293a82 100644 --- a/unified-runtime/test/conformance/kernel/urKernelGetGroupInfo.cpp +++ b/unified-runtime/test/conformance/kernel/urKernelGetGroupInfo.cpp @@ -71,7 +71,7 @@ TEST_P(urKernelGetGroupInfoMaxWorkGroupSizeTest, UR_KERNEL_GROUP_INFO_COMPILE_MAX_WORK_GROUP_SIZE; size_t property_size = 0; - ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY( + ASSERT_SUCCESS_OR_OPTIONAL_QUERY( urKernelGetGroupInfo(kernel, device, property_name, 0, nullptr, &property_size), property_name); @@ -91,7 +91,7 @@ TEST_P(urKernelGetGroupInfoMaxWorkGroupSizeTest, UR_KERNEL_GROUP_INFO_COMPILE_MAX_LINEAR_WORK_GROUP_SIZE; size_t property_size = 0; - ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY( + ASSERT_SUCCESS_OR_OPTIONAL_QUERY( urKernelGetGroupInfo(kernel, device, property_name, 0, nullptr, &property_size), property_name); diff --git a/unified-runtime/test/conformance/testing/include/uur/checks.h b/unified-runtime/test/conformance/testing/include/uur/checks.h index e333e59764c76..05c7d2d7e0b6a 100644 --- a/unified-runtime/test/conformance/testing/include/uur/checks.h +++ b/unified-runtime/test/conformance/testing/include/uur/checks.h @@ -95,23 +95,6 @@ inline bool stringPropertyIsValid(const char *property, // Handles optional queries by skipping the test if the adapter doesn't support them. #ifndef ASSERT_SUCCESS_OR_OPTIONAL_QUERY #define ASSERT_SUCCESS_OR_OPTIONAL_QUERY(CALL, QUERY) \ - do { \ - auto result = CALL; \ - if (result != UR_RESULT_SUCCESS) { \ - ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_FEATURE); \ - ASSERT_TRUE(uur::isQueryOptional(QUERY)); \ - GTEST_SKIP() << "Query " << #QUERY \ - << " is not supported by this adapter"; \ - } \ - } while (0) -#endif - -// Like ASSERT_SUCCESS_OR_OPTIONAL_QUERY but enforces that unsupported optional -// device-info enumerations report UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION (not -// UR_RESULT_ERROR_UNSUPPORTED_FEATURE). Use this for device-info queries whose -// absence is property-specific rather than a general feature absence. -#ifndef ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY -#define ASSERT_SUCCESS_OR_OPTIONAL_DEVICE_INFO_QUERY(CALL, QUERY) \ do { \ auto result = CALL; \ if (result != UR_RESULT_SUCCESS) { \ From 8ac0aadff01ab6f0835d6b81ab24e29dcc48f2b9 Mon Sep 17 00:00:00 2001 From: Katarzyna Kaczmarska Date: Tue, 21 Jul 2026 10:10:07 +0200 Subject: [PATCH 10/10] [UR] Fix LUID/NODE_MASK handling on unsupported platforms --- .../source/adapters/cuda/device.cpp | 21 +++++++++++++++++-- .../source/adapters/native_cpu/device.cpp | 6 ++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/unified-runtime/source/adapters/cuda/device.cpp b/unified-runtime/source/adapters/cuda/device.cpp index 2ba846157f415..ded4529397b3f 100644 --- a/unified-runtime/source/adapters/cuda/device.cpp +++ b/unified-runtime/source/adapters/cuda/device.cpp @@ -1230,7 +1230,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, // see sycl/doc/extensions/supported/sycl_ext_intel_device_info.md. std::array LUID{}; unsigned int nodeMask = 0; - UR_CHECK_ERROR(cuDeviceGetLuid(LUID.data(), &nodeMask, hDevice->get())); + // Must pass both parameters - CUDA returns SUCCESS with zeros on + // unsupported platforms + CUresult Result = cuDeviceGetLuid(LUID.data(), &nodeMask, hDevice->get()); + + // CUDA_ERROR_NOT_SUPPORTED means LUID is not available on this platform + if (Result == CUDA_ERROR_NOT_SUPPORTED) { + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + } + UR_CHECK_ERROR(Result); bool isAllZeros = true; for (char num : LUID) { @@ -1255,7 +1263,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, // see sycl/doc/extensions/supported/sycl_ext_intel_device_info.md. std::array LUID{}; unsigned int nodeMask = 0; - UR_CHECK_ERROR(cuDeviceGetLuid(LUID.data(), &nodeMask, hDevice->get())); + // Must pass both parameters - CUDA returns SUCCESS with zeros on + // unsupported platforms + CUresult Result = cuDeviceGetLuid(LUID.data(), &nodeMask, hDevice->get()); + + // CUDA_ERROR_NOT_SUPPORTED means node mask is not available on this + // platform + if (Result == CUDA_ERROR_NOT_SUPPORTED) { + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + } + UR_CHECK_ERROR(Result); // If nodeMask is zero, the feature is not supported on this platform if (nodeMask == 0) { diff --git a/unified-runtime/source/adapters/native_cpu/device.cpp b/unified-runtime/source/adapters/native_cpu/device.cpp index 152940e9204e9..c50700e54e6dd 100644 --- a/unified-runtime/source/adapters/native_cpu/device.cpp +++ b/unified-runtime/source/adapters/native_cpu/device.cpp @@ -477,6 +477,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, case UR_DEVICE_INFO_GRAPH_RECORD_AND_REPLAY_SUPPORT_EXP: return ReturnValue(false); + // LUID and NODE_MASK are Windows/D3D12 specific - not applicable on Native + // CPU + case UR_DEVICE_INFO_LUID: + case UR_DEVICE_INFO_NODE_MASK: + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + default: DIE_NO_IMPLEMENTATION; }