mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
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:
committed by
Compute-Runtime-Automation
parent
bebeef0e88
commit
e00da808cb
@@ -1904,7 +1904,7 @@ ze_result_t DeviceImp::getCsrForHighPriority(NEO::CommandStreamReceiver **csr, b
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceImp::isSuitableForLowPriority(ze_command_queue_priority_t priority, bool copyOnly) {
|
bool DeviceImp::isSuitableForLowPriority(ze_command_queue_priority_t priority, bool copyOnly) {
|
||||||
bool engineSuitable = copyOnly ? getGfxCoreHelper().getContextGroupContextsCount() > 0 : !this->implicitScalingCapable;
|
bool engineSuitable = copyOnly ? getGfxCoreHelper().areSecondaryContextsSupported() : !this->implicitScalingCapable;
|
||||||
|
|
||||||
return (priority == ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW && engineSuitable);
|
return (priority == ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW && engineSuitable);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3252,18 +3252,24 @@ HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest,
|
|||||||
HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest,
|
HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest,
|
||||||
givenCommandListUsingPrivateSurfaceHeapWhenTaskCountZeroAndCommandListDestroyedThenCsrDoNotDispatchesStateCacheFlush,
|
givenCommandListUsingPrivateSurfaceHeapWhenTaskCountZeroAndCommandListDestroyedThenCsrDoNotDispatchesStateCacheFlush,
|
||||||
HeapfulSupportedMatch) {
|
HeapfulSupportedMatch) {
|
||||||
auto &csr = neoDevice->getUltCommandStreamReceiver<FamilyType>();
|
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
debugManager.flags.ContextGroupSize.set(0);
|
||||||
|
NEO::MockDevice *mockNeoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get(), 0));
|
||||||
|
MockDeviceImp l0Device(mockNeoDevice, mockNeoDevice->getExecutionEnvironment());
|
||||||
|
|
||||||
|
auto &csr = mockNeoDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||||
auto &csrStream = csr.commandStream;
|
auto &csrStream = csr.commandStream;
|
||||||
|
|
||||||
ze_result_t returnValue;
|
ze_result_t returnValue;
|
||||||
L0::ult::CommandList *cmdListObject = CommandList::whiteboxCast(CommandList::create(productFamily, device, engineGroupType, 0u, returnValue, false));
|
L0::ult::CommandList *cmdListObject = CommandList::whiteboxCast(CommandList::create(productFamily, &l0Device, engineGroupType, 0u, returnValue, false));
|
||||||
|
|
||||||
auto sizeBeforeDestroy = csrStream.getUsed();
|
auto sizeBeforeDestroy = csrStream.getUsed();
|
||||||
|
|
||||||
returnValue = cmdListObject->destroy();
|
returnValue = cmdListObject->destroy();
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
|
||||||
cmdListObject = CommandList::whiteboxCast(CommandList::create(productFamily, device, engineGroupType, 0u, returnValue, false));
|
cmdListObject = CommandList::whiteboxCast(CommandList::create(productFamily, &l0Device, engineGroupType, 0u, returnValue, false));
|
||||||
|
|
||||||
returnValue = cmdListObject->destroy();
|
returnValue = cmdListObject->destroy();
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2024 Intel Corporation
|
* Copyright (C) 2024-2025 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -458,8 +458,17 @@ HWTEST2_P(LargeGrfTest, givenMixedLargeGrfAndSmallGrfKernelsWhenExecutedThenResu
|
|||||||
EXPECT_FALSE(largeGrfValues[3]);
|
EXPECT_FALSE(largeGrfValues[3]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ASSERT_EQ(1u, largeGrfValues.size());
|
auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
|
||||||
EXPECT_FALSE(largeGrfValues[0]);
|
if (gfxCoreHelper.areSecondaryContextsSupported() == false) {
|
||||||
|
ASSERT_EQ(1u, largeGrfValues.size());
|
||||||
|
EXPECT_FALSE(largeGrfValues[0]);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(0u, largeGrfValues.size());
|
||||||
|
largeGrfValues = NEO::UnitTestHelper<FamilyType>::getProgrammedLargeGrfValues(*this->csr,
|
||||||
|
this->csr->getCS(0));
|
||||||
|
ASSERT_NE(0u, largeGrfValues.size());
|
||||||
|
EXPECT_FALSE(largeGrfValues[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expectMemory<FamilyType>(
|
expectMemory<FamilyType>(
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ void ExecutionEnvironment::calculateMaxOsContextCount() {
|
|||||||
|
|
||||||
uint32_t numRootContexts = hasRootCsr ? 1 : 0;
|
uint32_t numRootContexts = hasRootCsr ? 1 : 0;
|
||||||
uint32_t numSecondaryContexts = 0;
|
uint32_t numSecondaryContexts = 0;
|
||||||
if (gfxCoreHelper.getContextGroupContextsCount() > 0) {
|
if (gfxCoreHelper.areSecondaryContextsSupported()) {
|
||||||
numSecondaryContexts += numRegularEngines * gfxCoreHelper.getContextGroupContextsCount();
|
numSecondaryContexts += numRegularEngines * gfxCoreHelper.getContextGroupContextsCount();
|
||||||
numSecondaryContexts += numHpEngines * gfxCoreHelper.getContextGroupContextsCount();
|
numSecondaryContexts += numHpEngines * gfxCoreHelper.getContextGroupContextsCount();
|
||||||
osContextCount -= (numRegularEngines + numHpEngines);
|
osContextCount -= (numRegularEngines + numHpEngines);
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ CompilerInterface *RootDeviceEnvironment::getCompilerInterface() {
|
|||||||
void RootDeviceEnvironment::initHelpers() {
|
void RootDeviceEnvironment::initHelpers() {
|
||||||
initProductHelper();
|
initProductHelper();
|
||||||
initGfxCoreHelper();
|
initGfxCoreHelper();
|
||||||
|
initializeGfxCoreHelperFromProductHelper();
|
||||||
initializeGfxCoreHelperFromHwInfo();
|
initializeGfxCoreHelperFromHwInfo();
|
||||||
initApiGfxCoreHelper();
|
initApiGfxCoreHelper();
|
||||||
initCompilerProductHelper();
|
initCompilerProductHelper();
|
||||||
@@ -171,6 +172,12 @@ void RootDeviceEnvironment::initializeGfxCoreHelperFromHwInfo() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RootDeviceEnvironment::initializeGfxCoreHelperFromProductHelper() {
|
||||||
|
if (this->productHelper) {
|
||||||
|
gfxCoreHelper->initializeFromProductHelper(*this->productHelper.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RootDeviceEnvironment::initGfxCoreHelper() {
|
void RootDeviceEnvironment::initGfxCoreHelper() {
|
||||||
if (gfxCoreHelper == nullptr) {
|
if (gfxCoreHelper == nullptr) {
|
||||||
gfxCoreHelper = GfxCoreHelper::create(this->getHardwareInfo()->platform.eRenderCoreFamily);
|
gfxCoreHelper = GfxCoreHelper::create(this->getHardwareInfo()->platform.eRenderCoreFamily);
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ struct RootDeviceEnvironment : NonCopyableClass {
|
|||||||
void initHelpers();
|
void initHelpers();
|
||||||
void initGfxCoreHelper();
|
void initGfxCoreHelper();
|
||||||
void initializeGfxCoreHelperFromHwInfo();
|
void initializeGfxCoreHelperFromHwInfo();
|
||||||
|
void initializeGfxCoreHelperFromProductHelper();
|
||||||
void initApiGfxCoreHelper();
|
void initApiGfxCoreHelper();
|
||||||
void initCompilerProductHelper();
|
void initCompilerProductHelper();
|
||||||
void initReleaseHelper();
|
void initReleaseHelper();
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ class GfxCoreHelper {
|
|||||||
virtual void adjustCopyEngineRegularContextCount(const size_t enginesCount, uint32_t &contextCount) const = 0;
|
virtual void adjustCopyEngineRegularContextCount(const size_t enginesCount, uint32_t &contextCount) const = 0;
|
||||||
virtual aub_stream::EngineType getDefaultHpCopyEngine(const HardwareInfo &hwInfo) const = 0;
|
virtual aub_stream::EngineType getDefaultHpCopyEngine(const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual void initializeDefaultHpCopyEngine(const HardwareInfo &hwInfo) = 0;
|
virtual void initializeDefaultHpCopyEngine(const HardwareInfo &hwInfo) = 0;
|
||||||
|
virtual void initializeFromProductHelper(const ProductHelper &productHelper) = 0;
|
||||||
|
|
||||||
virtual bool is48ResourceNeededForCmdBuffer() const = 0;
|
virtual bool is48ResourceNeededForCmdBuffer() const = 0;
|
||||||
virtual uint32_t getKernelPrivateMemSize(const KernelDescriptor &kernelDescriptor) 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;
|
void adjustCopyEngineRegularContextCount(const size_t enginesCount, uint32_t &contextCount) const override;
|
||||||
aub_stream::EngineType getDefaultHpCopyEngine(const HardwareInfo &hwInfo) const override;
|
aub_stream::EngineType getDefaultHpCopyEngine(const HardwareInfo &hwInfo) const override;
|
||||||
void initializeDefaultHpCopyEngine(const HardwareInfo &hwInfo) override;
|
void initializeDefaultHpCopyEngine(const HardwareInfo &hwInfo) override;
|
||||||
|
void initializeFromProductHelper(const ProductHelper &productHelper) override;
|
||||||
|
|
||||||
bool is48ResourceNeededForCmdBuffer() const override;
|
bool is48ResourceNeededForCmdBuffer() const override;
|
||||||
|
|
||||||
@@ -438,6 +440,7 @@ class GfxCoreHelperHw : public GfxCoreHelper {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
aub_stream::EngineType hpCopyEngineType = aub_stream::EngineType::NUM_ENGINES;
|
aub_stream::EngineType hpCopyEngineType = aub_stream::EngineType::NUM_ENGINES;
|
||||||
|
bool secondaryContextsEnabled = false;
|
||||||
|
|
||||||
static const AuxTranslationMode defaultAuxTranslationMode;
|
static const AuxTranslationMode defaultAuxTranslationMode;
|
||||||
GfxCoreHelperHw() = default;
|
GfxCoreHelperHw() = default;
|
||||||
|
|||||||
@@ -727,6 +727,11 @@ void GfxCoreHelperHw<GfxFamily>::initializeDefaultHpCopyEngine(const HardwareInf
|
|||||||
hpCopyEngineType = aub_stream::EngineType::NUM_ENGINES;
|
hpCopyEngineType = aub_stream::EngineType::NUM_ENGINES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily>
|
||||||
|
void GfxCoreHelperHw<GfxFamily>::initializeFromProductHelper(const ProductHelper &productHelper) {
|
||||||
|
secondaryContextsEnabled = productHelper.areSecondaryContextsSupported();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
bool GfxCoreHelperHw<GfxFamily>::is48ResourceNeededForCmdBuffer() const {
|
bool GfxCoreHelperHw<GfxFamily>::is48ResourceNeededForCmdBuffer() const {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ class ProductHelper {
|
|||||||
virtual bool isPageFaultSupported() const = 0;
|
virtual bool isPageFaultSupported() const = 0;
|
||||||
virtual bool isKmdMigrationSupported() const = 0;
|
virtual bool isKmdMigrationSupported() const = 0;
|
||||||
virtual bool isDisableScratchPagesSupported() const = 0;
|
virtual bool isDisableScratchPagesSupported() const = 0;
|
||||||
|
virtual bool areSecondaryContextsSupported() const = 0;
|
||||||
virtual bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const = 0;
|
virtual bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const = 0;
|
||||||
virtual bool isDcFlushAllowed() const = 0;
|
virtual bool isDcFlushAllowed() const = 0;
|
||||||
virtual bool isDcFlushMitigated() const = 0;
|
virtual bool isDcFlushMitigated() const = 0;
|
||||||
|
|||||||
@@ -436,6 +436,11 @@ bool ProductHelperHw<gfxProduct>::isDisableScratchPagesSupported() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
|
bool ProductHelperHw<gfxProduct>::areSecondaryContextsSupported() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template <PRODUCT_FAMILY gfxProduct>
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
bool ProductHelperHw<gfxProduct>::isDcFlushAllowed() const {
|
bool ProductHelperHw<gfxProduct>::isDcFlushAllowed() const {
|
||||||
using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct;
|
using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ class ProductHelperHw : public ProductHelper {
|
|||||||
bool blitEnqueuePreferred(bool isWriteToImageFromBuffer) const override;
|
bool blitEnqueuePreferred(bool isWriteToImageFromBuffer) const override;
|
||||||
bool isKmdMigrationSupported() const override;
|
bool isKmdMigrationSupported() const override;
|
||||||
bool isDisableScratchPagesSupported() const override;
|
bool isDisableScratchPagesSupported() const override;
|
||||||
|
bool areSecondaryContextsSupported() const override;
|
||||||
bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const override;
|
bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const override;
|
||||||
bool isDcFlushAllowed() const override;
|
bool isDcFlushAllowed() const override;
|
||||||
bool isDcFlushMitigated() const override;
|
bool isDcFlushMitigated() const override;
|
||||||
|
|||||||
Reference in New Issue
Block a user