Use range-based for.

Change-Id: I758f6d5fcbf75baae454dedc9467532bc0b8c9d5
Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
Piotr Fusik
2019-07-29 13:35:55 +02:00
committed by sys_ocldev
parent 2e3f77a3e9
commit dcd8728519
23 changed files with 154 additions and 186 deletions

View File

@ -1635,10 +1635,10 @@ void Kernel::getParentObjectCounts(ObjectCounts &objectCount) {
objectCount.samplerCount = 0;
DEBUG_BREAK_IF(!isParentKernel);
for (size_t i = 0; i < this->kernelArguments.size(); i++) {
if (kernelArguments[i].type == SAMPLER_OBJ) {
for (const auto &arg : this->kernelArguments) {
if (arg.type == SAMPLER_OBJ) {
objectCount.samplerCount++;
} else if (kernelArguments[i].type == IMAGE_OBJ) {
} else if (arg.type == IMAGE_OBJ) {
objectCount.imageCount++;
}
}
@ -1799,9 +1799,9 @@ void Kernel::ReflectionSurfaceHelper::getCurbeParams(std::vector<IGIL_KernelCurb
}
}
for (uint32_t i = 0; i < kernelInfo.patchInfo.dataParameterBuffers.size(); i++) {
if (kernelInfo.patchInfo.dataParameterBuffers[i]->Type == DATA_PARAMETER_KERNEL_ARGUMENT) {
curbeParamsOut.emplace_back(IGIL_KernelCurbeParams{DATA_PARAMETER_KERNEL_ARGUMENT, kernelInfo.patchInfo.dataParameterBuffers[i]->DataSize, kernelInfo.patchInfo.dataParameterBuffers[i]->Offset, kernelInfo.patchInfo.dataParameterBuffers[i]->ArgumentNumber});
for (auto param : kernelInfo.patchInfo.dataParameterBuffers) {
if (param->Type == DATA_PARAMETER_KERNEL_ARGUMENT) {
curbeParamsOut.emplace_back(IGIL_KernelCurbeParams{DATA_PARAMETER_KERNEL_ARGUMENT, param->DataSize, param->Offset, param->ArgumentNumber});
tokenMask |= ((uint64_t)1 << DATA_PARAMETER_KERNEL_ARGUMENT);
}
}
@ -2126,12 +2126,12 @@ void Kernel::patchEventPool(DeviceQueue *devQueue) {
void Kernel::patchBlocksSimdSize() {
BlockKernelManager *blockManager = program->getBlockKernelManager();
for (uint32_t i = 0; i < kernelInfo.childrenKernelsIdOffset.size(); i++) {
for (auto &idOffset : kernelInfo.childrenKernelsIdOffset) {
DEBUG_BREAK_IF(!(kernelInfo.childrenKernelsIdOffset[i].first < static_cast<uint32_t>(blockManager->getCount())));
DEBUG_BREAK_IF(!(idOffset.first < static_cast<uint32_t>(blockManager->getCount())));
const KernelInfo *blockInfo = blockManager->getBlockKernelInfo(kernelInfo.childrenKernelsIdOffset[i].first);
uint32_t *simdSize = reinterpret_cast<uint32_t *>(&crossThreadData[kernelInfo.childrenKernelsIdOffset[i].second]);
const KernelInfo *blockInfo = blockManager->getBlockKernelInfo(idOffset.first);
uint32_t *simdSize = reinterpret_cast<uint32_t *>(&crossThreadData[idOffset.second]);
*simdSize = blockInfo->getMaxSimdSize();
}
}

View File

@ -62,13 +62,11 @@ void Kernel::patchReflectionSurface(DeviceQueue *devQueue, PrintfHandler *printf
printfGpuAddress = printfSurface->getGpuAddress();
}
if (pBlockInfo->kernelArgInfo.size() > 0) {
for (uint32_t i = 0; i < pBlockInfo->kernelArgInfo.size(); i++) {
if (pBlockInfo->kernelArgInfo[i].isDeviceQueue) {
deviceQueueOffset = pBlockInfo->kernelArgInfo[i].kernelArgPatchInfoVector[0].crossthreadOffset;
deviceQueueSize = pBlockInfo->kernelArgInfo[i].kernelArgPatchInfoVector[0].size;
break;
}
for (const auto &arg : pBlockInfo->kernelArgInfo) {
if (arg.isDeviceQueue) {
deviceQueueOffset = arg.kernelArgPatchInfoVector[0].crossthreadOffset;
deviceQueueSize = arg.kernelArgPatchInfoVector[0].size;
break;
}
}