From a910ebb77d51cd2c780596e4932e691e10550dc4 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 23 Jan 2015 14:20:22 -0500
Subject: [PATCH] P4 to Git Change 1114824 by gandryey@gera-dev-w7 on
2015/01/23 14:01:28
EPR #410560 - Forum: [169727] Bug? CL_MEM_COPY_HOST_PTR is not thread safe
- Add extra condition for the scratch unbinding
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#349 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#126 edit
---
rocclr/runtime/device/gpu/gpuvirtual.cpp | 18 ++++++++----------
rocclr/runtime/device/gpu/gpuvirtual.hpp | 2 +-
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/rocclr/runtime/device/gpu/gpuvirtual.cpp b/rocclr/runtime/device/gpu/gpuvirtual.cpp
index 2dc6337196..92fb2ec7ba 100644
--- a/rocclr/runtime/device/gpu/gpuvirtual.cpp
+++ b/rocclr/runtime/device/gpu/gpuvirtual.cpp
@@ -642,7 +642,8 @@ VirtualGPU::~VirtualGPU()
gslKernels_.clear();
// Destroy all memories
- releaseMemObjects();
+ static const bool SkipScratch = false;
+ releaseMemObjects(SkipScratch);
// Destroy printf object
delete printfDbg_;
@@ -2885,7 +2886,7 @@ VirtualGPU::enableSyncedBlit() const
}
void
-VirtualGPU::releaseMemObjects()
+VirtualGPU::releaseMemObjects(bool scratch)
{
for (GpuEvents::const_iterator it = gpuEvents_.begin();
it != gpuEvents_.end(); ++it) {
@@ -2916,16 +2917,13 @@ VirtualGPU::releaseMemObjects()
setConstantBuffer(SC_INFO_CONSTANTBUFFER, NULL, 0, 0);
}
- if ((dev().scratch(hwRing()) != NULL) &&
- (dev().scratch(hwRing())->regNum_ > 0)) {
- // Unbind scratch memory
- const std::vector& mems = dev().scratch(hwRing())->memObjs_;
- for (uint i = 0; i < mems.size(); ++i) {
- if (mems[i] != NULL) {
- setScratchBuffer(NULL, i);
- }
+ if (scratch) {
+ uint numBufs = (dev().settings().siPlus_) ? 1 : dev().info().numberOfShaderEngines;
+ for (uint i = 0; i < numBufs; ++i) {
+ setScratchBuffer(NULL, i);
}
}
+
gpuEvents_.clear();
}
diff --git a/rocclr/runtime/device/gpu/gpuvirtual.hpp b/rocclr/runtime/device/gpu/gpuvirtual.hpp
index 76d156cfac..ec7b03919e 100644
--- a/rocclr/runtime/device/gpu/gpuvirtual.hpp
+++ b/rocclr/runtime/device/gpu/gpuvirtual.hpp
@@ -382,7 +382,7 @@ public:
const DmaFlushMgmt& dmaFlushMgmt() const { return dmaFlushMgmt_; }
//! Releases GSL memory objects allocated on this queue
- void releaseMemObjects();
+ void releaseMemObjects(bool scratch = true);
//! Returns the HW ring used on this virtual device
uint hwRing() const { return hwRing_; }