diff --git a/opencl/source/gen12lp/hardware_commands_helper_gen12lp.cpp b/opencl/source/gen12lp/hardware_commands_helper_gen12lp.cpp index 2bf1033fe2..bb99b8c2c6 100644 --- a/opencl/source/gen12lp/hardware_commands_helper_gen12lp.cpp +++ b/opencl/source/gen12lp/hardware_commands_helper_gen12lp.cpp @@ -29,33 +29,10 @@ bool HardwareCommandsHelper::doBindingTablePrefetch() { return false; } -template <> -bool HardwareCommandsHelper::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) { - if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_TIGERLAKE_LP) { - for (auto stepping : {&lowestSteppingWithBug, &steppingWithFix}) { - switch (*stepping) { - case REVISION_A0: - *stepping = 0x0; - break; - case REVISION_B: - *stepping = 0x1; - break; - case REVISION_C: - *stepping = 0x3; - break; - default: - DEBUG_BREAK_IF(true); - return false; - } - } - return (lowestSteppingWithBug <= hwInfo.platform.usRevId && hwInfo.platform.usRevId < steppingWithFix); - } - return Gen12LPHelpers::workaroundRequired(lowestSteppingWithBug, steppingWithFix, hwInfo); -} - template <> bool HardwareCommandsHelper::isPipeControlWArequired(const HardwareInfo &hwInfo) { - return (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) && HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo); + HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); + return (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) && hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo); } template <> diff --git a/opencl/source/helpers/hardware_commands_helper.h b/opencl/source/helpers/hardware_commands_helper.h index 26b2ceb287..3576d60ba1 100644 --- a/opencl/source/helpers/hardware_commands_helper.h +++ b/opencl/source/helpers/hardware_commands_helper.h @@ -127,7 +127,6 @@ struct HardwareCommandsHelper : public PerThreadDataHelper { static size_t getSizeRequiredForCacheFlush(const CommandQueue &commandQueue, const Kernel *kernel, uint64_t postSyncAddress); static bool isPipeControlWArequired(const HardwareInfo &hwInfo); static bool isPipeControlPriorToPipelineSelectWArequired(const HardwareInfo &hwInfo); - static bool isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo); static size_t getSizeRequiredDSH( const Kernel &kernel); static size_t getSizeRequiredIOH( diff --git a/opencl/source/helpers/hardware_commands_helper_bdw_plus.inl b/opencl/source/helpers/hardware_commands_helper_bdw_plus.inl index fc31bb6fc3..e3df52ec1f 100644 --- a/opencl/source/helpers/hardware_commands_helper_bdw_plus.inl +++ b/opencl/source/helpers/hardware_commands_helper_bdw_plus.inl @@ -16,11 +16,6 @@ namespace NEO { template bool HardwareCommandsHelper::isPipeControlWArequired(const HardwareInfo &hwInfo) { return false; } -template -bool HardwareCommandsHelper::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) { - return false; -} - template typename HardwareCommandsHelper::INTERFACE_DESCRIPTOR_DATA *HardwareCommandsHelper::getInterfaceDescriptor( const IndirectHeap &indirectHeap, 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 493eb70e2e..7fc7013d35 100644 --- a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl @@ -317,7 +317,7 @@ GEN12LPTEST_F(MemorySynchronizatiopCommandsTests, whenSettingCacheFlushExtraFiel GEN12LPTEST_F(HwHelperTestGen12Lp, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) { std::vector steppings; - PRODUCT_FAMILY productFamilies[] = {IGFX_TIGERLAKE_LP, IGFX_UNKNOWN}; + PRODUCT_FAMILY productFamilies[] = {IGFX_TIGERLAKE_LP, IGFX_DG1, IGFX_UNKNOWN}; for (auto productFamily : productFamilies) { hardwareInfo.platform.eProductFamily = productFamily; @@ -328,18 +328,26 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, givenRevisionEnumAndPlatformFamilyTypeThenPro for (auto stepping : steppings) { hardwareInfo.platform.usRevId = stepping; + HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); if (hardwareInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP) { if (stepping == 0x0) { - EXPECT_TRUE(HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo)); - EXPECT_FALSE(HardwareCommandsHelper::isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo)); + EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo)); + EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo)); } else if (stepping == 0x1) { - EXPECT_TRUE(HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo)); + EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo)); } else if (stepping == 0x3) { - EXPECT_FALSE(HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); + EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); + } + } else if (hardwareInfo.platform.eProductFamily == IGFX_DG1) { + if (stepping == 0x0) { + EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo)); + EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo)); + } else if (stepping == 0x1 || stepping == 0x4) { + EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); } } else { - EXPECT_FALSE(HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); + EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); } } steppings.clear(); diff --git a/opencl/test/unit_test/gen8/hw_helper_tests_gen8.cpp b/opencl/test/unit_test/gen8/hw_helper_tests_gen8.cpp index ddacbd4bf9..2a745912e1 100644 --- a/opencl/test/unit_test/gen8/hw_helper_tests_gen8.cpp +++ b/opencl/test/unit_test/gen8/hw_helper_tests_gen8.cpp @@ -28,10 +28,6 @@ GEN8TEST_F(HwHelperTestGen8, setCapabilityCoherencyFlag) { EXPECT_TRUE(coherency); } -GEN8TEST_F(HwHelperTestGen8, givenRevisionEnumThenWorkaroundIsNotRequired) { - EXPECT_FALSE(HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo)); -} - GEN8TEST_F(HwHelperTestGen8, getPitchAlignmentForImage) { auto &helper = HwHelper::get(renderCoreFamily); EXPECT_EQ(4u, helper.getPitchAlignmentForImage(&hardwareInfo)); diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index 442fc23352..5e4282874c 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -885,6 +885,14 @@ HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenIsForceDefaultRCSEngineWARequir EXPECT_FALSE(HwHelperHw::isForceDefaultRCSEngineWARequired(hardwareInfo)); } +HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenDefaultHwHelperHwWhenIsWorkaroundRequiredCalledThenFalseIsReturned) { + if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) { + GTEST_SKIP(); + } + auto &helper = HwHelper::get(renderCoreFamily); + EXPECT_FALSE(helper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo)); +} + HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenIsForceEmuInt32DivRemSPWARequiredCalledThenFalseIsReturned) { if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) { GTEST_SKIP(); diff --git a/shared/source/gen12lp/helpers_gen12lp.cpp b/shared/source/gen12lp/helpers_gen12lp.cpp index 101339fbd2..bfce974c58 100644 --- a/shared/source/gen12lp/helpers_gen12lp.cpp +++ b/shared/source/gen12lp/helpers_gen12lp.cpp @@ -8,6 +8,7 @@ #include "shared/source/gen12lp/helpers_gen12lp.h" #include "shared/source/command_stream/command_stream_receiver.h" +#include "shared/source/helpers/hw_helper.h" #include "opencl/source/helpers/hardware_commands_helper.h" @@ -19,7 +20,6 @@ bool pipeControlWaRequired(PRODUCT_FAMILY productFamily) { } bool workaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) { - DEBUG_BREAK_IF(true); return false; } @@ -46,7 +46,8 @@ void setAdditionalPipelineSelectFields(void *pipelineSelectCmd, const HardwareInfo &hwInfo) {} bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) { - return HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo); + HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); + return hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo); } bool isForceDefaultRCSEngineWARequired(const HardwareInfo &hwInfo) { @@ -54,7 +55,8 @@ bool isForceDefaultRCSEngineWARequired(const HardwareInfo &hwInfo) { } bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) { - return ((hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP) & HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo)); + HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); + return ((hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP) & hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo)); } bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) { diff --git a/shared/source/gen12lp/helpers_gen12lp_dg1.cpp b/shared/source/gen12lp/helpers_gen12lp_dg1.cpp index 13e7f0e05e..c48be1377b 100644 --- a/shared/source/gen12lp/helpers_gen12lp_dg1.cpp +++ b/shared/source/gen12lp/helpers_gen12lp_dg1.cpp @@ -19,23 +19,6 @@ bool pipeControlWaRequired(PRODUCT_FAMILY productFamily) { } bool workaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) { - if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_DG1) { - for (auto stepping : {&lowestSteppingWithBug, &steppingWithFix}) { - switch (*stepping) { - case REVISION_A0: - *stepping = 0x0; - break; - case REVISION_B: - *stepping = 0x1; - break; - default: - DEBUG_BREAK_IF(true); - return false; - } - } - return (lowestSteppingWithBug >= hwInfo.platform.usRevId && hwInfo.platform.usRevId < steppingWithFix); - } - DEBUG_BREAK_IF(true); return false; } diff --git a/shared/source/gen12lp/hw_helper_gen12lp.cpp b/shared/source/gen12lp/hw_helper_gen12lp.cpp index c60c42aa09..131b987ccc 100644 --- a/shared/source/gen12lp/hw_helper_gen12lp.cpp +++ b/shared/source/gen12lp/hw_helper_gen12lp.cpp @@ -74,6 +74,46 @@ bool HwHelperHw::isPageTableManagerSupported(const HardwareInfo &hwInfo) return hwInfo.capabilityTable.ftrRenderCompressedBuffers || hwInfo.capabilityTable.ftrRenderCompressedImages; } +template <> +bool HwHelperHw::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) const { + if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_TIGERLAKE_LP) { + for (auto stepping : {&lowestSteppingWithBug, &steppingWithFix}) { + switch (*stepping) { + case REVISION_A0: + *stepping = 0x0; + break; + case REVISION_B: + *stepping = 0x1; + break; + case REVISION_C: + *stepping = 0x3; + break; + default: + DEBUG_BREAK_IF(true); + return false; + } + } + return (lowestSteppingWithBug >= hwInfo.platform.usRevId && hwInfo.platform.usRevId < steppingWithFix); + } else if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_DG1) { + for (auto stepping : {&lowestSteppingWithBug, &steppingWithFix}) { + switch (*stepping) { + case REVISION_A0: + *stepping = 0x0; + break; + case REVISION_B: + *stepping = 0x1; + break; + default: + DEBUG_BREAK_IF(true); + return false; + } + } + return (lowestSteppingWithBug >= hwInfo.platform.usRevId && hwInfo.platform.usRevId < steppingWithFix); + } + + return Gen12LPHelpers::workaroundRequired(lowestSteppingWithBug, steppingWithFix, hwInfo); +} + template <> bool HwHelperHw::obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const { return false; @@ -90,7 +130,8 @@ bool HwHelperHw::checkResourceCompatibility(GraphicsAllocation &graphics template <> void HwHelperHw::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) { coherencyFlag = true; - if (pHwInfo->platform.eProductFamily == IGFX_TIGERLAKE_LP && HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, *pHwInfo)) { + HwHelper &hwHelper = HwHelper::get(pHwInfo->platform.eRenderCoreFamily); + if (pHwInfo->platform.eProductFamily == IGFX_TIGERLAKE_LP && hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *pHwInfo)) { //stepping A devices - turn off coherency coherencyFlag = false; } @@ -101,7 +142,8 @@ void HwHelperHw::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, template <> uint32_t HwHelperHw::getPitchAlignmentForImage(const HardwareInfo *hwInfo) { if (Gen12LPHelpers::imagePitchAlignmentWaRequired(hwInfo->platform.eProductFamily)) { - if (HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo)) { + HwHelper &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily); + if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo)) { return 64u; } return 4u; @@ -144,7 +186,8 @@ template <> void MemorySynchronizationCommands::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) { using PIPE_CONTROL = typename Family::PIPE_CONTROL; if (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) { - if (HardwareCommandsHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo)) { + HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); + if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo)) { PIPE_CONTROL cmd = Family::cmdInitPipeControl; cmd.setCommandStreamerStallEnable(true); auto pipeControl = static_cast(commandStream.getSpace(sizeof(PIPE_CONTROL))); diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 837e75c14d..1f4dd59a84 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -91,6 +91,7 @@ class HwHelper { virtual bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) = 0; virtual uint32_t getMinimalSIMDSize() = 0; + virtual bool isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) const = 0; virtual bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) const = 0; virtual bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const = 0; virtual bool isFusedEuDispatchEnabled(const HardwareInfo &hwInfo) const = 0; @@ -245,6 +246,8 @@ class HwHelperHw : public HwHelper { static bool isBlitAuxTranslationRequired(const HardwareInfo &hwInfo, const MultiDispatchInfo &multiDispatchInfo); + bool isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) const override; + bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) const override; bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index c99c5600f0..bc2a21e904 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -334,6 +334,11 @@ inline bool HwHelperHw::isOffsetToSkipSetFFIDGPWARequired(const Hardw return false; } +template +bool HwHelperHw::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) const { + return false; +} + template bool HwHelperHw::is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const { return false;