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] Implement quantizeToF16 #4875

Closed
Tracked by #4402
teoxoy opened this issue Dec 13, 2023 · 2 comments · Fixed by #6519
Closed
Tracked by #4402

[wgsl-in] Implement quantizeToF16 #4875

teoxoy opened this issue Dec 13, 2023 · 2 comments · Fixed by #6519
Labels
naga Shader Translator type: enhancement New feature or request

Comments

@teoxoy
Copy link
Member

teoxoy commented Dec 13, 2023

Implement the quantizeToF16 built-in function from the WGSL spec.

@teoxoy teoxoy changed the title quantizeToF16 [wgsl-in] Implement quantizeToF16 Dec 13, 2023
@jimblandy jimblandy moved this to One day in WebGPU for Firefox Dec 13, 2023
@teoxoy teoxoy removed the status in WebGPU for Firefox Dec 14, 2023
@teoxoy teoxoy added this to the WebGPU Specification V1 milestone Dec 14, 2023
@teoxoy teoxoy added type: enhancement New feature or request naga Shader Translator labels Dec 14, 2023
@jimblandy
Copy link
Member

The spec you want to follow is here.

The basic outline of this work is:

  • At some point, add a snapshot test input file to naga/tests/in/math-functions.wgsl, and edit naga/tests/snapshots.rs to know about it.
  • Add the function to naga::MathFunction in the Naga IR in naga/src/lib.rs. You'll get lots of compiler errors. Use todo!() to get things running again.
  • Add the function to the WGSL front end, naga/src/front/wgsl. You'll figure it out.
  • Extend the typifier in proc/typifier.rs.
  • Extend the validator in valid/expression.rs.
  • Add support to the WGSL backend in back/wgsl.
  • Add support to the SPIR-V backend, using OpQuantizeToF16.
  • Figure out what the corresponding functions are on Metal and HLSL, and add support to back/msl and back/hlsl.

You can use features like wgsl-in or spv-out to enable specific parts of Naga. By default, Naga doesn't enable any front- or backends, so you can pare down how much of the code base you want to deal with by just enabling the piece you're working on now.

@teoxoy
Copy link
Member Author

teoxoy commented Nov 5, 2024

You might find some more info in the issue that proposed adding this to the spec: gpuweb/gpuweb#704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
naga Shader Translator type: enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants