Skip to content

Commit 6e0d04e

Browse files
jchodorCompute-Runtime-Automation
authored andcommitted
Adding debug flag to disable DC flush in epilogue
Change-Id: I1784be279ee9f837a0994997bec49c1925a68390
1 parent 947794f commit 6e0d04e

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed

runtime/command_stream/command_stream_receiver_hw.inl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,11 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
563563

564564
//make sure we flush DC if needed
565565
if (epiloguePipeControlLocation) {
566-
((PIPE_CONTROL *)epiloguePipeControlLocation)->setDcFlushEnable(false == HwHelper::cacheFlushAfterWalkerSupported(this->hwInfo));
566+
bool flushDcInEpilogue = true;
567+
if (DebugManager.flags.DisableDcFlushInEpilogue.get()) {
568+
flushDcInEpilogue = false;
569+
}
570+
((PIPE_CONTROL *)epiloguePipeControlLocation)->setDcFlushEnable(flushDcInEpilogue);
567571
}
568572
auto flushStamp = this->flush(primaryCmdBuffer->batchBuffer, surfacesForSubmit);
569573

runtime/os_interface/debug_variables_base.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ DECLARE_DEBUG_VARIABLE(bool, UseNoRingFlushesKmdMode, true, "Windows only, passe
8080
DECLARE_DEBUG_VARIABLE(bool, DisableZeroCopyForUseHostPtr, false, "When active all buffer allocations created with CL_MEM_USE_HOST_PTR flag will not share memory with CPU.")
8181
DECLARE_DEBUG_VARIABLE(bool, DisableZeroCopyForBuffers, false, "When active all buffer allocations will not share memory with CPU.")
8282
DECLARE_DEBUG_VARIABLE(bool, EnableHostPtrTracking, true, "Enable host ptr tracking")
83+
DECLARE_DEBUG_VARIABLE(bool, DisableDcFlushInEpilogue, false, "Disable DC flush in epilogue")
8384

8485
/*FEATURE FLAGS*/
8586
DECLARE_DEBUG_VARIABLE(bool, EnableNV12, true, "Enables NV12 extension")

unit_tests/command_stream/command_stream_receiver_flush_task_3_tests.cpp

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,79 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushI
918918
EXPECT_NE(nullptr, cmdBuffer->epiloguePipeControlLocation);
919919
}
920920

921+
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlThenDcFlushIsEnabled) {
922+
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
923+
924+
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
925+
auto &commandStream = commandQueue.getCS(4096u);
926+
927+
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
928+
pDevice->resetCommandStreamReceiver(mockCsr);
929+
930+
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
931+
932+
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
933+
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
934+
935+
DispatchFlags dispatchFlags;
936+
dispatchFlags.guardCommandBufferWithPipeControl = true;
937+
dispatchFlags.outOfOrderExecutionAllowed = false;
938+
dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo());
939+
mockCsr->flushTask(commandStream,
940+
0,
941+
dsh,
942+
ioh,
943+
ssh,
944+
taskLevel,
945+
dispatchFlags,
946+
*pDevice);
947+
948+
auto cmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
949+
ASSERT_NE(nullptr, cmdBuffer->epiloguePipeControlLocation);
950+
auto pipeControl = genCmdCast<PIPE_CONTROL *>(cmdBuffer->epiloguePipeControlLocation);
951+
ASSERT_NE(nullptr, pipeControl);
952+
mockCsr->flushBatchedSubmissions();
953+
EXPECT_TRUE(pipeControl->getDcFlushEnable());
954+
}
955+
956+
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlWhendDcFlushDisabledByDebugFlagThenDcFlushIsDisabled) {
957+
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
958+
959+
DebugManagerStateRestore debugRestorer;
960+
DebugManager.flags.DisableDcFlushInEpilogue.set(true);
961+
962+
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
963+
auto &commandStream = commandQueue.getCS(4096u);
964+
965+
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
966+
pDevice->resetCommandStreamReceiver(mockCsr);
967+
968+
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
969+
970+
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
971+
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
972+
973+
DispatchFlags dispatchFlags;
974+
dispatchFlags.guardCommandBufferWithPipeControl = true;
975+
dispatchFlags.outOfOrderExecutionAllowed = false;
976+
dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo());
977+
mockCsr->flushTask(commandStream,
978+
0,
979+
dsh,
980+
ioh,
981+
ssh,
982+
taskLevel,
983+
dispatchFlags,
984+
*pDevice);
985+
986+
auto cmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
987+
ASSERT_NE(nullptr, cmdBuffer->epiloguePipeControlLocation);
988+
auto pipeControl = genCmdCast<PIPE_CONTROL *>(cmdBuffer->epiloguePipeControlLocation);
989+
ASSERT_NE(nullptr, pipeControl);
990+
mockCsr->flushBatchedSubmissions();
991+
EXPECT_FALSE(pipeControl->getDcFlushEnable());
992+
}
993+
921994
HWTEST_F(CommandStreamReceiverFlushTaskTests,
922995
givenCsrInBatchingModeAndOoqFlagSetToFalseWhenTwoTasksArePassedWithTheSameLevelThenThereIsPipeControlBetweenThemAfterFlush) {
923996
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);

unit_tests/test_files/igdrcl.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,4 @@ AUBDumpAllocsOnEnqueueReadOnly = 0
106106
AUBDumpForceAllToLocalMemory = 0
107107
EnableCacheFlushAfterWalker = 0
108108
EnableHostPtrTracking = 1
109+
DisableDcFlushInEpilogue = 0

0 commit comments

Comments
 (0)