From 509d540374a4c4d412740e0101e9b377020737c6 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 17 Jul 2018 18:11:43 -0400
Subject: [PATCH] P4 to Git Change 1581723 by todli@todli-win-opencl-kv1 on
2018/07/17 17:45:23
SWDEV-152361 - Fixed writeBuffer, writeBufferRect and copyBufferRect paths for ExternalPhysical memory in GPU backend, so that SDI copy can sync with writeMarker correctly in Linux.
http://ocltc.amd.com/reviews/r/15420/
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpublit.cpp#131 edit
---
rocclr/runtime/device/gpu/gpublit.cpp | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
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();