From c39b750790d67a234963431f486e7eacafd9898d Mon Sep 17 00:00:00 2001 From: Lukasz Jobczyk Date: Tue, 21 May 2024 08:54:21 +0000 Subject: [PATCH] performance: Cache host resources when mitigate dc flush Related-To: NEO-10556 Signed-off-by: Lukasz Jobczyk --- shared/source/os_interface/product_helper.h | 1 + shared/source/os_interface/product_helper.inl | 14 ++++++++++---- shared/source/os_interface/product_helper_hw.h | 1 + shared/test/common/mocks/mock_product_helper.cpp | 5 +++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index c0c610b094..2b41e9ebad 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -131,6 +131,7 @@ class ProductHelper { virtual bool isDcFlushAllowed() const = 0; virtual bool isDcFlushMitigated() 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; virtual bool getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array &uuid) const = 0; virtual bool isFlushTaskAllowed() const = 0; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index bb45568ce5..7be7d8bd59 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -407,16 +407,22 @@ bool ProductHelperHw::isDcFlushMitigated() const { template bool ProductHelperHw::overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const { + return this->isDcFlushMitigated() && + (this->overrideCacheableForDcFlushMitigation(allocationType) || + allocationType == AllocationType::timestampPacketTagBuffer || + allocationType == AllocationType::tagBuffer || + allocationType == AllocationType::gpuTimestampDeviceBuffer); +} + +template +bool ProductHelperHw::overrideCacheableForDcFlushMitigation(AllocationType allocationType) const { return this->isDcFlushMitigated() && (allocationType == AllocationType::externalHostPtr || allocationType == AllocationType::bufferHostMemory || allocationType == AllocationType::mapAllocation || allocationType == AllocationType::svmCpu || allocationType == AllocationType::svmZeroCopy || - allocationType == AllocationType::internalHostMemory || - allocationType == AllocationType::timestampPacketTagBuffer || - allocationType == AllocationType::tagBuffer || - allocationType == AllocationType::gpuTimestampDeviceBuffer); + allocationType == AllocationType::internalHostMemory); } template diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index a2efc1e44a..455a9526c0 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -76,6 +76,7 @@ class ProductHelperHw : public ProductHelper { bool isDcFlushAllowed() const override; bool isDcFlushMitigated() const override; bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const override; + bool overrideCacheableForDcFlushMitigation(AllocationType allocationType) const override; uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const override; bool getUuid(NEO::DriverModel *driverModel, uint32_t subDeviceCount, uint32_t deviceIndex, std::array &uuid) const override; bool isFlushTaskAllowed() const override; diff --git a/shared/test/common/mocks/mock_product_helper.cpp b/shared/test/common/mocks/mock_product_helper.cpp index f025be1f1f..53de35b19e 100644 --- a/shared/test/common/mocks/mock_product_helper.cpp +++ b/shared/test/common/mocks/mock_product_helper.cpp @@ -281,6 +281,11 @@ bool ProductHelperHw::overridePatAndUsageForDcFlushMitigation(Allo return false; } +template <> +bool ProductHelperHw::overrideCacheableForDcFlushMitigation(AllocationType allocationType) const { + return false; +} + template <> uint32_t ProductHelperHw::computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const { return hwInfo.gtSystemInfo.MaxSubSlicesSupported;