mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
fix: add heap to residency container instead of calling make resident
Related-To: NEO-11212 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com> There was make resident call outside lock on csr, so in multi thread scenarios assigned residency task count may be not correct. Instead of calling make resident allocation is added to residency container
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
9152b6ac04
commit
4b3b1be191
@@ -39,6 +39,7 @@ class MyMockCommandContainer : public CommandContainer {
|
||||
using CommandContainer::getAlignedCmdBufferSize;
|
||||
using CommandContainer::immediateReusableAllocationList;
|
||||
using CommandContainer::secondaryCommandStreamForImmediateCmdList;
|
||||
using CommandContainer::skipHeapAllocationCreation;
|
||||
|
||||
GraphicsAllocation *allocateCommandBuffer(bool forceHostMemory) override {
|
||||
allocateCommandBufferCalled[!!forceHostMemory]++;
|
||||
@@ -1439,8 +1440,17 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsThe
|
||||
ASSERT_NE(cmdContainer->immediateReusableAllocationList, nullptr);
|
||||
EXPECT_FALSE(cmdContainer->immediateReusableAllocationList->peekIsEmpty());
|
||||
EXPECT_FALSE(heapHelper->storageForReuse->getAllocationsForReuse().peekIsEmpty());
|
||||
EXPECT_EQ(heapHelper->storageForReuse->getAllocationsForReuse().peekHead()->getResidencyTaskCount(csr->getOsContext().getContextId()), 1u);
|
||||
EXPECT_EQ(cmdContainer->getResidencyContainer().size(), actualResidencyContainerSize + 1);
|
||||
EXPECT_EQ(heapHelper->storageForReuse->getAllocationsForReuse().peekHead()->getResidencyTaskCount(csr->getOsContext().getContextId()), GraphicsAllocation::objectNotResident);
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
auto amountToFill = gfxCoreHelper.getAmountOfAllocationsToFill();
|
||||
uint32_t numHeaps = 0;
|
||||
for (int heapType = 0; heapType < IndirectHeap::Type::numTypes; heapType++) {
|
||||
if (!cmdContainer->skipHeapAllocationCreation(static_cast<HeapType>(heapType))) {
|
||||
numHeaps++;
|
||||
}
|
||||
}
|
||||
auto numAllocsAddedToResidencyContainer = amountToFill + (amountToFill * numHeaps);
|
||||
EXPECT_EQ(cmdContainer->getResidencyContainer().size(), actualResidencyContainerSize + numAllocsAddedToResidencyContainer);
|
||||
|
||||
cmdContainer.reset();
|
||||
allocList.freeAllGraphicsAllocations(pDevice);
|
||||
@@ -1463,7 +1473,16 @@ TEST_F(CommandContainerTest, givenCreateSecondaryCmdBufferInHostMemWhenFillReusa
|
||||
|
||||
ASSERT_NE(cmdContainer->immediateReusableAllocationList, nullptr);
|
||||
EXPECT_FALSE(cmdContainer->immediateReusableAllocationList->peekIsEmpty());
|
||||
EXPECT_EQ(cmdContainer->getResidencyContainer().size(), actualResidencyContainerSize + 2);
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
auto amountToFill = gfxCoreHelper.getAmountOfAllocationsToFill();
|
||||
uint32_t numHeaps = 0;
|
||||
for (int heapType = 0; heapType < IndirectHeap::Type::numTypes; heapType++) {
|
||||
if (!cmdContainer->skipHeapAllocationCreation(static_cast<HeapType>(heapType))) {
|
||||
numHeaps++;
|
||||
}
|
||||
}
|
||||
auto numAllocsAddedToResidencyContainer = 2 * amountToFill + (amountToFill * numHeaps);
|
||||
EXPECT_EQ(cmdContainer->getResidencyContainer().size(), actualResidencyContainerSize + numAllocsAddedToResidencyContainer);
|
||||
|
||||
cmdContainer.reset();
|
||||
allocList.freeAllGraphicsAllocations(pDevice);
|
||||
|
||||
Reference in New Issue
Block a user