refactor: use reference in for-range loops

Related-To: NEO-9038
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-10-03 15:02:52 +00:00
committed by Compute-Runtime-Automation
parent 9b344280d6
commit 895a586083
16 changed files with 34 additions and 34 deletions

View File

@@ -83,7 +83,7 @@ ze_result_t DeviceImp::getStatus() {
return ZE_RESULT_ERROR_DEVICE_LOST;
}
auto engines = neoDevice->getAllEngines();
for (auto engine : engines) {
for (auto &engine : engines) {
auto csr = engine.commandStreamReceiver;
if (csr->isGpuHangDetected()) {
return ZE_RESULT_ERROR_DEVICE_LOST;
@@ -1105,7 +1105,7 @@ ze_result_t DeviceImp::systemBarrier() { return ZE_RESULT_ERROR_UNSUPPORTED_FEAT
ze_result_t DeviceImp::activateMetricGroupsDeferred(uint32_t count,
zet_metric_group_handle_t *phMetricGroups) {
if (!this->isSubdevice && this->isImplicitScalingCapable()) {
for (auto subDevice : this->subDevices) {
for (auto &subDevice : this->subDevices) {
subDevice->getMetricDeviceContext().activateMetricGroupsDeferred(count, phMetricGroups);
}
} else {
@@ -1410,7 +1410,7 @@ NEO::GraphicsAllocation *DeviceImp::allocateManagedMemoryFromHostPtr(void *buffe
if (!allocDataArray.empty()) {
UNRECOVERABLE_IF(commandList == nullptr);
for (auto allocData : allocDataArray) {
for (auto &allocData : allocDataArray) {
allocation = allocData->gpuAllocations.getGraphicsAllocation(getRootDeviceIndex());
char *allocAddress = reinterpret_cast<char *>(allocation->getGpuAddress());
size_t allocSize = allocData->size;

View File

@@ -35,7 +35,7 @@ ze_result_t DeviceImp::queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latenc
std::string fabricPath;
fabricPath.clear();
std::vector<std::string> list = NEO::Directory::getFiles(peerDevicePath + "/device");
for (auto entry : list) {
for (auto &entry : list) {
if ((entry.find(iafDirectory) != std::string::npos) || (entry.find(iafDirectoryLegacy) != std::string::npos)) {
fabricPath = entry + fabricIdFile;
break;
@@ -71,4 +71,4 @@ ze_result_t DeviceImp::queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latenc
return ZE_RESULT_SUCCESS;
}
} // namespace L0
} // namespace L0