SWDEV-453145 - Enable _sync tests on nvidia

* _sync tests that use warp match functions (__match_any_sync and __match_all_sync) were disabled for nvidia because those functions are supported only on devices with compute capability 7.x or higher. In this solution, tests are always build (with specifying appropriate compile flag) and in in the runtime it is decided weather they should be skipped or not.

Change-Id: Ifa9e55f3b47aa3a00027cb986cd6ae46aed45ebd
This commit is contained in:
Vladana Stojiljkovic
2024-09-17 15:56:39 +02:00
committed by Rakesh Roy
parent 455ec9d367
commit 9893726343
9 changed files with 57 additions and 10 deletions
+22
View File
@@ -313,6 +313,20 @@ inline bool isImageSupported() {
return imageSupport != 0;
}
inline bool areWarpMatchFunctionsSupported() {
int matchFunctionsSupported = 1;
#if HT_NVIDIA
int device;
hipDeviceProp_t prop;
HIP_CHECK(hipGetDevice(&device));
HIP_CHECK(hipGetDeviceProperties(&prop, device));
if (prop.major < 7) {
matchFunctionsSupported = 0;
}
#endif
return matchFunctionsSupported != 0;
}
/**
* Causes the test to stop and be skipped at runtime.
* reason: Message describing the reason the test has been skipped.
@@ -485,6 +499,14 @@ class BlockingContext {
return; \
}
// This must be called in the beginning of warp test app's main() to indicate warp match functions
// are supported.
#define CHECK_WARP_MATCH_FUNCTIONS_SUPPORT \
if (!HipTest::areWarpMatchFunctionsSupported()) { \
INFO("Warp Match Functions are not support on the device. Skipped."); \
return; \
}
// Call GENERATE_CAPTURE macro at the start of the test, before using BEGIN/END_CAPTURE.
// Use BEGIN/END_CAPTURE macros to execute APIs in both stream capturing and non-capturing modes.
// Place BEGIN_CAPTURE before the API call and END_CAPTURE after the call.
+17 -10
View File
@@ -3,6 +3,13 @@ set(TEST_SRC
warp_ballot.cc
warp_any.cc
warp_all.cc
hipMatchSyncAllTests.cc
hipMatchSyncAnyTests.cc
hipShflSyncDownTests.cc
hipShflSyncUpTests.cc
hipShflSyncXorTests.cc
hipShflSyncTests.cc
hipVoteSyncTests.cc
)
if(HIP_PLATFORM MATCHES "amd")
@@ -13,19 +20,19 @@ if(HIP_PLATFORM MATCHES "amd")
warp_shfl_down.cc
hipShflUpDownTest.cc
hipShflTests.cc
# FIXME: The tests for sync intrinsics are temporarily disabled on CUDA
# because they depend on __match_any_sync, which is not available on older
# NVIDIA devices. (SWDEV-453145)
hipMatchSyncAllTests.cc
hipMatchSyncAnyTests.cc
hipShflSyncDownTests.cc
hipShflSyncUpTests.cc
hipShflSyncXorTests.cc
hipShflSyncTests.cc
hipVoteSyncTests.cc
)
endif()
if(HIP_PLATFORM MATCHES "nvidia")
set_source_files_properties(hipMatchSyncAllTests.cc PROPERTIES COMPILE_FLAGS "-arch=sm_70")
set_source_files_properties(hipMatchSyncAnyTests.cc PROPERTIES COMPILE_FLAGS "-arch=sm_70")
set_source_files_properties(hipShflSyncDownTests.cc PROPERTIES COMPILE_FLAGS "-arch=sm_70")
set_source_files_properties(hipShflSyncUpTests.cc PROPERTIES COMPILE_FLAGS "-arch=sm_70")
set_source_files_properties(hipShflSyncXorTests.cc PROPERTIES COMPILE_FLAGS "-arch=sm_70")
set_source_files_properties(hipShflSyncTests.cc PROPERTIES COMPILE_FLAGS "-arch=sm_70")
set_source_files_properties(hipVoteSyncTests.cc PROPERTIES COMPILE_FLAGS "-arch=sm_70")
endif()
hip_add_exe_to_target(NAME WarpTest
TEST_SRC ${TEST_SRC}
TEST_TARGET_NAME build_tests)
+2
View File
@@ -238,6 +238,8 @@ static void runTestMatchAll_3() {
*/
TEST_CASE("Unit_hipMatchSync_All") {
CHECK_WARP_MATCH_FUNCTIONS_SUPPORT
SECTION("run test for int") {
runTestMatchAll_1<int>();
runTestMatchAll_2<int>();
+2
View File
@@ -161,6 +161,8 @@ static void runTestMatchAny_2() {
*/
TEST_CASE("Unit_hipMatchSync_Any") {
CHECK_WARP_MATCH_FUNCTIONS_SUPPORT
SECTION("run test for int") {
runTestMatchAny_1<int>();
runTestMatchAny_2<int>();
+2
View File
@@ -188,6 +188,8 @@ static void runTestShflDown_3() {
*/
TEST_CASE("Unit_hipShflSync_Down") {
CHECK_WARP_MATCH_FUNCTIONS_SUPPORT
SECTION("run test for short") {
runTestShflDown_1<short>();
runTestShflDown_2<short>();
+2
View File
@@ -133,6 +133,8 @@ static void runTestShfl_2() {
*/
TEST_CASE("Unit_hipShflSync") {
CHECK_WARP_MATCH_FUNCTIONS_SUPPORT
SECTION("run test for short") {
runTestShfl_1<short>();
runTestShfl_2<short>();
+2
View File
@@ -180,6 +180,8 @@ static void runTestShflUp_3() {
*/
TEST_CASE("Unit_hipShflSync_Up") {
CHECK_WARP_MATCH_FUNCTIONS_SUPPORT
SECTION("run test for short") {
runTestShflUp_1<short>();
runTestShflUp_2<short>();
+2
View File
@@ -171,6 +171,8 @@ static void runTestShflXor_3() {
*/
TEST_CASE("Unit_hipShflSync_Xor") {
CHECK_WARP_MATCH_FUNCTIONS_SUPPORT
SECTION("run test for short") {
runTestShflXor_1<short>();
runTestShflXor_2<short>();
+6
View File
@@ -573,6 +573,8 @@ static void runTestBallot_3() {
*/
TEST_CASE("Unit_hipVoteSync_Any") {
CHECK_WARP_MATCH_FUNCTIONS_SUPPORT
runTestAny_1();
runTestAny_2_w64();
runTestAny_2_w32();
@@ -581,6 +583,8 @@ TEST_CASE("Unit_hipVoteSync_Any") {
}
TEST_CASE("Unit_hipVoteSync_All") {
CHECK_WARP_MATCH_FUNCTIONS_SUPPORT
runTestAll_1_w64();
runTestAll_1_w32();
runTestAll_2();
@@ -589,6 +593,8 @@ TEST_CASE("Unit_hipVoteSync_All") {
}
TEST_CASE("Unit_hipVoteSync_Ballot") {
CHECK_WARP_MATCH_FUNCTIONS_SUPPORT
runTestBallot_1();
runTestBallot_2();
runTestBallot_3();