diff --git a/runtime/command_stream/command_stream_receiver.h b/runtime/command_stream/command_stream_receiver.h index 894b918d2a..a002d3acc4 100644 --- a/runtime/command_stream/command_stream_receiver.h +++ b/runtime/command_stream/command_stream_receiver.h @@ -177,6 +177,10 @@ class CommandStreamReceiver { } bool isMultiOsContextCapable() const; + void setLatestSentTaskCount(uint32_t latestSentTaskCount) { + this->latestSentTaskCount = latestSentTaskCount; + } + protected: void cleanupResources(); diff --git a/runtime/command_stream/command_stream_receiver_with_aub_dump.inl b/runtime/command_stream/command_stream_receiver_with_aub_dump.inl index 19a073cecc..05515f95a4 100644 --- a/runtime/command_stream/command_stream_receiver_with_aub_dump.inl +++ b/runtime/command_stream/command_stream_receiver_with_aub_dump.inl @@ -29,6 +29,7 @@ template FlushStamp CommandStreamReceiverWithAUBDump::flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) { if (aubCSR) { aubCSR->flush(batchBuffer, allocationsForResidency); + aubCSR->setLatestSentTaskCount(BaseCSR::peekLatestSentTaskCount()); } FlushStamp flushStamp = BaseCSR::flush(batchBuffer, allocationsForResidency); return flushStamp; diff --git a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp index 41514f7f59..ff697ea959 100644 --- a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp @@ -252,6 +252,30 @@ HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAub memoryManager->freeGraphicsMemoryImpl(commandBuffer); } +HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenFlushIsCalledThenLatestSentTaskCountShouldBeUpdatedForAubCsr) { + GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); + ASSERT_NE(nullptr, commandBuffer); + LinearStream cs(commandBuffer); + BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs}; + + ResidencyContainer allocationsForResidency; + + EXPECT_EQ(0u, csrWithAubDump->peekLatestSentTaskCount()); + if (createAubCSR) { + EXPECT_EQ(0u, csrWithAubDump->getAubMockCsr().peekLatestSentTaskCount()); + } + + csrWithAubDump->setLatestSentTaskCount(1u); + csrWithAubDump->flush(batchBuffer, allocationsForResidency); + + EXPECT_EQ(1u, csrWithAubDump->peekLatestSentTaskCount()); + if (createAubCSR) { + EXPECT_EQ(csrWithAubDump->peekLatestSentTaskCount(), csrWithAubDump->getAubMockCsr().peekLatestSentTaskCount()); + } + + memoryManager->freeGraphicsMemoryImpl(commandBuffer); +} + HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenMakeNonResidentIsCalledThenBothBaseAndAubCsrMakeNonResidentIsCalled) { auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); ASSERT_NE(nullptr, gfxAllocation);