Skip to content

Commit 647321a

Browse files
Remove O(n) lookup in command container destructor
Signed-off-by: Szymon Morek <[email protected]>
1 parent f4c40c7 commit 647321a

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

shared/source/command_container/cmdcontainer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,8 @@ void CommandContainer::handleCmdBufferAllocations(size_t startIndex) {
254254
if (isHandleFenceCompletionRequired) {
255255
this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]);
256256
}
257-
if (!this->reusableAllocationList->peekContains(*cmdBufferAllocations[i])) {
258-
reusableAllocationList->pushFrontOne(*cmdBufferAllocations[i]);
259-
}
257+
258+
reusableAllocationList->pushFrontOne(*cmdBufferAllocations[i]);
260259
} else {
261260
this->device->getMemoryManager()->freeGraphicsMemory(cmdBufferAllocations[i]);
262261
}

shared/test/unit_test/command_container/command_container_tests.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -879,20 +879,6 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithoutA
879879
allocList.freeAllGraphicsAllocations(pDevice);
880880
}
881881

882-
TEST_F(CommandContainerTest, givenCmdContainerWhenDestroyCommandContainerThenAllocationListFilledCorrectly) {
883-
auto cmdContainer = std::make_unique<CommandContainer>();
884-
AllocationsList allocList;
885-
cmdContainer->initialize(pDevice, &allocList, false);
886-
auto alloc = cmdContainer->getCmdBufferAllocations()[0];
887-
allocList.pushFrontOne(*alloc);
888-
cmdContainer.reset();
889-
890-
EXPECT_TRUE(allocList.peekContains(*alloc));
891-
EXPECT_EQ(allocList.peekHead()->countThisAndAllConnected(), 1u);
892-
893-
allocList.freeAllGraphicsAllocations(pDevice);
894-
}
895-
896882
HWTEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithAllocationInListAndCsrTaskCountLowerThanAllocationThenReturnNullptr) {
897883
auto cmdContainer = std::make_unique<CommandContainer>();
898884
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();

0 commit comments

Comments
 (0)