Workgroup size from spec constant
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.4k
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
When you use subgroups, you can often simplify code by assuming subgroup size == workgroup size for any subgroup intrinsics. But subgroup size is defined by the HW you are executing on, so what you'd need to do is use a specialization constant to set your workgroup size. You can already do this in glsl since vulkan first released:
The built-in vector gl_WorkGroupSize can be specialized using special layout local_size_{xyz}_id's applied to the "in" qualifier. For example:
layout(local_size_x_id = 18, local_size_z_id = 19) in;
This leaves gl_WorkGroupSize.y as a non-specialization constant, with gl_WorkGroupSize being a partially specialized vector. Its x and z components can be later specialized using the ID's 18 and 19.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked GL_KHR_vulkan_glsl specification passage describing specialization constants for gl_WorkGroupSize, then locate the Rust-GPU compiler path that handles workgroup size and specialization constants. Done means subgroup-related workgroup size assumptions can use a specialization constant, with coverage added for the supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100