Skip to content

Commit 118bad1

Browse files
Dont add PIPE_CONTROL between Walkers for TimestampPacket writes
Change-Id: I6216a0926678c7f7a997cb37ce4eb59f914b518e Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
1 parent 6096263 commit 118bad1

File tree

2 files changed

+64
-3
lines changed

2 files changed

+64
-3
lines changed

runtime/command_stream/command_stream_receiver_hw.inl

+7-3
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
175175

176176
epiloguePipeControlLocation = ptrOffset(commandStreamTask.getCpuBase(), commandStreamTask.getUsed());
177177

178-
if (dispatchFlags.outOfOrderExecutionAllowed && !dispatchFlags.dcFlush) {
178+
if ((dispatchFlags.outOfOrderExecutionAllowed || DebugManager.flags.EnableTimestampPacket.get()) &&
179+
!dispatchFlags.dcFlush) {
179180
currentPipeControlForNooping = epiloguePipeControlLocation;
180181
}
181182

@@ -348,7 +349,9 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
348349

349350
// Add a PC if we have a dependency on a previous walker to avoid concurrency issues.
350351
if (taskLevel > this->taskLevel) {
351-
addPipeControl(commandStreamCSR, false);
352+
if (!DebugManager.flags.EnableTimestampPacket.get()) {
353+
addPipeControl(commandStreamCSR, false);
354+
}
352355
this->taskLevel = taskLevel;
353356
DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "this->taskCount", this->taskCount);
354357
}
@@ -615,7 +618,8 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSizeAligned(const
615618
return alignUp(size, MemoryConstants::cacheLineSize);
616619
}
617620

618-
template <typename GfxFamily> size_t CommandStreamReceiverHw<GfxFamily>::getRequiredStateBaseAddressSize() const {
621+
template <typename GfxFamily>
622+
size_t CommandStreamReceiverHw<GfxFamily>::getRequiredStateBaseAddressSize() const {
619623
return sizeof(typename GfxFamily::STATE_BASE_ADDRESS) + sizeof(PIPE_CONTROL);
620624
}
621625

unit_tests/command_stream/command_stream_receiver_flush_task_tests.cpp

+57
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,23 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, higherTaskLevelShouldSendAPipeCont
297297
EXPECT_NE(cmdList.end(), itorPC);
298298
}
299299

300+
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenHigherTaskLevelWhenDebugVariableIsEnabledThenDontAddPipeControl) {
301+
DebugManagerStateRestore restore;
302+
DebugManager.flags.EnableTimestampPacket.set(true);
303+
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
304+
commandStreamReceiver.isPreambleSent = true;
305+
configureCSRtoNonDirtyState<FamilyType>();
306+
commandStreamReceiver.taskLevel = taskLevel;
307+
taskLevel++; // submit with higher taskLevel
308+
309+
flushTask(commandStreamReceiver);
310+
311+
parseCommands<FamilyType>(commandStreamReceiver.commandStream, 0);
312+
313+
auto itorPC = find<typename FamilyType::PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
314+
EXPECT_EQ(cmdList.end(), itorPC);
315+
}
316+
300317
HWTEST_F(CommandStreamReceiverFlushTaskTests, whenSamplerCacheFlushNotRequiredThenDontSendPipecontrol) {
301318
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
302319
OCLRT::WorkaroundTable *waTable = nullptr;
@@ -2902,6 +2919,46 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrInBatch
29022919
EXPECT_NE(itorPipeControl, itorBatchBufferStartSecond);
29032920
}
29042921

2922+
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndOoqFlagSetToFalseWhenDebugVariableIsSetThenNoopPipeControl) {
2923+
DebugManagerStateRestore restore;
2924+
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
2925+
auto &commandStream = commandQueue.getCS(4096u);
2926+
2927+
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment);
2928+
pDevice->resetCommandStreamReceiver(mockCsr);
2929+
2930+
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
2931+
2932+
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
2933+
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
2934+
2935+
DispatchFlags dispatchFlags;
2936+
dispatchFlags.guardCommandBufferWithPipeControl = true;
2937+
dispatchFlags.outOfOrderExecutionAllowed = false;
2938+
2939+
auto taskLevelPriorToSubmission = mockCsr->peekTaskLevel();
2940+
2941+
DebugManager.flags.EnableTimestampPacket.set(false);
2942+
mockCsr->flushTask(commandStream, 0, dsh, ioh, ssh, taskLevelPriorToSubmission, dispatchFlags, *pDevice);
2943+
mockCsr->flushTask(commandStream, 0, dsh, ioh, ssh, taskLevelPriorToSubmission, dispatchFlags, *pDevice);
2944+
2945+
auto firstCmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
2946+
EXPECT_EQ(nullptr, firstCmdBuffer->pipeControlThatMayBeErasedLocation);
2947+
auto secondCmdBuffer = firstCmdBuffer->next;
2948+
EXPECT_EQ(nullptr, secondCmdBuffer->pipeControlThatMayBeErasedLocation);
2949+
2950+
mockCsr->flushBatchedSubmissions();
2951+
2952+
DebugManager.flags.EnableTimestampPacket.set(true);
2953+
mockCsr->flushTask(commandStream, 0, dsh, ioh, ssh, taskLevelPriorToSubmission, dispatchFlags, *pDevice);
2954+
mockCsr->flushTask(commandStream, 0, dsh, ioh, ssh, taskLevelPriorToSubmission, dispatchFlags, *pDevice);
2955+
2956+
firstCmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
2957+
EXPECT_NE(nullptr, firstCmdBuffer->pipeControlThatMayBeErasedLocation);
2958+
secondCmdBuffer = firstCmdBuffer->next;
2959+
EXPECT_NE(nullptr, secondCmdBuffer->pipeControlThatMayBeErasedLocation);
2960+
}
2961+
29052962
HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenPipeControlForNoopAddressIsNullThenPipeControlIsNotNooped) {
29062963
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
29072964
auto &commandStream = commandQueue.getCS(4096u);

0 commit comments

Comments
 (0)