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

[wgsl-in] Missing built-in integer function implementations #1824

Closed
hanawatson opened this issue Apr 13, 2022 · 3 comments
Closed

[wgsl-in] Missing built-in integer function implementations #1824

hanawatson opened this issue Apr 13, 2022 · 3 comments
Labels
area: back-end Outputs of shader conversion area: front-end Input formats for conversion area: middle Intermediate representation

Comments

@hanawatson
Copy link

Hi - not sure if this is already known and on a to-do list somewhere, but while working on a WGSL fuzzing project I noticed naga has no implementation for a couple of built-in integer functions (https://gpuweb.github.io/gpuweb/wgsl/#integer-builtin-functions):

  • countLeadingZeros
  • countTrailingZeros

code example (analogous for countTrailingZeros):

@stage(compute) @workgroup_size(1)
fn compute_main() {
    var test_var = countLeadingZeros(53);
}

resultant error from attempting to compile with naga:

error: no definition in scope for identifier: 'countLeadingZeros'
  ┌─ test.wgsl:3:20
  │
3 │     var test_var = countLeadingZeros(53);
  │                    ^^^^^^^^^^^^^^^^^ unknown identifier

Could not parse WGSL
@teoxoy
Copy link
Member

teoxoy commented Apr 13, 2022

They are indeed missing, thanks for the report!

@teoxoy teoxoy added area: front-end Input formats for conversion area: back-end Outputs of shader conversion area: middle Intermediate representation labels Apr 13, 2022
@teoxoy teoxoy added this to the WGSL Specification V1 milestone Apr 30, 2022
@fornwall
Copy link
Contributor

@teoxoy This seems to have been fixed (#2226 and #2243).

@teoxoy
Copy link
Member

teoxoy commented Aug 19, 2023

Thanks for the reminder!

@teoxoy teoxoy closed this as completed Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: back-end Outputs of shader conversion area: front-end Input formats for conversion area: middle Intermediate representation
Projects
None yet
Development

No branches or pull requests

3 participants