From f6efba9a265d3581f975d60ba70c3a4e37976f53 Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Sat, 24 Jul 2021 09:11:35 +0200 Subject: [PATCH] Revert "Use latest sent task count for Linux flush stamp" This reverts commit 566415a1f503c993242799712bd12ef9e456a384. Signed-off-by: Compute-Runtime-Validation --- opencl/source/os_interface/linux/drm_command_stream.h | 1 - opencl/source/os_interface/linux/drm_command_stream.inl | 2 +- .../command_stream_receiver_flush_task_2_tests.cpp | 6 +----- .../mocks/linux/mock_drm_command_stream_receiver.h | 1 - opencl/test/unit_test/mocks/mock_aub_csr.h | 4 ++++ .../os_interface/linux/drm_command_stream_tests_2.cpp | 8 ++++---- .../command_stream/command_stream_receiver_hw_base.inl | 5 ++--- 7 files changed, 12 insertions(+), 15 deletions(-) diff --git a/opencl/source/os_interface/linux/drm_command_stream.h b/opencl/source/os_interface/linux/drm_command_stream.h index 222a886f43..82c928078c 100644 --- a/opencl/source/os_interface/linux/drm_command_stream.h +++ b/opencl/source/os_interface/linux/drm_command_stream.h @@ -32,7 +32,6 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver { using BaseClass::requiredScratchSize; using CommandStreamReceiverHw::CommandStreamReceiver::getTagAddress; using CommandStreamReceiverHw::CommandStreamReceiver::getTagAllocation; - using CommandStreamReceiverHw::CommandStreamReceiver::latestSentTaskCount; using CommandStreamReceiverHw::CommandStreamReceiver::taskCount; using CommandStreamReceiverHw::CommandStreamReceiver::useNotifyEnableForPostSync; diff --git a/opencl/source/os_interface/linux/drm_command_stream.inl b/opencl/source/os_interface/linux/drm_command_stream.inl index 601e724e01..8647694063 100644 --- a/opencl/source/os_interface/linux/drm_command_stream.inl +++ b/opencl/source/os_interface/linux/drm_command_stream.inl @@ -116,7 +116,7 @@ bool DrmCommandStreamReceiver::flush(BatchBuffer &batchBuffer, Reside } if (isUserFenceWaitActive()) { - this->flushStamp->setStamp(latestSentTaskCount); + this->flushStamp->setStamp(taskCount); } else { this->flushStamp->setStamp(bb->peekHandle()); } diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp index 0fb0e64635..485519a477 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp @@ -32,7 +32,7 @@ using namespace NEO; -using CommandStreamReceiverFlushTaskTests = UltCommandStreamReceiverTest; +typedef UltCommandStreamReceiverTest CommandStreamReceiverFlushTaskTests; HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelNotRequiringDCFlushWhenUnblockedThenDCFlushIsNotAdded) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; @@ -491,12 +491,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenc EXPECT_FALSE(csr.isMadeResident(csr.globalFenceAllocation)); EXPECT_FALSE(csr.isMadeNonResident(csr.globalFenceAllocation)); - csr.taskCount = 2u; flushSmallTask(csr); - EXPECT_EQ(3u, csr.latestSentTaskCount); - EXPECT_EQ(3u, csr.latestFlushedTaskCount); - EXPECT_TRUE(csr.isMadeResident(csr.globalFenceAllocation)); EXPECT_TRUE(csr.isMadeNonResident(csr.globalFenceAllocation)); diff --git a/opencl/test/unit_test/mocks/linux/mock_drm_command_stream_receiver.h b/opencl/test/unit_test/mocks/linux/mock_drm_command_stream_receiver.h index 72252b6f72..70f76cff46 100644 --- a/opencl/test/unit_test/mocks/linux/mock_drm_command_stream_receiver.h +++ b/opencl/test/unit_test/mocks/linux/mock_drm_command_stream_receiver.h @@ -21,7 +21,6 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver { return this->tagAllocation; } + void setLatestSentTaskCount(uint32_t latestSentTaskCount) { + this->latestSentTaskCount = latestSentTaskCount; + } + bool flushBatchedSubmissions() override { flushBatchedSubmissionsCalled = true; return true; diff --git a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests_2.cpp b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests_2.cpp index 72ee26433e..262dc75a7e 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests_2.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests_2.cpp @@ -789,7 +789,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocationWithSingleBuffer } HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, - givenWaitUserFenceFlagAndVmBindAvailableSetWhenDrmCsrFlushedThenExpectLatestSentTaskCountStoredAsFlushStamp) { + givenWaitUserFenceFlagAndVmBindAvailableSetWhenDrmCsrFlushedThenExpectTaskCountStoredAsFlushStamp) { DebugManagerStateRestore restorer; DebugManager.flags.EnableUserFenceForCompletionWait.set(1); @@ -811,7 +811,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, CommandStreamReceiverHw::alignToCacheLine(cs); BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false}; - testedCsr->latestSentTaskCount = 160u; + testedCsr->taskCount = 160u; testedCsr->flush(batchBuffer, testedCsr->getResidencyAllocations()); EXPECT_EQ(160u, testedCsr->flushStamp->peekStamp()); @@ -841,7 +841,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, DrmAllocation *alloc = static_cast(cs.getGraphicsAllocation()); auto boHandle = static_cast(alloc->getBO()->peekHandle()); - testedCsr->latestSentTaskCount = 160u; + testedCsr->taskCount = 160u; testedCsr->flush(batchBuffer, testedCsr->getResidencyAllocations()); @@ -875,7 +875,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, DrmAllocation *alloc = static_cast(cs.getGraphicsAllocation()); auto boHandle = static_cast(alloc->getBO()->peekHandle()); - testedCsr->latestSentTaskCount = 160u; + testedCsr->taskCount = 160u; testedCsr->flush(batchBuffer, testedCsr->getResidencyAllocations()); diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index f88182fde7..b9927b546b 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -1199,6 +1199,8 @@ void CommandStreamReceiverHw::flushPipeControl() { this->flushSmallTask(commandStream, commandStreamStart); + this->latestFlushedTaskCount = taskCount + 1; + this->latestSentTaskCount = taskCount + 1; taskCount++; } @@ -1289,9 +1291,6 @@ void CommandStreamReceiverHw::flushSmallTask(LinearStream &commandStr makeResident(*globalFenceAllocation); } - this->latestFlushedTaskCount = taskCount + 1; - this->latestSentTaskCount = taskCount + 1; - BatchBuffer batchBuffer{commandStreamTask.getGraphicsAllocation(), commandStreamStartTask, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, commandStreamTask.getUsed(), &commandStreamTask, endingCmdPtr, false};