Skip to content

Commit

Permalink
Adding debug flag to disable DC flush in epilogue
Browse files Browse the repository at this point in the history
Change-Id: I1784be279ee9f837a0994997bec49c1925a68390
  • Loading branch information
jchodor authored and Compute-Runtime-Automation committed Feb 8, 2019
1 parent 947794f commit 6e0d04e
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runtime/command_stream/command_stream_receiver_hw.inl
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,11 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {

//make sure we flush DC if needed
if (epiloguePipeControlLocation) {
((PIPE_CONTROL *)epiloguePipeControlLocation)->setDcFlushEnable(false == HwHelper::cacheFlushAfterWalkerSupported(this->hwInfo));
bool flushDcInEpilogue = true;
if (DebugManager.flags.DisableDcFlushInEpilogue.get()) {
flushDcInEpilogue = false;
}
((PIPE_CONTROL *)epiloguePipeControlLocation)->setDcFlushEnable(flushDcInEpilogue);
}
auto flushStamp = this->flush(primaryCmdBuffer->batchBuffer, surfacesForSubmit);

Expand Down
1 change: 1 addition & 0 deletions runtime/os_interface/debug_variables_base.inl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ DECLARE_DEBUG_VARIABLE(bool, UseNoRingFlushesKmdMode, true, "Windows only, passe
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.")
DECLARE_DEBUG_VARIABLE(bool, DisableZeroCopyForBuffers, false, "When active all buffer allocations will not share memory with CPU.")
DECLARE_DEBUG_VARIABLE(bool, EnableHostPtrTracking, true, "Enable host ptr tracking")
DECLARE_DEBUG_VARIABLE(bool, DisableDcFlushInEpilogue, false, "Disable DC flush in epilogue")

/*FEATURE FLAGS*/
DECLARE_DEBUG_VARIABLE(bool, EnableNV12, true, "Enables NV12 extension")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,79 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenDcFlushI
EXPECT_NE(nullptr, cmdBuffer->epiloguePipeControlLocation);
}

HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlThenDcFlushIsEnabled) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;

CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);

auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);

mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);

auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);

DispatchFlags dispatchFlags;
dispatchFlags.guardCommandBufferWithPipeControl = true;
dispatchFlags.outOfOrderExecutionAllowed = false;
dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo());
mockCsr->flushTask(commandStream,
0,
dsh,
ioh,
ssh,
taskLevel,
dispatchFlags,
*pDevice);

auto cmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
ASSERT_NE(nullptr, cmdBuffer->epiloguePipeControlLocation);
auto pipeControl = genCmdCast<PIPE_CONTROL *>(cmdBuffer->epiloguePipeControlLocation);
ASSERT_NE(nullptr, pipeControl);
mockCsr->flushBatchedSubmissions();
EXPECT_TRUE(pipeControl->getDcFlushEnable());
}

HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEpiloguePipeControlWhendDcFlushDisabledByDebugFlagThenDcFlushIsDisabled) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;

DebugManagerStateRestore debugRestorer;
DebugManager.flags.DisableDcFlushInEpilogue.set(true);

CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);

auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(mockCsr);

mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);

auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);

DispatchFlags dispatchFlags;
dispatchFlags.guardCommandBufferWithPipeControl = true;
dispatchFlags.outOfOrderExecutionAllowed = false;
dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo());
mockCsr->flushTask(commandStream,
0,
dsh,
ioh,
ssh,
taskLevel,
dispatchFlags,
*pDevice);

auto cmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
ASSERT_NE(nullptr, cmdBuffer->epiloguePipeControlLocation);
auto pipeControl = genCmdCast<PIPE_CONTROL *>(cmdBuffer->epiloguePipeControlLocation);
ASSERT_NE(nullptr, pipeControl);
mockCsr->flushBatchedSubmissions();
EXPECT_FALSE(pipeControl->getDcFlushEnable());
}

HWTEST_F(CommandStreamReceiverFlushTaskTests,
givenCsrInBatchingModeAndOoqFlagSetToFalseWhenTwoTasksArePassedWithTheSameLevelThenThereIsPipeControlBetweenThemAfterFlush) {
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
Expand Down
1 change: 1 addition & 0 deletions unit_tests/test_files/igdrcl.config
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ AUBDumpAllocsOnEnqueueReadOnly = 0
AUBDumpForceAllToLocalMemory = 0
EnableCacheFlushAfterWalker = 0
EnableHostPtrTracking = 1
DisableDcFlushInEpilogue = 0

0 comments on commit 6e0d04e

Please sign in to comment.