SWDEV-339742 - Check can access before set device to 1. (#2758)
Change-Id: I5b06f98b0061ee162488e288c3bfac09ff4f94cf
This commit is contained in:
committed by
GitHub
parent
88d9a0e7ae
commit
60b60f78e6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user