diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_3_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_3_tests.cpp index 724f913d5b..3cebee4cd5 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_3_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_3_tests.cpp @@ -644,6 +644,40 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenUpdateTaskCountFromWaitEnable EXPECT_EQ(cmd->getDcFlushEnable(), mockCsr->getDcFlushSupport()); } +HWTEST_F(CommandStreamReceiverFlushTaskTests, givenUpdateTaskCountFromWaitEnabledAndBlockingFlagWhenFlushTaskThenTaskCountIsFlushed) { + DebugManagerStateRestore restorer; + DebugManager.flags.UpdateTaskCountFromWait.set(3); + + auto mockCsr = new MockCsrHw2(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); + mockCsr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); + pDevice->resetCommandStreamReceiver(mockCsr); + mockCsr->useNewResourceImplicitFlush = false; + mockCsr->useGpuIdleImplicitFlush = false; + + DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags(); + dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); + dispatchFlags.guardCommandBufferWithPipeControl = false; + dispatchFlags.blocking = true; + + mockCsr->flushTask(commandStream, + 0, + &dsh, + &ioh, + &ssh, + taskLevel, + dispatchFlags, + *pDevice); + + parseCommands(commandStream); + auto itorPipeControl = find(cmdList.begin(), cmdList.end()); + if (MemorySynchronizationCommands::isBarrierWaRequired(pDevice->getRootDeviceEnvironment())) { + itorPipeControl++; + } + EXPECT_NE(itorPipeControl, cmdList.end()); + auto cmd = genCmdCast(*itorPipeControl); + EXPECT_EQ(cmd->getDcFlushEnable(), mockCsr->getDcFlushSupport()); +} + HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeWhenFlushTaskIsCalledThenFlushedTaskCountIsModifed) { CommandQueueHw commandQueue(nullptr, pClDevice, 0, false); auto &commandStream = commandQueue.getCS(4096u); 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 c7ab7e0592..86a5581e63 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -377,7 +377,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( // for BatchedSubmissions it will be nooped and only last ppc in batch will be emitted. levelClosed = true; // if we guard with ppc, flush dc as well to speed up completion latency - if (dispatchFlags.guardCommandBufferWithPipeControl || this->heapStorageRequiresRecyclingTag) { + if (dispatchFlags.guardCommandBufferWithPipeControl || this->heapStorageRequiresRecyclingTag || dispatchFlags.blocking) { dispatchFlags.dcFlush = this->dcFlushSupport; } }