From f309cdff2fc15aeebb303176897b4662df08cda4 Mon Sep 17 00:00:00 2001 From: Rafal Maziejuk Date: Thu, 26 Aug 2021 14:57:05 +0000 Subject: [PATCH] Delete unnecessary checks in isWorkaroundRequired function related tests Signed-off-by: Rafal Maziejuk --- .../gen12lp/hw_helper_tests_gen12lp.inl | 20 --------- .../xe_hp_core/hw_helper_tests_xe_hp_core.cpp | 44 +++++++++---------- shared/source/helpers/hw_helper_base.inl | 8 +--- 3 files changed, 23 insertions(+), 49 deletions(-) diff --git a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl index de226e5369..5de45eca6f 100644 --- a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl @@ -304,26 +304,6 @@ GEN12LPTEST_F(MemorySynchronizatiopCommandsTests, whenSettingCacheFlushExtraFiel EXPECT_FALSE(args.constantCacheInvalidationEnable); } -GEN12LPTEST_F(HwHelperTestGen12Lp, givenUnknownProductFamilyWhenGettingIsWorkaroundRequiredThenFalseIsReturned) { - const auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); - const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); - uint32_t steppings[] = { - REVISION_A0, - REVISION_B, - REVISION_C, - CommonConstants::invalidStepping}; - hardwareInfo.platform.eProductFamily = IGFX_UNKNOWN; - - for (auto stepping : steppings) { - hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(stepping, hardwareInfo); - - EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo)); - EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo)); - EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); - EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo)); - } -} - GEN12LPTEST_F(HwHelperTestGen12Lp, givenGen12WhenCallIsPackedSupportedThenReturnTrue) { auto &helper = HwHelper::get(renderCoreFamily); EXPECT_TRUE(helper.packedFormatsSupported()); diff --git a/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp b/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp index 2a9efb01f9..7059da6c5f 100644 --- a/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp +++ b/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp @@ -124,35 +124,33 @@ XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenDifferentBufferSizesWhenEnableSta } XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) { - std::vector steppings; - PRODUCT_FAMILY productFamilies[] = {IGFX_XE_HP_SDV, IGFX_TIGERLAKE_LP, IGFX_UNKNOWN}; + uint32_t steppings[] = { + REVISION_A0, + REVISION_A1, + REVISION_C, + REVISION_D, + CommonConstants::invalidStepping, + }; - for (auto productFamily : productFamilies) { - hardwareInfo.platform.eProductFamily = productFamily; - steppings.push_back(0x0); - steppings.push_back(0x1); - steppings.push_back(0x4); - steppings.push_back(0x5); + const auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); - for (auto stepping : steppings) { - hardwareInfo.platform.usRevId = stepping; - HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); + for (auto stepping : steppings) { + hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(stepping, hardwareInfo); - if (hardwareInfo.platform.eProductFamily == IGFX_XE_HP_SDV) { - if (stepping == 0x0) { //A0 - EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo)); - EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo)); - EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo)); - } else if (stepping == 0x1) { //A1 - EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo)); - } else if (stepping == 0x4 || stepping == 0x5) { //B0, undefined - EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); - } - } else { + if (hardwareInfo.platform.eProductFamily == IGFX_XE_HP_SDV) { + if (stepping == REVISION_A0) { + EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo)); + EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo)); + EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo)); + } else if (stepping == REVISION_A1) { + EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo)); + } else if (stepping == REVISION_C || stepping == REVISION_D) { //undefined EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); } + } else { + EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); } - steppings.clear(); } } diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 658697e9a5..6520a0c1ad 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -396,12 +396,8 @@ uint32_t HwHelperHw::getAubStreamSteppingFromHwRevId(const HardwareIn template bool HwHelperHw::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) const { const auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily); - auto lowestHwRevIdWithBug = CommonConstants::invalidStepping; - auto hwRevIdWithFix = CommonConstants::invalidStepping; - if (hwInfoConfig != nullptr) { - lowestHwRevIdWithBug = hwInfoConfig->getHwRevIdFromStepping(lowestSteppingWithBug, hwInfo); - hwRevIdWithFix = hwInfoConfig->getHwRevIdFromStepping(steppingWithFix, hwInfo); - } + auto lowestHwRevIdWithBug = hwInfoConfig->getHwRevIdFromStepping(lowestSteppingWithBug, hwInfo); + auto hwRevIdWithFix = hwInfoConfig->getHwRevIdFromStepping(steppingWithFix, hwInfo); if ((lowestHwRevIdWithBug == CommonConstants::invalidStepping) || (hwRevIdWithFix == CommonConstants::invalidStepping)) { return false; }