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

Change-Id: I5b06f98b0061ee162488e288c3bfac09ff4f94cf
This commit is contained in:
ROCm CI Service Account authored and GitHub committed 2022-06-28 13:36:26 -07:00
1 والد e33d74832d
کامیت ed9c22eee8
1 file changed
+8 -4
@@ -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