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

Implement specialization constant support in numthreads / local_size #5963

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

juliusikkala
Copy link
Contributor

@juliusikkala juliusikkala commented Dec 30, 2024

Adds support for using SPIR-V specialization constants in numthreads:

[vk::constant_id(0)] const int WG_SIZE = 8;

[shader("compute")]
[numthreads(1, WG_SIZE, 1)]
void main(uint3 tid : SV_DispatchThreadID)
{
}

Similar to the local_size_x_id feature from GLSL, this allows users to generate shader permutations with different work group shapes / thread counts after the shader has already been compiled to SPIR-V.

Currently, this works with the SPIR-V (using LocalSizeId execution mode) and GLSL (using local_size_{x,y,z}_id) targets. I'm not sure if there even is anything that could be done for the other targets, other than to just present diagnostics about this feature not being supported there.

TODO (hence draft):

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.

local_size_x_id layout qualifier is unrecognized in GLSL compatibility mode
1 participant