From a2bc1b8388192508ecf2d360a7e1492f8703a2f9 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Wed, 18 Dec 2024 11:40:36 +0000 Subject: [PATCH] Move UUR_RETURN_ON_FATAL_FAILURE and UUR_ASSERT_SUCCESS_OR_UNSUPPORTED to join similar macros in checks.h --- source/adapters/cuda/device.cpp | 2 +- source/adapters/cuda/usm_p2p.cpp | 4 ++-- source/adapters/hip/usm_p2p.cpp | 4 ++-- source/adapters/level_zero/usm_p2p.cpp | 4 ++-- test/conformance/exp_usm_p2p/usm_p2p.cpp | 6 +++--- test/conformance/testing/include/uur/checks.h | 18 ++++++++++++++++++ .../conformance/testing/include/uur/fixtures.h | 18 ------------------ 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/source/adapters/cuda/device.cpp b/source/adapters/cuda/device.cpp index 24054752ed..ff036d79d4 100644 --- a/source/adapters/cuda/device.cpp +++ b/source/adapters/cuda/device.cpp @@ -1105,7 +1105,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS; return ReturnValue(UpdateCapabilities); } - case UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP: { + case UR_DEVICE_INFO_CLUSTER_LAUNCH_SUPPORT_EXP: { int Value = getAttribute(hDevice, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR) >= 9; return ReturnValue(static_cast(Value)); diff --git a/source/adapters/cuda/usm_p2p.cpp b/source/adapters/cuda/usm_p2p.cpp index e09220d730..bfb27f8856 100644 --- a/source/adapters/cuda/usm_p2p.cpp +++ b/source/adapters/cuda/usm_p2p.cpp @@ -45,11 +45,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( try { ScopedContext active(commandDevice); switch (propName) { - case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: { + case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORT: { cuAttr = CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED; break; } - case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED: { + case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORT: { cuAttr = CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED; break; } diff --git a/source/adapters/hip/usm_p2p.cpp b/source/adapters/hip/usm_p2p.cpp index 5a3effd3c8..f5abb4a5a2 100644 --- a/source/adapters/hip/usm_p2p.cpp +++ b/source/adapters/hip/usm_p2p.cpp @@ -44,11 +44,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( try { ScopedDevice active(commandDevice); switch (propName) { - case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: { + case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORT: { hipAttr = hipDevP2PAttrAccessSupported; break; } - case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED: { + case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORT: { hipAttr = hipDevP2PAttrNativeAtomicSupported; break; } diff --git a/source/adapters/level_zero/usm_p2p.cpp b/source/adapters/level_zero/usm_p2p.cpp index 756c76f8bc..0e57abf349 100644 --- a/source/adapters/level_zero/usm_p2p.cpp +++ b/source/adapters/level_zero/usm_p2p.cpp @@ -43,7 +43,7 @@ ur_result_t urUsmP2PPeerAccessGetInfoExp(ur_device_handle_t commandDevice, int propertyValue = 0; switch (propName) { - case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: { + case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORT: { bool p2pAccessSupported = false; ZeStruct p2pProperties; ZE2UR_CALL(zeDeviceGetP2PProperties, @@ -58,7 +58,7 @@ ur_result_t urUsmP2PPeerAccessGetInfoExp(ur_device_handle_t commandDevice, propertyValue = p2pAccessSupported && p2pDeviceSupported; break; } - case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED: { + case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORT: { ZeStruct p2pProperties; ZE2UR_CALL(zeDeviceGetP2PProperties, (commandDevice->ZeDevice, peerDevice->ZeDevice, &p2pProperties)); diff --git a/test/conformance/exp_usm_p2p/usm_p2p.cpp b/test/conformance/exp_usm_p2p/usm_p2p.cpp index 599e0f8817..9b606fb1b6 100644 --- a/test/conformance/exp_usm_p2p/usm_p2p.cpp +++ b/test/conformance/exp_usm_p2p/usm_p2p.cpp @@ -37,11 +37,11 @@ TEST_P(urP2PTest, Success) { ASSERT_SUCCESS(urUsmP2PPeerAccessGetInfoExp( devices[0], ///< [in] handle of the command device object devices[1], ///< [in] handle of the peer device object - UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED, sizeof(int), &value, + UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORT, sizeof(int), &value, &returned_size)); // Note that whilst it is not currently specified to be a requirement in the // specification, currently all supported backends return value = 1 for the - // UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED query when the query is true + // UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORT query when the query is true // (matching the native query return values). Generally different backends can // return different values for a given device query; however it is // advisable that for boolean queries they return the same values to indicate @@ -52,7 +52,7 @@ TEST_P(urP2PTest, Success) { // Just check that this doesn't throw since supporting peer atomics is // optional and can depend on backend/device. ASSERT_SUCCESS(urUsmP2PPeerAccessGetInfoExp( - devices[0], devices[1], UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED, + devices[0], devices[1], UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORT, sizeof(int), &value, &returned_size)); ASSERT_SUCCESS(urUsmP2PEnablePeerAccessExp(devices[0], devices[1])); diff --git a/test/conformance/testing/include/uur/checks.h b/test/conformance/testing/include/uur/checks.h index c0adb12453..d247c64b42 100644 --- a/test/conformance/testing/include/uur/checks.h +++ b/test/conformance/testing/include/uur/checks.h @@ -68,4 +68,22 @@ inline std::ostream &operator<<(std::ostream &out, return out; } +#define UUR_RETURN_ON_FATAL_FAILURE(...) \ + __VA_ARGS__; \ + if (this->HasFatalFailure() || this->IsSkipped()) { \ + return; \ + } \ + (void)0 + +#define UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(ret) \ + do { \ + auto status = ret; \ + if (status == UR_RESULT_ERROR_UNSUPPORTED_FEATURE || \ + status == UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION) { \ + GTEST_SKIP(); \ + } else { \ + ASSERT_EQ(status, UR_RESULT_SUCCESS); \ + } \ + } while (0) + #endif // UR_CONFORMANCE_INCLUDE_CHECKS_H_INCLUDED diff --git a/test/conformance/testing/include/uur/fixtures.h b/test/conformance/testing/include/uur/fixtures.h index 9b8d8e7daf..e57d6f890b 100644 --- a/test/conformance/testing/include/uur/fixtures.h +++ b/test/conformance/testing/include/uur/fixtures.h @@ -15,24 +15,6 @@ #include -#define UUR_RETURN_ON_FATAL_FAILURE(...) \ - __VA_ARGS__; \ - if (this->HasFatalFailure() || this->IsSkipped()) { \ - return; \ - } \ - (void)0 - -#define UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(ret) \ - do { \ - auto status = ret; \ - if (status == UR_RESULT_ERROR_UNSUPPORTED_FEATURE || \ - status == UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION) { \ - GTEST_SKIP(); \ - } else { \ - ASSERT_EQ(status, UR_RESULT_SUCCESS); \ - } \ - } while (0) - namespace uur { struct urAdapterTest : ::testing::Test,