From 8d4b0ecb0cbf258601c98b46fd2fb590b7fb6a21 Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Wed, 21 Oct 2020 08:04:15 -0400 Subject: [PATCH] SWDEV-255614: Fix Caffe2 Test Failure Change-Id: I043caa89b2a43dace7f18c739f30d2a7bfa644ca Fixes the issue when memcpy DtoH is performed on device 0 where the device buffer is allocated on device1 and the destination pinned buffer is allocated from device 0. [ROCm/clr commit: 60ec2a3e461794ac74bf27276ded380f3c874e3f] --- projects/clr/hipamd/rocclr/hip_memory.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/clr/hipamd/rocclr/hip_memory.cpp b/projects/clr/hipamd/rocclr/hip_memory.cpp index 915d1248a6..bdde2e4e36 100755 --- a/projects/clr/hipamd/rocclr/hip_memory.cpp +++ b/projects/clr/hipamd/rocclr/hip_memory.cpp @@ -202,7 +202,9 @@ hipError_t ihipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKin } } else { amd::HostQueue* pQueue = &queue; - if ((srcMemory->getContext().devices()[0] == dstMemory->getContext().devices()[0]) && + if (((srcMemory->getContext().devices()[0] == dstMemory->getContext().devices()[0]) || + (srcMemory->getContext().devices().size() != 1) || + (dstMemory->getContext().devices().size() != 1)) && (queueDevice != srcMemory->getContext().devices()[0])) { pQueue = hip::getNullStream(srcMemory->getContext()); amd::Command* cmd = queue.getLastQueuedCommand(true);