Flip order of instructions in appendWaitOnEvents

It might be beneficial to flush the caches in parallel with
the wait instruction

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
Aravind Gopalakrishnan 2021-01-27 19:55:52 -08:00 committed by Compute-Runtime-Automation
parent aa79af46ac
commit 8f36ca5736
2 changed files with 17 additions and 17 deletions

View File

@ -1474,17 +1474,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnEvents(uint32_t nu
for (uint32_t i = 0; i < numEvents; i++) {
auto event = Event::fromHandle(phEvent[i]);
commandContainer.addToResidencyContainer(&event->getAllocation());
gpuAddr = event->getGpuAddress();
if (event->isTimestampEvent) {
gpuAddr += offsetof(TimestampPacketStorage::Packet, contextEnd);
}
NEO::EncodeSempahore<GfxFamily>::addMiSemaphoreWaitCommand(*commandContainer.getCommandStream(),
gpuAddr,
eventStateClear,
COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD);
dcFlushRequired |= (!event->waitScope) ? false : true;
}
@ -1497,6 +1486,20 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnEvents(uint32_t nu
}
}
for (uint32_t i = 0; i < numEvents; i++) {
auto event = Event::fromHandle(phEvent[i]);
commandContainer.addToResidencyContainer(&event->getAllocation());
gpuAddr = event->getGpuAddress();
if (event->isTimestampEvent) {
gpuAddr += offsetof(TimestampPacketStorage::Packet, contextEnd);
}
NEO::EncodeSempahore<GfxFamily>::addMiSemaphoreWaitCommand(*commandContainer.getCommandStream(),
gpuAddr,
eventStateClear,
COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD);
}
return ZE_RESULT_SUCCESS;
}

View File

@ -990,7 +990,7 @@ HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushTheP
EXPECT_NE(cmdList.end(), itor);
}
HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushThePipeControlIsProgrammedOnlyOnce) {
HWTEST_F(CommandListCreate, givenCommandListWhenAppendWaitEventsWithDcFlushThePipeControlIsProgrammedOnlyOnce) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
ze_result_t returnValue;
@ -1007,14 +1007,11 @@ HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushTheP
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed()));
auto itor = find<SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
auto itor = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
itor++;
auto itor2 = find<PIPE_CONTROL *>(itor, cmdList.end());
auto itor2 = find<SEMAPHORE_WAIT *>(itor, cmdList.end());
EXPECT_NE(cmdList.end(), itor2);
itor2++;
auto itor3 = find<PIPE_CONTROL *>(itor2, cmdList.end());
EXPECT_EQ(cmdList.end(), itor3);
}
using Platforms = IsAtLeastProduct<IGFX_SKYLAKE>;