From 2500357ad5ec1467113c071fab185d3cb65b30cd Mon Sep 17 00:00:00 2001 From: Bartosz Dunajski Date: Fri, 19 Jun 2020 09:50:04 +0200 Subject: [PATCH] Debug flag to force implicit flush Change-Id: I40f1ecb323a61242cbf230e02ba14fce510dbabf Signed-off-by: Bartosz Dunajski --- .../command_stream_receiver_flush_task_1_tests.cpp | 12 ++++++++++++ opencl/test/unit_test/test_files/igdrcl.config | 1 + .../command_stream_receiver_hw_base.inl | 5 +++++ .../source/debug_settings/debug_variables_base.inl | 1 + 4 files changed, 19 insertions(+) diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp index e72e893a55..781df67e38 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp @@ -55,6 +55,18 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenForceCsrFlushingDebugVariable EXPECT_TRUE(commandStreamReceiver.flushBatchedSubmissionsCalled); } +HWTEST_F(CommandStreamReceiverFlushTaskTests, givenForceImplicitFlushDebugVariableSetWhenFlushingThenFlushBatchedSubmissionsShouldBeCalled) { + DebugManagerStateRestore restore; + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + commandStreamReceiver.dispatchMode = DispatchMode::BatchedDispatch; + + DebugManager.flags.ForceImplicitFlush.set(true); + + flushTask(commandStreamReceiver); + + EXPECT_TRUE(commandStreamReceiver.flushBatchedSubmissionsCalled); +} + HWTEST_F(CommandStreamReceiverFlushTaskTests, givenOverrideThreadArbitrationPolicyDebugVariableSetWhenFlushingThenRequestRequiredMode) { DebugManagerStateRestore restore; auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); diff --git a/opencl/test/unit_test/test_files/igdrcl.config b/opencl/test/unit_test/test_files/igdrcl.config index 394a3f0222..edf1d88a64 100644 --- a/opencl/test/unit_test/test_files/igdrcl.config +++ b/opencl/test/unit_test/test_files/igdrcl.config @@ -168,3 +168,4 @@ EnableMultiStorageResources = -1 PrintExecutionBuffer = 0 EnableCrossDeviceAccess = -1 PauseOnBlitCopy = -1 +ForceImplicitFlush = 0 \ No newline at end of file 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 745e3cf98d..fd813f2f0a 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -180,6 +180,11 @@ CompletionStamp CommandStreamReceiverHw::flushTask( if (DebugManager.flags.ForceCsrFlushing.get()) { flushBatchedSubmissions(); } + + if (DebugManager.flags.ForceImplicitFlush.get()) { + dispatchFlags.implicitFlush = true; + } + if (detectInitProgrammingFlagsRequired(dispatchFlags)) { initProgrammingFlags(); } diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index 37e44fdbc1..cb2ee689d8 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -66,6 +66,7 @@ DECLARE_DEBUG_VARIABLE(bool, RebuildPrecompiledKernels, false, "forces driver to DECLARE_DEBUG_VARIABLE(bool, LoopAtDriverInit, false, "Adds endless loop in DebugSettingsManager constructor, useful for debugging.") DECLARE_DEBUG_VARIABLE(bool, DoNotRegisterTrimCallback, false, "When set to true driver is not registering trim callback.") DECLARE_DEBUG_VARIABLE(bool, OverrideInvalidEngineWithDefault, false, "When set to true driver chooses engine 0 if no engine is found.") +DECLARE_DEBUG_VARIABLE(bool, ForceImplicitFlush, false, "Flush after each enqueue. Useful for debugging batched submission logic. ") /*LOGGING FLAGS*/ DECLARE_DEBUG_VARIABLE(bool, PrintDeviceAndEngineIdOnSubmission, false, "print submissions device and engine IDs to standard output")