From db0c3fdaaf3236aa9b2a303fd096d54afce271cf Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Mon, 15 Feb 2021 01:54:00 -0500 Subject: [PATCH] SWDEV-272543 - Fix hipDeviceGetP2PAttribute when both devices are same Change-Id: I3db17a962807565ea134e3cbcefa66d373e2d363 [ROCm/hip commit: 0d7cd231e8468f8331d92461082ba6373d3d3e1d] --- projects/hip/rocclr/hip_peer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }