Add helper functions to convert stepping

Change-Id: I39997f6f60398ab35612d8425cce579e14d081d3
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2020-07-17 17:04:52 +02:00
committed by sys_ocldev
parent 51e08dd07c
commit 7b8009ccbe
11 changed files with 163 additions and 73 deletions

View File

@ -5,6 +5,8 @@
*
*/
#include "shared/source/utilities/compiler_support.h"
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
using HwHelperTestDg1 = HwHelperTest;
@ -52,3 +54,24 @@ DG1TEST_F(HwHelperTestDg1, givenDg1BWhenAdjustDefaultEngineTypeCalledThenCcsIsRe
helper.adjustDefaultEngineType(&hardwareInfo);
EXPECT_EQ(aub_stream::ENGINE_RCS, hardwareInfo.capabilityTable.defaultEngineType);
}
DG1TEST_F(HwHelperTestDg1, givenDg1AndVariousSteppingsWhenGettingIsWorkaroundRequiredThenCorrectValueIsReturned) {
HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
uint32_t steppings[] = {
REVISION_A0,
REVISION_B,
CommonConstants::invalidStepping};
for (auto stepping : steppings) {
hardwareInfo.platform.usRevId = hwHelper.getHwRevIdFromStepping(stepping, hardwareInfo);
switch (stepping) {
case REVISION_A0:
EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
CPP_ATTRIBUTE_FALLTHROUGH;
default:
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo));
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
}
}
}

View File

@ -327,41 +327,21 @@ GEN12LPTEST_F(MemorySynchronizatiopCommandsTests, whenSettingCacheFlushExtraFiel
EXPECT_FALSE(pipeControl.getConstantCacheInvalidationEnable());
}
GEN12LPTEST_F(HwHelperTestGen12Lp, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) {
std::vector<unsigned short> steppings;
PRODUCT_FAMILY productFamilies[] = {IGFX_TIGERLAKE_LP, IGFX_DG1, IGFX_UNKNOWN};
GEN12LPTEST_F(HwHelperTestGen12Lp, givenUnknownProductFamilyWhenGettingIsWorkaroundRequiredThenFalseIsReturned) {
HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
uint32_t steppings[] = {
REVISION_A0,
REVISION_B,
REVISION_C,
CommonConstants::invalidStepping};
hardwareInfo.platform.eProductFamily = 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 = hwHelper.getHwRevIdFromStepping(stepping, hardwareInfo);
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(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo));
} else if (stepping == 0x1) {
EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo));
} else if (stepping == 0x3) {
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(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
}
}
steppings.clear();
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));
}
}

View File

@ -5,6 +5,8 @@
*
*/
#include "shared/source/utilities/compiler_support.h"
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
using HwHelperTestGen12Lp = HwHelperTest;
@ -48,3 +50,28 @@ TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpWhenSteppingBThenIntegerDivisionEmula
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_FALSE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo));
}
TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpAndVariousSteppingsWhenGettingIsWorkaroundRequiredThenCorrectValueIsReturned) {
HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
uint32_t steppings[] = {
REVISION_A0,
REVISION_B,
REVISION_C,
CommonConstants::invalidStepping};
for (auto stepping : steppings) {
hardwareInfo.platform.usRevId = hwHelper.getHwRevIdFromStepping(stepping, hardwareInfo);
switch (stepping) {
case REVISION_A0:
EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
CPP_ATTRIBUTE_FALLTHROUGH;
case REVISION_B:
EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo));
CPP_ATTRIBUTE_FALLTHROUGH;
default:
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo));
}
}
}

View File

@ -898,6 +898,29 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenDefaultHwHelperHwWhenIsWorkaround
EXPECT_FALSE(helper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
}
HWTEST_F(HwHelperTest, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConversionIsCorrect) {
auto &helper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
for (uint32_t testValue = 0; testValue < 0x10; testValue++) {
auto hwRevIdFromStepping = helper.getHwRevIdFromStepping(testValue, hardwareInfo);
if (hwRevIdFromStepping != CommonConstants::invalidStepping) {
EXPECT_EQ(testValue, helper.getSteppingFromHwRevId(hwRevIdFromStepping, hardwareInfo));
}
auto steppingFromHwRevId = helper.getSteppingFromHwRevId(testValue, hardwareInfo);
if (steppingFromHwRevId != CommonConstants::invalidStepping) {
EXPECT_EQ(testValue, helper.getHwRevIdFromStepping(steppingFromHwRevId, hardwareInfo));
}
}
}
HWTEST_F(HwHelperTest, givenInvalidProductFamilyWhenConvertingHwRevIdAndSteppingThenConversionFails) {
auto &helper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
hardwareInfo.platform.eProductFamily = IGFX_UNKNOWN;
for (uint32_t testValue = 0; testValue < 0x10; testValue++) {
EXPECT_EQ(CommonConstants::invalidStepping, helper.getHwRevIdFromStepping(testValue, hardwareInfo));
EXPECT_EQ(CommonConstants::invalidStepping, helper.getSteppingFromHwRevId(testValue, hardwareInfo));
}
}
HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenIsForceEmuInt32DivRemSPWARequiredCalledThenFalseIsReturned) {
if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
GTEST_SKIP();