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