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

[naga] Implement quantizeToF16 #6519

Merged
merged 1 commit into from
Nov 12, 2024
Merged

Conversation

jamienicol
Copy link
Contributor

@jamienicol jamienicol commented Nov 11, 2024

Connections
Fixes #4875

Description
Adds MathFunction::QuantiseToF16 and required typification and validation. Implement WGSL frontend and WGSL, SPIR-V, HLSL, MSL, and GLSL backends. WGSL and SPIR-V backends natively support the instruction. MSL and HLSL emulate it by casting to f16 and back to f32. GLSL does similar but must (mis)use (un)pack2x16 to do so.

Testing
Manual inspection of naga/tests/out/*/math-functions.* files. Ran validation. Compiled gecko with changes and ran relevant CTS tests.

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@jamienicol jamienicol requested a review from a team as a code owner November 11, 2024 15:19
naga/src/back/glsl/mod.rs Outdated Show resolved Hide resolved
@jamienicol jamienicol force-pushed the quantizeToF16 branch 3 times, most recently from 829f4e2 to cd4d9a7 Compare November 12, 2024 10:18
@jamienicol jamienicol changed the title [DRAFT] [naga] Implement quantizeToF16 [naga] Implement quantizeToF16 Nov 12, 2024
@jamienicol
Copy link
Contributor Author

Thanks @teoxoy ! I think this is ready for a proper review now

Implement WGSL frontend and WGSL, SPIR-V, HLSL, MSL, and GLSL
backends. WGSL and SPIR-V backends natively support the instruction.
MSL and HLSL emulate it by casting to f16 and back to f32. GLSL does
similar but must (mis)use (un)pack2x16 to do so.
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@teoxoy teoxoy merged commit cffc793 into gfx-rs:trunk Nov 12, 2024
27 checks passed
@jamienicol jamienicol deleted the quantizeToF16 branch November 12, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[wgsl-in] Implement quantizeToF16
2 participants