From ad1839e9eeaf15274d766d49ed89b0fcf791b2fc Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 29 Aug 2018 18:57:40 -0400
Subject: [PATCH] P4 to Git Change 1599701 by gandryey@gera-w8 on 2018/08/29
18:48:36
SWDEV-79445 - OCL generic changes and code clean-up
- Use SDMA staging transfers for data upload if pinning fails. Fixes HIP failure in a test that uses the code segment data for uppload.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palblit.cpp#26 edit
[ROCm/clr commit: 45d50bb7384a18f7b9a04e5be01b097115a22a83]
---
.../clr/rocclr/runtime/device/pal/palblit.cpp | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/pal/palblit.cpp b/projects/clr/rocclr/runtime/device/pal/palblit.cpp
index cf691c8598..43b0ecd860 100644
--- a/projects/clr/rocclr/runtime/device/pal/palblit.cpp
+++ b/projects/clr/rocclr/runtime/device/pal/palblit.cpp
@@ -270,17 +270,18 @@ bool DmaBlitManager::writeMemoryStaged(const void* srcHost, Memory& dstMemory, M
chunkSize = std::max(chunkSize, 64 * Ki);
bool flushDMA = true;
}
-
+ size_t srcOffset = 0;
+ uint32_t flags = Resource::NoWait;
while (xferSize != 0) {
// Find the partial transfer size
size_t tmpSize = std::min(chunkSize, xferSize);
- amd::Coord3D src(offset, 0, 0);
+ amd::Coord3D src(srcOffset, 0, 0);
amd::Coord3D dst(origin + offset, 0, 0);
amd::Coord3D copySize(tmpSize, 0, 0);
// Copy data into the temporary buffer, using CPU
if (!xferBuf.hostWrite(&gpu(), reinterpret_cast(srcHost) + offset,
- src, copySize, Resource::NoWait)) {
+ src, copySize, flags)) {
return false;
}
@@ -292,6 +293,13 @@ bool DmaBlitManager::writeMemoryStaged(const void* srcHost, Memory& dstMemory, M
totalSize -= tmpSize;
offset += tmpSize;
xferSize -= tmpSize;
+ srcOffset += tmpSize;
+ if ((srcOffset + tmpSize) > gpu().xferWrite().MaxSize()) {
+ srcOffset = 0;
+ flags = 0;
+ } else {
+ flags = Resource::NoWait;
+ }
}
return true;
}
@@ -1950,7 +1958,7 @@ bool KernelBlitManager::writeBuffer(const void* srcHost, device::Memory& dstMemo
if (amdMemory == NULL) {
// Force SW copy
- result = HostBlitManager::writeBuffer(srcHost, dstMemory, origin, size, entire);
+ result = DmaBlitManager::writeBuffer(srcHost, dstMemory, origin, size, entire);
synchronize();
return result;
}