Skip to content

[SYCL] Added error handling for non-uniform work group size case #2569

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

Merged
merged 6 commits into from
Oct 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2954,9 +2954,22 @@ piEnqueueKernelLaunch(pi_queue Queue, pi_kernel Kernel, pi_uint32 WorkDim,
return PI_INVALID_VALUE;
}

assert(GlobalWorkSize[0] == (ZeThreadGroupDimensions.groupCountX * WG[0]));
assert(GlobalWorkSize[1] == (ZeThreadGroupDimensions.groupCountY * WG[1]));
assert(GlobalWorkSize[2] == (ZeThreadGroupDimensions.groupCountZ * WG[2]));
// Error handling for non-uniform group size case
if (GlobalWorkSize[0] != (ZeThreadGroupDimensions.groupCountX * WG[0])) {
zePrint("piEnqueueKernelLaunch: invalid work_dim. The range is not a "
"multiple of the group size in the 1st dimension\n");
return PI_INVALID_WORK_GROUP_SIZE;
}
if (GlobalWorkSize[1] != (ZeThreadGroupDimensions.groupCountY * WG[1])) {
zePrint("piEnqueueKernelLaunch: invalid work_dim. The range is not a "
"multiple of the group size in the 2nd dimension\n");
return PI_INVALID_WORK_GROUP_SIZE;
}
if (GlobalWorkSize[2] != (ZeThreadGroupDimensions.groupCountZ * WG[2])) {
zePrint("piEnqueueKernelLaunch: invalid work_dim. The range is not a "
"multiple of the group size in the 3rd dimension\n");
return PI_INVALID_WORK_GROUP_SIZE;
}

ZE_CALL(zeKernelSetGroupSize(Kernel->ZeKernel, WG[0], WG[1], WG[2]));

Expand Down