Skip to content

document error for kernel enqueue with a work-group size of zero#1542

Merged
bashbaug merged 1 commit intoKhronosGroup:mainfrom
bashbaug:local-work-size-zero
Apr 28, 2026
Merged

document error for kernel enqueue with a work-group size of zero#1542
bashbaug merged 1 commit intoKhronosGroup:mainfrom
bashbaug:local-work-size-zero

Conversation

@bashbaug
Copy link
Copy Markdown
Contributor

@bashbaug bashbaug commented Apr 1, 2026

possible fix for #1541

Copy link
Copy Markdown

@lpavank lpavank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@karolherbst
Copy link
Copy Markdown
Contributor

I wonder if requiring this could break applications that simply specify a [0, 0, 0] local size.

But the spec also states If local_work_size is specified, the values specified in global_work_size[0], …​, global_work_size[work_dim - 1] must be evenly divisible by the corresponding values specified in local_work_size[0], …​, local_work_size[work_dim - 1] and that would be a division by 0. So if we have some major vendor that don't handle explicit local sizes of 0 I think it's safe to merge.

However if those are handled it's difficult to rule out that it wouldn't break things. But I think this is good to clarify, I just know that in rusticl enqueue with local_work_size == [0, 0, 0] is the same as specifying NULL. Not because the intention was to support 0 local sizes, but because it made sense to implement it that way logistically.

@bashbaug bashbaug merged commit 31ac208 into KhronosGroup:main Apr 28, 2026
1 check passed
@bashbaug bashbaug deleted the local-work-size-zero branch April 28, 2026 15:58
@bashbaug
Copy link
Copy Markdown
Contributor Author

So if we have some major vendor that don't handle explicit local sizes of 0 I think it's safe to merge.

Mentioning for completeness: we currently return the error CL_INVALID_WORK_GROUP_SIZE when the local work-group size is explicitly zero for both CPU and GPU.

>>>> clEnqueueNDRangeKernel( Test ): queue = 0x5aefdf259830, kernel = 0x5aefe19b8810, global_work_size = < 512 x 1 >, local_work_size = < 0 x 0 >
<<<< clEnqueueNDRangeKernel -> CL_INVALID_WORK_GROUP_SIZE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants