Skip to content

Commit

Permalink
Move UUR_RETURN_ON_FATAL_FAILURE and UUR_ASSERT_SUCCESS_OR_UNSUPPORTE…
Browse files Browse the repository at this point in the history
…D to join similar macros in checks.h
  • Loading branch information
martygrant committed Dec 18, 2024
1 parent da0a133 commit a2bc1b8
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>(Value));
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/cuda/usm_p2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/hip/usm_p2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/level_zero/usm_p2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ze_device_p2p_properties_t> p2pProperties;
ZE2UR_CALL(zeDeviceGetP2PProperties,
Expand All @@ -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<ze_device_p2p_properties_t> p2pProperties;
ZE2UR_CALL(zeDeviceGetP2PProperties,
(commandDevice->ZeDevice, peerDevice->ZeDevice, &p2pProperties));
Expand Down
6 changes: 3 additions & 3 deletions test/conformance/exp_usm_p2p/usm_p2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]));
Expand Down
18 changes: 18 additions & 0 deletions test/conformance/testing/include/uur/checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 0 additions & 18 deletions test/conformance/testing/include/uur/fixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@

#include <random>

#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,
Expand Down

0 comments on commit a2bc1b8

Please sign in to comment.