Add check for local work group size in clEnqueueNDRangeKernel call.

- Incoming local work group size cannot exceed device capabilities.

Change-Id: I89a7503155c71443e3ebc630debb5d5b466c6cb5
This commit is contained in:
Mrozek, Michal
2018-04-20 07:58:48 +02:00
parent 5ed13d7c88
commit ce8c44cae3
6 changed files with 34 additions and 18 deletions

View File

@ -71,6 +71,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueKernel(
}
size_t remainder = 0;
size_t totalWorkItems = 1u;
const size_t *localWkgSizeToPass = localWorkSizeIn ? workGroupSize : nullptr;
for (auto i = 0u; i < workDim; i++) {
@ -86,6 +87,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueKernel(
}
}
workGroupSize[i] = localWorkSizeIn[i];
totalWorkItems *= localWorkSizeIn[i];
}
remainder += region[i] % workGroupSize[i];
@ -126,6 +128,10 @@ cl_int CommandQueueHw<GfxFamily>::enqueueKernel(
",", globalWorkSizeIn[2],
",SIMD:, ", kernel.getKernelInfo().getMaxSimdSize());
if (totalWorkItems > this->getDevice().getDeviceInfo().maxWorkGroupSize) {
return CL_INVALID_WORK_GROUP_SIZE;
}
enqueueHandler<CL_COMMAND_NDRANGE_KERNEL>(
surfaces,
false,