SWDEV-564412 - fix test failure on hipSetValidDevices_with_hipMemcpyPeer (#2150)
This commit is contained in:
gecommit door
GitHub
bovenliggende
0f0504d79d
commit
88f4bb1988
@@ -430,7 +430,15 @@ TEST_CASE("Unit_hipSetValidDevices_with_hipMemcpyPeer") {
|
|||||||
HipTest::HIP_SKIP_TEST("Skipping, as this test requires more than 2 GPUs");
|
HipTest::HIP_SKIP_TEST("Skipping, as this test requires more than 2 GPUs");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int canAccessPeer = -1;
|
||||||
|
HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, 1, 0));
|
||||||
|
if (!canAccessPeer) {
|
||||||
|
std::string msg = "Device is not capable of directly accessing memory from peerDevice. Skipping the test.";
|
||||||
|
HipTest::HIP_SKIP_TEST(msg.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
REQUIRE(canAccessPeer == 1);
|
||||||
|
HIP_CHECK(hipDeviceEnablePeerAccess(1, 0));
|
||||||
REQUIRE(getCurrentDevice() == 0);
|
REQUIRE(getCurrentDevice() == 0);
|
||||||
|
|
||||||
int* dev0_Arr = nullptr;
|
int* dev0_Arr = nullptr;
|
||||||
@@ -453,10 +461,6 @@ TEST_CASE("Unit_hipSetValidDevices_with_hipMemcpyPeer") {
|
|||||||
HIP_CHECK(hipMalloc(&dev1_Arr, NBYTES));
|
HIP_CHECK(hipMalloc(&dev1_Arr, NBYTES));
|
||||||
REQUIRE(dev1_Arr != nullptr);
|
REQUIRE(dev1_Arr != nullptr);
|
||||||
|
|
||||||
int canAccessPeer = -1;
|
|
||||||
HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer, 1, 0));
|
|
||||||
REQUIRE(canAccessPeer == 1);
|
|
||||||
|
|
||||||
HIP_CHECK(hipMemcpyPeer(dev1_Arr, 1, dev0_Arr, 0, N * sizeof(int)));
|
HIP_CHECK(hipMemcpyPeer(dev1_Arr, 1, dev0_Arr, 0, N * sizeof(int)));
|
||||||
|
|
||||||
int dstHostMem[N];
|
int dstHostMem[N];
|
||||||
@@ -468,4 +472,6 @@ TEST_CASE("Unit_hipSetValidDevices_with_hipMemcpyPeer") {
|
|||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
REQUIRE(dstHostMem[i] == 5);
|
REQUIRE(dstHostMem[i] == 5);
|
||||||
}
|
}
|
||||||
|
HIP_CHECK(hipFree(dev0_Arr));
|
||||||
|
HIP_CHECK(hipFree(dev1_Arr));
|
||||||
}
|
}
|
||||||
|
|||||||
Verwijs in nieuw issue
Block a user