Skip to content

Commit 41914d3

Browse files
Make enqueue blocking if parent kernel requires aux translation
Change-Id: I678e1045d84f15e30223a99438bbb7057e172cff Signed-off-by: Dunajski, Bartosz <[email protected]>
1 parent 83237bd commit 41914d3

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

runtime/command_queue/enqueue_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
336336
slmUsed |= scheduler.slmTotalSize > 0;
337337

338338
parentKernel->getProgram()->getBlockKernelManager()->makeInternalAllocationsResident(commandStreamReceiver);
339+
if (parentKernel->isAuxTranslationRequired()) {
340+
blocking = true;
341+
}
339342
}
340343

341344
auto submissionRequired = isCommandWithoutKernel(commandType) ? false : true;

unit_tests/command_queue/enqueue_kernel_tests.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,13 @@ struct EnqueueAuxKernelTests : public EnqueueKernelTest {
15891589
dispatchAuxTranslationInputs.emplace_back(lastKernel, multiDispatchInfo.size(), buffersForAuxTranslation, auxTranslationDirection);
15901590
}
15911591

1592+
void waitUntilComplete(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) override {
1593+
waitCalled++;
1594+
CommandQueueHw<FamilyType>::waitUntilComplete(taskCountToWait, flushStampToWait, useQuickKmdSleep);
1595+
}
1596+
15921597
std::vector<std::tuple<Kernel *, size_t, BuffersForAuxTranslation, AuxTranslationDirection>> dispatchAuxTranslationInputs;
1598+
uint32_t waitCalled = 0;
15931599
};
15941600
};
15951601

@@ -1737,3 +1743,25 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueAuxKernelTests, givenParentKernelWhenAuxTrans
17371743
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, buffer2.getGraphicsAllocation()->getAllocationType());
17381744
}
17391745
}
1746+
1747+
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueAuxKernelTests, givenParentKernelWhenAuxTranslationIsRequiredThenMakeEnqueueBlocking) {
1748+
if (pDevice->getSupportedClVersion() >= 20) {
1749+
MyCmdQ<FamilyType> cmdQ(context, pDevice);
1750+
size_t gws[3] = {1, 0, 0};
1751+
1752+
cl_queue_properties queueProperties = {};
1753+
auto mockDevQueue = std::make_unique<MockDeviceQueueHw<FamilyType>>(context, pDevice, queueProperties);
1754+
context->setDefaultDeviceQueue(mockDevQueue.get());
1755+
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(*context, false, false, false, false, false));
1756+
parentKernel->initialize();
1757+
1758+
parentKernel->auxTranslationRequired = false;
1759+
cmdQ.enqueueKernel(parentKernel.get(), 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
1760+
EXPECT_EQ(0u, cmdQ.waitCalled);
1761+
mockDevQueue->getIgilQueue()->m_controls.m_CriticalSection = 0;
1762+
1763+
parentKernel->auxTranslationRequired = true;
1764+
cmdQ.enqueueKernel(parentKernel.get(), 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
1765+
EXPECT_EQ(1u, cmdQ.waitCalled);
1766+
}
1767+
}

0 commit comments

Comments
 (0)