refactor: Add dc flush mitigation infrastructure

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2024-05-22 09:55:38 +00:00
committed by Compute-Runtime-Automation
parent ff624514be
commit 9dbf83c85a
7 changed files with 31 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -212,6 +212,9 @@ struct PerformanceHintEnqueueMapTest : public PerformanceHintEnqueueTest,
void SetUp() override {
PerformanceHintEnqueueTest::SetUp();
if (context->getDevice(0)->getRootDeviceEnvironment().getProductHelper().isDcFlushMitigated()) {
GTEST_SKIP();
}
}
void TearDown() override {

View File

@@ -130,6 +130,7 @@ class ProductHelper {
virtual bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isDcFlushAllowed() const = 0;
virtual bool isDcFlushMitigated() const = 0;
virtual bool mitigateDcFlush() const = 0;
virtual bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const = 0;
virtual bool overrideCacheableForDcFlushMitigation(AllocationType allocationType) const = 0;
virtual uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const = 0;

View File

@@ -389,7 +389,7 @@ bool ProductHelperHw<gfxProduct>::isDisableScratchPagesSupported() const {
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isDcFlushAllowed() const {
using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct;
bool dcFlushAllowed = GfxProduct::isDcFlushAllowed;
bool dcFlushAllowed = GfxProduct::isDcFlushAllowed && !this->mitigateDcFlush();
if (debugManager.flags.AllowDcFlush.get() != -1) {
dcFlushAllowed = debugManager.flags.AllowDcFlush.get();
@@ -398,6 +398,11 @@ bool ProductHelperHw<gfxProduct>::isDcFlushAllowed() const {
return dcFlushAllowed;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::mitigateDcFlush() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isDcFlushMitigated() const {
using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct;

View File

@@ -75,6 +75,7 @@ class ProductHelperHw : public ProductHelper {
bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const override;
bool isDcFlushAllowed() const override;
bool isDcFlushMitigated() const override;
bool mitigateDcFlush() const override;
bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const override;
bool overrideCacheableForDcFlushMitigation(AllocationType allocationType) const override;
uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const override;

View File

@@ -276,6 +276,11 @@ bool ProductHelperHw<IGFX_UNKNOWN>::isDcFlushMitigated() const {
return false;
}
template <>
bool ProductHelperHw<IGFX_UNKNOWN>::mitigateDcFlush() const {
return false;
}
template <>
bool ProductHelperHw<IGFX_UNKNOWN>::overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const {
return false;

View File

@@ -682,6 +682,11 @@ TEST(GmmTest, givenHwInfoWhenDeviceIsCreatedThenSetThisHwInfoToGmmHelper) {
TEST(GmmTest, givenAllocationTypeWhenGettingUsageTypeThenReturnCorrectValue) {
MockExecutionEnvironment mockExecutionEnvironment{};
const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
if (productHelper.isDcFlushMitigated()) {
GTEST_SKIP();
}
for (uint32_t i = 0; i < static_cast<uint32_t>(AllocationType::count); i++) {
auto allocationType = static_cast<AllocationType>(i);
auto uncachedGmmUsageType = productHelper.isNewCoherencyModelSupported() ? GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC : GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED;
@@ -874,6 +879,10 @@ TEST(GmmTest, givenUncachedDebugFlagMaskSetWhenAskingForUsageTypeThenReturnUncac
MockExecutionEnvironment mockExecutionEnvironment{};
const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
if (productHelper.isDcFlushMitigated()) {
GTEST_SKIP();
}
constexpr int64_t bufferMask = 1 << (static_cast<int64_t>(AllocationType::buffer) - 1);
constexpr int64_t imageMask = 1 << (static_cast<int64_t>(AllocationType::image) - 1);

View File

@@ -311,10 +311,12 @@ HWTEST_F(ProductHelperTest, givenVariousValuesWhenGettingAubStreamSteppingFromHw
HWTEST_F(ProductHelperTest, givenDcFlushMitigationWhenOverridePatAndUsageForDcFlushMitigationThenReturnCorrectValue) {
DebugManagerStateRestore restorer;
if (!productHelper->isDcFlushMitigated()) {
for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) {
auto allocationType = static_cast<AllocationType>(i);
EXPECT_FALSE(productHelper->overridePatAndUsageForDcFlushMitigation(allocationType));
}
}
debugManager.flags.AllowDcFlush.set(0);
for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) {
auto allocationType = static_cast<AllocationType>(i);