Add blocking semaphore after N enqueue.

Change-Id: I3f0a636ed67137c3bfce6345725d3b898952e4b7
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2020-04-22 16:34:39 +02:00
committed by sys_ocldev
parent 843edb10c8
commit 0fdaadc505
5 changed files with 127 additions and 1 deletions

View File

@@ -237,6 +237,13 @@ size_t EnqueueOperation<GfxFamily>::getTotalSizeRequiredCS(uint32_t eventType, c
expectedSizeCS += TimestampPacketHelper::getRequiredCmdStreamSize<GfxFamily>(csrDeps);
expectedSizeCS += EnqueueOperation<GfxFamily>::getSizeRequiredForTimestampPacketWrite();
}
if (DebugManager.flags.AddBlockingSemaphoreAfterSpecificEnqueue.get() != -1) {
if (DebugManager.flags.AddCacheFlushBeforeBlockingSemaphore.get()) {
expectedSizeCS += MemorySynchronizationCommands<GfxFamily>::getSizeForSinglePipeControl();
}
expectedSizeCS += sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT);
}
return expectedSizeCS;
}

View File

@@ -102,6 +102,22 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
HardwareCommandsHelper<GfxFamily>::programCacheFlushAfterWalkerCommand(commandStream, commandQueue, mainKernel, postSyncAddress);
}
dispatchProfilingPerfEndCommands(hwTimeStamps, hwPerfCounter, commandStream, commandQueue);
if (DebugManager.flags.AddBlockingSemaphoreAfterSpecificEnqueue.get() != -1) {
auto &gpgpuCsr = commandQueue.getGpgpuCommandStreamReceiver();
if (static_cast<uint32_t>(DebugManager.flags.AddBlockingSemaphoreAfterSpecificEnqueue.get()) == gpgpuCsr.peekTaskCount()) {
if (DebugManager.flags.AddCacheFlushBeforeBlockingSemaphore.get()) {
MemorySynchronizationCommands<GfxFamily>::addPipeControl(*commandStream, true);
}
auto tagValue = *(gpgpuCsr.getTagAddress());
auto tagAddress = gpgpuCsr.getTagAllocation()->getGpuAddress();
// Wait for (tag == tag - 1). This will be never satisfied.
HardwareCommandsHelper<GfxFamily>::programMiSemaphoreWait(*commandStream, tagAddress, (tagValue - 1), GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD);
}
}
}
template <typename GfxFamily>