Remove O(n) lookup in command container destructor

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2022-10-14 12:28:13 +00:00
committed by Compute-Runtime-Automation
parent f4c40c74cb
commit 647321af6f
2 changed files with 2 additions and 17 deletions

View File

@@ -254,9 +254,8 @@ void CommandContainer::handleCmdBufferAllocations(size_t startIndex) {
if (isHandleFenceCompletionRequired) { if (isHandleFenceCompletionRequired) {
this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]); this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]);
} }
if (!this->reusableAllocationList->peekContains(*cmdBufferAllocations[i])) {
reusableAllocationList->pushFrontOne(*cmdBufferAllocations[i]); reusableAllocationList->pushFrontOne(*cmdBufferAllocations[i]);
}
} else { } else {
this->device->getMemoryManager()->freeGraphicsMemory(cmdBufferAllocations[i]); this->device->getMemoryManager()->freeGraphicsMemory(cmdBufferAllocations[i]);
} }

View File

@@ -879,20 +879,6 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithoutA
allocList.freeAllGraphicsAllocations(pDevice); allocList.freeAllGraphicsAllocations(pDevice);
} }
TEST_F(CommandContainerTest, givenCmdContainerWhenDestroyCommandContainerThenAllocationListFilledCorrectly) {
auto cmdContainer = std::make_unique<CommandContainer>();
AllocationsList allocList;
cmdContainer->initialize(pDevice, &allocList, false);
auto alloc = cmdContainer->getCmdBufferAllocations()[0];
allocList.pushFrontOne(*alloc);
cmdContainer.reset();
EXPECT_TRUE(allocList.peekContains(*alloc));
EXPECT_EQ(allocList.peekHead()->countThisAndAllConnected(), 1u);
allocList.freeAllGraphicsAllocations(pDevice);
}
HWTEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithAllocationInListAndCsrTaskCountLowerThanAllocationThenReturnNullptr) { HWTEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithAllocationInListAndCsrTaskCountLowerThanAllocationThenReturnNullptr) {
auto cmdContainer = std::make_unique<CommandContainer>(); auto cmdContainer = std::make_unique<CommandContainer>();
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>(); auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();