Add helper for stepping isWorkaroundRequired

Related-To: NEO-4751
Change-Id: I430a354314e0f3d7a042505c377f3b7d9e9d588b
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala 2020-06-19 14:19:31 +02:00 committed by sys_ocldev
parent b73c757a82
commit ef4cc0e685
8 changed files with 81 additions and 9 deletions

View File

@ -29,9 +29,33 @@ 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)) && (hwInfo.platform.usRevId == REVISION_A0);
return (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) && HardwareCommandsHelper<TGLLPFamily>::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo);
}
template <>

View File

@ -127,6 +127,7 @@ 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,6 +16,11 @@ 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

@ -314,3 +314,34 @@ GEN12LPTEST_F(MemorySynchronizatiopCommandsTests, whenSettingCacheFlushExtraFiel
EXPECT_TRUE(pipeControl.getHdcPipelineFlush());
EXPECT_FALSE(pipeControl.getConstantCacheInvalidationEnable());
}
GEN12LPTEST_F(HwHelperTestGen12Lp, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) {
std::vector<unsigned short> steppings;
PRODUCT_FAMILY productFamilies[] = {IGFX_TIGERLAKE_LP, IGFX_UNKNOWN};
for (auto productFamily : productFamilies) {
hardwareInfo.platform.eProductFamily = productFamily;
steppings.push_back(0x0); //A0
steppings.push_back(0x1); //B0
steppings.push_back(0x3); //C0
steppings.push_back(0x4); //undefined
for (auto stepping : steppings) {
hardwareInfo.platform.usRevId = stepping;
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));
} else if (stepping == 0x1) {
EXPECT_TRUE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo));
} else if (stepping == 0x3) {
EXPECT_FALSE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
}
} else {
EXPECT_FALSE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
}
}
steppings.clear();
}
}

View File

@ -8,6 +8,7 @@
#include "shared/source/helpers/constants.h"
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
#include "opencl/source/helpers/hardware_commands_helper.h"
#include "opencl/test/unit_test/helpers/get_gpgpu_engines_tests.inl"
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
@ -27,6 +28,10 @@ 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

@ -9,6 +9,8 @@
#include "shared/source/command_stream/command_stream_receiver.h"
#include "opencl/source/helpers/hardware_commands_helper.h"
namespace NEO {
namespace Gen12LPHelpers {
@ -16,6 +18,11 @@ bool pipeControlWaRequired(PRODUCT_FAMILY productFamily) {
return (productFamily == PRODUCT_FAMILY::IGFX_TIGERLAKE_LP);
}
bool workaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) {
DEBUG_BREAK_IF(true);
return false;
}
bool imagePitchAlignmentWaRequired(PRODUCT_FAMILY productFamily) {
return (productFamily == PRODUCT_FAMILY::IGFX_TIGERLAKE_LP);
}
@ -39,7 +46,7 @@ void setAdditionalPipelineSelectFields(void *pipelineSelectCmd,
const HardwareInfo &hwInfo) {}
bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) {
return (hwInfo.platform.usRevId == REVISION_A0);
return HardwareCommandsHelper<TGLLPFamily>::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo);
}
bool isForceDefaultRCSEngineWARequired(const HardwareInfo &hwInfo) {
@ -47,7 +54,7 @@ bool isForceDefaultRCSEngineWARequired(const HardwareInfo &hwInfo) {
}
bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) {
return ((hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP) & (hwInfo.platform.usRevId == REVISION_A0));
return ((hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP) & HardwareCommandsHelper<TGLLPFamily>::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo));
}
bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) {

View File

@ -22,6 +22,7 @@ class Image;
namespace Gen12LPHelpers {
bool pipeControlWaRequired(PRODUCT_FAMILY productFamily);
bool workaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo);
bool imagePitchAlignmentWaRequired(PRODUCT_FAMILY productFamily);
void adjustCoherencyFlag(PRODUCT_FAMILY productFamily, bool &coherencyFlag);
bool isLocalMemoryEnabled(const HardwareInfo &hwInfo);

View File

@ -90,8 +90,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 && pHwInfo->platform.usRevId == 0x0) {
//stepping A0 devices - turn off coherency
if (pHwInfo->platform.eProductFamily == IGFX_TIGERLAKE_LP && HardwareCommandsHelper<Family>::isWorkaroundRequired(REVISION_A0, REVISION_B, *pHwInfo)) {
//stepping A devices - turn off coherency
coherencyFlag = false;
}
@ -101,8 +101,7 @@ void HwHelperHw<Family>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo,
template <>
uint32_t HwHelperHw<Family>::getPitchAlignmentForImage(const HardwareInfo *hwInfo) {
if (Gen12LPHelpers::imagePitchAlignmentWaRequired(hwInfo->platform.eProductFamily)) {
auto stepping = hwInfo->platform.usRevId;
if (stepping == 0) {
if (HardwareCommandsHelper<Family>::isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo)) {
return 64u;
}
return 4u;
@ -145,8 +144,7 @@ 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)) {
auto stepping = hwInfo.platform.usRevId;
if (stepping == 0) {
if (HardwareCommandsHelper<Family>::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)));