Add wait on timestamp mechanism

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2021-11-17 15:05:48 +00:00
committed by Compute-Runtime-Automation
parent 59bcfc30a5
commit 36efe72e3e
15 changed files with 242 additions and 13 deletions

View File

@@ -955,6 +955,58 @@ void CommandQueue::aubCaptureHook(bool &blocking, bool &clearAllDependencies, co
}
}
bool CommandQueue::isTimestampWaitEnabled() {
auto enabled = false;
switch (DebugManager.flags.EnableTimestampWait.get()) {
case 0:
enabled = false;
break;
case 1:
enabled = getGpgpuCommandStreamReceiver().isUpdateTagFromWaitEnabled();
break;
case 2:
enabled = getGpgpuCommandStreamReceiver().isDirectSubmissionEnabled();
break;
case 3:
enabled = getGpgpuCommandStreamReceiver().isAnyDirectSubmissionEnabled();
break;
case 4:
enabled = true;
break;
}
return enabled;
}
void CommandQueue::waitForTimestamps(uint32_t taskCount) {
if (isTimestampWaitEnabled()) {
bool waited = false;
for (const auto &timestamp : timestampPacketContainer->peekNodes()) {
for (uint32_t i = 0; i < timestamp->getPacketsUsed(); i++) {
while (timestamp->getContextEndValue(i) == 1) {
}
waited = true;
}
}
if (isOOQEnabled()) {
for (const auto &timestamp : deferredTimestampPackets->peekNodes()) {
for (uint32_t i = 0; i < timestamp->getPacketsUsed(); i++) {
while (timestamp->getContextEndValue(i) == 1) {
}
waited = true;
}
}
}
if (waited) {
getGpgpuCommandStreamReceiver().updateTagFromCpu(taskCount);
}
}
}
void CommandQueue::waitForAllEngines(bool blockedQueue, PrintfHandler *printfHandler, bool cleanTemporaryAllocationsList) {
if (blockedQueue) {
while (isQueueBlocked()) {
@@ -963,6 +1015,7 @@ void CommandQueue::waitForAllEngines(bool blockedQueue, PrintfHandler *printfHan
TimestampPacketContainer nodesToRelease;
if (deferredTimestampPackets) {
waitForTimestamps(taskCount);
deferredTimestampPackets->swapNodes(nodesToRelease);
}