fix: use const auto& to avoid unnecessary copies

Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwoliński
2025-09-15 16:30:38 +00:00
committed by Compute-Runtime-Automation
parent dfd926a9c6
commit 8cf8fe4f5a
8 changed files with 9 additions and 9 deletions

View File

@@ -480,7 +480,7 @@ void ContextImp::freePeerAllocations(const void *ptr, bool blocking, Device *dev
auto peerAlloc = peerAllocData->gpuAllocations.getDefaultGraphicsAllocation();
auto peerPtr = reinterpret_cast<void *>(peerAlloc->getGpuAddress());
if (peerAllocData->mappedAllocData) {
auto gpuAllocations = peerAllocData->gpuAllocations;
const auto &gpuAllocations = peerAllocData->gpuAllocations;
for (const auto &graphicsAllocation : gpuAllocations.getGraphicsAllocations()) {
this->driverHandle->getMemoryManager()->freeGraphicsMemory(graphicsAllocation);
}

View File

@@ -214,7 +214,7 @@ ze_result_t DriverHandleImp::getExtensionProperties(uint32_t *pCount,
*pCount = std::min(extensionCount, *pCount);
for (uint32_t i = 0; i < *pCount; i++) {
auto extension = (i < this->extensionsSupported.size()) ? this->extensionsSupported[i] : additionalExtensions[i - this->extensionsSupported.size()];
const auto &extension = (i < this->extensionsSupported.size()) ? this->extensionsSupported[i] : additionalExtensions[i - this->extensionsSupported.size()];
strncpy_s(pExtensionProperties[i].name, ZE_MAX_EXTENSION_NAME,
extension.first.c_str(), extension.first.length());
pExtensionProperties[i].version = extension.second;

View File

@@ -204,7 +204,7 @@ KernelData *MutableCommandListImp::getKernelData(L0::Kernel *kernel) {
auto &kernelDescriptor = kernel->getKernelDescriptor();
const auto kernelName = kernelDescriptor.kernelMetadata.kernelName;
const auto &kernelName = kernelDescriptor.kernelMetadata.kernelName;
const L0::Module *module = &(static_cast<L0::KernelImp *>(kernel)->getParentModule());
std::pair<const L0::Module *, std::string> pairFind(module, kernelName);