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

Allow override-expressions in element count of fixed-size arrays #5315

Open
ErichDonGubler opened this issue Feb 28, 2024 · 0 comments
Open
Assignees
Labels
area: correctness We're behaving incorrectly lang: WGSL WebGPU Shading Language naga Shader Translator

Comments

@ErichDonGubler
Copy link
Member

Description

We don't appear to allow override-expressions within template parameters, though it is specified by the WebGPU spec.'s 6.2.9 Array Types section:

The element count expression N of a fixed-size array is subject to the following constraints:

Repro steps

I don't have straightforward STR ATM (TODO), but this repros with WebGPU CTS' webgpu:shader,execution,zero_init:compute,zero_init:* test (see the source of the shader it submits here: https://github.com/mozilla/gpuweb-cts/blob/41f89e77b67e6b66cb017be4e00235a0a9429ca7/src/webgpu/shader/execution/zero_init.spec.ts#L413-L429). In particular, the var<workgroup> wg_mem : array<u32, ${wg_memory_limits} / 4>; line exercises this functionality, yielding an error like the following:

[ERROR wgpu_core::device::global] Device::create_shader_module error:
    Shader '' parsing error: expected '>', found '/'
      ┌─ wgsl:4:48
      │
    4 │       var<workgroup> wg_mem : array<u32, 16384 / 4>;
      │                                                ^ expected '>'

Expected vs observed behavior

Expected: Compilation Just Works™, and the shader module is usable in subsequently constructed pipelines.

Actual: We get a relatively unhelpful error diagnostic message, and the shader module is invalid.

Extra materials

None provided.

Platform

None provided.

@ErichDonGubler ErichDonGubler added area: correctness We're behaving incorrectly naga Shader Translator lang: WGSL WebGPU Shading Language labels Feb 28, 2024
@teoxoy teoxoy moved this to Todo in WebGPU for Firefox Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: correctness We're behaving incorrectly lang: WGSL WebGPU Shading Language naga Shader Translator
Projects
Status: Todo
Development

No branches or pull requests

2 participants