fix: remove heap resource leak after command list reset

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2024-02-19 14:47:22 +00:00
committed by Compute-Runtime-Automation
parent 0edb025cf7
commit db9d0c9a58
5 changed files with 58 additions and 32 deletions

View File

@@ -130,11 +130,8 @@ void CommandList::removeDeallocationContainerData() {
if (allocData) {
device->getDriverHandle()->getSvmAllocsManager()->removeSVMAlloc(*allocData);
}
if (!((deallocation->getAllocationType() == NEO::AllocationType::internalHeap) ||
(deallocation->getAllocationType() == NEO::AllocationType::linearStream))) {
memoryManager->freeGraphicsMemory(deallocation);
eraseDeallocationContainerEntry(deallocation);
}
memoryManager->freeGraphicsMemory(deallocation);
eraseDeallocationContainerEntry(deallocation);
}
}

View File

@@ -1923,23 +1923,6 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenThereIsNoEnoughSpaceFo
EXPECT_EQ(latestFlushedTaskCount + 1, whiteBoxCmdList->csr->peekLatestFlushedTaskCount());
}
HWTEST_F(CommandListCreate, givenCommandListWhenRemoveDeallocationContainerDataThenHeapNotErased) {
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily,
device,
NEO::EngineGroupType::compute,
0u,
returnValue, false));
auto &cmdContainer = commandList->getCmdContainer();
auto heapAlloc = cmdContainer.getIndirectHeapAllocation(HeapType::indirectObject);
cmdContainer.getDeallocationContainer().push_back(heapAlloc);
EXPECT_EQ(cmdContainer.getDeallocationContainer().size(), 1u);
commandList->removeDeallocationContainerData();
EXPECT_EQ(cmdContainer.getDeallocationContainer().size(), 1u);
cmdContainer.getDeallocationContainer().clear();
}
TEST(CommandList, givenContextGroupEnabledWhenCreatingImmediateCommandListThenEachCmdListHasDifferentCsr) {
HardwareInfo hwInfo = *defaultHwInfo;