Rename an overload of waitUntilComplete to waitForAllEngines

- Overloaded functions were quite different, they should have different names
- waitForLatestTaskCount function was redundant and hence its body was moved
inside waitForAllEngines

Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2021-09-22 15:07:20 +00:00
committed by Compute-Runtime-Automation
parent d211864410
commit 6d1e048327
6 changed files with 15 additions and 24 deletions

View File

@@ -187,15 +187,6 @@ bool CommandQueue::isCompleted(uint32_t gpgpuTaskCount, CopyEngineState bcsState
return false;
}
void CommandQueue::waitForLatestTaskCount() {
TimestampPacketContainer nodesToRelease;
if (deferredTimestampPackets) {
deferredTimestampPackets->swapNodes(nodesToRelease);
}
waitUntilComplete(taskCount, this->bcsState.taskCount, flushStamp->peekStamp(), false);
}
void CommandQueue::waitUntilComplete(uint32_t gpgpuTaskCountToWait, uint32_t bcsTaskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) {
WAIT_ENTER()
@@ -918,13 +909,18 @@ void CommandQueue::aubCaptureHook(bool &blocking, bool &clearAllDependencies, co
}
}
void CommandQueue::waitUntilComplete(bool blockedQueue, PrintfHandler *printfHandler) {
void CommandQueue::waitForAllEngines(bool blockedQueue, PrintfHandler *printfHandler) {
if (blockedQueue) {
while (isQueueBlocked()) {
}
}
waitForLatestTaskCount();
TimestampPacketContainer nodesToRelease;
if (deferredTimestampPackets) {
deferredTimestampPackets->swapNodes(nodesToRelease);
}
waitUntilComplete(taskCount, this->bcsState.taskCount, flushStamp->peekStamp(), false);
if (printfHandler) {
printfHandler->printEnqueueOutput();

View File

@@ -217,7 +217,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);
MOCKABLE_VIRTUAL void waitUntilComplete(bool blockedQueue, PrintfHandler *printfHandler);
MOCKABLE_VIRTUAL void waitForAllEngines(bool blockedQueue, PrintfHandler *printfHandler);
static uint32_t getTaskLevelFromWaitList(uint32_t taskLevel,
cl_uint numEventsInWaitList,
@@ -360,7 +360,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
MOCKABLE_VIRTUAL bool blitEnqueueImageAllowed(const size_t *origin, const size_t *region, const Image &image) const;
void aubCaptureHook(bool &blocking, bool &clearAllDependencies, const MultiDispatchInfo &multiDispatchInfo);
virtual bool obtainTimestampPacketForCacheFlush(bool isCacheFlushRequired) const = 0;
void waitForLatestTaskCount();
Context *context = nullptr;
ClDevice *device = nullptr;

View File

@@ -409,7 +409,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
commandStreamRecieverOwnership.unlock();
if (blocking) {
waitUntilComplete(blockQueue, (blockQueue ? nullptr : printfHandler.get()));
waitForAllEngines(blockQueue, (blockQueue ? nullptr : printfHandler.get()));
}
if (migratedMemory) {
getGpgpuCommandStreamReceiver().flushBatchedSubmissions();
@@ -1249,7 +1249,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlit(const MultiDispatchInfo &multiDispat
commandStreamRecieverOwnership.unlock();
if (blocking) {
waitUntilComplete(blockQueue, nullptr);
waitForAllEngines(blockQueue, nullptr);
}
}

View File

@@ -19,12 +19,8 @@ cl_int CommandQueueHw<GfxFamily>::finish() {
return CL_OUT_OF_RESOURCES;
}
//as long as queue is blocked we need to stall.
while (isQueueBlocked())
;
// Stall until HW reaches CQ taskCount
waitForLatestTaskCount();
// Stall until HW reaches taskCount on all its engines
waitForAllEngines(true, nullptr);
return CL_SUCCESS;
}

View File

@@ -1031,7 +1031,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenUpdateTaskCountFromWaitSetWhe
mockCsr->useGpuIdleImplicitFlush = false;
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
commandQueue.waitUntilComplete(false, nullptr);
commandQueue.waitForAllEngines(false, nullptr);
parseCommands<FamilyType>(mockCsr->getCS(4096u));
auto itorPipeControl = find<typename FamilyType::PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
@@ -1059,7 +1059,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenEnabledDirectSubmissionUpdate
mockCsr->useGpuIdleImplicitFlush = false;
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
commandQueue.waitUntilComplete(false, nullptr);
commandQueue.waitForAllEngines(false, nullptr);
parseCommands<FamilyType>(mockCsr->getCS(4096u));
auto itorPipeControl = find<typename FamilyType::PIPE_CONTROL *>(cmdList.begin(), cmdList.end());

View File

@@ -169,7 +169,7 @@ HWTEST_F(PrintfHandlerTests, givenPrintfHandlerWhenEnqueueIsBlockedThenDontUsePr
using CommandQueueHw<FamilyType>::CommandQueueHw;
using CommandQueueHw<FamilyType>::enqueueKernel;
void waitUntilComplete(bool blockedQueue, PrintfHandler *printfHandler) override {
void waitForAllEngines(bool blockedQueue, PrintfHandler *printfHandler) override {
waitCalled = true;
printfHandlerUsedForWait = printfHandler;
}