Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL] Improve error handling for kernel invocation #1209

Merged
merged 11 commits into from
Apr 8, 2020
Prev Previous commit
Next Next commit
Apply comments
Signed-off-by: amochalo <anastasiya.mochalova@intel.com>
  • Loading branch information
MochalovaAn committed Mar 25, 2020
commit adf76053969c8a425d43499d63379dcad4d1fa85
11 changes: 6 additions & 5 deletions sycl/source/detail/error_handling/enqueue_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ bool oclHandleInvalidWorkGroupSize(const device_impl &DeviceImpl,
// program source.

// Fallback

constexpr pi_result Error = PI_INVALID_WORK_GROUP_SIZE;
throw runtime_error(
"OpenCL API failed. OpenCL API returns: " + codeToString(Error), Error);
Expand All @@ -178,6 +177,7 @@ bool handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,

const plugin &Plugin = DeviceImpl.getPlugin();
RT::PiDevice Device = DeviceImpl.getHandleRef();

if (HasLocalSize) {
size_t MaxThreadsPerBlock[3] = {};
Plugin.call<PiApiKind::piDeviceGetInfo>(
Expand Down Expand Up @@ -222,11 +222,12 @@ bool handleInvalidWorkItemSize(const device_impl &DeviceImpl,
Plugin.call<PiApiKind::piDeviceGetInfo>(
Device, PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES, sizeof(MaxWISize), &MaxWISize,
nullptr);
for (int i = 0; i < NDRDesc.Dims; i++) {
if (NDRDesc.LocalSize[i] > MaxWISize[i])
for (int I = 0; I < NDRDesc.Dims; I++) {
if (NDRDesc.LocalSize[I] > MaxWISize[I])
throw sycl::nd_range_error(
"Number of work-items in a work-group exceed limit for dimension "
"{I}: {NDRDesc.LocalSize[I]} > {MaxWISize[I]}",
"Number of work-items in a work-group exceed limit for dimension " +
std::to_string(I) + " : " + std::to_string(NDRDesc.LocalSize[I]) +
" > " + std::to_string(MaxWISize[I]),
PI_INVALID_WORK_ITEM_SIZE);
}
return 0;
Expand Down