mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-22 19:29:06 +08:00
performance: don't reprogram SBA when not needed
Related-To: NEO-15024 When defer to pat is enabled, all mocs are set to 0, so no check for uncached mocs is needed Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a6d13659de
commit
ce1bcb536c
@@ -374,13 +374,7 @@ struct CommandListCoreFamily : public CommandListImp {
|
||||
bool isAllocationImported(NEO::GraphicsAllocation *gpuAllocation, NEO::SVMAllocsManager *svmManager) const;
|
||||
static constexpr bool checkIfAllocationImportedRequired();
|
||||
|
||||
bool isKernelUncachedMocsRequired(bool kernelState) {
|
||||
this->containsStatelessUncachedResource |= kernelState;
|
||||
if (this->stateBaseAddressTracking) {
|
||||
return false;
|
||||
}
|
||||
return this->containsStatelessUncachedResource;
|
||||
}
|
||||
bool isKernelUncachedMocsRequired(bool kernelState);
|
||||
|
||||
bool isUsingSystemAllocation(const NEO::AllocationType &allocType) const {
|
||||
return ((allocType == NEO::AllocationType::bufferHostMemory) ||
|
||||
|
||||
@@ -4757,4 +4757,16 @@ bool CommandListCoreFamily<gfxCoreFamily>::isAllocationImported(NEO::GraphicsAll
|
||||
return false;
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
bool CommandListCoreFamily<gfxCoreFamily>::isKernelUncachedMocsRequired(bool kernelState) {
|
||||
this->containsStatelessUncachedResource |= kernelState;
|
||||
auto &productHelper = this->device->getNEODevice()->getProductHelper();
|
||||
auto &rootDeviceEnvironment = this->device->getNEODevice()->getRootDeviceEnvironment();
|
||||
|
||||
if (this->stateBaseAddressTracking || productHelper.deferMOCSToPatIndex(rootDeviceEnvironment.isWddmOnLinux())) {
|
||||
return false;
|
||||
}
|
||||
return this->containsStatelessUncachedResource;
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -641,6 +641,7 @@ class MockCommandListCoreFamily : public CommandListCoreFamily<gfxCoreFamily> {
|
||||
using BaseClass::enableInOrderExecution;
|
||||
using BaseClass::encodeMiFlush;
|
||||
using BaseClass::getDeviceCounterAllocForResidency;
|
||||
using BaseClass::isKernelUncachedMocsRequired;
|
||||
using BaseClass::ownedPrivateAllocations;
|
||||
using BaseClass::setAdditionalBlitProperties;
|
||||
using BaseClass::taskCountUpdateFenceRequired;
|
||||
|
||||
@@ -1934,5 +1934,29 @@ HWTEST_F(CommandListCreate, givenNullptrPeerAllocationWhenGetDeviceCounterAllocF
|
||||
EXPECT_ANY_THROW(commandList->getDeviceCounterAllocForResidency(&counterDeviceAlloc));
|
||||
}
|
||||
|
||||
HWTEST_F(CommandListCreate, givenCommandListWhenIsKernelUncachedMocsRequiredCalledThenReturnCorrectValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableStateBaseAddressTracking.set(0);
|
||||
|
||||
auto commandList = std::make_unique<MockCommandListCoreFamily<FamilyType::gfxCoreFamily>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::renderCompute, 0u);
|
||||
EXPECT_FALSE(commandList->isKernelUncachedMocsRequired(false));
|
||||
|
||||
auto &rootDeviceEnvironment = neoDevice->executionEnvironment->rootDeviceEnvironments[0];
|
||||
auto deferMOCSToPatIndex = device->getProductHelper().deferMOCSToPatIndex(rootDeviceEnvironment->isWddmOnLinux());
|
||||
EXPECT_EQ(!deferMOCSToPatIndex, commandList->isKernelUncachedMocsRequired(true));
|
||||
EXPECT_TRUE(commandList->getContainsStatelessUncachedResource());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandListCreate, givenSbaTrackingEnabledWhenIsKernelUncachedMocsRequiredCalledThenReturnFalse) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableStateBaseAddressTracking.set(1);
|
||||
|
||||
auto commandList = std::make_unique<MockCommandListCoreFamily<FamilyType::gfxCoreFamily>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::renderCompute, 0u);
|
||||
EXPECT_FALSE(commandList->isKernelUncachedMocsRequired(true));
|
||||
EXPECT_TRUE(commandList->getContainsStatelessUncachedResource());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user