From 0e8b2ec0ba4a6e46446179a9cc4cc541a435265d Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 21 Aug 2014 18:12:12 -0400
Subject: [PATCH] P4 to Git Change 1069045 by gandryey@gera-dev-w7 on
2014/08/21 17:55:18
EPR #404714 - [CQE OCL][2.0][DTB]Opencl1.2 WF Conf. Math test failedon Pitcairn and Oland due to CL#1065597
- Add a new MapCacheLock monitor to separate the map cache from the global lock
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#456 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#131 edit
[ROCm/clr commit: 18b88ee0950cd0104d3567f0fdcb6c4a96917c8d]
---
.../clr/rocclr/runtime/device/gpu/gpudevice.cpp | 15 +++++++++++----
.../clr/rocclr/runtime/device/gpu/gpudevice.hpp | 1 +
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
index 84858beb3a..6eb98503df 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -366,6 +366,7 @@ Device::Device()
, lockAsyncOpsForInitHeap_(NULL)
, vgpusAccess_(NULL)
, scratchAlloc_(NULL)
+ , mapCacheOps_(NULL)
, xferRead_(NULL)
, xferWrite_(NULL)
, vaCacheAccess_(NULL)
@@ -427,6 +428,7 @@ Device::~Device()
delete lockAsyncOpsForInitHeap_;
delete vgpusAccess_;
delete scratchAlloc_;
+ delete mapCacheOps_;
delete vaCacheAccess_;
delete vaCacheList_;
@@ -801,6 +803,11 @@ Device::create(CALuint ordinal)
return false;
}
+ mapCacheOps_ = new amd::Monitor("Map Cache Lock", true);
+ if (NULL == scratchAlloc_) {
+ return false;
+ }
+
vaCacheAccess_ = new amd::Monitor("VA Cache Ops Lock", true);
if (NULL == vaCacheAccess_) {
return false;
@@ -2190,8 +2197,8 @@ Device::findMemoryFromVA(const void* ptr, size_t* offset) const
amd::Memory*
Device::findMapTarget(size_t size) const
{
- // Must be serialised. Global async is too conservative
- amd::ScopedLock lk(*lockAsyncOps_);
+ // Must be serialised for access
+ amd::ScopedLock lk(*mapCacheOps_);
amd::Memory* map = NULL;
size_t minSize = 0;
@@ -2250,8 +2257,8 @@ Device::findMapTarget(size_t size) const
bool
Device::addMapTarget(amd::Memory* memory) const
{
- // Must be serialised. Global async is too conservative
- amd::ScopedLock lk(*lockAsyncOps_);
+ // Must be serialised for access
+ amd::ScopedLock lk(*mapCacheOps_);
//the svm memory shouldn't be cached
if (!memory->canBeCached()) {
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.hpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.hpp
index c5657e4cb2..a3ca8f92f3 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.hpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.hpp
@@ -610,6 +610,7 @@ private:
amd::Monitor* lockAsyncOpsForInitHeap_; //!< Lock to serialise all async ops on initialization heap operation
amd::Monitor* vgpusAccess_; //!< Lock to serialise virtual gpu list access
amd::Monitor* scratchAlloc_; //!< Lock to serialise scratch allocation
+ amd::Monitor* mapCacheOps_; //!< Lock to serialise cache for the map resources
XferBuffers* xferRead_; //!< Transfer buffers read
XferBuffers* xferWrite_; //!< Transfer buffers write