[3/n] Optimize indirect allocations handling.

Add new debug variable to trigger new mode.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2022-01-25 13:24:45 +00:00
committed by Compute-Runtime-Automation
parent 0424f30782
commit 6df17f5a30
9 changed files with 103 additions and 9 deletions

View File

@ -747,6 +747,7 @@ TEST(UnifiedMemoryTest, givenInternalAllocationWhenItIsMadeResidentThenNewTracki
unifiedMemoryManager->makeIndirectAllocationsResident(commandStreamReceiver, 1u);
EXPECT_TRUE(graphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->isResident(commandStreamReceiver.getOsContext().getContextId()));
EXPECT_EQ(GraphicsAllocation::objectAlwaysResident, graphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getResidencyTaskCount(commandStreamReceiver.getOsContext().getContextId()));
EXPECT_FALSE(graphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->peekEvictable());
EXPECT_EQ(1u, unifiedMemoryManager->indirectAllocationsResidency.size());
auto internalEntry = unifiedMemoryManager->indirectAllocationsResidency.find(&commandStreamReceiver)->second;

View File

@ -712,6 +712,26 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMultipleMakeResidentWhenMa
mm->freeGraphicsMemory(allocation1);
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocationThatIsAlwaysResidentWhenMakeNonResidentIsCalledThenItIsNotMadeNonResident) {
auto allocation1 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
ASSERT_NE(nullptr, allocation1);
csr->makeResident(*allocation1);
allocation1->updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, csr->getOsContext().getContextId());
EXPECT_NE(0u, csr->getResidencyAllocations().size());
csr->processResidency(csr->getResidencyAllocations(), 0u);
csr->makeSurfacePackNonResident(csr->getResidencyAllocations());
EXPECT_EQ(0u, csr->getResidencyAllocations().size());
EXPECT_TRUE(allocation1->isResident(csr->getOsContext().getContextId()));
mm->freeGraphicsMemory(allocation1);
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenMemObjectCallsDrmCsrWhenMakingNonResidentThenMakeNonResidentWithGraphicsAllocation) {
auto allocation1 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), 0x1000});
ASSERT_NE(nullptr, allocation1);

View File

@ -370,4 +370,6 @@ ExperimentalEnableSourceLevelDebugger = 0
Force2dImageAsArray = -1
ForceExtendedBufferSize = -1
OverrideMaxAllocationSizeForMapReuseBufferInMb = -1
OverrideMapReuseBufferSizeInMb = -1
OverrideMapReuseBufferSizeInMb = -1
MakeIndirectAllocationsResidentAsPack = -1