Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

workgroup_size attribute does not support variable expression #2080

Closed
haoyunfeix opened this issue Oct 8, 2022 · 2 comments
Closed

workgroup_size attribute does not support variable expression #2080

haoyunfeix opened this issue Oct 8, 2022 · 2 comments

Comments

@haoyunfeix
Copy link

haoyunfeix commented Oct 8, 2022

Failed shader:

 var a : i32 = 256u;
 @compute @workgroup_size(a, 1u, 1u)
        fn main(@builtin(local_invocation_id) LocalId : vec3<u32>,
                  @builtin(global_invocation_id) GlobalId : vec3<u32>,
                  @builtin(num_workgroups) NumWorkgroups : vec3<u32>) {
          var localId = LocalId;
          var globalId = GlobalId;
          var numWorkgroups = NumWorkgroups;
          }

Output:

naga .\6842.wgsl
error: expected 32-bit signed integer literal, found 'a'
  ┌─ .\6842.wgsl:2:27
  │
2 │  @compute @workgroup_size(a, 1u, 1u)
  │                           ^ expected 32-bit signed integer literal

Could not parse WGSL

This shader should be acceptable due to spec https://gpuweb.github.io/gpuweb/wgsl/#attributes
Each parameter must be a const-expression or an override-expression.

Related to tfjs issue: tensorflow/tfjs#6842 (comment)

@haoyunfeix haoyunfeix changed the title workgroup_size attribute does not support expression workgroup_size attribute does not support variable expression Oct 9, 2022
@SparkyPotato
Copy link
Contributor

Note that a must be declared const a = 256; in accordance with the spec.
(Naga does not support this yet)

@teoxoy
Copy link
Member

teoxoy commented Dec 5, 2022

This will be fixed as part of #1829

@teoxoy teoxoy closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants