Improve enqueue kernel error handling.

- Do not allow to enqueue parent kernel if there is no device queue.

Change-Id: I0f06b8ed2387fc87abd652653f2c8bb8c4939a12
Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2019-11-13 16:50:25 +01:00
committed by sys_ocldev
parent 5ab6386581
commit e7901775a8
2 changed files with 17 additions and 0 deletions

View File

@@ -40,6 +40,10 @@ cl_int CommandQueueHw<GfxFamily>::enqueueKernel(
auto &kernel = *castToObject<Kernel>(clKernel);
const auto &kernelInfo = kernel.getKernelInfo();
if (kernel.isParentKernel && !this->context->getDefaultDeviceQueue()) {
return CL_INVALID_OPERATION;
}
if (!kernel.isPatched()) {
if (event) {
*event = nullptr;

View File

@@ -882,3 +882,16 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueAuxKernelTests, givenParentKernelWhenAuxTrans
EXPECT_EQ(1u, cmdQ.waitCalled);
}
}
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueAuxKernelTests, givenParentKernelButNoDeviceQueueWhenEnqueueIsCalledItReturnsInvalidOperation) {
if (pDevice->getSupportedClVersion() >= 20) {
MyCmdQ<FamilyType> cmdQ(context, pDevice);
size_t gws[3] = {1, 0, 0};
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(*context, false, false, false, false, false));
parentKernel->initialize();
auto status = cmdQ.enqueueKernel(parentKernel.get(), 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
EXPECT_EQ(CL_INVALID_OPERATION, status);
}
}