From 8d6240ee4e2e747beb26af3c49e5b77d39c80a7f Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 26 Jul 2017 16:14:35 -0400
Subject: [PATCH] P4 to Git Change 1439905 by cpaquot@cpaquot-ocl-lc-lnx on
2017/07/26 15:57:06
SWDEV-121486 - Clean up sampler list if we run out of memory.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#42 edit
[ROCm/clr commit: 3a805c96cc946d59975d197f06a2a20f3cfb7b61]
---
.../clr/rocclr/runtime/device/rocm/rocvirtual.cpp | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp b/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp
index d1e253b954..6887ebdeab 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp
@@ -1664,8 +1664,18 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const
hsa_status_t status =
hsa_ext_sampler_create(dev().getBackendDevice(), &samplerDescriptor, &hsa_sampler);
if (status != HSA_STATUS_SUCCESS) {
- LogError("Error creating device sampler object!");
- return false;
+ // Wait on a kernel if one is outstanding
+ releaseGpuMemoryFence();
+ // Release the sampler handles allocated for the various
+ // on one or more kernel submissions
+ std::for_each(samplerList_.begin(), samplerList_.end(),
+ std::bind2nd(DestroySampler(), gpu_device_));
+ samplerList_.clear();
+ status = hsa_ext_sampler_create(dev().getBackendDevice(), &samplerDescriptor, &hsa_sampler);
+ if (status != HSA_STATUS_SUCCESS) {
+ LogError("Error creating device sampler object!");
+ return false;
+ }
}
if (dev().settings().enableImageHandle_) {