From 3d6c24b7fac0bd6f09507fe26614c807820103a5 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/hip commit: ee32c0407a7db98245aa814d7402ae4a25776b7f] --- projects/hip/rocclr/hip_memory.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/hip/rocclr/hip_memory.cpp b/projects/hip/rocclr/hip_memory.cpp index 915d1248a6..bdde2e4e36 100755 --- a/projects/hip/rocclr/hip_memory.cpp +++ b/projects/hip/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);