From d58970c94ea4b103d1b34f7654e2f054a1d5772b Mon Sep 17 00:00:00 2001 From: Sarbojit Sarkar Date: Mon, 24 Aug 2020 13:19:49 -0400 Subject: [PATCH] [perf]hipMalloc perf optimization Change-Id: I9cd1d29205cb0c9938d26bb8e336fc9fe8a262ed [ROCm/hip commit: 718ac775f710e13357739b87a1b28d2fbbb93534] --- projects/hip/rocclr/hip_peer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/hip/rocclr/hip_peer.cpp b/projects/hip/rocclr/hip_peer.cpp index fe22803c33..a6456c271d 100755 --- a/projects/hip/rocclr/hip_peer.cpp +++ b/projects/hip/rocclr/hip_peer.cpp @@ -185,6 +185,11 @@ hipError_t hipDeviceDisablePeerAccess(int peerDeviceId) { if ((hipSuccess != canAccessPeer(&canAccess, deviceId, peerDeviceId)) || (canAccess == 0)) { HIP_RETURN(hipErrorInvalidDevice); } + + amd::Device* device = g_devices[deviceId]->devices()[0]; + amd::Device* peer_device = g_devices[peerDeviceId]->devices()[0]; + peer_device->disableP2P(device); + HIP_RETURN(hip::getCurrentDevice()->DisablePeerAccess(peerDeviceId)); } @@ -198,6 +203,11 @@ hipError_t hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags) { if ((hipSuccess != canAccessPeer(&canAccess, deviceId, peerDeviceId)) || (canAccess == 0)) { HIP_RETURN(hipErrorInvalidDevice); } + + amd::Device* device = g_devices[deviceId]->asContext()->devices()[0]; + amd::Device* peer_device = g_devices[peerDeviceId]->asContext()->devices()[0]; + peer_device->enableP2P(device); + HIP_RETURN(hip::getCurrentDevice()->EnablePeerAccess(peerDeviceId)); }