-
Notifications
You must be signed in to change notification settings - Fork 713
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
[SPIR-V] Allow thread group size to be specified with specialization constants #3092
Comments
Thanks for reporting @SaschaWillems |
One suggestion would be detecting
Seems a bit hacky though... |
Sample assembly from
Assembly:
Don't know if |
Any updates on this? |
My preferred syntax would be
We can already define spec constants, so I would want to reuse the same syntax, just allow them in the @llvm-beanz Is this something that would need to go through hlsl specs? |
@s-perron, no I think this is just a bug. We should allow any compile-time constant in that attribute, but I think the way it is implemented we don’t correctly support that. We have a few related issues: |
Any updates on this? I'm working on translating some complex glsl shaders to hlsl, and this is somewhat of a blocker. |
I have a draft PR that implements this: #7084. However, this cannot go into DXC yet. We would need an HLSL spec update. We could add a new attribute or update numthreads. If we update numthreads, the implementation of it will have to completely change. That would need to be discussed. Also in the compute derivatives feature, the quads are determined by the values in the numthreads attribute. This assumes the values are all known at compile time, so we can add the correct SPIR-V capability/executionmode. We will need to update the HLSL in this respect for the new attribute. There are solutions to these, but they have to be handled in the HLSL spec first. The draft PR also includes a partial refactoring of the OpExecutionModeId instruction in the SPIR-V backend. The current implementation is not expressive enough for what we want to do. This refactoring should be pulled out into its own PR.
|
I do not have any timeline on when we can get to this. |
In glsl it's possible to set the thread group / work group size for compute shaders via specialization constants. This allows an application to use different sizes depending e.g. on the hardware limits, without the need for different shaders.
The
GL_ARB_gl_spirv
extension added explicit qualifiers for this:There doesn't seem to be an equivalent of this for HLSL to SPIR-V right now.
The text was updated successfully, but these errors were encountered: