From c069927c13f79327409186f8bfa497669ac97714 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 10 Jan 2023 17:12:42 +0530 Subject: [PATCH] SWDEV-372064 - Check peer access supported before enable or disable it. (#81) Change-Id: I32263089be3f00f3503422dcb63726eb2a2930bf [ROCm/hip-tests commit: c051a4395bd56a10a3f948d80e6c09df0472f469] --- .../unit/device/hipDeviceEnableDisablePeerAccess.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/hip-tests/catch/unit/device/hipDeviceEnableDisablePeerAccess.cc b/projects/hip-tests/catch/unit/device/hipDeviceEnableDisablePeerAccess.cc index 491515163f..d6cd24853d 100644 --- a/projects/hip-tests/catch/unit/device/hipDeviceEnableDisablePeerAccess.cc +++ b/projects/hip-tests/catch/unit/device/hipDeviceEnableDisablePeerAccess.cc @@ -74,6 +74,12 @@ TEST_CASE("Unit_hipDeviceEnablePeerAccess_negative") { } SECTION("Peer Access already enabled") { HIP_CHECK(hipSetDevice(0)); + int canAccessPeer = 0; + HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, 1, 0)); + if (canAccessPeer == 0) { + HipTest::HIP_SKIP_TEST("Skipping because no P2P support"); + return; + } HIP_CHECK(hipDeviceEnablePeerAccess(1, 0)); HIP_CHECK_ERROR(hipDeviceEnablePeerAccess(1, 0), hipErrorPeerAccessAlreadyEnabled); HIP_CHECK(hipDeviceDisablePeerAccess(1)); @@ -97,6 +103,12 @@ TEST_CASE("Unit_hipDeviceDisablePeerAccess_negative") { } SECTION("Peer Access disabled twice") { HIP_CHECK(hipSetDevice(0)); + int canAccessPeer = 0; + HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, 1, 0)); + if (canAccessPeer == 0) { + HipTest::HIP_SKIP_TEST("Skipping because no P2P support"); + return; + } HIP_CHECK(hipDeviceEnablePeerAccess(1, 0)); HIP_CHECK(hipDeviceDisablePeerAccess(1)); HIP_CHECK_ERROR(hipDeviceDisablePeerAccess(1), hipErrorPeerAccessNotEnabled);