Unify waiting method

Change-Id: I8e17d097e00f7d14c7243cc7989dd333807d5b44
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2020-08-26 15:44:12 +02:00
committed by sys_ocldev
parent 0e28eecb16
commit 9cefc84edc
3 changed files with 18 additions and 26 deletions

View File

@@ -33,6 +33,7 @@
#include "opencl/source/helpers/queue_helpers.h"
#include "opencl/source/mem_obj/buffer.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/source/program/printf_handler.h"
#include "CL/cl_ext.h"
@@ -698,4 +699,17 @@ void CommandQueue::aubCaptureHook(bool &blocking, bool &clearAllDependencies, co
}
}
void CommandQueue::waitUntilComplete(bool blockedQueue, PrintfHandler *printfHandler) {
if (blockedQueue) {
while (isQueueBlocked()) {
}
}
waitUntilComplete(taskCount, bcsTaskCount, flushStamp->peekStamp(), false);
if (printfHandler) {
printfHandler->printEnqueueOutput();
}
}
} // namespace NEO

View File

@@ -216,6 +216,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
MOCKABLE_VIRTUAL bool isQueueBlocked();
MOCKABLE_VIRTUAL void waitUntilComplete(uint32_t gpgpuTaskCountToWait, uint32_t bcsTaskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep);
void waitUntilComplete(bool blockedQueue, PrintfHandler *printfHandler);
static uint32_t getTaskLevelFromWaitList(uint32_t taskLevel,
cl_uint numEventsInWaitList,

View File

@@ -380,16 +380,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
commandStreamRecieverOwnership.unlock();
if (blocking) {
if (blockQueue) {
while (isQueueBlocked()) {
}
waitUntilComplete(taskCount, bcsTaskCount, flushStamp->peekStamp(), false);
} else {
waitUntilComplete(taskCount, bcsTaskCount, flushStamp->peekStamp(), false);
if (printfHandler) {
printfHandler->printEnqueueOutput();
}
}
waitUntilComplete(blockQueue, printfHandler.get());
}
}
@@ -1127,17 +1118,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlit(const MultiDispatchInfo &multiDispat
if (!blockQueue) {
csrDeps.makeResident(getGpgpuCommandStreamReceiver());
completionStamp = enqueueCommandWithoutKernel(
nullptr,
0,
commandStream,
commandStreamStart,
blocking,
enqueueProperties,
timestampPacketDependencies,
eventsRequest,
eventBuilder,
taskLevel);
completionStamp = enqueueCommandWithoutKernel(nullptr, 0, commandStream, commandStreamStart, blocking, enqueueProperties, timestampPacketDependencies, eventsRequest, eventBuilder, taskLevel);
if (eventBuilder.getEvent()) {
eventBuilder.getEvent()->flushStamp->replaceStampObject(this->flushStamp->getStampReference());
@@ -1160,11 +1141,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlit(const MultiDispatchInfo &multiDispat
commandStreamRecieverOwnership.unlock();
if (blocking) {
if (blockQueue) {
while (isQueueBlocked()) {
}
}
waitUntilComplete(taskCount, bcsTaskCount, flushStamp->peekStamp(), false);
waitUntilComplete(blockQueue, nullptr);
}
}
} // namespace NEO