Skip to content

Commit

Permalink
Dont add PIPE_CONTROL between Walkers for TimestampPacket writes
Browse files Browse the repository at this point in the history
Change-Id: I6216a0926678c7f7a997cb37ce4eb59f914b518e
Signed-off-by: Dunajski, Bartosz <[email protected]>
  • Loading branch information
BartoszDunajski authored and Compute-Runtime-Automation committed Aug 30, 2018
1 parent 6096263 commit 118bad1
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 3 deletions.
10 changes: 7 additions & 3 deletions runtime/command_stream/command_stream_receiver_hw.inl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(

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

if (dispatchFlags.outOfOrderExecutionAllowed && !dispatchFlags.dcFlush) {
if ((dispatchFlags.outOfOrderExecutionAllowed || DebugManager.flags.EnableTimestampPacket.get()) &&
!dispatchFlags.dcFlush) {
currentPipeControlForNooping = epiloguePipeControlLocation;
}

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

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

template <typename GfxFamily> size_t CommandStreamReceiverHw<GfxFamily>::getRequiredStateBaseAddressSize() const {
template <typename GfxFamily>
size_t CommandStreamReceiverHw<GfxFamily>::getRequiredStateBaseAddressSize() const {
return sizeof(typename GfxFamily::STATE_BASE_ADDRESS) + sizeof(PIPE_CONTROL);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,23 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, higherTaskLevelShouldSendAPipeCont
EXPECT_NE(cmdList.end(), itorPC);
}

HWTEST_F(CommandStreamReceiverFlushTaskTests, givenHigherTaskLevelWhenDebugVariableIsEnabledThenDontAddPipeControl) {
DebugManagerStateRestore restore;
DebugManager.flags.EnableTimestampPacket.set(true);
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
commandStreamReceiver.isPreambleSent = true;
configureCSRtoNonDirtyState<FamilyType>();
commandStreamReceiver.taskLevel = taskLevel;
taskLevel++; // submit with higher taskLevel

flushTask(commandStreamReceiver);

parseCommands<FamilyType>(commandStreamReceiver.commandStream, 0);

auto itorPC = find<typename FamilyType::PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
EXPECT_EQ(cmdList.end(), itorPC);
}

HWTEST_F(CommandStreamReceiverFlushTaskTests, whenSamplerCacheFlushNotRequiredThenDontSendPipecontrol) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
OCLRT::WorkaroundTable *waTable = nullptr;
Expand Down Expand Up @@ -2902,6 +2919,46 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrInBatch
EXPECT_NE(itorPipeControl, itorBatchBufferStartSecond);
}

HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndOoqFlagSetToFalseWhenDebugVariableIsSetThenNoopPipeControl) {
DebugManagerStateRestore restore;
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;

auto taskLevelPriorToSubmission = mockCsr->peekTaskLevel();

DebugManager.flags.EnableTimestampPacket.set(false);
mockCsr->flushTask(commandStream, 0, dsh, ioh, ssh, taskLevelPriorToSubmission, dispatchFlags, *pDevice);
mockCsr->flushTask(commandStream, 0, dsh, ioh, ssh, taskLevelPriorToSubmission, dispatchFlags, *pDevice);

auto firstCmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
EXPECT_EQ(nullptr, firstCmdBuffer->pipeControlThatMayBeErasedLocation);
auto secondCmdBuffer = firstCmdBuffer->next;
EXPECT_EQ(nullptr, secondCmdBuffer->pipeControlThatMayBeErasedLocation);

mockCsr->flushBatchedSubmissions();

DebugManager.flags.EnableTimestampPacket.set(true);
mockCsr->flushTask(commandStream, 0, dsh, ioh, ssh, taskLevelPriorToSubmission, dispatchFlags, *pDevice);
mockCsr->flushTask(commandStream, 0, dsh, ioh, ssh, taskLevelPriorToSubmission, dispatchFlags, *pDevice);

firstCmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
EXPECT_NE(nullptr, firstCmdBuffer->pipeControlThatMayBeErasedLocation);
secondCmdBuffer = firstCmdBuffer->next;
EXPECT_NE(nullptr, secondCmdBuffer->pipeControlThatMayBeErasedLocation);
}

HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenPipeControlForNoopAddressIsNullThenPipeControlIsNotNooped) {
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStream = commandQueue.getCS(4096u);
Expand Down

0 comments on commit 118bad1

Please sign in to comment.