diff --git a/opencl/source/context/context.cpp b/opencl/source/context/context.cpp index 9977348326f87..49f4b759cf053 100644 --- a/opencl/source/context/context.cpp +++ b/opencl/source/context/context.cpp @@ -285,7 +285,7 @@ bool Context::createImpl(const cl_context_properties *properties, engine.commandStreamReceiver->ensureTagAllocationForRootDeviceIndex(rootDeviceIndex); } } - deviceBitfields.insert({rootDeviceIndex, deviceBitfield}); + deviceBitfields.emplace(rootDeviceIndex, deviceBitfield); } if (devices.size() > 0) { diff --git a/opencl/source/helpers/destructor_callbacks.h b/opencl/source/helpers/destructor_callbacks.h index 4caea2f5b325f..3c21158852349 100644 --- a/opencl/source/helpers/destructor_callbacks.h +++ b/opencl/source/helpers/destructor_callbacks.h @@ -16,7 +16,7 @@ class DestructorCallbacks { public: inline void add(CallbackType *callback, void *userData) { - callbacks.push_back({callback, userData}); + callbacks.emplace_back(callback, userData); } inline bool empty() { return callbacks.empty(); diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index cbcea0baaef2e..0f08ad8fcf221 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -879,7 +879,7 @@ void Kernel::markArgPatchedAndResolveArgs(uint32_t argIndex) { auto migrateRequiredForArg = memObj->getMultiGraphicsAllocation().requiresMigrations(); if (migratableArgsMap.find(argIndex) == migratableArgsMap.end() && migrateRequiredForArg) { - migratableArgsMap.insert({argIndex, memObj}); + migratableArgsMap.emplace(argIndex, memObj); } else if (migrateRequiredForArg) { migratableArgsMap[argIndex] = memObj; } else { diff --git a/opencl/source/platform/platform.cpp b/opencl/source/platform/platform.cpp index 5e35e4c4d4146..4a30b6044a281 100644 --- a/opencl/source/platform/platform.cpp +++ b/opencl/source/platform/platform.cpp @@ -250,8 +250,8 @@ std::vector Platform::groupDevices(DeviceVector devices) { auto productFamily = device->getHardwareInfo().platform.eProductFamily; auto result = platformsMap.find(productFamily); if (result == platformsMap.end()) { - platformsMap.insert({productFamily, platformsMap.size()}); - outDevices.push_back(DeviceVector{}); + platformsMap.emplace(productFamily, platformsMap.size()); + outDevices.emplace_back(); } auto platformId = platformsMap[productFamily]; outDevices[platformId].push_back(std::move(device)); diff --git a/opencl/source/program/process_device_binary.cpp b/opencl/source/program/process_device_binary.cpp index 93b654e459cf0..6bf080f6c94a8 100644 --- a/opencl/source/program/process_device_binary.cpp +++ b/opencl/source/program/process_device_binary.cpp @@ -124,7 +124,7 @@ cl_int Program::linkBinary(Device *pDevice, const void *constantsInitData, size_ for (const auto &kernelInfo : kernelInfoArray) { auto &kernHeapInfo = kernelInfo->heapInfo; const char *originalIsa = reinterpret_cast(kernHeapInfo.pKernelHeap); - patchedIsaTempStorage.push_back(std::vector(originalIsa, originalIsa + kernHeapInfo.kernelHeapSize)); + patchedIsaTempStorage.emplace_back(originalIsa, originalIsa + kernHeapInfo.kernelHeapSize); DEBUG_BREAK_IF(nullptr == kernelInfo->getGraphicsAllocation()); isaSegmentsForPatching.push_back(Linker::PatchableSegment{patchedIsaTempStorage.rbegin()->data(), static_cast(kernelInfo->getGraphicsAllocation()->getGpuAddressToPatch()), kernHeapInfo.kernelHeapSize}); kernelDescriptors.push_back(&kernelInfo->kernelDescriptor); @@ -142,7 +142,7 @@ cl_int Program::linkBinary(Device *pDevice, const void *constantsInitData, size_ if (false == linkSuccess) { std::vector kernelNames; for (const auto &kernelInfo : kernelInfoArray) { - kernelNames.push_back("kernel : " + kernelInfo->kernelDescriptor.kernelMetadata.kernelName); + kernelNames.emplace_back("kernel : " + kernelInfo->kernelDescriptor.kernelMetadata.kernelName); } auto error = constructLinkerErrorMessage(unresolvedExternalsInfo, kernelNames); updateBuildLog(pDevice->getRootDeviceIndex(), error.c_str(), error.size()); diff --git a/shared/offline_compiler/source/ocloc_supported_devices_helper.cpp b/shared/offline_compiler/source/ocloc_supported_devices_helper.cpp index f3b0aa16403df..aa0c00f17aa57 100644 --- a/shared/offline_compiler/source/ocloc_supported_devices_helper.cpp +++ b/shared/offline_compiler/source/ocloc_supported_devices_helper.cpp @@ -35,7 +35,7 @@ SupportedDevicesHelper::SupportedDevicesData SupportedDevicesHelper::collectSupp } for (const auto &acronym : device.deviceAcronyms) { - data.acronyms.push_back({acronym.data(), device.aotConfig.value}); + data.acronyms.emplace_back(acronym.data(), device.aotConfig.value); } } @@ -45,7 +45,7 @@ SupportedDevicesHelper::SupportedDevicesData SupportedDevicesHelper::collectSupp groupedDevices[device.family].push_back(device.aotConfig.value); } for (const auto &entry : groupedDevices) { - data.familyGroups.push_back({productConfigHelper->getAcronymFromAFamily(entry.first).data(), entry.second}); + data.familyGroups.emplace_back(productConfigHelper->getAcronymFromAFamily(entry.first).data(), entry.second); } // Populate Release groups @@ -56,7 +56,7 @@ SupportedDevicesHelper::SupportedDevicesData SupportedDevicesHelper::collectSupp for (const auto &entry : groupedReleases) { auto name = productConfigHelper->getAcronymFromARelease(entry.first); if (!name.empty()) { - data.releaseGroups.push_back({name.data(), entry.second}); + data.releaseGroups.emplace_back(name.data(), entry.second); } } @@ -161,7 +161,7 @@ std::map SupportedDev std::string acronym = parser.readKey(acrNode).str(); uint32_t ipVersion; if (parser.readValueChecked(acrNode, ipVersion)) { - data.acronyms.push_back({acronym, ipVersion}); + data.acronyms.emplace_back(acronym, ipVersion); } } } @@ -178,7 +178,7 @@ std::map SupportedDev } } if (!ipVersions.empty()) { - data.familyGroups.push_back({family, ipVersions}); + data.familyGroups.emplace_back(family, ipVersions); } } } @@ -195,7 +195,7 @@ std::map SupportedDev } } if (!ipVersions.empty()) { - data.releaseGroups.push_back({release, ipVersions}); + data.releaseGroups.emplace_back(release, ipVersions); } } } @@ -272,14 +272,14 @@ SupportedDevicesHelper::SupportedDevicesData SupportedDevicesHelper::mergeOclocD // Sort FamilyGroups (alphabetically by group name) for (const auto &[family, ipVersions] : uniqueFamilyGroups) { - mergedData.familyGroups.push_back({family, std::vector(ipVersions.begin(), ipVersions.end())}); + mergedData.familyGroups.emplace_back(family, std::vector(ipVersions.begin(), ipVersions.end())); } std::sort(mergedData.familyGroups.begin(), mergedData.familyGroups.end(), [](const auto &a, const auto &b) { return a.first < b.first; }); // Sort ReleaseGroups (alphabetically by group name) for (const auto &[release, ipVersions] : uniqueReleaseGroups) { - mergedData.releaseGroups.push_back({release, std::vector(ipVersions.begin(), ipVersions.end())}); + mergedData.releaseGroups.emplace_back(release, std::vector(ipVersions.begin(), ipVersions.end())); } std::sort(mergedData.releaseGroups.begin(), mergedData.releaseGroups.end(), [](const auto &a, const auto &b) { return a.first < b.first; }); diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index 870db00f2f082..247409742e1c2 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -182,7 +182,7 @@ std::vector OfflineCompiler::getOpenCLCFeatures(ConstStringRef std::vector allSupportedFeatures; for (auto &feature : availableFeatures) { - allSupportedFeatures.push_back({feature.name, feature.version}); + allSupportedFeatures.emplace_back(feature.name, feature.version); } return allSupportedFeatures; } @@ -245,7 +245,7 @@ std::string formatNameVersionString(std::vector extensions, boo std::vector formatedExtensions; formatedExtensions.reserve(extensions.size()); for (const auto &ext : extensions) { - formatedExtensions.push_back({}); + formatedExtensions.emplace_back(); auto it = formatedExtensions.rbegin(); bool needsQuoutes = (nullptr != strstr(ext.name, " ")); it->reserve(strnlen_s(ext.name, sizeof(ext.name)) + (needsQuoutes ? 2 : 0) + (needVersions ? 16 : 0)); diff --git a/shared/source/aub/aub_helper_add_mmio.cpp b/shared/source/aub/aub_helper_add_mmio.cpp index fd82968ca84b4..a7b3bfc77ee8c 100644 --- a/shared/source/aub/aub_helper_add_mmio.cpp +++ b/shared/source/aub/aub_helper_add_mmio.cpp @@ -39,7 +39,7 @@ MMIOList AubHelper::splitMMIORegisters(const std::string ®isters, char delimi } token.clear(); if (!firstElementInPair) { - result.push_back(std::pair(registerOffset, registerValue)); + result.emplace_back(registerOffset, registerValue); registerValue = 0; registerOffset = 0; } diff --git a/shared/source/command_stream/aub_command_stream_receiver_hw_base.inl b/shared/source/command_stream/aub_command_stream_receiver_hw_base.inl index 8a0de1d0bf0bb..ad034d880a453 100644 --- a/shared/source/command_stream/aub_command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/aub_command_stream_receiver_hw_base.inl @@ -398,13 +398,11 @@ bool AUBCommandStreamReceiverHw::addPatchInfoComments() { str << std::endl; if (patchInfoData.sourceAllocation) { - allocationsMap.insert(std::pair(patchInfoData.sourceAllocation, - ppgtt->map(static_cast(patchInfoData.sourceAllocation), 1, 0, MemoryBanks::mainBank))); + allocationsMap.emplace(patchInfoData.sourceAllocation, ppgtt->map(static_cast(patchInfoData.sourceAllocation), 1, 0, MemoryBanks::mainBank)); } if (patchInfoData.targetAllocation) { - allocationsMap.insert(std::pair(patchInfoData.targetAllocation, - ppgtt->map(static_cast(patchInfoData.targetAllocation), 1, 0, MemoryBanks::mainBank))); + allocationsMap.emplace(patchInfoData.targetAllocation, ppgtt->map(static_cast(patchInfoData.targetAllocation), 1, 0, MemoryBanks::mainBank)); } } bool result = getAubStream()->addComment(str.str().c_str()); diff --git a/shared/source/compiler_interface/linker.cpp b/shared/source/compiler_interface/linker.cpp index 36ec70392d62a..2ffb4c1e5287f 100644 --- a/shared/source/compiler_interface/linker.cpp +++ b/shared/source/compiler_interface/linker.cpp @@ -263,7 +263,7 @@ bool LinkerInput::addSymbol(Elf::Elf &elf, const SectionNameToSegmentId traits.exportsFunctions = true; exportedFunctionsSegmentId = static_cast(symbolInfo.instructionSegmentId); - extFuncSymbols.push_back({symbolName, symbolInfo}); + extFuncSymbols.emplace_back(symbolName, symbolInfo); } } else { return false; diff --git a/shared/source/debugger/debugger_l0_tgllp_and_later.inl b/shared/source/debugger/debugger_l0_tgllp_and_later.inl index 7357699bd7041..23fbdf6637d18 100644 --- a/shared/source/debugger/debugger_l0_tgllp_and_later.inl +++ b/shared/source/debugger/debugger_l0_tgllp_and_later.inl @@ -35,22 +35,22 @@ void DebuggerL0Hw::programSbaTrackingCommandsSingleAddressSpace(NEO:: std::vector> fieldOffsetAndValue; if (sba.generalStateBaseAddress) { - fieldOffsetAndValue.push_back({offsetof(SbaTrackedAddresses, generalStateBaseAddress), sba.generalStateBaseAddress}); + fieldOffsetAndValue.emplace_back(offsetof(SbaTrackedAddresses, generalStateBaseAddress), sba.generalStateBaseAddress); } if (sba.surfaceStateBaseAddress) { - fieldOffsetAndValue.push_back({offsetof(SbaTrackedAddresses, surfaceStateBaseAddress), sba.surfaceStateBaseAddress}); + fieldOffsetAndValue.emplace_back(offsetof(SbaTrackedAddresses, surfaceStateBaseAddress), sba.surfaceStateBaseAddress); } if (sba.dynamicStateBaseAddress) { - fieldOffsetAndValue.push_back({offsetof(SbaTrackedAddresses, dynamicStateBaseAddress), sba.dynamicStateBaseAddress}); + fieldOffsetAndValue.emplace_back(offsetof(SbaTrackedAddresses, dynamicStateBaseAddress), sba.dynamicStateBaseAddress); } if (sba.indirectObjectBaseAddress) { - fieldOffsetAndValue.push_back({offsetof(SbaTrackedAddresses, indirectObjectBaseAddress), sba.indirectObjectBaseAddress}); + fieldOffsetAndValue.emplace_back(offsetof(SbaTrackedAddresses, indirectObjectBaseAddress), sba.indirectObjectBaseAddress); } if (sba.instructionBaseAddress) { - fieldOffsetAndValue.push_back({offsetof(SbaTrackedAddresses, instructionBaseAddress), sba.instructionBaseAddress}); + fieldOffsetAndValue.emplace_back(offsetof(SbaTrackedAddresses, instructionBaseAddress), sba.instructionBaseAddress); } if (sba.bindlessSurfaceStateBaseAddress) { - fieldOffsetAndValue.push_back({offsetof(SbaTrackedAddresses, bindlessSurfaceStateBaseAddress), sba.bindlessSurfaceStateBaseAddress}); + fieldOffsetAndValue.emplace_back(offsetof(SbaTrackedAddresses, bindlessSurfaceStateBaseAddress), sba.bindlessSurfaceStateBaseAddress); } const auto cmdStreamGpuBase = cmdStream.getGpuBase(); const auto cmdStreamCpuBase = reinterpret_cast(cmdStream.getCpuBase()); diff --git a/shared/source/device_binary_format/zebin/debug_zebin.cpp b/shared/source/device_binary_format/zebin/debug_zebin.cpp index db0d79725df67..12fc527a5a694 100644 --- a/shared/source/device_binary_format/zebin/debug_zebin.cpp +++ b/shared/source/device_binary_format/zebin/debug_zebin.cpp @@ -29,7 +29,7 @@ Segments::Segments(const GraphicsAllocation *globalVarAlloc, const GraphicsAlloc stringData = {reinterpret_cast(globalStrings.begin()), globalStrings.size()}; } for (auto &[kernelName, isaSegment] : kernels) { - nameToSegMap.insert(std::pair(kernelName, isaSegment)); + nameToSegMap.emplace(kernelName, isaSegment); } } diff --git a/shared/source/device_binary_format/zebin/zeinfo_decoder.cpp b/shared/source/device_binary_format/zebin/zeinfo_decoder.cpp index 8dcbfbb85d0f4..fcd131d027ea7 100644 --- a/shared/source/device_binary_format/zebin/zeinfo_decoder.cpp +++ b/shared/source/device_binary_format/zebin/zeinfo_decoder.cpp @@ -787,7 +787,7 @@ DecodeError readZeInfoAttributes(const Yaml::YamlParser &parser, const Yaml::Nod } else if (key == Tags::Kernel::Attributes::vecTypeHint) { outAttributes.vecTypeHint = parser.readValue(attributesMetadataNd); } else if (key.contains(Tags::Kernel::Attributes::hintSuffix.data())) { - outAttributes.otherHints.push_back({key, parser.readValue(attributesMetadataNd)}); + outAttributes.otherHints.emplace_back(key, parser.readValue(attributesMetadataNd)); } else { encounterUnknownZeInfoAttribute("\"" + key.str() + "\" in context of " + context.str(), outErrReason, outWarning, err); } diff --git a/shared/source/helpers/flat_batch_buffer_helper.cpp b/shared/source/helpers/flat_batch_buffer_helper.cpp index 637f0f30f8003..2535d78854430 100644 --- a/shared/source/helpers/flat_batch_buffer_helper.cpp +++ b/shared/source/helpers/flat_batch_buffer_helper.cpp @@ -53,7 +53,7 @@ bool FlatBatchBufferHelper::registerCommandChunk(CommandChunk &commandChunk) { } bool FlatBatchBufferHelper::registerBatchBufferStartAddress(uint64_t commandAddress, uint64_t startAddress) { - batchBufferStartAddressSequence.insert(std::pair(commandAddress, startAddress)); + batchBufferStartAddressSequence.emplace(commandAddress, startAddress); return true; } diff --git a/shared/source/memory_manager/host_ptr_manager.cpp b/shared/source/memory_manager/host_ptr_manager.cpp index 8b7f22c958dd9..e7edef9040ab9 100644 --- a/shared/source/memory_manager/host_ptr_manager.cpp +++ b/shared/source/memory_manager/host_ptr_manager.cpp @@ -129,7 +129,7 @@ void HostPtrManager::storeFragment(uint32_t rootDeviceIndex, FragmentStorage &fr element->second.refCount++; } else { fragment.refCount++; - partialAllocations.insert(std::pair(key, fragment)); + partialAllocations.emplace(key, fragment); } } diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 2b66c0c8cc0e2..b20a6a52f3352 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -369,7 +369,7 @@ bool MemoryManager::isMemoryBudgetExhausted() const { void MemoryManager::updateLatestContextIdForRootDevice(uint32_t rootDeviceIndex) { // rootDeviceIndexToContextId map would contain the first entry for context for each rootDevice - auto entry = rootDeviceIndexToContextId.insert(std::pair(rootDeviceIndex, latestContextId)); + auto entry = rootDeviceIndexToContextId.emplace(rootDeviceIndex, latestContextId); if (entry.second == false) { if (latestContextId == std::numeric_limits::max()) { // If we are here, it means we are reinitializing the contextId. diff --git a/shared/source/memory_manager/unified_memory_manager.cpp b/shared/source/memory_manager/unified_memory_manager.cpp index 4393e62e092ff..543ad9ede74e7 100644 --- a/shared/source/memory_manager/unified_memory_manager.cpp +++ b/shared/source/memory_manager/unified_memory_manager.cpp @@ -970,7 +970,7 @@ void SVMAllocsManager::insertSVMAlloc(void *svmPtr, const SvmAllocationData &all UNRECOVERABLE_IF(internalAllocationsMap.count(allocData.getAllocId()) > 0); for (auto alloc : allocData.gpuAllocations.getGraphicsAllocations()) { if (alloc != nullptr) { - internalAllocationsMap.insert({allocData.getAllocId(), alloc}); + internalAllocationsMap.emplace(allocData.getAllocId(), alloc); } } } diff --git a/shared/source/program/program_initialization.cpp b/shared/source/program/program_initialization.cpp index 81e9665c462cd..78bd775f180e2 100644 --- a/shared/source/program/program_initialization.cpp +++ b/shared/source/program/program_initialization.cpp @@ -34,7 +34,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc RootDeviceIndicesContainer rootDeviceIndices; rootDeviceIndices.pushUnique(rootDeviceIndex); std::map subDeviceBitfields; - subDeviceBitfields.insert({rootDeviceIndex, deviceBitfield}); + subDeviceBitfields.emplace(rootDeviceIndex, deviceBitfield); NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1, rootDeviceIndices, subDeviceBitfields); unifiedMemoryProperties.device = &device; unifiedMemoryProperties.requestedAllocationType = allocationType; diff --git a/shared/source/utilities/buffer_pool_allocator.inl b/shared/source/utilities/buffer_pool_allocator.inl index 7f0206792afdf..cc5f3cfb7ed3b 100644 --- a/shared/source/utilities/buffer_pool_allocator.inl +++ b/shared/source/utilities/buffer_pool_allocator.inl @@ -29,7 +29,7 @@ AbstractBuffersPool::AbstractBuffersPool(Ab template void AbstractBuffersPool::tryFreeFromPoolBuffer(BufferParentType *possiblePoolBuffer, size_t offset, size_t size) { if (this->isPoolBuffer(possiblePoolBuffer)) { - this->chunksToFree.push_back({offset, size}); + this->chunksToFree.emplace_back(offset, size); } } diff --git a/shared/source/utilities/debug_file_reader.cpp b/shared/source/utilities/debug_file_reader.cpp index 436fd2a914a93..acda653a8a52a 100644 --- a/shared/source/utilities/debug_file_reader.cpp +++ b/shared/source/utilities/debug_file_reader.cpp @@ -148,7 +148,7 @@ void SettingsFileReader::parseStream(std::istream &inputStream) { } } - settingStringMap.insert(std::pair(key, value)); + settingStringMap.emplace(key, value); } } }; // namespace NEO