diff --git a/projects/hip/rocclr/hip_peer.cpp b/projects/hip/rocclr/hip_peer.cpp index a6456c271d..ef4aa14dfb 100755 --- a/projects/hip/rocclr/hip_peer.cpp +++ b/projects/hip/rocclr/hip_peer.cpp @@ -122,7 +122,7 @@ hipError_t hipDeviceGetP2PAttribute(int* value, hipDeviceP2PAttr attr, HIP_RETURN(hipErrorInvalidValue); } - if (srcDevice >= static_cast(g_devices.size()) + if (srcDevice == dstDevice || srcDevice >= static_cast(g_devices.size()) || dstDevice >= static_cast(g_devices.size())) { HIP_RETURN(hipErrorInvalidDevice); }