From 53eb6893f7f97e902f7b8bcf1fa602aa28ba2c91 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 1 Sep 2015 15:40:43 -0400
Subject: [PATCH] P4 to Git Change 1186913 by
skudchad@skudchad_test_win_opencl2 on 2015/09/01 15:22:13
EPR #424190 - IOMMU2/SVM on CZ Win10, Optimization_1
- Map can now return the surface address directly as we do system memory allocations that GPU can rw via IOMMUv2.
- Unpack shaders binary to the shader surface directly, skip unmap which saves a lot of CPDMA calls.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/8386/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#138 edit
[ROCm/clr commit: 4d4e4ce7a2c709608a6946d320c80b8be84342f5]
---
.../device/gpu/gslbe/src/rt/GSLDevice.cpp | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
index 8a01c5635a..f09e55a4a2 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp
@@ -919,6 +919,14 @@ CALGSLDevice::resMapLocal(void*& pPtr,
assert(m_cs != 0);
assert(mem != 0);
+ // No map really necessary if IOMMUv2 is being used, return the surface address directly
+ // as CPU can write to it for Linear tiled surfaces only
+ if (m_adp->pAsicInfo->svmFineGrainSystem && mem->getAttribs().tiling <= GSL_MOA_TILING_LINEAR)
+ {
+ pPtr = (void*)mem->getImage(0)->surf.addr.getAddress();
+ return true;
+ }
+
//! @note: GSL device isn't thread safe
amd::ScopedLock k(gslDeviceOps());
@@ -1126,6 +1134,13 @@ CALGSLDevice::resUnmapLocal(gslMemObject mem, bool isHwDebug)
{
assert(m_cs != 0);
+ // No unmap necessary with IOMMUv2 as map operation directly returned the base surface System VA
+ // which CPU can write to it for Linear tiled surfaces only
+ if (m_adp->pAsicInfo->svmFineGrainSystem && mem->getAttribs().tiling <= GSL_MOA_TILING_LINEAR)
+ {
+ return true;
+ }
+
//! @note: GSL device isn't thread safe
amd::ScopedLock k(gslDeviceOps());
@@ -1246,6 +1261,14 @@ CALGSLDevice::resMapRemote(void*& pPtr,
assert(m_cs != 0);
assert(mem != 0);
+ // No map really necessary if IOMMUv2 is being used, return the surface address directly
+ // as CPU can write to it for Linear tiled surfaces only
+ if (m_adp->pAsicInfo->svmFineGrainSystem && mem->getAttribs().tiling <= GSL_MOA_TILING_LINEAR)
+ {
+ pPtr = (void*)mem->getImage(0)->surf.addr.getAddress();
+ return true;
+ }
+
//! @note: GSL device isn't thread safe
amd::ScopedLock k(gslDeviceOps());
@@ -1267,6 +1290,13 @@ CALGSLDevice::resUnmapRemote(gslMemObject mem) const
{
assert(m_cs != 0);
+ // No unmap necessary with IOMMUv2 as map operation directly returned the base surface System VA
+ // which CPU can write to it for Linear tiled surfaces only
+ if (m_adp->pAsicInfo->svmFineGrainSystem && mem->getAttribs().tiling <= GSL_MOA_TILING_LINEAR)
+ {
+ return true;
+ }
+
//! @note: GSL device isn't thread safe
amd::ScopedLock k(gslDeviceOps());