feature: add logic to control secondaryContextsSupport in ProductHelper

- product helper sets flag in GfxCoreHelper - this allows to control
secondary contexts support per product - not whole core family

Related-To: NEO-13789

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2025-01-24 10:50:51 +00:00
committed by Compute-Runtime-Automation
parent bebeef0e88
commit e00da808cb
11 changed files with 46 additions and 8 deletions

View File

@@ -115,7 +115,7 @@ void ExecutionEnvironment::calculateMaxOsContextCount() {
uint32_t numRootContexts = hasRootCsr ? 1 : 0;
uint32_t numSecondaryContexts = 0;
if (gfxCoreHelper.getContextGroupContextsCount() > 0) {
if (gfxCoreHelper.areSecondaryContextsSupported()) {
numSecondaryContexts += numRegularEngines * gfxCoreHelper.getContextGroupContextsCount();
numSecondaryContexts += numHpEngines * gfxCoreHelper.getContextGroupContextsCount();
osContextCount -= (numRegularEngines + numHpEngines);

View File

@@ -158,6 +158,7 @@ CompilerInterface *RootDeviceEnvironment::getCompilerInterface() {
void RootDeviceEnvironment::initHelpers() {
initProductHelper();
initGfxCoreHelper();
initializeGfxCoreHelperFromProductHelper();
initializeGfxCoreHelperFromHwInfo();
initApiGfxCoreHelper();
initCompilerProductHelper();
@@ -171,6 +172,12 @@ void RootDeviceEnvironment::initializeGfxCoreHelperFromHwInfo() {
}
}
void RootDeviceEnvironment::initializeGfxCoreHelperFromProductHelper() {
if (this->productHelper) {
gfxCoreHelper->initializeFromProductHelper(*this->productHelper.get());
}
}
void RootDeviceEnvironment::initGfxCoreHelper() {
if (gfxCoreHelper == nullptr) {
gfxCoreHelper = GfxCoreHelper::create(this->getHardwareInfo()->platform.eRenderCoreFamily);

View File

@@ -84,6 +84,7 @@ struct RootDeviceEnvironment : NonCopyableClass {
void initHelpers();
void initGfxCoreHelper();
void initializeGfxCoreHelperFromHwInfo();
void initializeGfxCoreHelperFromProductHelper();
void initApiGfxCoreHelper();
void initCompilerProductHelper();
void initReleaseHelper();

View File

@@ -176,6 +176,7 @@ class GfxCoreHelper {
virtual void adjustCopyEngineRegularContextCount(const size_t enginesCount, uint32_t &contextCount) const = 0;
virtual aub_stream::EngineType getDefaultHpCopyEngine(const HardwareInfo &hwInfo) const = 0;
virtual void initializeDefaultHpCopyEngine(const HardwareInfo &hwInfo) = 0;
virtual void initializeFromProductHelper(const ProductHelper &productHelper) = 0;
virtual bool is48ResourceNeededForCmdBuffer() const = 0;
virtual uint32_t getKernelPrivateMemSize(const KernelDescriptor &kernelDescriptor) const = 0;
@@ -412,6 +413,7 @@ class GfxCoreHelperHw : public GfxCoreHelper {
void adjustCopyEngineRegularContextCount(const size_t enginesCount, uint32_t &contextCount) const override;
aub_stream::EngineType getDefaultHpCopyEngine(const HardwareInfo &hwInfo) const override;
void initializeDefaultHpCopyEngine(const HardwareInfo &hwInfo) override;
void initializeFromProductHelper(const ProductHelper &productHelper) override;
bool is48ResourceNeededForCmdBuffer() const override;
@@ -438,6 +440,7 @@ class GfxCoreHelperHw : public GfxCoreHelper {
protected:
aub_stream::EngineType hpCopyEngineType = aub_stream::EngineType::NUM_ENGINES;
bool secondaryContextsEnabled = false;
static const AuxTranslationMode defaultAuxTranslationMode;
GfxCoreHelperHw() = default;

View File

@@ -727,6 +727,11 @@ void GfxCoreHelperHw<GfxFamily>::initializeDefaultHpCopyEngine(const HardwareInf
hpCopyEngineType = aub_stream::EngineType::NUM_ENGINES;
}
template <typename GfxFamily>
void GfxCoreHelperHw<GfxFamily>::initializeFromProductHelper(const ProductHelper &productHelper) {
secondaryContextsEnabled = productHelper.areSecondaryContextsSupported();
}
template <typename GfxFamily>
bool GfxCoreHelperHw<GfxFamily>::is48ResourceNeededForCmdBuffer() const {
return true;

View File

@@ -128,6 +128,7 @@ class ProductHelper {
virtual bool isPageFaultSupported() const = 0;
virtual bool isKmdMigrationSupported() const = 0;
virtual bool isDisableScratchPagesSupported() const = 0;
virtual bool areSecondaryContextsSupported() const = 0;
virtual bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isDcFlushAllowed() const = 0;
virtual bool isDcFlushMitigated() const = 0;

View File

@@ -436,6 +436,11 @@ bool ProductHelperHw<gfxProduct>::isDisableScratchPagesSupported() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::areSecondaryContextsSupported() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isDcFlushAllowed() const {
using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct;

View File

@@ -71,6 +71,7 @@ class ProductHelperHw : public ProductHelper {
bool blitEnqueuePreferred(bool isWriteToImageFromBuffer) const override;
bool isKmdMigrationSupported() const override;
bool isDisableScratchPagesSupported() const override;
bool areSecondaryContextsSupported() const override;
bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const override;
bool isDcFlushAllowed() const override;
bool isDcFlushMitigated() const override;