Move isWorkaroundRequired to hw_helper files

Related-To: NEO-4751
Change-Id: Id2c87ee087e767c22adba1242010bb659be6684c
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2020-06-29 13:07:41 +02:00
committed by sys_ocldev
parent 3f64cc0e4d
commit a31db56769
11 changed files with 83 additions and 64 deletions

View File

@ -29,33 +29,10 @@ bool HardwareCommandsHelper<TGLLPFamily>::doBindingTablePrefetch() {
return false;
}
template <>
bool HardwareCommandsHelper<TGLLPFamily>::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<TGLLPFamily>::isPipeControlWArequired(const HardwareInfo &hwInfo) {
return (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) && HardwareCommandsHelper<TGLLPFamily>::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 <>

View File

@ -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(

View File

@ -16,11 +16,6 @@ namespace NEO {
template <typename GfxFamily>
bool HardwareCommandsHelper<GfxFamily>::isPipeControlWArequired(const HardwareInfo &hwInfo) { return false; }
template <typename GfxFamily>
bool HardwareCommandsHelper<GfxFamily>::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) {
return false;
}
template <typename GfxFamily>
typename HardwareCommandsHelper<GfxFamily>::INTERFACE_DESCRIPTOR_DATA *HardwareCommandsHelper<GfxFamily>::getInterfaceDescriptor(
const IndirectHeap &indirectHeap,

View File

@ -317,7 +317,7 @@ GEN12LPTEST_F(MemorySynchronizatiopCommandsTests, whenSettingCacheFlushExtraFiel
GEN12LPTEST_F(HwHelperTestGen12Lp, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) {
std::vector<unsigned short> 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<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
EXPECT_FALSE(HardwareCommandsHelper<FamilyType>::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<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo));
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo));
} else if (stepping == 0x3) {
EXPECT_FALSE(HardwareCommandsHelper<FamilyType>::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<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
}
}
steppings.clear();

View File

@ -28,10 +28,6 @@ GEN8TEST_F(HwHelperTestGen8, setCapabilityCoherencyFlag) {
EXPECT_TRUE(coherency);
}
GEN8TEST_F(HwHelperTestGen8, givenRevisionEnumThenWorkaroundIsNotRequired) {
EXPECT_FALSE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
}
GEN8TEST_F(HwHelperTestGen8, getPitchAlignmentForImage) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_EQ(4u, helper.getPitchAlignmentForImage(&hardwareInfo));

View File

@ -885,6 +885,14 @@ HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenIsForceDefaultRCSEngineWARequir
EXPECT_FALSE(HwHelperHw<FamilyType>::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();

View File

@ -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<TGLLPFamily>::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<TGLLPFamily>::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) {

View File

@ -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;
}

View File

@ -74,6 +74,46 @@ bool HwHelperHw<Family>::isPageTableManagerSupported(const HardwareInfo &hwInfo)
return hwInfo.capabilityTable.ftrRenderCompressedBuffers || hwInfo.capabilityTable.ftrRenderCompressedImages;
}
template <>
bool HwHelperHw<Family>::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<Family>::obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const {
return false;
@ -90,7 +130,8 @@ bool HwHelperHw<Family>::checkResourceCompatibility(GraphicsAllocation &graphics
template <>
void HwHelperHw<Family>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) {
coherencyFlag = true;
if (pHwInfo->platform.eProductFamily == IGFX_TIGERLAKE_LP && HardwareCommandsHelper<Family>::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<Family>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo,
template <>
uint32_t HwHelperHw<Family>::getPitchAlignmentForImage(const HardwareInfo *hwInfo) {
if (Gen12LPHelpers::imagePitchAlignmentWaRequired(hwInfo->platform.eProductFamily)) {
if (HardwareCommandsHelper<Family>::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<Family>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
using PIPE_CONTROL = typename Family::PIPE_CONTROL;
if (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) {
if (HardwareCommandsHelper<Family>::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<Family::PIPE_CONTROL *>(commandStream.getSpace(sizeof(PIPE_CONTROL)));

View File

@ -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;

View File

@ -334,6 +334,11 @@ inline bool HwHelperHw<GfxFamily>::isOffsetToSkipSetFFIDGPWARequired(const Hardw
return false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) const {
return false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const {
return false;