fix: Remove fence handling when reuse cmd buffer

Resolves: NEO-10163
Related-To: NEO-7116

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2024-01-26 08:53:09 +00:00
committed by Compute-Runtime-Automation
parent 63a5b64c7e
commit 4704cd49a3
4 changed files with 1 additions and 99 deletions

View File

@@ -302,66 +302,6 @@ TEST_F(CommandContainerTest, givenCmdContainerWithAllocsListWhenAllocateAndReset
allocList.freeAllGraphicsAllocations(pDevice);
}
HWTEST_F(CommandContainerTest, givenCmdContainerAndHandleFenceWithAllocsListWhenAllocateAndResetThenCmdBufferAllocIsReused) {
AllocationsList allocList;
auto cmdContainer = std::make_unique<CommandContainer>();
cmdContainer->setHandleFenceCompletionRequired();
cmdContainer->initialize(pDevice, &allocList, true, HeapSize::defaultHeapSize, false);
auto &cmdBufferAllocs = cmdContainer->getCmdBufferAllocations();
auto memoryManager = static_cast<MockMemoryManager *>(pDevice->getMemoryManager());
auto csr = reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(memoryManager->getRegisteredEngines(0u)[0].commandStreamReceiver);
csr->directSubmissionAvailable = true;
csr->callFlushTagUpdate = false;
EXPECT_EQ(memoryManager->handleFenceCompletionCalled, 0u);
EXPECT_EQ(cmdBufferAllocs.size(), 1u);
EXPECT_TRUE(allocList.peekIsEmpty());
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
auto cmdBuffer0 = cmdBufferAllocs[0];
auto cmdBuffer1 = cmdBufferAllocs[1];
cmdContainer->reset();
EXPECT_EQ(memoryManager->handleFenceCompletionCalled, 1u);
EXPECT_EQ(cmdBufferAllocs.size(), 1u);
EXPECT_EQ(cmdBufferAllocs[0], cmdBuffer0);
EXPECT_FALSE(allocList.peekIsEmpty());
EXPECT_FALSE(csr->stopDirectSubmissionCalled);
EXPECT_FALSE(csr->stopDirectSubmissionCalledBlocking);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
cmdContainer->reset();
EXPECT_EQ(memoryManager->handleFenceCompletionCalled, 2u);
EXPECT_EQ(cmdBufferAllocs.size(), 1u);
EXPECT_EQ(cmdBufferAllocs[0], cmdBuffer0);
EXPECT_FALSE(allocList.peekIsEmpty());
EXPECT_FALSE(csr->stopDirectSubmissionCalled);
EXPECT_FALSE(csr->stopDirectSubmissionCalledBlocking);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
EXPECT_EQ(cmdBufferAllocs[0], cmdBuffer0);
EXPECT_EQ(cmdBufferAllocs[1], cmdBuffer1);
EXPECT_TRUE(allocList.peekIsEmpty());
EXPECT_FALSE(csr->stopDirectSubmissionCalled);
EXPECT_FALSE(csr->stopDirectSubmissionCalledBlocking);
cmdBuffer1->updateTaskCount(1u, 0u);
cmdContainer.reset();
EXPECT_FALSE(csr->stopDirectSubmissionCalled);
EXPECT_FALSE(csr->stopDirectSubmissionCalledBlocking);
csr = reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(memoryManager->getRegisteredEngines(0u)[1].commandStreamReceiver);
EXPECT_FALSE(csr->stopDirectSubmissionCalled);
EXPECT_FALSE(csr->stopDirectSubmissionCalledBlocking);
EXPECT_EQ(memoryManager->handleFenceCompletionCalled, 3u);
EXPECT_FALSE(allocList.peekIsEmpty());
cmdBuffer1->releaseUsageInOsContext(0u);
allocList.freeAllGraphicsAllocations(pDevice);
}
TEST_F(CommandContainerTest, givenReusableAllocationsAndRemoveUserFenceInCmdlistResetAndDestroyFlagWhenAllocateAndResetThenHandleFenceCompletionIsCalled) {
DebugManagerStateRestore restore;
debugManager.flags.RemoveUserFenceInCmdlistResetAndDestroy.set(0);
@@ -375,21 +315,14 @@ TEST_F(CommandContainerTest, givenReusableAllocationsAndRemoveUserFenceInCmdlist
EXPECT_EQ(cmdBufferAllocs.size(), 1u);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
cmdContainer->reset();
EXPECT_EQ(1u, memoryManager->handleFenceCompletionCalled);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
cmdBufferAllocs[1]->updateTaskCount(2u, 0u);
cmdContainer->reset();
EXPECT_EQ(2u, memoryManager->handleFenceCompletionCalled);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
EXPECT_FALSE(cmdBufferAllocs[1]->isUsedByOsContext(0u));
cmdBufferAllocs[0]->updateTaskCount(5u, 0u);
cmdBufferAllocs[1]->updateTaskCount(5u, 0u);
cmdContainer.reset();
EXPECT_EQ(4u, memoryManager->handleFenceCompletionCalled);
allocList.freeAllGraphicsAllocations(pDevice);
@@ -408,21 +341,14 @@ TEST_F(CommandContainerTest, givenReusableAllocationsAndRemoveUserFenceInCmdlist
EXPECT_EQ(cmdBufferAllocs.size(), 1u);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
cmdContainer->reset();
EXPECT_EQ(0u, memoryManager->handleFenceCompletionCalled);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
cmdBufferAllocs[1]->updateTaskCount(2u, 0u);
cmdContainer->reset();
EXPECT_EQ(0u, memoryManager->handleFenceCompletionCalled);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
EXPECT_FALSE(cmdBufferAllocs[1]->isUsedByOsContext(0u));
cmdBufferAllocs[0]->updateTaskCount(5u, 0u);
cmdBufferAllocs[1]->updateTaskCount(5u, 0u);
cmdContainer.reset();
EXPECT_EQ(0u, memoryManager->handleFenceCompletionCalled);
allocList.freeAllGraphicsAllocations(pDevice);