From 36c3328b23dd8a95d0dc204b14efc154e20eb1bd Mon Sep 17 00:00:00 2001 From: "GunaShekar, Ajay" Date: Wed, 30 Jul 2025 09:20:59 -0700 Subject: [PATCH] SWDEV-527806 - p2p checks for Atomic tests (#502) [ROCm/hip-tests commit: a82f042ca1b4420af826e7e938b08d550869f575] --- .../hip-tests/catch/unit/atomics/atomicExch_common.hh | 11 +++++++++++ .../hip-tests/catch/unit/atomics/min_max_common.hh | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/projects/hip-tests/catch/unit/atomics/atomicExch_common.hh b/projects/hip-tests/catch/unit/atomics/atomicExch_common.hh index e0fcf84c87..29e3605a47 100644 --- a/projects/hip-tests/catch/unit/atomics/atomicExch_common.hh +++ b/projects/hip-tests/catch/unit/atomics/atomicExch_common.hh @@ -397,6 +397,17 @@ void AtomicExchMultipleDeviceMultipleKernelAndHostTest(const unsigned int num_de if (kernel_count > 1) { for (auto i = 0u; i < num_devices; ++i) { + int canAccess = 0; + for (auto j = 0u; j < num_devices; ++j) { + if (i != j) { + HIP_CHECK(hipDeviceCanAccessPeer(&canAccess, i, j)); + if(canAccess == 0) { + std::string msg = "P2P access check failed between dev1:" + std::to_string(i) + ",dev2:" + std::to_string(j); + HipTest::HIP_SKIP_TEST(msg.c_str()); + return; + } + } + } int concurrent_kernels = 0; HIP_CHECK(hipDeviceGetAttribute(&concurrent_kernels, hipDeviceAttributeConcurrentKernels, i)); if (!concurrent_kernels) { diff --git a/projects/hip-tests/catch/unit/atomics/min_max_common.hh b/projects/hip-tests/catch/unit/atomics/min_max_common.hh index 467cfdcae1..5ca88d4f25 100644 --- a/projects/hip-tests/catch/unit/atomics/min_max_common.hh +++ b/projects/hip-tests/catch/unit/atomics/min_max_common.hh @@ -424,6 +424,17 @@ void MultipleDeviceMultipleKernelTest(const unsigned int num_devices, if (kernel_count > 1) { for (auto i = 0u; i < num_devices; ++i) { + int canAccess = 0; + for (auto j = 0u; j < num_devices; ++j) { + if (i != j) { + HIP_CHECK(hipDeviceCanAccessPeer(&canAccess, i, j)); + if(canAccess == 0) { + std::string msg = "P2P access check failed between dev1:" + std::to_string(i) + ",dev2:" + std::to_string(j); + HipTest::HIP_SKIP_TEST(msg.c_str()); + return; + } + } + } int concurrent_kernels = 0; HIP_CHECK(hipDeviceGetAttribute(&concurrent_kernels, hipDeviceAttributeConcurrentKernels, i)); if (!concurrent_kernels) {