Dont add PIPE_CONTROL between Walkers for TimestampPacket writes

Change-Id: I6216a0926678c7f7a997cb37ce4eb59f914b518e
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2018-08-30 11:05:18 +02:00
committed by sys_ocldev
parent 6096263d2a
commit 118bad16df
2 changed files with 64 additions and 3 deletions

View File

@ -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;
}
@ -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);
}
@ -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);
}

View File

@ -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;
@ -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);