diff --git a/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp b/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp index a56278199f..acdb97cd0d 100644 --- a/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp +++ b/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp @@ -453,8 +453,8 @@ HWTEST2_F(L0GfxCoreHelperFusedEuTest, givenDynamicallyPopulatesSliceInfoGreaterT hwInfo.gtSystemInfo.IsDynamicallyPopulated = true; hwInfo.gtSystemInfo.MaxSlicesSupported = 2; - for (int i = 0; i < GT_MAX_SLICE; i++) { - hwInfo.gtSystemInfo.SliceInfo[i].Enabled = false; + for (auto &sliceInfo : hwInfo.gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; } hwInfo.gtSystemInfo.SliceInfo[2].Enabled = true; hwInfo.gtSystemInfo.SliceInfo[3].Enabled = true; diff --git a/level_zero/tools/test/unit_tests/sources/debug/debug_session_tests.cpp b/level_zero/tools/test/unit_tests/sources/debug/debug_session_tests.cpp index 47b0bd7f91..5b5511388a 100644 --- a/level_zero/tools/test/unit_tests/sources/debug/debug_session_tests.cpp +++ b/level_zero/tools/test/unit_tests/sources/debug/debug_session_tests.cpp @@ -38,8 +38,8 @@ TEST(DeviceWithDebugSessionTest, GivenSlicesEnabledWithEarlierSlicesDisabledThen hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 32; hwInfo.gtSystemInfo.IsDynamicallyPopulated = true; hwInfo.gtSystemInfo.MaxSlicesSupported = 2; - for (int i = 0; i < GT_MAX_SLICE; i++) { - hwInfo.gtSystemInfo.SliceInfo[i].Enabled = false; + for (auto &sliceInfo : hwInfo.gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; } hwInfo.gtSystemInfo.SliceInfo[2].Enabled = true; hwInfo.gtSystemInfo.SliceInfo[3].Enabled = true; diff --git a/level_zero/tools/test/unit_tests/sources/debug/debug_session_thread_tests.cpp b/level_zero/tools/test/unit_tests/sources/debug/debug_session_thread_tests.cpp index c381bb4fca..f572baa00e 100644 --- a/level_zero/tools/test/unit_tests/sources/debug/debug_session_thread_tests.cpp +++ b/level_zero/tools/test/unit_tests/sources/debug/debug_session_thread_tests.cpp @@ -187,14 +187,11 @@ TEST(DebugSession, givenAllThreadsWithLowSliceDisabledWhenGettingSingleThreadsTh auto hwInfo = *NEO::defaultHwInfo.get(); hwInfo.gtSystemInfo.MaxSlicesSupported = 2; hwInfo.gtSystemInfo.IsDynamicallyPopulated = true; - hwInfo.gtSystemInfo.SliceInfo[0].Enabled = false; - hwInfo.gtSystemInfo.SliceInfo[1].Enabled = false; + for (auto &sliceInfo : hwInfo.gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; + } hwInfo.gtSystemInfo.SliceInfo[2].Enabled = true; hwInfo.gtSystemInfo.SliceInfo[3].Enabled = true; - hwInfo.gtSystemInfo.SliceInfo[4].Enabled = false; - hwInfo.gtSystemInfo.SliceInfo[5].Enabled = false; - hwInfo.gtSystemInfo.SliceInfo[6].Enabled = false; - hwInfo.gtSystemInfo.SliceInfo[7].Enabled = false; NEO::Device *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); Mock deviceImp(neoDevice, neoDevice->getExecutionEnvironment()); diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp index 6d00c08ed7..8066dd774e 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp @@ -1475,12 +1475,13 @@ HWTEST_F(GfxCoreHelperTest, WhenIsDynamicallyPopulatedIsTrueThenGetHighestEnable hwInfo.gtSystemInfo.MaxSlicesSupported = 1; hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 4; - for (int i = 0; i < GT_MAX_SLICE; i++) { - hwInfo.gtSystemInfo.SliceInfo[i].Enabled = false; - for (unsigned int dssID = 0; dssID < GT_MAX_DUALSUBSLICE_PER_SLICE; dssID++) { - hwInfo.gtSystemInfo.SliceInfo[i].DSSInfo[dssID].Enabled = false; + for (auto &sliceInfo : hwInfo.gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; + for (auto &dssInfo : sliceInfo.DSSInfo) { + dssInfo.Enabled = false; } } + hwInfo.gtSystemInfo.SliceInfo[3].Enabled = true; hwInfo.gtSystemInfo.SliceInfo[3].DSSInfo[0].Enabled = true; hwInfo.gtSystemInfo.SliceInfo[3].DSSInfo[1].Enabled = true; diff --git a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp index 624a1e9ebc..63fc16c329 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp @@ -155,9 +155,10 @@ TEST_F(WddmTests, GivengtSystemInfoSliceInfoHasEnabledSlicesAtHigherIndicesThenE defaultHwInfo.get()->gtSystemInfo.IsDynamicallyPopulated = true; defaultHwInfo.get()->gtSystemInfo.SliceCount = 1; // Only one slice enabled - defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].Enabled = false; - defaultHwInfo.get()->gtSystemInfo.SliceInfo[1].Enabled = false; - defaultHwInfo.get()->gtSystemInfo.SliceInfo[2].Enabled = false; + for (auto &sliceInfo : defaultHwInfo->gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; + } + defaultHwInfo.get()->gtSystemInfo.SliceInfo[3].Enabled = true; defaultHwInfo.get()->gtSystemInfo.SliceInfo[3].DualSubSliceEnabledCount = 1; defaultHwInfo.get()->gtSystemInfo.SliceInfo[3].DSSInfo[0].Enabled = true; @@ -230,6 +231,10 @@ TEST_F(WddmTests, GivenProperTopologyDataWhenQueryingTopologyThenExpectTrue) { defaultHwInfo.get()->gtSystemInfo.IsDynamicallyPopulated = true; defaultHwInfo.get()->gtSystemInfo.SliceCount = 1; // Only one slice enabled + for (auto &sliceInfo : defaultHwInfo->gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; + } + defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].Enabled = true; defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].DualSubSliceEnabledCount = 2; defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].DSSInfo[0].Enabled = false; // DSS[0] disabled @@ -242,9 +247,6 @@ TEST_F(WddmTests, GivenProperTopologyDataWhenQueryingTopologyThenExpectTrue) { defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].DSSInfo[3].SubSlice[0].Enabled = true; defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].DSSInfo[3].SubSlice[1].Enabled = true; defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].DSSInfo[3].SubSlice[1].EuEnabledCount = 4; - for (uint32_t i = 1; i < defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported; i++) { - defaultHwInfo.get()->gtSystemInfo.SliceInfo[i].Enabled = false; - } wddm->rootDeviceEnvironment.setHwInfoAndInitHelpers(defaultHwInfo.get()); EXPECT_TRUE(wddm->buildTopologyMapping()); @@ -263,9 +265,12 @@ TEST_F(WddmTests, GivenMoreThanOneEnabledSliceWhenQueryingTopologyThenExpectTrue defaultHwInfo.get()->gtSystemInfo.MultiTileArchInfo.TileCount = 1; defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported = GT_MAX_SLICE; defaultHwInfo.get()->gtSystemInfo.SliceCount = 2; - defaultHwInfo.get()->gtSystemInfo.SliceInfo[0].Enabled = false; defaultHwInfo.get()->gtSystemInfo.IsDynamicallyPopulated = true; + for (auto &sliceInfo : defaultHwInfo->gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; + } + uint32_t index = 1; for (uint32_t enabledSliceCount = 0; enabledSliceCount < defaultHwInfo.get()->gtSystemInfo.SliceCount; enabledSliceCount++) { defaultHwInfo.get()->gtSystemInfo.SliceInfo[index].Enabled = true; @@ -277,9 +282,6 @@ TEST_F(WddmTests, GivenMoreThanOneEnabledSliceWhenQueryingTopologyThenExpectTrue defaultHwInfo.get()->gtSystemInfo.SliceInfo[index].DSSInfo[0].SubSlice[1].EuEnabledCount = 4; index++; } - for (; index < defaultHwInfo.get()->gtSystemInfo.MaxSlicesSupported; index++) { - defaultHwInfo.get()->gtSystemInfo.SliceInfo[index].Enabled = false; - } wddm->rootDeviceEnvironment.setHwInfoAndInitHelpers(defaultHwInfo.get()); EXPECT_TRUE(wddm->buildTopologyMapping()); @@ -328,8 +330,8 @@ TEST_F(WddmTests, GivenNoEuThreadsEnabledWhenQueryingTopologyThenExpectFalse) { TEST_F(WddmTests, GivenNoSliceEnabledWhenQueryingTopologyThenExpectFalse) { VariableBackup backupHwInfo(defaultHwInfo.get()); defaultHwInfo.get()->gtSystemInfo.MultiTileArchInfo.TileCount = 1; - for (uint32_t i = 0; i < GT_MAX_SLICE; i++) { - defaultHwInfo.get()->gtSystemInfo.SliceInfo[i].Enabled = false; + for (auto &sliceInfo : defaultHwInfo->gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; } wddm->rootDeviceEnvironment.setHwInfoAndInitHelpers(defaultHwInfo.get()); EXPECT_FALSE(wddm->buildTopologyMapping()); diff --git a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp index fd965317bf..60dd9b0360 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp @@ -647,8 +647,8 @@ DG2TEST_F(ProductHelperTestDg2, givenEnabledSliceInNonStandardConfigWhenComputeU HardwareInfo &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo; testSysInfo.IsDynamicallyPopulated = true; - for (int i = 0; i < GT_MAX_SLICE; i++) { - testSysInfo.SliceInfo[i].Enabled = false; + for (auto &sliceInfo : testSysInfo.SliceInfo) { + sliceInfo.Enabled = false; } testSysInfo.SliceInfo[2].Enabled = true; testSysInfo.SliceInfo[3].Enabled = true; @@ -667,8 +667,8 @@ DG2TEST_F(ProductHelperTestDg2, givenNotEnabledSliceWhenComputeUnitsUsedForScrat HardwareInfo &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo; testSysInfo.IsDynamicallyPopulated = true; - for (int i = 0; i < GT_MAX_SLICE; i++) { - testSysInfo.SliceInfo[i].Enabled = false; + for (auto &sliceInfo : testSysInfo.SliceInfo) { + sliceInfo.Enabled = false; } auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper();