From 7899017d497e66687f333d3dc8231f0c57a1081b Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 18 Jul 2018 15:41:11 -0400 Subject: [PATCH] P4 to Git Change 1582337 by vsytchen@vsytchen-win10 on 2018/07/18 15:21:49 SWDEV-79445 - OCL generic changes and code clean-up 1. std::bind2nd is deprecated in c++11 and removed in c++17. Use a range based for loop without any functor instead. ReviewBoardURL = http://ocltc.amd.com/reviews/r/15430/diff/ Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#59 edit --- rocclr/runtime/device/rocm/rocvirtual.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/rocclr/runtime/device/rocm/rocvirtual.cpp b/rocclr/runtime/device/rocm/rocvirtual.cpp index 05d041ff77..41c95d9995 100644 --- a/rocclr/runtime/device/rocm/rocvirtual.cpp +++ b/rocclr/runtime/device/rocm/rocvirtual.cpp @@ -688,13 +688,6 @@ void VirtualGPU::profilingEnd(amd::Command& command) { } } -struct DestroySampler : public std::binary_function { - bool operator()(hsa_ext_sampler_t& sampler, hsa_agent_t agent) const { - hsa_status_t status = hsa_ext_sampler_destroy(agent, sampler); - return status == HSA_STATUS_SUCCESS; - } -}; - void VirtualGPU::updateCommandsState(amd::Command* list) { Timestamp* ts = nullptr; @@ -774,8 +767,11 @@ void VirtualGPU::updateCommandsState(amd::Command* list) { // 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_)); + for (const auto& it: samplerList_) { + if (hsa_ext_sampler_destroy(gpu_device_, it) != HSA_STATUS_SUCCESS) { + LogWarning("Error destroying device sampler object!"); + } + } samplerList_.clear(); return; @@ -2046,9 +2042,13 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const 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_)); + for (const auto& it: samplerList_) { + if (hsa_ext_sampler_destroy(gpu_device_, it) != HSA_STATUS_SUCCESS) { + LogWarning("Error destroying device sampler object!"); + } + } samplerList_.clear(); + status = hsa_ext_sampler_create(dev().getBackendDevice(), &samplerDescriptor, &hsa_sampler); if (status != HSA_STATUS_SUCCESS) { LogError("Error creating device sampler object!");