From bf647698074298712791f296725c14d674709283 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Mon, 7 Nov 2022 19:54:52 +0000 Subject: [PATCH] Remove not needed std::vector copies Signed-off-by: Kamil Kopryk --- .../ocloc_product_config_tests.cpp | 2 +- .../offline_compiler_tests.cpp | 18 +++++++++--------- .../source/ocloc_fatbinary.cpp | 6 +++--- .../source/offline_compiler.cpp | 2 +- .../command_stream/get_devices_tests.cpp | 2 +- .../helpers/product_config_helper_tests.cpp | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.cpp b/opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.cpp index 92abc5d486..6bf4f6222d 100644 --- a/opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.cpp @@ -13,7 +13,7 @@ namespace NEO { TEST_P(OclocProductConfigTests, GivenProductConfigValuesWhenInitHardwareInfoThenCorrectValuesAreSet) { auto deviceId = 0u; auto revId = 0u; - auto allSupportedConfigs = mockOfflineCompiler->argHelper->productConfigHelper->getDeviceAotInfo(); + auto &allSupportedConfigs = mockOfflineCompiler->argHelper->productConfigHelper->getDeviceAotInfo(); for (const auto &deviceConfig : allSupportedConfigs) { if (aotConfig.ProductConfig == deviceConfig.aotConfig.ProductConfig) { diff --git a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp index bf6b07dea1..3aa4ce80f6 100644 --- a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp @@ -189,7 +189,7 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWhenBuildingMultiCommandThenSuc } TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuildingMultiCommandThenSuccessIsReturned) { - auto allEnabledDeviceConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); + auto &allEnabledDeviceConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); if (allEnabledDeviceConfigs.empty()) { GTEST_SKIP(); } @@ -526,7 +526,7 @@ TEST(MultiCommandWhiteboxTest, GivenInvalidArgsWhenInitializingThenErrorIsReturn using MockOfflineCompilerTests = ::testing::Test; TEST_F(MockOfflineCompilerTests, givenProductConfigValueAndRevisionIdWhenInitHwInfoThenTheseValuesAreSet) { MockOfflineCompiler mockOfflineCompiler; - auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo(); + auto &allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo(); if (allEnabledDeviceConfigs.empty()) { GTEST_SKIP(); } @@ -550,7 +550,7 @@ TEST_F(MockOfflineCompilerTests, givenProductConfigValueAndRevisionIdWhenInitHwI TEST_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenBaseHardwareInfoValuesAreSet) { MockOfflineCompiler mockOfflineCompiler; - auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo(); + auto &allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo(); if (allEnabledDeviceConfigs.empty()) { GTEST_SKIP(); } @@ -639,7 +639,7 @@ TEST_F(MockOfflineCompilerTests, givenHwInfoConfigWhenSetHwInfoForDeprecatedAcro TEST_F(MockOfflineCompilerTests, givenAcronymWithUppercaseWhenInitHwInfoThenSuccessIsReturned) { MockOfflineCompiler mockOfflineCompiler; - auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo(); + auto &allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo(); if (allEnabledDeviceConfigs.empty()) { GTEST_SKIP(); } @@ -676,7 +676,7 @@ TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithUppercaseWhenInitHwI HWTEST2_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenMaxDualSubSlicesSupportedIsSet, IsAtLeastGen12lp) { MockOfflineCompiler mockOfflineCompiler; - auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo(); + auto &allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo(); if (allEnabledDeviceConfigs.empty()) { GTEST_SKIP(); } @@ -736,7 +736,7 @@ TEST_F(OfflineCompilerTests, givenFamilyAcronymWhenIdsCommandIsInvokeThenSuccess if (enabledFamilies.empty()) { GTEST_SKIP(); } - auto supportedDevicesConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); + auto &supportedDevicesConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); for (const auto &familyAcronym : enabledFamilies) { std::vector expected{}; auto family = ProductConfigHelper::getFamilyForAcronym(familyAcronym.str()); @@ -770,7 +770,7 @@ TEST_F(OfflineCompilerTests, givenReleaseAcronymWhenIdsCommandIsInvokeThenSucces if (enabledReleases.empty()) { GTEST_SKIP(); } - auto supportedDevicesConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); + auto &supportedDevicesConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); for (const auto &releaseAcronym : enabledReleases) { std::vector expected{}; auto release = ProductConfigHelper::getReleaseForAcronym(releaseAcronym.str()); @@ -804,7 +804,7 @@ TEST_F(OfflineCompilerTests, givenProductAcronymWhenIdsCommandIsInvokeThenSucces if (enabledProducts.empty()) { GTEST_SKIP(); } - auto supportedDevicesConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); + auto &supportedDevicesConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); for (const auto &productAcronym : enabledProducts) { std::vector expected{}; auto product = ProductConfigHelper::getProductConfigForAcronym(productAcronym.str()); @@ -1757,7 +1757,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingThenBuildSucceeds) { } TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingWithDeviceConfigValueThenBuildSucceeds) { - auto allEnabledDeviceConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); + auto &allEnabledDeviceConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo(); if (allEnabledDeviceConfigs.empty()) { return; } diff --git a/shared/offline_compiler/source/ocloc_fatbinary.cpp b/shared/offline_compiler/source/ocloc_fatbinary.cpp index 4a128b0d9b..bafa63602b 100644 --- a/shared/offline_compiler/source/ocloc_fatbinary.cpp +++ b/shared/offline_compiler/source/ocloc_fatbinary.cpp @@ -47,7 +47,7 @@ bool requestedFatBinary(const std::vector &args, OclocArgHelper *he template <> void getProductsAcronymsForTarget(std::vector &out, AOT::FAMILY target, OclocArgHelper *argHelper) { - auto allSuppportedProducts = argHelper->productConfigHelper->getDeviceAotInfo(); + auto &allSuppportedProducts = argHelper->productConfigHelper->getDeviceAotInfo(); for (const auto &device : allSuppportedProducts) { if (device.family == target && !device.acronyms.empty()) { if (std::find(out.begin(), out.end(), device.acronyms.front()) == out.end()) { @@ -59,7 +59,7 @@ void getProductsAcronymsForTarget(std::vector template <> void getProductsAcronymsForTarget(std::vector &out, AOT::RELEASE target, OclocArgHelper *argHelper) { - auto allSuppportedProducts = argHelper->productConfigHelper->getDeviceAotInfo(); + auto &allSuppportedProducts = argHelper->productConfigHelper->getDeviceAotInfo(); for (const auto &device : allSuppportedProducts) { if (device.release == target && !device.acronyms.empty()) { if (std::find(out.begin(), out.end(), device.acronyms.front()) == out.end()) { @@ -83,7 +83,7 @@ void getProductsForTargetRange(T targetFrom, T targetTo, std::vector &out, OclocArgHelper *argHelper) { - auto allSuppportedProducts = argHelper->productConfigHelper->getDeviceAotInfo(); + auto &allSuppportedProducts = argHelper->productConfigHelper->getDeviceAotInfo(); for (const auto &device : allSuppportedProducts) { auto validAcronym = device.aotConfig.ProductConfig >= productFrom; diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index 25c82e016d..86bfca2a67 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -158,7 +158,7 @@ int OfflineCompiler::queryAcronymIds(size_t numArgs, const std::vectorproductConfigHelper->getDeviceAotInfo(); + auto &enabledDevices = helper->productConfigHelper->getDeviceAotInfo(); std::vector matchedVersions{}; if (helper->productConfigHelper->isFamily(queryAcronym)) { diff --git a/shared/test/unit_test/command_stream/get_devices_tests.cpp b/shared/test/unit_test/command_stream/get_devices_tests.cpp index 948f8d7269..633de07f50 100644 --- a/shared/test/unit_test/command_stream/get_devices_tests.cpp +++ b/shared/test/unit_test/command_stream/get_devices_tests.cpp @@ -25,7 +25,7 @@ struct PrepareDeviceEnvironmentsTest : ::testing::Test { ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false; productConfigHelper = std::make_unique(); - auto aotInfos = productConfigHelper->getDeviceAotInfo(); + auto &aotInfos = productConfigHelper->getDeviceAotInfo(); for (const auto &aotInfo : aotInfos) { if (aotInfo.hwInfo->platform.eProductFamily == productFamily && !aotInfo.acronyms.empty()) { deviceAot = aotInfo; diff --git a/shared/test/unit_test/helpers/product_config_helper_tests.cpp b/shared/test/unit_test/helpers/product_config_helper_tests.cpp index 916f02d47d..540afbcd26 100644 --- a/shared/test/unit_test/helpers/product_config_helper_tests.cpp +++ b/shared/test/unit_test/helpers/product_config_helper_tests.cpp @@ -431,7 +431,7 @@ TEST_F(AotDeviceInfoTests, givenDeprecatedAcronymsWhenSearchingPresenceInNewName } TEST_F(AotDeviceInfoTests, givenNotFullConfigWhenGetProductConfigThenUnknownIsaIsReturned) { - auto allEnabledDeviceConfigs = productConfigHelper->getDeviceAotInfo(); + auto &allEnabledDeviceConfigs = productConfigHelper->getDeviceAotInfo(); if (allEnabledDeviceConfigs.empty()) { GTEST_SKIP(); } @@ -449,7 +449,7 @@ TEST_F(AotDeviceInfoTests, givenNotFullConfigWhenGetProductConfigThenUnknownIsaI } TEST_F(AotDeviceInfoTests, givenEnabledProductsAcronymsAndVersionsWhenCheckIfProductConfigThenTrueIsReturned) { - auto enabledProducts = productConfigHelper->getDeviceAotInfo(); + auto &enabledProducts = productConfigHelper->getDeviceAotInfo(); for (const auto &product : enabledProducts) { auto configStr = ProductConfigHelper::parseMajorMinorRevisionValue(product.aotConfig); EXPECT_FALSE(configStr.empty());