Move setCapabilityCoherencyFlag function from HwHelper to HwInfoConfig

Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com>
Related-To: NEO-4541
This commit is contained in:
Rafal Maziejuk
2021-09-22 14:39:01 +00:00
committed by Compute-Runtime-Automation
parent 80b49e4a47
commit 7c473d0a11
21 changed files with 74 additions and 93 deletions

View File

@ -19,14 +19,6 @@ GEN11TEST_F(HwHelperTestGen11, WhenGettingMaxBarriersPerSliceThenCorrectSizeIsRe
EXPECT_EQ(32u, helper.getMaxBarrierRegisterPerSlice());
}
GEN11TEST_F(HwHelperTestGen11, WhenSettingCapabilityCoherencyFlagThenFlagIsSet) {
auto &helper = HwHelper::get(renderCoreFamily);
bool coherency = false;
helper.setCapabilityCoherencyFlag(&hardwareInfo, coherency);
EXPECT_TRUE(coherency);
}
GEN11TEST_F(HwHelperTestGen11, WhenGettingPitchAlignmentForImageThenCorrectValueIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_EQ(4u, helper.getPitchAlignmentForImage(&hardwareInfo));

View File

@ -39,29 +39,6 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, WhenGettingMaxBarriersPerSliceThenCorrectSize
EXPECT_EQ(32u, helper.getMaxBarrierRegisterPerSlice());
}
GEN12LPTEST_F(HwHelperTestGen12Lp, givenGen12LpSkuWhenGettingCapabilityCoherencyFlagThenExpectValidValue) {
auto &helper = HwHelper::get(renderCoreFamily);
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
bool coherency = false;
helper.setCapabilityCoherencyFlag(&hardwareInfo, coherency);
const bool checkDone = SpecialUltHelperGen12lp::additionalCoherencyCheck(hardwareInfo.platform.eProductFamily, coherency);
if (checkDone) {
return;
}
if (SpecialUltHelperGen12lp::isAdditionalCapabilityCoherencyFlagSettingRequired(hardwareInfo.platform.eProductFamily)) {
hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A1, hardwareInfo);
helper.setCapabilityCoherencyFlag(&hardwareInfo, coherency);
EXPECT_TRUE(coherency);
hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hardwareInfo);
helper.setCapabilityCoherencyFlag(&hardwareInfo, coherency);
EXPECT_FALSE(coherency);
} else {
EXPECT_TRUE(coherency);
}
}
GEN12LPTEST_F(HwHelperTestGen12Lp, WhenGettingPitchAlignmentForImageThenCorrectValueIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily);
auto stepping = hardwareInfo.platform.usRevId;

View File

@ -62,3 +62,25 @@ GEN12LPTEST_F(HwInfoConfigTestWindowsGen12lp, givenCompressionFtrEnabledWhenAski
outHwInfo.capabilityTable.ftrRenderCompressedImages = true;
EXPECT_TRUE(hwInfoConfig.isPageTableManagerSupported(outHwInfo));
}
GEN12LPTEST_F(HwInfoConfigTestWindowsGen12lp, givenGen12LpSkuWhenGettingCapabilityCoherencyFlagThenExpectValidValue) {
auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
bool coherency = false;
hwInfoConfig.setCapabilityCoherencyFlag(outHwInfo, coherency);
const bool checkDone = SpecialUltHelperGen12lp::additionalCoherencyCheck(outHwInfo.platform.eProductFamily, coherency);
if (checkDone) {
return;
}
if (SpecialUltHelperGen12lp::isAdditionalCapabilityCoherencyFlagSettingRequired(outHwInfo.platform.eProductFamily)) {
outHwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A1, outHwInfo);
hwInfoConfig.setCapabilityCoherencyFlag(outHwInfo, coherency);
EXPECT_TRUE(coherency);
outHwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, outHwInfo);
hwInfoConfig.setCapabilityCoherencyFlag(outHwInfo, coherency);
EXPECT_FALSE(coherency);
} else {
EXPECT_TRUE(coherency);
}
}

View File

@ -22,14 +22,6 @@ GEN8TEST_F(HwHelperTestGen8, WhenGettingMaxBarriersPerSliceThenCorrectSizeIsRetu
EXPECT_EQ(16u, helper.getMaxBarrierRegisterPerSlice());
}
GEN8TEST_F(HwHelperTestGen8, WhenSettingCapabilityCoherencyFlagThenFlagIsSet) {
auto &helper = HwHelper::get(renderCoreFamily);
bool coherency = false;
helper.setCapabilityCoherencyFlag(&hardwareInfo, coherency);
EXPECT_TRUE(coherency);
}
GEN8TEST_F(HwHelperTestGen8, WhenGettingPitchAlignmentForImageThenCorrectValueIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_EQ(4u, helper.getPitchAlignmentForImage(&hardwareInfo));

View File

@ -24,14 +24,6 @@ GEN9TEST_F(HwHelperTestGen9, givenGen9WhenCallIsPackedSupportedThenReturnFalse)
EXPECT_FALSE(helper.packedFormatsSupported());
}
GEN9TEST_F(HwHelperTestGen9, WhenSettingCapabilityCoherencyFlagThenFlagIsSet) {
auto &helper = HwHelper::get(renderCoreFamily);
bool coherency = false;
helper.setCapabilityCoherencyFlag(&hardwareInfo, coherency);
EXPECT_TRUE(coherency);
}
GEN9TEST_F(HwHelperTestGen9, WhenGettingPitchAlignmentForImageThenCorrectValueIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_EQ(4u, helper.getPitchAlignmentForImage(&hardwareInfo));

View File

@ -28,14 +28,6 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, WhenGettingMaxBarriersPer
EXPECT_EQ(32u, helper.getMaxBarrierRegisterPerSlice());
}
HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, whenCapabilityCoherencyFlagSetTrueThenOverrideToFalse) {
auto &helper = HwHelper::get(renderCoreFamily);
bool coherency = true;
helper.setCapabilityCoherencyFlag(&hardwareInfo, coherency);
EXPECT_FALSE(coherency);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, givenHwHelperWhenGetGpuTimeStampInNSIsCalledThenOnlyLow32BitsFromTimeStampAreUsedAndCorrectValueIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily);
@ -451,4 +443,12 @@ using HwInfoConfigTestXeHpAndLater = ::testing::Test;
HWCMDTEST_F(IGFX_XE_HP_CORE, HwInfoConfigTestXeHpAndLater, givenXeHPAndLaterPlatformWhenCheckNewResidencyModelSupportedThenReturnTrue) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
EXPECT_TRUE(hwInfoConfig->isNewResidencyModelSupported());
}
}
HWCMDTEST_F(IGFX_XE_HP_CORE, HwInfoConfigTestXeHpAndLater, whenCapabilityCoherencyFlagSetTrueThenOverrideToFalse) {
auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
bool coherency = true;
hwInfoConfig.setCapabilityCoherencyFlag(*defaultHwInfo, coherency);
EXPECT_FALSE(coherency);
}

View File

@ -283,3 +283,11 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfHeapInLocalMemThenFalseIs
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
EXPECT_FALSE(hwInfoConfig.heapInLocalMem(pInHwInfo));
}
HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigWhenSettingCapabilityCoherencyFlagThenFlagIsSet, IsAtMostGen11) {
auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
bool coherency = false;
hwInfoConfig.setCapabilityCoherencyFlag(pInHwInfo, coherency);
EXPECT_TRUE(coherency);
}

View File

@ -76,11 +76,10 @@ TEST_F(HwInfoConfigTestWindows, givenInstrumentationForHardwareIsEnabledOrDisabl
HWTEST_F(HwInfoConfigTestWindows, givenFtrIaCoherencyFlagWhenConfiguringHwInfoThenSetCoherencySupportCorrectly) {
HardwareInfo initialHwInfo = *defaultHwInfo;
auto &hwHelper = HwHelper::get(initialHwInfo.platform.eRenderCoreFamily);
auto hwInfoConfig = HwInfoConfig::get(initialHwInfo.platform.eProductFamily);
bool initialCoherencyStatus = false;
hwHelper.setCapabilityCoherencyFlag(&outHwInfo, initialCoherencyStatus);
hwInfoConfig->setCapabilityCoherencyFlag(outHwInfo, initialCoherencyStatus);
initialHwInfo.featureTable.ftrL3IACoherency = false;
hwInfoConfig->configureHwInfoWddm(&initialHwInfo, &outHwInfo, osInterface.get());

View File

@ -25,7 +25,6 @@ enum class LocalMemoryAccessMode;
namespace Gen12LPHelpers {
bool pipeControlWaRequired(PRODUCT_FAMILY productFamily);
bool imagePitchAlignmentWaRequired(PRODUCT_FAMILY productFamily);
void adjustCoherencyFlag(PRODUCT_FAMILY productFamily, bool &coherencyFlag);
bool isLocalMemoryEnabled(const HardwareInfo &hwInfo);
void initAdditionalGlobalMMIO(const CommandStreamReceiver &commandStreamReceiver, AubMemDump::AubStream &stream);
uint64_t getPPGTTAdditionalBits(GraphicsAllocation *graphicsAllocation);

View File

@ -21,12 +21,6 @@ bool imagePitchAlignmentWaRequired(PRODUCT_FAMILY productFamily) {
return (productFamily == IGFX_TIGERLAKE_LP) || (productFamily == IGFX_DG1);
}
void adjustCoherencyFlag(PRODUCT_FAMILY productFamily, bool &coherencyFlag) {
if (productFamily == IGFX_DG1) {
coherencyFlag = false;
}
}
bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) {
return hwInfo.featureTable.ftrLocalMemory;
}

View File

@ -85,18 +85,6 @@ bool HwHelperHw<Family>::checkResourceCompatibility(GraphicsAllocation &graphics
return true;
}
template <>
void HwHelperHw<Family>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) {
coherencyFlag = true;
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;
}
Gen12LPHelpers::adjustCoherencyFlag(pHwInfo->platform.eProductFamily, coherencyFlag);
}
template <>
uint32_t HwHelperHw<Family>::getPitchAlignmentForImage(const HardwareInfo *hwInfo) const {
if (Gen12LPHelpers::imagePitchAlignmentWaRequired(hwInfo->platform.eProductFamily)) {

View File

@ -17,5 +17,10 @@ constexpr static auto gfxProduct = IGFX_DG1;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_dg1.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
template <>
void HwInfoConfigHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
coherencyFlag = false;
}
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -17,6 +17,15 @@ constexpr static auto gfxProduct = IGFX_TIGERLAKE_LP;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_tgllp.inl"
template class HwInfoConfigHw<gfxProduct>;
template <>
void HwInfoConfigHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
coherencyFlag = true;
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo)) {
//stepping A devices - turn off coherency
coherencyFlag = false;
}
}
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -48,7 +48,6 @@ class HwHelper {
virtual uint32_t getComputeUnitsUsedForScratch(const HardwareInfo *pHwInfo) const = 0;
virtual uint32_t getPitchAlignmentForImage(const HardwareInfo *hwInfo) const = 0;
virtual uint32_t getMaxNumSamplers() const = 0;
virtual void setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) = 0;
virtual void adjustDefaultEngineType(HardwareInfo *pHwInfo) = 0;
virtual void setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) = 0;
virtual bool isL3Configurable(const HardwareInfo &hwInfo) = 0;
@ -206,8 +205,6 @@ class HwHelperHw : public HwHelper {
uint32_t getMaxNumSamplers() const override;
void setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) override;
void adjustDefaultEngineType(HardwareInfo *pHwInfo) override;
void setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) override;

View File

@ -25,11 +25,6 @@ inline uint32_t HwHelperHw<GfxFamily>::getGlobalTimeStampBits() const {
return 36;
}
template <typename GfxFamily>
void HwHelperHw<GfxFamily>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) {
coherencyFlag = true;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) const {
return false;

View File

@ -39,11 +39,6 @@ inline uint32_t HwHelperHw<GfxFamily>::getGlobalTimeStampBits() const {
return 32;
}
template <typename GfxFamily>
void HwHelperHw<GfxFamily>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) {
coherencyFlag = false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) const {
return hwInfo.featureTable.ftrLocalMemory;

View File

@ -64,6 +64,7 @@ class HwInfoConfig {
virtual bool isNewResidencyModelSupported() const = 0;
virtual bool isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo) const = 0;
virtual bool heapInLocalMem(const HardwareInfo &hwInfo) const = 0;
virtual void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) = 0;
protected:
virtual LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
@ -113,6 +114,7 @@ class HwInfoConfigHw : public HwInfoConfig {
bool isNewResidencyModelSupported() const override;
bool isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo) const override;
bool heapInLocalMem(const HardwareInfo &hwInfo) const override;
void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) override;
protected:
HwInfoConfigHw() = default;

View File

@ -45,4 +45,9 @@ bool HwInfoConfigHw<gfxProduct>::heapInLocalMem(const HardwareInfo &hwInfo) cons
return false;
}
template <PRODUCT_FAMILY gfxProduct>
void HwInfoConfigHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
coherencyFlag = true;
}
} // namespace NEO

View File

@ -42,4 +42,9 @@ bool HwInfoConfigHw<gfxProduct>::isNewResidencyModelSupported() const {
return true;
}
template <PRODUCT_FAMILY gfxProduct>
void HwInfoConfigHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
coherencyFlag = false;
}
} // namespace NEO

View File

@ -17,14 +17,15 @@
namespace NEO {
int HwInfoConfig::configureHwInfoWddm(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, OSInterface *osIface) {
HwHelper &hwHelper = HwHelper::get(outHwInfo->platform.eRenderCoreFamily);
auto &hwHelper = HwHelper::get(outHwInfo->platform.eRenderCoreFamily);
auto &hwInfoConfig = *HwInfoConfig::get(outHwInfo->platform.eProductFamily);
outHwInfo->capabilityTable.ftrSvm = outHwInfo->featureTable.ftrSVM;
hwHelper.adjustDefaultEngineType(outHwInfo);
outHwInfo->capabilityTable.defaultEngineType = getChosenEngineType(*outHwInfo);
hwHelper.setCapabilityCoherencyFlag(outHwInfo, outHwInfo->capabilityTable.ftrSupportsCoherency);
hwInfoConfig.setCapabilityCoherencyFlag(*outHwInfo, outHwInfo->capabilityTable.ftrSupportsCoherency);
outHwInfo->capabilityTable.ftrSupportsCoherency &= inHwInfo->featureTable.ftrL3IACoherency;
PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable,

View File

@ -188,4 +188,8 @@ bool HwInfoConfigHw<IGFX_UNKNOWN>::heapInLocalMem(const HardwareInfo &hwInfo) co
return false;
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
}
} //namespace NEO