From 8bb14fb26f240f68070015803ee505ff3ac73f7d Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 28 Jul 2016 16:28:15 -0400
Subject: [PATCH] P4 to Git Change 1296696 by gandryey@gera-w8 on 2016/07/28
16:20:00
SWDEV-99203 - [CGG] OpenCL Samplers object ref count mechanism doesn't work correctly when 2 different samplers are set as argument of the same kernel
- Revert the change from CL#590388. We have to release the sampler in the captured memory. CPU device has different logic now and doesn't alternate captured memory anymore.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.cpp#22 edit
[ROCm/clr commit: fa73da1714821e5b9fa778f7c6729817024e82a3]
---
projects/clr/rocclr/runtime/platform/kernel.cpp | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/projects/clr/rocclr/runtime/platform/kernel.cpp b/projects/clr/rocclr/runtime/platform/kernel.cpp
index 6591f1864b..6df3ed1910 100644
--- a/projects/clr/rocclr/runtime/platform/kernel.cpp
+++ b/projects/clr/rocclr/runtime/platform/kernel.cpp
@@ -156,16 +156,13 @@ KernelParameters::capture(const Device& device)
}
}
else if (desc.type_ == T_SAMPLER) {
- // We're going to replace (mem + desc.offset_) in the
- // CPU device code -- It will go from Sampler* to clk_sampler.
- // Do the retain() and release() on this other copy.
- Sampler* samplerArg = *(Sampler**)(values_ + desc.offset_);
+ Sampler* samplerArg = *(Sampler**)(mem + desc.offset_);
if (samplerArg != NULL) {
samplerArg->retain();
}
}
else if (desc.type_ == T_QUEUE) {
- DeviceQueue* queue = *(DeviceQueue**)(values_ + desc.offset_);
+ DeviceQueue* queue = *(DeviceQueue**)(mem + desc.offset_);
if (queue != NULL) {
queue->retain();
}
@@ -216,13 +213,13 @@ KernelParameters::release(address mem, const amd::Device& device) const
}
}
else if (desc.type_ == T_SAMPLER) {
- Sampler* samplerArg = *(Sampler**)(values_ + desc.offset_);
+ Sampler* samplerArg = *(Sampler**)(mem + desc.offset_);
if (samplerArg != NULL) {
samplerArg->release();
}
}
else if (desc.type_ == T_QUEUE) {
- DeviceQueue* queue = *(DeviceQueue**)(values_ + desc.offset_);
+ DeviceQueue* queue = *(DeviceQueue**)(mem + desc.offset_);
if (queue != NULL) {
queue->release();
}