diff --git a/rocclr/runtime/device/gpu/gpublit.cpp b/rocclr/runtime/device/gpu/gpublit.cpp index d31a3a0255..ff63bdfe65 100644 --- a/rocclr/runtime/device/gpu/gpublit.cpp +++ b/rocclr/runtime/device/gpu/gpublit.cpp @@ -304,7 +304,9 @@ bool DmaBlitManager::writeBuffer(const void* srcHost, device::Memory& dstMemory, const amd::Coord3D& origin, const amd::Coord3D& size, bool entire) const { // Use host copy if memory has direct access or it's persistent - if (setup_.disableWriteBuffer_ || gpuMem(dstMemory).isHostMemDirectAccess() || + if (setup_.disableWriteBuffer_ || + (gpuMem(dstMemory).isHostMemDirectAccess() && + (gpuMem(dstMemory).memoryType() != Resource::ExternalPhysical)) || gpuMem(dstMemory).isPersistentDirectMap()) { return HostBlitManager::writeBuffer(srcHost, dstMemory, origin, size, entire); } else { @@ -392,7 +394,9 @@ bool DmaBlitManager::writeBufferRect(const void* srcHost, device::Memory& dstMem const amd::BufferRect& bufRect, const amd::Coord3D& size, bool entire) const { // Use host copy if memory has direct access or it's persistent - if (setup_.disableWriteBufferRect_ || dstMemory.isHostMemDirectAccess() || + if (setup_.disableWriteBufferRect_ || + (dstMemory.isHostMemDirectAccess() && + (gpuMem(dstMemory).memoryType() != Resource::ExternalPhysical)) || gpuMem(dstMemory).isPersistentDirectMap()) { return HostBlitManager::writeBufferRect(srcHost, dstMemory, hostRect, bufRect, size, entire); } else { @@ -476,7 +480,8 @@ bool DmaBlitManager::copyBufferRect(device::Memory& srcMemory, device::Memory& d const amd::Coord3D& size, bool entire) const { if (setup_.disableCopyBufferRect_ || (gpuMem(srcMemory).isHostMemDirectAccess() && gpuMem(srcMemory).isCacheable() && - gpuMem(dstMemory).isHostMemDirectAccess())) { + gpuMem(dstMemory).isHostMemDirectAccess() && + (gpuMem(dstMemory).memoryType() != Resource::ExternalPhysical))) { return HostBlitManager::copyBufferRect(srcMemory, dstMemory, srcRect, dstRect, size, entire); } else { size_t srcOffset; @@ -1904,7 +1909,9 @@ bool KernelBlitManager::writeBuffer(const void* srcHost, device::Memory& dstMemo bool result = false; // Use host copy if memory has direct access or it's persistent - if (setup_.disableWriteBuffer_ || gpuMem(dstMemory).isHostMemDirectAccess() || + if (setup_.disableWriteBuffer_ || + (gpuMem(dstMemory).isHostMemDirectAccess() && + (gpuMem(dstMemory).memoryType() != Resource::ExternalPhysical)) || (gpuMem(dstMemory).memoryType() == Resource::Persistent)) { result = HostBlitManager::writeBuffer(srcHost, dstMemory, origin, size, entire); synchronize(); @@ -1954,7 +1961,9 @@ bool KernelBlitManager::writeBufferRect(const void* srcHost, device::Memory& dst bool result = false; // Use host copy if memory has direct access or it's persistent - if (setup_.disableWriteBufferRect_ || gpuMem(dstMemory).isHostMemDirectAccess() || + if (setup_.disableWriteBufferRect_ || + (gpuMem(dstMemory).isHostMemDirectAccess() && + (gpuMem(dstMemory).memoryType() != Resource::ExternalPhysical)) || gpuMem(dstMemory).isPersistentDirectMap()) { result = HostBlitManager::writeBufferRect(srcHost, dstMemory, hostRect, bufRect, size, entire); synchronize();