Skip to content

feat: implement F16 support in shaders #5701

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

Merged
merged 4 commits into from
Mar 19, 2025

Conversation

FL33TW00D
Copy link
Contributor

@FL33TW00D FL33TW00D commented May 13, 2024

Connections

Checklist for merge-ability

Additional context

F16 is available in >=SM6.2: https://github.com/microsoft/DirectXShaderCompiler/wiki/16-Bit-Scalar-Types

@FL33TW00D FL33TW00D mentioned this pull request May 14, 2024
@FL33TW00D FL33TW00D changed the title feature: Parse enable directives feature: Parse enable directives & SHADER-F16 support May 14, 2024
@FL33TW00D FL33TW00D marked this pull request as ready for review May 15, 2024 21:19
@FL33TW00D FL33TW00D requested a review from a team May 15, 2024 21:19
@FL33TW00D FL33TW00D requested a review from a team as a code owner May 15, 2024 21:19
@FL33TW00D
Copy link
Contributor Author

I've marked this as ready for review, as the wgpu specific logic is implemented and would be great to start iterating on it.

2 main blockers are:

  1. Merging of the PR on half-rs.
  2. hexf-parse improved implementation.

@FL33TW00D
Copy link
Contributor Author

FL33TW00D commented May 20, 2024

Dogfooding works! Fixed a few bugs in 30e12b5. Still waiting on upstream.

@teoxoy

This comment was marked as resolved.

@FL33TW00D

This comment was marked as resolved.

@teoxoy
Copy link
Member

teoxoy commented Jun 13, 2024

One thing I'm concerned is that the polyfills we have in some of the backends might not support f16. It would be worth adding more tests covering the built-in functions and operations that support f16. Execution tests would be great as well, they live in tests/tests/shader.

@teoxoy

This comment was marked as resolved.

@teoxoy teoxoy self-assigned this Jun 13, 2024
@FL33TW00D FL33TW00D force-pushed the feature/enable branch 2 times, most recently from 9c6a9b3 to 9f33e0e Compare June 14, 2024 14:20
@ErichDonGubler

This comment was marked as outdated.

@ErichDonGubler ErichDonGubler added type: enhancement New feature or request backend: webgpu Issues with direct interface with WebGPU labels Jun 14, 2024
@ErichDonGubler
Copy link
Member

@raphamorim: Can you please post the Git history for half-2, presumably in a fork under your user? We noticed that the commit hash 367f64f7a23e8763d1662e7da6731d74422133b3 in half-2's .cargo_vcs_info.json is not accessible from the starkat99 or FL33TWOOD repos.

@raphamorim
Copy link

raphamorim commented Mar 5, 2025

@ErichDonGubler I apologize, I haven't updated the fork on GH. Just ran a git push 🙏

Regarding that hash I confess I did the fork and published as a test to if it was something worth to maintain and use for wgpu, but in case we plan to use half fork then I just updated the tree to only contain @FL33TW00D changes (along with Cargo.toml)

Also please bump to 2.4.2 https://crates.io/crates/half-2

@cwfitzgerald
Copy link
Member

All comments should be addressed.

@FrankenApps
Copy link
Contributor

Btw.: half was recently updated with the PR on which this depends.

@cwfitzgerald
Copy link
Member

Yup! I also updated it to use half 2.5 again

@ErichDonGubler
Copy link
Member

@gfx-rs/wgpu: I will take on Mozilla's audit workload for half.

Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

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

image

@ErichDonGubler ErichDonGubler self-assigned this Mar 19, 2025
@ErichDonGubler ErichDonGubler dismissed teoxoy’s stale review March 19, 2025 13:57

Teo's out, we've handled his previous feedback, and we can iterate on his feedback in follow-up PRs.

@ErichDonGubler
Copy link
Member

Resolved conflicts with the extraction of the ir module in naga, and added efabbf6 for a bit of clarity with the num-traits upgrade.

@ErichDonGubler ErichDonGubler enabled auto-merge (squash) March 19, 2025 13:58
@raphamorim
Copy link

image

image

LET'S GOOOO, great job folks 🙏

@ErichDonGubler ErichDonGubler merged commit c628679 into gfx-rs:trunk Mar 19, 2025
37 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in WebGPU for Firefox Mar 19, 2025
@cwfitzgerald
Copy link
Member

Wooooooooooooo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cts Issues stemming from the WebGPU Conformance Test Suite area: naga back-end Outputs of naga shader conversion area: naga front-end area: naga processing Passes over IR in the middle backend: webgpu Issues with direct interface with WebGPU lang: WGSL WebGPU Shading Language naga Shader Translator type: enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

WGSL: Support the enable directive [meta] f16 support
9 participants