diff --git a/runtime/command_queue/gpgpu_walker_bdw_plus.inl b/runtime/command_queue/gpgpu_walker_bdw_plus.inl index b61c22a726..ea49e80232 100644 --- a/runtime/command_queue/gpgpu_walker_bdw_plus.inl +++ b/runtime/command_queue/gpgpu_walker_bdw_plus.inl @@ -65,7 +65,7 @@ void GpgpuWalkerHelper::dispatchScheduler( using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; bool dcFlush = false; - PipeControlHelper::addPipeControlWithWA(commandStream, dcFlush); + PipeControlHelper::addPipeControl(commandStream, dcFlush); uint32_t interfaceDescriptorIndex = devQueueHw.schedulerIDIndex; const size_t offsetInterfaceDescriptorTable = devQueueHw.colorCalcStateSize; @@ -155,7 +155,7 @@ void GpgpuWalkerHelper::dispatchScheduler( // Do not put BB_START only when returning in first Scheduler run if (devQueueHw.getSchedulerReturnInstance() != 1) { - PipeControlHelper::addPipeControlWithWA(commandStream, true); + PipeControlHelper::addPipeControl(commandStream, true); // Add BB Start Cmd to the SLB in the Primary Batch Buffer auto *bbStart = static_cast(commandStream.getSpace(sizeof(MI_BATCH_BUFFER_START))); diff --git a/runtime/command_stream/command_stream_receiver_hw_base.inl b/runtime/command_stream/command_stream_receiver_hw_base.inl index 39a3b9327a..5ee6c6a747 100644 --- a/runtime/command_stream/command_stream_receiver_hw_base.inl +++ b/runtime/command_stream/command_stream_receiver_hw_base.inl @@ -348,7 +348,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( // Add a PC if we have a dependency on a previous walker to avoid concurrency issues. if (taskLevel > this->taskLevel) { if (!timestampPacketWriteEnabled) { - PipeControlHelper::addPipeControlWithWA(commandStreamCSR, false); + PipeControlHelper::addPipeControl(commandStreamCSR, false); } this->taskLevel = taskLevel; DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "this->taskCount", this->taskCount); @@ -493,7 +493,7 @@ inline void CommandStreamReceiverHw::flushBatchedSubmissions() { ResidencyContainer surfacesForSubmit; ResourcePackage resourcePackage; - auto pipeControlLocationSize = PipeControlHelper::getRequiredPipeControlSize(true); + auto pipeControlLocationSize = PipeControlHelper::getRequiredPipeControlSize(); void *currentPipeControlForNooping = nullptr; void *epiloguePipeControlLocation = nullptr; @@ -582,7 +582,7 @@ size_t CommandStreamReceiverHw::getRequiredCmdStreamSize(const Dispat if (!this->isStateSipSent || device.isSourceLevelDebuggerActive()) { size += PreemptionHelper::getRequiredStateSipCmdSize(device); } - size += PipeControlHelper::getRequiredPipeControlSize(true); + size += PipeControlHelper::getRequiredPipeControlSize(); size += sizeof(typename GfxFamily::MI_BATCH_BUFFER_START); size += getCmdSizeForL3Config(); diff --git a/runtime/gen8/hw_helper_gen8.cpp b/runtime/gen8/hw_helper_gen8.cpp index 7da54f1ce1..71a4872460 100644 --- a/runtime/gen8/hw_helper_gen8.cpp +++ b/runtime/gen8/hw_helper_gen8.cpp @@ -27,9 +27,9 @@ void HwHelperHw::setupHardwareCapabilities(HardwareCapabilities *caps, c } template <> -void PipeControlHelper::addPipeControlWithWA(LinearStream &commandStream, bool dcFlush) { - PipeControlHelper::addPipeControlWA(commandStream); - PipeControlHelper::addPipeControl(commandStream, true); +void PipeControlHelper::addPipeControl(LinearStream &commandStream, bool dcFlush) { + auto pCmd = PipeControlHelper::addPipeControlBase(commandStream, dcFlush); + pCmd->setDcFlushEnable(true); } template class AubHelperHw; diff --git a/runtime/helpers/hw_helper.h b/runtime/helpers/hw_helper.h index ecb1f866da..02722295ca 100644 --- a/runtime/helpers/hw_helper.h +++ b/runtime/helpers/hw_helper.h @@ -198,9 +198,9 @@ struct PipeControlHelper { uint64_t immediateData, bool dcFlush); static void addPipeControlWA(LinearStream &commandStream); - static PIPE_CONTROL *addPipeControl(LinearStream &commandStream, bool dcFlush); - static void addPipeControlWithWA(LinearStream &commandStream, bool dcFlush); - static size_t getRequiredPipeControlSize(bool withWA); + static PIPE_CONTROL *addPipeControlBase(LinearStream &commandStream, bool dcFlush); + static void addPipeControl(LinearStream &commandStream, bool dcFlush); + static int getRequiredPipeControlSize(); }; union SURFACE_STATE_BUFFER_LENGTH { diff --git a/runtime/helpers/hw_helper_base.inl b/runtime/helpers/hw_helper_base.inl index b643ee89f2..8bda51b79c 100644 --- a/runtime/helpers/hw_helper_base.inl +++ b/runtime/helpers/hw_helper_base.inl @@ -154,11 +154,13 @@ typename Family::PIPE_CONTROL *PipeControlHelper::obtainPipeControlAndPr uint64_t gpuAddress, uint64_t immediateData, bool dcFlush) { - auto pipeControl = addPipeControl(*commandStream, dcFlush); - + auto pipeControl = reinterpret_cast(commandStream->getSpace(sizeof(PIPE_CONTROL))); + *pipeControl = Family::cmdInitPipeControl; + pipeControl->setCommandStreamerStallEnable(true); pipeControl->setPostSyncOperation(operation); pipeControl->setAddress(static_cast(gpuAddress & 0x0000FFFFFFFFULL)); pipeControl->setAddressHigh(static_cast(gpuAddress >> 32)); + pipeControl->setDcFlushEnable(dcFlush); if (operation == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) { pipeControl->setImmediateData(immediateData); } @@ -166,7 +168,9 @@ typename Family::PIPE_CONTROL *PipeControlHelper::obtainPipeControlAndPr } template -typename GfxFamily::PIPE_CONTROL *PipeControlHelper::addPipeControl(LinearStream &commandStream, bool dcFlush) { +typename GfxFamily::PIPE_CONTROL *PipeControlHelper::addPipeControlBase(LinearStream &commandStream, bool dcFlush) { + PipeControlHelper::addPipeControlWA(commandStream); + auto pCmd = reinterpret_cast(commandStream.getSpace(sizeof(PIPE_CONTROL))); *pCmd = GfxFamily::cmdInitPipeControl; pCmd->setCommandStreamerStallEnable(true); @@ -190,14 +194,13 @@ void PipeControlHelper::addPipeControlWA(LinearStream &commandStream) } template -void PipeControlHelper::addPipeControlWithWA(LinearStream &commandStream, bool dcFlush) { - PipeControlHelper::addPipeControlWA(commandStream); - PipeControlHelper::addPipeControl(commandStream, dcFlush); +void PipeControlHelper::addPipeControl(LinearStream &commandStream, bool dcFlush) { + PipeControlHelper::addPipeControlBase(commandStream, dcFlush); } template -size_t PipeControlHelper::getRequiredPipeControlSize(bool withWA) { - const auto pipeControlCount = (withWA && HardwareCommandsHelper::isPipeControlWArequired()) ? 2u : 1u; +int PipeControlHelper::getRequiredPipeControlSize() { + const auto pipeControlCount = HardwareCommandsHelper::isPipeControlWArequired() ? 2u : 1u; return pipeControlCount * sizeof(typename GfxFamily::PIPE_CONTROL); } diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp index f7bb958fa1..dc6d8d4a0b 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp @@ -103,7 +103,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSu //we do level change that will emit PPC, fill all the space so only BB end fits. taskLevel++; - auto ppcSize = PipeControlHelper::getRequiredPipeControlSize(true); + auto ppcSize = PipeControlHelper::getRequiredPipeControlSize(); auto fillSize = MemoryConstants::cacheLineSize - ppcSize - sizeof(typename FamilyType::MI_BATCH_BUFFER_END); csrCommandStream.getSpace(fillSize); auto expectedUsedSize = 2 * MemoryConstants::cacheLineSize; @@ -928,7 +928,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskBlockingHasPipeControlWit auto &commandStreamReceiver = commandQueue.getCommandStreamReceiver(); - size_t pipeControlCount = PipeControlHelper::getRequiredPipeControlSize(true) / sizeof(PIPE_CONTROL); + size_t pipeControlCount = PipeControlHelper::getRequiredPipeControlSize() / sizeof(PIPE_CONTROL); auto &commandStreamTask = commandQueue.getCS(1024); diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp index feed0d1aad..e9148c1fe2 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_2_tests.cpp @@ -754,7 +754,7 @@ HWTEST_F(UltCommandStreamReceiverTest, addPipeControlWithFlushAllCaches) { char buff[sizeof(PIPE_CONTROL) * 3]; LinearStream stream(buff, sizeof(PIPE_CONTROL) * 3); - PipeControlHelper::addPipeControlWithWA(stream, false); + PipeControlHelper::addPipeControl(stream, false); parseCommands(stream, 0); diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp index 0c01d0d055..1d0af2100e 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp @@ -1466,7 +1466,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDcFlushArgumentIsTrueWhenCall std::unique_ptr buffer(new uint8_t[128]); LinearStream commandStream(buffer.get(), 128); - PipeControlHelper::addPipeControlWithWA(commandStream, true); + PipeControlHelper::addPipeControl(commandStream, true); auto pipeControlOffset = HardwareCommandsHelper::isPipeControlWArequired() ? sizeof(PIPE_CONTROL) : 0u; auto pipeControlAddress = buffer.get() + pipeControlOffset; auto pipeControl = genCmdCast(pipeControlAddress); @@ -1480,7 +1480,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDcFlushArgumentIsFalseWhenCal std::unique_ptr buffer(new uint8_t[128]); LinearStream commandStream(buffer.get(), 128); - PipeControlHelper::addPipeControlWithWA(commandStream, false); + PipeControlHelper::addPipeControl(commandStream, false); auto pipeControlOffset = HardwareCommandsHelper::isPipeControlWArequired() ? sizeof(PIPE_CONTROL) : 0u; auto pipeControlAddress = buffer.get() + pipeControlOffset; auto pipeControl = genCmdCast(pipeControlAddress); diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp index 74b3b739b7..f73ee31ca2 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_gmock_tests.cpp @@ -75,8 +75,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenCsrInBatchingModeThreeRe dispatchFlags.outOfOrderExecutionAllowed = true; EXPECT_CALL(*mockHelper, setPatchInfoData(::testing::_)).Times(10); - size_t removePatchInfoDataCount = 4u * PipeControlHelper::getRequiredPipeControlSize(true) / sizeof(PIPE_CONTROL); - EXPECT_CALL(*mockHelper, removePatchInfoData(::testing::_)).Times(static_cast(removePatchInfoDataCount)); + EXPECT_CALL(*mockHelper, removePatchInfoData(::testing::_)).Times(4 * PipeControlHelper::getRequiredPipeControlSize() / sizeof(PIPE_CONTROL)); EXPECT_CALL(*mockHelper, registerCommandChunk(::testing::_)).Times(4); EXPECT_CALL(*mockHelper, registerBatchBufferStartAddress(::testing::_, ::testing::_)).Times(3); diff --git a/unit_tests/helpers/hw_helper_tests.cpp b/unit_tests/helpers/hw_helper_tests.cpp index 9491d2cca0..61237d33e3 100644 --- a/unit_tests/helpers/hw_helper_tests.cpp +++ b/unit_tests/helpers/hw_helper_tests.cpp @@ -11,7 +11,6 @@ #include "runtime/gmm_helper/gmm_helper.h" #include "runtime/gmm_helper/resource_info.h" #include "runtime/helpers/aligned_memory.h" -#include "runtime/helpers/hardware_commands_helper.h" #include "runtime/helpers/options.h" #include "runtime/helpers/string.h" #include "runtime/memory_manager/graphics_allocation.h" @@ -204,21 +203,6 @@ HWTEST_F(PipeControlHelperTests, givenPostSyncWriteTimestampModeWhenHelperIsUsed EXPECT_TRUE(memcmp(pipeControl, &expectedPipeControl, sizeof(PIPE_CONTROL)) == 0); } -HWTEST_F(PipeControlHelperTests, whenQueryingPipeControlSizeWithoutWaThenReturnSinglePipeControlSize) { - using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; - auto size = PipeControlHelper::getRequiredPipeControlSize(false); - EXPECT_EQ(sizeof(PIPE_CONTROL), size); -} - -HWTEST_F(PipeControlHelperTests, whenQueryingPipeControlSizeWithWaThenReturnValidPipeControlSize) { - using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; - - auto size = PipeControlHelper::getRequiredPipeControlSize(true); - size_t pipeControlsCount = HardwareCommandsHelper::isPipeControlWArequired() ? 2 : 1; - - EXPECT_EQ(sizeof(PIPE_CONTROL) * pipeControlsCount, size); -} - HWTEST_F(PipeControlHelperTests, givenPostSyncWriteImmediateDataModeWhenHelperIsUsedThenProperFieldsAreProgrammed) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; std::unique_ptr buffer(new uint8_t[128]);