SWDEV-339742 - Check can access before set device to 1. (#2758)

Change-Id: I5b06f98b0061ee162488e288c3bfac09ff4f94cf


[ROCm/hip commit: 60b60f78e6]
This commit is contained in:
ROCm CI Service Account
2022-06-29 02:06:26 +05:30
zatwierdzone przez GitHub
rodzic 97925dc878
commit 901da47ebd
@@ -122,10 +122,14 @@ TEST_CASE("Unit_hipPtrGetAttribute_Simple") {
// HIP_POINTER_ATTRIBUTE_DEVICE_ORDINAL
if (numDevices > 1) {
HIP_CHECK(hipSetDevice(1));
HIP_CHECK(hipPointerGetAttribute(&datatype, HIP_POINTER_ATTRIBUTE_DEVICE_ORDINAL,
reinterpret_cast<hipDeviceptr_t>(A_d)));
REQUIRE(datatype == 0);
int canAccess = -1;
HIP_CHECK(hipDeviceCanAccessPeer(&canAccess, 1, 0));
if (canAccess == 1) {
HIP_CHECK(hipSetDevice(1));
HIP_CHECK(hipPointerGetAttribute(&datatype, HIP_POINTER_ATTRIBUTE_DEVICE_ORDINAL,
reinterpret_cast<hipDeviceptr_t>(A_d)));
REQUIRE(datatype == 0);
}
}
// HIP_POINTER_ATTRIBUTE_MAPPED