Skip to content

Commit 18357f7

Browse files
[SYCL] Add error handling for non-uniform work group size case (#2569)
Signed-off-by: Eugene T Damiba <[email protected]>
1 parent 36c61d7 commit 18357f7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2988,9 +2988,22 @@ piEnqueueKernelLaunch(pi_queue Queue, pi_kernel Kernel, pi_uint32 WorkDim,
29882988
return PI_INVALID_VALUE;
29892989
}
29902990

2991-
assert(GlobalWorkSize[0] == (ZeThreadGroupDimensions.groupCountX * WG[0]));
2992-
assert(GlobalWorkSize[1] == (ZeThreadGroupDimensions.groupCountY * WG[1]));
2993-
assert(GlobalWorkSize[2] == (ZeThreadGroupDimensions.groupCountZ * WG[2]));
2991+
// Error handling for non-uniform group size case
2992+
if (GlobalWorkSize[0] != (ZeThreadGroupDimensions.groupCountX * WG[0])) {
2993+
zePrint("piEnqueueKernelLaunch: invalid work_dim. The range is not a "
2994+
"multiple of the group size in the 1st dimension\n");
2995+
return PI_INVALID_WORK_GROUP_SIZE;
2996+
}
2997+
if (GlobalWorkSize[1] != (ZeThreadGroupDimensions.groupCountY * WG[1])) {
2998+
zePrint("piEnqueueKernelLaunch: invalid work_dim. The range is not a "
2999+
"multiple of the group size in the 2nd dimension\n");
3000+
return PI_INVALID_WORK_GROUP_SIZE;
3001+
}
3002+
if (GlobalWorkSize[2] != (ZeThreadGroupDimensions.groupCountZ * WG[2])) {
3003+
zePrint("piEnqueueKernelLaunch: invalid work_dim. The range is not a "
3004+
"multiple of the group size in the 3rd dimension\n");
3005+
return PI_INVALID_WORK_GROUP_SIZE;
3006+
}
29943007

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

0 commit comments

Comments
 (0)