Skip to content

Commit ef4cc0e

Browse files
kgibalaCompute-Runtime-Automation
authored andcommitted
Add helper for stepping isWorkaroundRequired
Related-To: NEO-4751 Change-Id: I430a354314e0f3d7a042505c377f3b7d9e9d588b Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
1 parent b73c757 commit ef4cc0e

File tree

8 files changed

+81
-9
lines changed

8 files changed

+81
-9
lines changed

opencl/source/gen12lp/hardware_commands_helper_gen12lp.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,33 @@ bool HardwareCommandsHelper<TGLLPFamily>::doBindingTablePrefetch() {
2929
return false;
3030
}
3131

32+
template <>
33+
bool HardwareCommandsHelper<TGLLPFamily>::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) {
34+
if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_TIGERLAKE_LP) {
35+
for (auto stepping : {&lowestSteppingWithBug, &steppingWithFix}) {
36+
switch (*stepping) {
37+
case REVISION_A0:
38+
*stepping = 0x0;
39+
break;
40+
case REVISION_B:
41+
*stepping = 0x1;
42+
break;
43+
case REVISION_C:
44+
*stepping = 0x3;
45+
break;
46+
default:
47+
DEBUG_BREAK_IF(true);
48+
return false;
49+
}
50+
}
51+
return (lowestSteppingWithBug <= hwInfo.platform.usRevId && hwInfo.platform.usRevId < steppingWithFix);
52+
}
53+
return Gen12LPHelpers::workaroundRequired(lowestSteppingWithBug, steppingWithFix, hwInfo);
54+
}
55+
3256
template <>
3357
bool HardwareCommandsHelper<TGLLPFamily>::isPipeControlWArequired(const HardwareInfo &hwInfo) {
34-
return (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) && (hwInfo.platform.usRevId == REVISION_A0);
58+
return (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) && HardwareCommandsHelper<TGLLPFamily>::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo);
3559
}
3660

3761
template <>

opencl/source/helpers/hardware_commands_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ struct HardwareCommandsHelper : public PerThreadDataHelper {
127127
static size_t getSizeRequiredForCacheFlush(const CommandQueue &commandQueue, const Kernel *kernel, uint64_t postSyncAddress);
128128
static bool isPipeControlWArequired(const HardwareInfo &hwInfo);
129129
static bool isPipeControlPriorToPipelineSelectWArequired(const HardwareInfo &hwInfo);
130+
static bool isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo);
130131
static size_t getSizeRequiredDSH(
131132
const Kernel &kernel);
132133
static size_t getSizeRequiredIOH(

opencl/source/helpers/hardware_commands_helper_bdw_plus.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ namespace NEO {
1616
template <typename GfxFamily>
1717
bool HardwareCommandsHelper<GfxFamily>::isPipeControlWArequired(const HardwareInfo &hwInfo) { return false; }
1818

19+
template <typename GfxFamily>
20+
bool HardwareCommandsHelper<GfxFamily>::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) {
21+
return false;
22+
}
23+
1924
template <typename GfxFamily>
2025
typename HardwareCommandsHelper<GfxFamily>::INTERFACE_DESCRIPTOR_DATA *HardwareCommandsHelper<GfxFamily>::getInterfaceDescriptor(
2126
const IndirectHeap &indirectHeap,

opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,3 +314,34 @@ GEN12LPTEST_F(MemorySynchronizatiopCommandsTests, whenSettingCacheFlushExtraFiel
314314
EXPECT_TRUE(pipeControl.getHdcPipelineFlush());
315315
EXPECT_FALSE(pipeControl.getConstantCacheInvalidationEnable());
316316
}
317+
318+
GEN12LPTEST_F(HwHelperTestGen12Lp, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) {
319+
std::vector<unsigned short> steppings;
320+
PRODUCT_FAMILY productFamilies[] = {IGFX_TIGERLAKE_LP, IGFX_UNKNOWN};
321+
322+
for (auto productFamily : productFamilies) {
323+
hardwareInfo.platform.eProductFamily = productFamily;
324+
steppings.push_back(0x0); //A0
325+
steppings.push_back(0x1); //B0
326+
steppings.push_back(0x3); //C0
327+
steppings.push_back(0x4); //undefined
328+
329+
for (auto stepping : steppings) {
330+
hardwareInfo.platform.usRevId = stepping;
331+
332+
if (hardwareInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP) {
333+
if (stepping == 0x0) {
334+
EXPECT_TRUE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
335+
EXPECT_FALSE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo));
336+
} else if (stepping == 0x1) {
337+
EXPECT_TRUE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo));
338+
} else if (stepping == 0x3) {
339+
EXPECT_FALSE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
340+
}
341+
} else {
342+
EXPECT_FALSE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
343+
}
344+
}
345+
steppings.clear();
346+
}
347+
}

opencl/test/unit_test/gen8/hw_helper_tests_gen8.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "shared/source/helpers/constants.h"
99
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
1010

11+
#include "opencl/source/helpers/hardware_commands_helper.h"
1112
#include "opencl/test/unit_test/helpers/get_gpgpu_engines_tests.inl"
1213
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
1314

@@ -27,6 +28,10 @@ GEN8TEST_F(HwHelperTestGen8, setCapabilityCoherencyFlag) {
2728
EXPECT_TRUE(coherency);
2829
}
2930

31+
GEN8TEST_F(HwHelperTestGen8, givenRevisionEnumThenWorkaroundIsNotRequired) {
32+
EXPECT_FALSE(HardwareCommandsHelper<FamilyType>::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
33+
}
34+
3035
GEN8TEST_F(HwHelperTestGen8, getPitchAlignmentForImage) {
3136
auto &helper = HwHelper::get(renderCoreFamily);
3237
EXPECT_EQ(4u, helper.getPitchAlignmentForImage(&hardwareInfo));

shared/source/gen12lp/helpers_gen12lp.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,20 @@
99

1010
#include "shared/source/command_stream/command_stream_receiver.h"
1111

12+
#include "opencl/source/helpers/hardware_commands_helper.h"
13+
1214
namespace NEO {
1315
namespace Gen12LPHelpers {
1416

1517
bool pipeControlWaRequired(PRODUCT_FAMILY productFamily) {
1618
return (productFamily == PRODUCT_FAMILY::IGFX_TIGERLAKE_LP);
1719
}
1820

21+
bool workaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) {
22+
DEBUG_BREAK_IF(true);
23+
return false;
24+
}
25+
1926
bool imagePitchAlignmentWaRequired(PRODUCT_FAMILY productFamily) {
2027
return (productFamily == PRODUCT_FAMILY::IGFX_TIGERLAKE_LP);
2128
}
@@ -39,15 +46,15 @@ void setAdditionalPipelineSelectFields(void *pipelineSelectCmd,
3946
const HardwareInfo &hwInfo) {}
4047

4148
bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) {
42-
return (hwInfo.platform.usRevId == REVISION_A0);
49+
return HardwareCommandsHelper<TGLLPFamily>::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo);
4350
}
4451

4552
bool isForceDefaultRCSEngineWARequired(const HardwareInfo &hwInfo) {
4653
return ((hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP));
4754
}
4855

4956
bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) {
50-
return ((hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP) & (hwInfo.platform.usRevId == REVISION_A0));
57+
return ((hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP) & HardwareCommandsHelper<TGLLPFamily>::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo));
5158
}
5259

5360
bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) {

shared/source/gen12lp/helpers_gen12lp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Image;
2222

2323
namespace Gen12LPHelpers {
2424
bool pipeControlWaRequired(PRODUCT_FAMILY productFamily);
25+
bool workaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo);
2526
bool imagePitchAlignmentWaRequired(PRODUCT_FAMILY productFamily);
2627
void adjustCoherencyFlag(PRODUCT_FAMILY productFamily, bool &coherencyFlag);
2728
bool isLocalMemoryEnabled(const HardwareInfo &hwInfo);

shared/source/gen12lp/hw_helper_gen12lp.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ bool HwHelperHw<Family>::checkResourceCompatibility(GraphicsAllocation &graphics
9090
template <>
9191
void HwHelperHw<Family>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) {
9292
coherencyFlag = true;
93-
if (pHwInfo->platform.eProductFamily == IGFX_TIGERLAKE_LP && pHwInfo->platform.usRevId == 0x0) {
94-
//stepping A0 devices - turn off coherency
93+
if (pHwInfo->platform.eProductFamily == IGFX_TIGERLAKE_LP && HardwareCommandsHelper<Family>::isWorkaroundRequired(REVISION_A0, REVISION_B, *pHwInfo)) {
94+
//stepping A devices - turn off coherency
9595
coherencyFlag = false;
9696
}
9797

@@ -101,8 +101,7 @@ void HwHelperHw<Family>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo,
101101
template <>
102102
uint32_t HwHelperHw<Family>::getPitchAlignmentForImage(const HardwareInfo *hwInfo) {
103103
if (Gen12LPHelpers::imagePitchAlignmentWaRequired(hwInfo->platform.eProductFamily)) {
104-
auto stepping = hwInfo->platform.usRevId;
105-
if (stepping == 0) {
104+
if (HardwareCommandsHelper<Family>::isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo)) {
106105
return 64u;
107106
}
108107
return 4u;
@@ -145,8 +144,7 @@ template <>
145144
void MemorySynchronizationCommands<Family>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
146145
using PIPE_CONTROL = typename Family::PIPE_CONTROL;
147146
if (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) {
148-
auto stepping = hwInfo.platform.usRevId;
149-
if (stepping == 0) {
147+
if (HardwareCommandsHelper<Family>::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo)) {
150148
PIPE_CONTROL cmd = Family::cmdInitPipeControl;
151149
cmd.setCommandStreamerStallEnable(true);
152150
auto pipeControl = static_cast<Family::PIPE_CONTROL *>(commandStream.getSpace(sizeof(PIPE_CONTROL)));

0 commit comments

Comments
 (0)