P4 to Git Change 1536925 by vsytchen@vsytchen-ocl-win10 on 2018/04/04 17:20:38

SWDEV-79445 - OCL generic changes and code clean-up

	1. This change replaces the use of std::map with std::unordered_map to improve lookup/insert time.
	2. Replace the use of std::make_pair and std::pair constructor with uniform initialization for cleaner code.
	3. Replace the use of std::Container::iterator type with the auto keyword for cleaner code.
	4. Use range based for loops where needed.

	ReviewBoardURL = http://ocltc.amd.com/reviews/r/14517/diff/

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#58 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d10.cpp#16 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d10_amd.hpp#9 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d11.cpp#24 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d11_amd.hpp#13 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d9.cpp#34 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_d3d9_amd.hpp#17 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_gl.cpp#57 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_pipe.cpp#7 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_program.cpp#46 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#23 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/appprofile.hpp#14 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.cpp#72 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuvirtual.cpp#27 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#216 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#297 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuappprofile.cpp#13 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpubinary.cpp#59 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucompiler.cpp#158 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#587 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#322 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprintf.cpp#46 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#237 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.hpp#70 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#242 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#415 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#143 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palappprofile.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcompiler.cpp#22 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#79 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprintf.cpp#9 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#59 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.cpp#60 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#84 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.hpp#46 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/CMakeLists.txt#11 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/pro/prodevice.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/pro/prodevice.hpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocbinary.hpp#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#42 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccounters.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.cpp#10 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#81 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#81 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#89 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#24 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.cpp#49 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.hpp#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#129 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#102 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/perfctr.hpp#7 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#91 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.hpp#43 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/sampler.hpp#9 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.cpp#17 edit
This commit is contained in:
foreman
2018-04-04 18:00:17 -04:00
parent 0c062f57e3
commit d09ca72f74
43 changed files with 254 additions and 322 deletions
+2 -4
View File
@@ -11,10 +11,8 @@ namespace gpu {
AppProfile::AppProfile()
: amd::AppProfile(), enableHighPerformanceState_(true), reportAsOCL12Device_(false) {
propertyDataMap_.insert(DataMap::value_type(
"HighPerfState", PropertyData(DataType_Boolean, &enableHighPerformanceState_)));
propertyDataMap_.insert({"HighPerfState", PropertyData(DataType_Boolean, &enableHighPerformanceState_)});
propertyDataMap_.insert(
DataMap::value_type("OCL12Device", PropertyData(DataType_Boolean, &reportAsOCL12Device_)));
propertyDataMap_.insert({"OCL12Device", PropertyData(DataType_Boolean, &reportAsOCL12Device_)});
}
}
+13 -21
View File
@@ -73,16 +73,14 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
functionNameMap[] maps from a function name (linkage name in the generated code)
to ElfSymbol_t, which is defined as above.
*/
std::map<std::string, ElfSymbol_t*> functionNameMap;
std::unordered_map<std::string, ElfSymbol_t*> functionNameMap;
// Keep all kernel ILs if -use-debugil is present (gpu debugging)
std::map<std::string, std::string> kernelILs;
std::unordered_map<std::string, std::string> kernelILs;
~TempWrapper() {
std::map<std::string, ElfSymbol_t *>::iterator I, IB = functionNameMap.begin(),
IE = functionNameMap.end();
for (I = IB; I != IE; ++I) {
delete[](*I).second;
for (const auto& it : functionNameMap) {
delete[] it.second;
}
kernelILs.clear();
@@ -177,10 +175,8 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
}
// Append all function metadata to debugIL
std::map<std::string, ElfSymbol_t *>::iterator I, IB = tempObj.functionNameMap.begin(),
IE = tempObj.functionNameMap.end();
for (I = IB; I != IE; ++I) {
ElfSymbol_t* elfsymbol = (*I).second;
for (const auto& it : tempObj.functionNameMap) {
ElfSymbol_t* elfsymbol = it.second;
if (elfsymbol == NULL) {
// Not valid, skip
continue;
@@ -202,11 +198,9 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
}
// Now, patch the IL from debugIL into functionNameMap[]
std::map<std::string, std::string>::iterator KI, KIB = tempObj.kernelILs.begin(),
KIE = tempObj.kernelILs.end();
for (KI = KIB; KI != KIE; ++KI) {
const std::string& kn = (*KI).first;
const std::string& ilstr = (*KI).second;
for (const auto& it : tempObj.kernelILs) {
const std::string& kn = it.first;
const std::string& ilstr = it.second;
ElfSymbol_t* elfsymbol = tempObj.functionNameMap[kn];
if (elfsymbol == NULL) {
@@ -225,10 +219,8 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
bool recompiled = false;
bool hasKernels = false;
std::map<std::string, ElfSymbol_t *>::iterator I, IB = tempObj.functionNameMap.begin(),
IE = tempObj.functionNameMap.end();
for (I = IB; I != IE; ++I) {
ElfSymbol_t* elfsymbol = (*I).second;
for (const auto& it : tempObj.functionNameMap) {
ElfSymbol_t* elfsymbol = it.second;
if (elfsymbol == NULL) {
// Not valid, skip
continue;
@@ -237,7 +229,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
// and the new binary is needed.
if (saveAMDIL() && (elfsymbol->SymInfo[NDX_METADATA].size > 0)) {
std::string fmetadata = "__OpenCL_";
fmetadata.append((*I).first);
fmetadata.append(it.first);
fmetadata.append("_fmetadata");
if (!elfOut()->addSymbol(amd::OclElf::RODATA, fmetadata.c_str(),
@@ -250,7 +242,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
continue;
}
amd::OclElf::SymbolInfo* sinfo = &(elfsymbol->SymInfo[0]);
std::string FName = (*I).first;
std::string FName = it.first;
// For this kernel, get the demangled kernel name, which is used to identify each kernel.
const size_t name_sz = FName.size() - (sizeof(_kernel) - 1) - (sizeof(__OpenCL_) - 1);
+4 -6
View File
@@ -74,9 +74,8 @@ bool NullProgram::compileImpl(const std::string& src,
std::string headerIncludeName(headerIncludeNames[i]);
// replace / in path with current os's file separator
if (amd::Os::fileSeparator() != '/') {
for (std::string::iterator it = headerIncludeName.begin(), end = headerIncludeName.end();
it != end; ++it) {
if (*it == '/') *it = amd::Os::fileSeparator();
for (auto& it : headerIncludeName) {
if (it == '/') it = amd::Os::fileSeparator();
}
}
size_t pos = headerIncludeName.rfind(amd::Os::fileSeparator());
@@ -355,9 +354,8 @@ bool HSAILProgram::compileImpl(const std::string& sourceCode,
std::string headerIncludeName(headerIncludeNames[i]);
// replace / in path with current os's file separator
if (amd::Os::fileSeparator() != '/') {
for (std::string::iterator it = headerIncludeName.begin(), end = headerIncludeName.end();
it != end; ++it) {
if (*it == '/') *it = amd::Os::fileSeparator();
for (auto& it : headerIncludeName) {
if (it == '/') it = amd::Os::fileSeparator();
}
}
size_t pos = headerIncludeName.rfind(amd::Os::fileSeparator());
+1 -1
View File
@@ -1152,7 +1152,7 @@ device::Program* Device::createProgram(amd::option::Options* options) {
}
//! Requested devices list as configured by the GPU_DEVICE_ORDINAL
typedef std::map<int, bool> requestedDevices_t;
typedef std::unordered_map<int, bool> requestedDevices_t;
//! Parses the requested list of devices to be exposed to the user.
static void parseRequestedDeviceList(requestedDevices_t& requestedDevices) {
+8 -9
View File
@@ -1349,10 +1349,9 @@ bool Kernel::bindGlobalHwCb(VirtualGPU& gpu, VirtualGPU::GslKernelDesc* desc) co
// Bind HW constant buffers used for the global data store
const Program::HwConstBuffers& gds = prog().glbHwCb();
for (Program::HwConstBuffers::const_iterator it = gds.begin(); (it != gds.end() && result);
++it) {
uint idx = it->first;
result = bindResource(gpu, *(it->second), idx, ConstantBuffer, idx);
for (const auto& it : gds) {
uint idx = it.first;
result = bindResource(gpu, *(it.second), idx, ConstantBuffer, idx);
}
return result;
@@ -1535,16 +1534,16 @@ void Kernel::debug(VirtualGPU& gpu) const {
}
}
const Program::HwConstBuffers& gds = prog().glbHwCb();
for (Program::HwConstBuffers::const_iterator it = gds.begin(); it != gds.end(); ++it) {
uint idx = it->first;
for (const auto& it : gds) {
uint idx = it.first;
std::stringstream fileName;
fileName << counter++ << "_kernel_" << name() << "_const" << idx << ".bin";
stubWrite.open(fileName.str().c_str(), (std::fstream::out | std::fstream::binary));
if (stubWrite.is_open()) {
address memory = reinterpret_cast<address>((it->second)->map(&gpu, Resource::ReadOnly));
address memory = reinterpret_cast<address>(it.second->map(&gpu, Resource::ReadOnly));
// Check if we have OpenCL program
stubWrite.write(reinterpret_cast<char*>(memory), (it->second)->size());
(it->second)->unmap(&gpu);
stubWrite.write(reinterpret_cast<char*>(memory), it.second->size());
it.second->unmap(&gpu);
stubWrite.close();
}
}
+3 -5
View File
@@ -543,7 +543,7 @@ bool PrintfDbgHSA::init(VirtualGPU& gpu, bool printfEnabled) {
// First DWORD = Offset to where next information is to
// be written, initialized to 0
// Second DWORD = Number of bytes available for printf data
// = buffer size 2*sizeof(uint32_t)
// = buffer size 2*sizeof(uint32_t)
const uint8_t initSize = 2 * sizeof(uint32_t);
uint8_t sysMem[initSize];
memset(sysMem, 0, initSize);
@@ -601,8 +601,6 @@ bool PrintfDbgHSA::output(VirtualGPU& gpu, bool printfEnabled,
return false;
}
std::vector<uint>::const_iterator ita;
uint sb = 0;
uint sbt = 0;
@@ -614,8 +612,8 @@ bool PrintfDbgHSA::output(VirtualGPU& gpu, bool printfEnabled,
}
const PrintfInfo& info = printfInfo[(*dbgBufferPtr)];
sb += sizeof(uint32_t);
for (ita = info.arguments_.begin(); ita != info.arguments_.end(); ++ita) {
sb += *ita;
for (const auto& it : info.arguments_) {
sb += it;
}
if (sbt + sb > bufSize) {
+11 -12
View File
@@ -318,7 +318,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
std::string metadataStr;
std::vector<ILFunc*> notCalled;
std::vector<ILFunc*> called;
std::map<int, const char**> macros;
std::unordered_map<int, const char**> macros;
size_t j;
Kernel::InitData initData = {0};
@@ -464,8 +464,8 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
amd::option::Options* options, bool createLibrary) {
std::vector<std::string*> llvmBinaries(inputPrograms.size());
std::vector<amd::OclElf::oclElfSections> elfSectionType(inputPrograms.size());
std::vector<device::Program*>::const_iterator it = inputPrograms.begin();
std::vector<device::Program*>::const_iterator itEnd = inputPrograms.end();
auto it = inputPrograms.cbegin();
const auto itEnd = inputPrograms.cend();
for (size_t i = 0; it != itEnd; ++it, ++i) {
NullProgram* program = (NullProgram*)*it;
@@ -682,7 +682,7 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
std::string metadataStr;
std::vector<ILFunc*> notCalled;
std::vector<ILFunc*> called;
std::map<int, const char**> macros;
std::unordered_map<int, const char**> macros;
size_t j;
Kernel::InitData initData = {0};
@@ -1433,7 +1433,7 @@ NullKernel* NullProgram::createKernel(const std::string& name, const Kernel::Ini
}
// Invoked from ClBinary
bool NullProgram::getAllKernelILs(std::map<std::string, std::string>& allKernelILs,
bool NullProgram::getAllKernelILs(std::unordered_map<std::string, std::string>& allKernelILs,
std::string& programIL, const char* ilKernelName) {
llvm::CompUnit compunit(programIL);
if (ilKernelName != NULL) {
@@ -1471,8 +1471,8 @@ bool NullProgram::createBinary(amd::option::Options* options) {
Program::~Program() {
// Destroy the global HW constant buffers
const Program::HwConstBuffers& gds = glbHwCb();
for (Program::HwConstBuffers::const_iterator it = gds.begin(); it != gds.end(); ++it) {
delete it->second;
for (const auto& it : gds) {
delete it.second;
}
// Destroy the global data store
@@ -1634,8 +1634,8 @@ bool HSAILProgram::finiBuild(bool isBuildGood) {
bool HSAILProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
amd::option::Options* options, bool createLibrary) {
std::vector<device::Program*>::const_iterator it = inputPrograms.begin();
std::vector<device::Program*>::const_iterator itEnd = inputPrograms.end();
auto it = inputPrograms.cbegin();
const auto itEnd = inputPrograms.cend();
acl_error errorCode;
// For each program we need to extract the LLVMIR and create
@@ -2037,13 +2037,12 @@ bool HSAILProgram::linkImpl(amd::option::Options* options) {
}
std::vector<std::string> vKernels = splitSpaceSeparatedString(kernelNames);
delete [] kernelNames;
std::vector<std::string>::iterator it = vKernels.begin();
bool dynamicParallelism = false;
aclMetadata md;
md.numHiddenKernelArgs = 0;
size_t sizeOfnumHiddenKernelArgs = sizeof(md.numHiddenKernelArgs);
for (it; it != vKernels.end(); ++it) {
std::string kernelName(*it);
for (const auto& it : vKernels) {
std::string kernelName(it);
std::string openclKernelName = Kernel::openclMangledName(kernelName);
errorCode = aclQueryInfo(dev().hsaCompiler(), binaryElf_, RT_NUM_KERNEL_HIDDEN_ARGS,
openclKernelName.c_str(), &md.numHiddenKernelArgs,
+2 -2
View File
@@ -256,7 +256,7 @@ class NullProgram : public device::Program {
/*! Get all per-kernel IL from programIL, where programIL is the IL for the
* whole compilation unit.
*/
bool getAllKernelILs(std::map<std::string, std::string>& allKernelILs, std::string& programIL,
bool getAllKernelILs(std::unordered_map<std::string, std::string>& allKernelILs, std::string& programIL,
const char* ilKernelName);
protected:
@@ -322,7 +322,7 @@ class Program : public NullProgram {
size_t binarySize = 0 //!< the machine code size
);
typedef std::map<uint, gpu::Memory*> HwConstBuffers;
typedef std::unordered_map<uint, gpu::Memory*> HwConstBuffers;
//! Global HW constant buffers
const HwConstBuffers& glbHwCb() const { return constBufs_; }
+1 -1
View File
@@ -1744,7 +1744,7 @@ bool ResourceCache::addCalResource(Resource::CalResourceDesc* desc, GslResourceR
memcpy(descCached, desc, sizeof(Resource::CalResourceDesc));
// Add the current resource to the cache
resCache_.push_front(std::make_pair(descCached, ref));
resCache_.push_front({descCached, ref});
cacheSize_ += size;
result = true;
}
+19 -22
View File
@@ -545,9 +545,9 @@ VirtualGPU::~VirtualGPU() {
uint i;
// Destroy all kernels
for (GslKernels::const_iterator it = gslKernels_.begin(); it != gslKernels_.end(); ++it) {
if (it->first != 0) {
freeKernelDesc(it->second);
for (const auto& it : gslKernels_) {
if (it.first != 0) {
freeKernelDesc(it.second);
}
}
gslKernels_.clear();
@@ -1365,10 +1365,9 @@ void VirtualGPU::submitMigrateMemObjects(amd::MigrateMemObjectsCommand& vcmd) {
profilingBegin(vcmd, true);
std::vector<amd::Memory*>::const_iterator itr;
for (itr = vcmd.memObjects().begin(); itr != vcmd.memObjects().end(); ++itr) {
for (const auto& it : vcmd.memObjects()) {
// Find device memory
gpu::Memory* memory = dev().getGpuMemory(*itr);
gpu::Memory* memory = dev().getGpuMemory(it);
if (vcmd.migrationFlags() & CL_MIGRATE_MEM_OBJECT_HOST) {
memory->mgpuCacheWriteBack();
@@ -2016,7 +2015,7 @@ void VirtualGPU::submitMarker(amd::Marker& vcmd) {
// Loop through all outstanding command batches
while (!cbList_.empty()) {
CommandBatchList::const_iterator it = cbList_.begin();
const auto it = cbList_.cbegin();
// Wait for completion
foundEvent = awaitCompletion(*it, vcmd.waitingEvent());
// Release a command batch
@@ -2210,8 +2209,8 @@ void VirtualGPU::submitThreadTraceMemObjects(amd::ThreadTraceMemObjectsCommand&
const size_t memObjSize = cmd.getMemoryObjectSize();
const std::vector<amd::Memory*>& memObj = cmd.getMemList();
size_t se = 0;
for (std::vector<amd::Memory *>::const_iterator itMemObj = memObj.begin();
itMemObj != memObj.end(); ++itMemObj, ++se) {
for (auto itMemObj = memObj.cbegin();
itMemObj != memObj.cend(); ++itMemObj, ++se) {
// Find GSL Mem Object
gslMemObject gslMemObj = dev().getGpuMemory(*itMemObj)->gslResource();
@@ -2297,15 +2296,14 @@ void VirtualGPU::submitAcquireExtObjects(amd::AcquireExtObjectsCommand& vcmd) {
profilingBegin(vcmd);
for (std::vector<amd::Memory*>::const_iterator it = vcmd.getMemList().begin();
it != vcmd.getMemList().end(); ++it) {
for (const auto& it : vcmd.getMemList()) {
// amd::Memory object should never be NULL
assert(*it && "Memory object for interop is NULL");
gpu::Memory* memory = dev().getGpuMemory(*it);
assert(it && "Memory object for interop is NULL");
gpu::Memory* memory = dev().getGpuMemory(it);
// If resource is a shared copy of original resource, then
// runtime needs to copy data from original resource
(*it)->getInteropObj()->copyOrigToShared();
it->getInteropObj()->copyOrigToShared();
// Check if OpenCL has direct access to the interop memory
if (memory->interopType() == Memory::InteropDirectAccess) {
@@ -2336,11 +2334,10 @@ void VirtualGPU::submitReleaseExtObjects(amd::ReleaseExtObjectsCommand& vcmd) {
profilingBegin(vcmd);
for (std::vector<amd::Memory*>::const_iterator it = vcmd.getMemList().begin();
it != vcmd.getMemList().end(); ++it) {
for (const auto& it : vcmd.getMemList()) {
// amd::Memory object should never be NULL
assert(*it && "Memory object for interop is NULL");
gpu::Memory* memory = dev().getGpuMemory(*it);
assert(it && "Memory object for interop is NULL");
gpu::Memory* memory = dev().getGpuMemory(it);
// Check if we can use HW interop
if (memory->interopType() == Memory::InteropHwEmulation) {
@@ -2362,7 +2359,7 @@ void VirtualGPU::submitReleaseExtObjects(amd::ReleaseExtObjectsCommand& vcmd) {
// If resource is a shared copy of original resource, then
// runtime needs to copy data back to original resource
(*it)->getInteropObj()->copySharedToOrig();
it->getInteropObj()->copySharedToOrig();
}
profilingEnd(vcmd);
@@ -2513,7 +2510,7 @@ void VirtualGPU::flush(amd::Command* list, bool wait) {
wait |= state_.forceWait_;
// Loop through all outstanding command batches
while (!cbList_.empty()) {
CommandBatchList::const_iterator it = cbList_.begin();
const auto it = cbList_.cbegin();
// Check if command batch finished without a wait
bool finished = true;
for (uint i = 0; i < AllEngines; ++i) {
@@ -2537,8 +2534,8 @@ void VirtualGPU::flush(amd::Command* list, bool wait) {
void VirtualGPU::enableSyncedBlit() const { return blitMgr_->enableSynchronization(); }
void VirtualGPU::releaseMemObjects(bool scratch) {
for (GpuEvents::const_iterator it = gpuEvents_.begin(); it != gpuEvents_.end(); ++it) {
GpuEvent event = it->second;
for (const auto& it : gpuEvents_) {
GpuEvent event = it.second;
waitForEvent(&event);
}
// Unbind all resources.So the queue won't have any bound mem objects
+2 -2
View File
@@ -380,8 +380,8 @@ class VirtualGPU : public device::VirtualDevice, public CALGSLContext {
) const;
private:
typedef std::map<CALimage, GslKernelDesc*> GslKernels;
typedef std::map<gslMemObject, GpuEvent> GpuEvents;
typedef std::unordered_map<CALimage, GslKernelDesc*> GslKernels;
typedef std::unordered_map<gslMemObject, GpuEvent> GpuEvents;
//! Finds total amount of necessary iterations
inline void findIterations(const amd::NDRangeContainer& sizes, //!< Original workload sizes