From e910e28819dca7280f398531802ec300e4645d3d Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Mon, 7 Sep 2020 14:17:01 +0200 Subject: [PATCH] Add start override to Direct Submission debug flags Related-To: NEO-5010 Change-Id: I6d690d3f1aef9ad377ad44db0f3be753ad831f63 Signed-off-by: Zbigniew Zdanowicz --- .../command_stream_receiver_hw_tests.cpp | 99 ++++++++++++++++--- .../command_stream_receiver_hw.h | 3 +- .../command_stream_receiver_hw_base.inl | 15 ++- .../debug_settings/debug_variables_base.inl | 6 +- 4 files changed, 103 insertions(+), 20 deletions(-) diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp index b5cd58ca50..527ec04bfb 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests.cpp @@ -258,7 +258,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenNoBlitterOverrideWhenBlitterNotSuppo DirectSubmissionProperties properties; properties.engineSupported = false; - EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_BCS)); + properties.submitOnInit = false; + bool startOnInit = true; + EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_BCS, startOnInit)); + EXPECT_FALSE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenNoBlitterOverrideWhenBlitterSupportedThenExpectTrueReturned) { @@ -266,7 +269,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenNoBlitterOverrideWhenBlitterSupporte DirectSubmissionProperties properties; properties.engineSupported = true; - EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_BCS)); + properties.submitOnInit = true; + bool startOnInit = false; + EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_BCS, startOnInit)); + EXPECT_TRUE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenBlitterOverrideEnableWhenBlitterNotSupportedThenExpectTrueReturned) { @@ -276,7 +282,23 @@ HWTEST_F(UltCommandStreamReceiverTest, givenBlitterOverrideEnableWhenBlitterNotS DirectSubmissionProperties properties; properties.engineSupported = false; - EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_BCS)); + properties.submitOnInit = false; + bool startOnInit = false; + EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_BCS, startOnInit)); + EXPECT_TRUE(startOnInit); +} + +HWTEST_F(UltCommandStreamReceiverTest, givenBlitterOverrideEnableAndNoStartWhenBlitterNotSupportedThenExpectTrueReturnedStartOnInitSetToTrue) { + DebugManagerStateRestore debugManagerStateRestore; + DebugManager.flags.DirectSubmissionOverrideBlitterSupport.set(2); + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + DirectSubmissionProperties properties; + properties.engineSupported = false; + properties.submitOnInit = true; + bool startOnInit = true; + EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_BCS, startOnInit)); + EXPECT_FALSE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenBlitterOverrideDisableWhenBlitterSupportedThenExpectFalseReturned) { @@ -286,7 +308,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenBlitterOverrideDisableWhenBlitterSup DirectSubmissionProperties properties; properties.engineSupported = true; - EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_BCS)); + properties.submitOnInit = false; + bool startOnInit = true; + EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_BCS, startOnInit)); + EXPECT_FALSE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenNoRenderOverrideWhenRenderNotSupportedThenExpectFalseReturned) { @@ -294,7 +319,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenNoRenderOverrideWhenRenderNotSupport DirectSubmissionProperties properties; properties.engineSupported = false; - EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_RCS)); + properties.submitOnInit = false; + bool startOnInit = true; + EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_RCS, startOnInit)); + EXPECT_FALSE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenNoRenderOverrideWhenRenderSupportedThenExpectTrueReturned) { @@ -302,7 +330,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenNoRenderOverrideWhenRenderSupportedT DirectSubmissionProperties properties; properties.engineSupported = true; - EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_RCS)); + properties.submitOnInit = true; + bool startOnInit = false; + EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_RCS, startOnInit)); + EXPECT_TRUE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenRenderOverrideEnableWhenRenderNotSupportedThenExpectTrueReturned) { @@ -312,7 +343,23 @@ HWTEST_F(UltCommandStreamReceiverTest, givenRenderOverrideEnableWhenRenderNotSup DirectSubmissionProperties properties; properties.engineSupported = false; - EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_RCS)); + properties.submitOnInit = false; + bool startOnInit = false; + EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_RCS, startOnInit)); + EXPECT_TRUE(startOnInit); +} + +HWTEST_F(UltCommandStreamReceiverTest, givenRenderOverrideEnableAndNoStartWhenRenderNotSupportedThenExpectTrueReturnedAndStartOnInitSetFalse) { + DebugManagerStateRestore debugManagerStateRestore; + DebugManager.flags.DirectSubmissionOverrideRenderSupport.set(2); + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + DirectSubmissionProperties properties; + properties.engineSupported = false; + properties.submitOnInit = true; + bool startOnInit = true; + EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_RCS, startOnInit)); + EXPECT_FALSE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenRenderOverrideDisableWhenRenderSupportedThenExpectFalseReturned) { @@ -322,7 +369,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenRenderOverrideDisableWhenRenderSuppo DirectSubmissionProperties properties; properties.engineSupported = true; - EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_RCS)); + properties.submitOnInit = false; + bool startOnInit = true; + EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_RCS, startOnInit)); + EXPECT_FALSE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenNoComputeOverrideWhenComputeNotSupportedThenExpectFalseReturned) { @@ -330,7 +380,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenNoComputeOverrideWhenComputeNotSuppo DirectSubmissionProperties properties; properties.engineSupported = false; - EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_CCS)); + properties.submitOnInit = false; + bool startOnInit = true; + EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_CCS, startOnInit)); + EXPECT_FALSE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenNoComputeOverrideWhenComputeSupportedThenExpectTrueReturned) { @@ -338,7 +391,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenNoComputeOverrideWhenComputeSupporte DirectSubmissionProperties properties; properties.engineSupported = true; - EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_CCS)); + properties.submitOnInit = true; + bool startOnInit = false; + EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_CCS, startOnInit)); + EXPECT_TRUE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenComputeOverrideEnableWhenComputeNotSupportedThenExpectTrueReturned) { @@ -348,7 +404,23 @@ HWTEST_F(UltCommandStreamReceiverTest, givenComputeOverrideEnableWhenComputeNotS DirectSubmissionProperties properties; properties.engineSupported = false; - EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_CCS)); + properties.submitOnInit = false; + bool startOnInit = false; + EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_CCS, startOnInit)); + EXPECT_TRUE(startOnInit); +} + +HWTEST_F(UltCommandStreamReceiverTest, givenComputeOverrideEnableAndNoStartWhenComputeNotSupportedThenExpectTrueReturnedAndStartOnInitSetToFalse) { + DebugManagerStateRestore debugManagerStateRestore; + DebugManager.flags.DirectSubmissionOverrideComputeSupport.set(2); + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + DirectSubmissionProperties properties; + properties.engineSupported = false; + properties.submitOnInit = true; + bool startOnInit = true; + EXPECT_TRUE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_CCS, startOnInit)); + EXPECT_FALSE(startOnInit); } HWTEST_F(UltCommandStreamReceiverTest, givenComputeOverrideDisableWhenComputeSupportedThenExpectFalseReturned) { @@ -358,7 +430,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenComputeOverrideDisableWhenComputeSup DirectSubmissionProperties properties; properties.engineSupported = true; - EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_CCS)); + properties.submitOnInit = false; + bool startOnInit = true; + EXPECT_FALSE(commandStreamReceiver.checkDirectSubmissionSupportsEngine(properties, aub_stream::ENGINE_CCS, startOnInit)); + EXPECT_FALSE(startOnInit); } typedef UltCommandStreamReceiverTest CommandStreamReceiverFlushTests; diff --git a/shared/source/command_stream/command_stream_receiver_hw.h b/shared/source/command_stream/command_stream_receiver_hw.h index 9570e8b0f0..dcd69ec02a 100644 --- a/shared/source/command_stream/command_stream_receiver_hw.h +++ b/shared/source/command_stream/command_stream_receiver_hw.h @@ -100,7 +100,8 @@ class CommandStreamReceiverHw : public CommandStreamReceiver { bool initDirectSubmission(Device &device, OsContext &osContext) override; bool checkDirectSubmissionSupportsEngine(const DirectSubmissionProperties &directSubmissionProperty, - aub_stream::EngineType contextEngineType); + aub_stream::EngineType contextEngineType, + bool &startOnInit); protected: void programPreemption(LinearStream &csr, DispatchFlags &dispatchFlags); 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 f85acc1622..b13a5faf5e 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -1070,15 +1070,17 @@ inline bool CommandStreamReceiverHw::initDirectSubmission(Device &dev startDirect = directSubmissionProperty.useRootDevice; } + bool submitOnInit = directSubmissionProperty.submitOnInit; bool engineSupported = checkDirectSubmissionSupportsEngine(directSubmissionProperty, - contextEngineType); + contextEngineType, + submitOnInit); if (engineSupported && startDirect) { if (contextEngineType == aub_stream::ENGINE_BCS) { blitterDirectSubmission = DirectSubmissionHw>::create(device, osContext); - ret = blitterDirectSubmission->initialize(directSubmissionProperty.submitOnInit); + ret = blitterDirectSubmission->initialize(submitOnInit); } else { directSubmission = DirectSubmissionHw>::create(device, osContext); - ret = directSubmission->initialize(directSubmissionProperty.submitOnInit); + ret = directSubmission->initialize(submitOnInit); this->dispatchMode = DispatchMode::ImmediateDispatch; } } @@ -1088,23 +1090,28 @@ inline bool CommandStreamReceiverHw::initDirectSubmission(Device &dev template inline bool CommandStreamReceiverHw::checkDirectSubmissionSupportsEngine(const DirectSubmissionProperties &directSubmissionProperty, - aub_stream::EngineType contextEngineType) { + aub_stream::EngineType contextEngineType, + bool &startOnInit) { bool supported = directSubmissionProperty.engineSupported; + startOnInit = directSubmissionProperty.submitOnInit; if (contextEngineType == aub_stream::ENGINE_BCS) { int32_t blitterOverrideKey = DebugManager.flags.DirectSubmissionOverrideBlitterSupport.get(); if (blitterOverrideKey != -1) { supported = blitterOverrideKey == 0 ? false : true; + startOnInit = blitterOverrideKey == 1 ? true : false; } } else if (contextEngineType == aub_stream::ENGINE_RCS) { int32_t renderOverrideKey = DebugManager.flags.DirectSubmissionOverrideRenderSupport.get(); if (renderOverrideKey != -1) { supported = renderOverrideKey == 0 ? false : true; + startOnInit = renderOverrideKey == 1 ? true : false; } } else { //assume else is CCS int32_t computeOverrideKey = DebugManager.flags.DirectSubmissionOverrideComputeSupport.get(); if (computeOverrideKey != -1) { supported = computeOverrideKey == 0 ? false : true; + startOnInit = computeOverrideKey == 1 ? true : false; } } diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index 0f1ded3dae..10769b4fa2 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -133,9 +133,9 @@ DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionSemaphoreAddressing, -1, "-1: do DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionDisableCpuCacheFlush, -1, "-1: do not override, 0: disable, 1: enable") DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionEnableDebugBuffer, 0, "0: diagnostic feature disabled - dispatch regular workload, 1: dispatch diagnostic buffer - mode 1 - single SDI command, 2: dispatch diagnostic buffer - mode 2 - no command") DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionDiagnosticExecutionCount, 30, "Number of executions of EnableDebugBuffer modes within diagnostic run") -DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionOverrideBlitterSupport, -1, "Overrides default blitter support: -1: do not override, 0: disable engine support, 1: enable engine support") -DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionOverrideRenderSupport, -1, "Overrides default render support: -1: do not override, 0: disable engine support, 1: enable engine support") -DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionOverrideComputeSupport, -1, "Overrides default compute support: -1: do not override, 0: disable engine support, 1: enable engine support") +DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionOverrideBlitterSupport, -1, "Overrides default blitter support: -1: do not override, 0: disable engine support, 1: enable engine support with init start, 2: enable engine support without init start") +DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionOverrideRenderSupport, -1, "Overrides default render support: -1: do not override, 0: disable engine support, 1: enable engine support with init start, 2: enable engine support without init start") +DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionOverrideComputeSupport, -1, "Overrides default compute support: -1: do not override, 0: disable engine support, 1: enable engine support with init start, 2: enable engine support without init start") DECLARE_DEBUG_VARIABLE(bool, DirectSubmissionDisableCacheFlush, false, "Disable dispatching cache flush commands") DECLARE_DEBUG_VARIABLE(bool, DirectSubmissionDisableMonitorFence, false, "Disable dispatching monitor fence commands")