Skip to content

[naga]: Add no_std polyfill for round_ties_even for f32 and f64 #7585

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 3 commits into from
May 8, 2025

Conversation

bushrat011899
Copy link
Contributor

@bushrat011899 bushrat011899 commented Apr 21, 2025

Connections

Description

  • Generalizes the round_ties_even f16 polyfill for f32 and f64 using num_traits::float::FloatCore, specifically for no_std support
  • Adds naga to the Check no_std CI action now that it is MVP compatible

Testing

  • CI

Squash or Rebase?

Squash

Checklist

  • Run cargo fmt.
  • Run taplo format. N/A
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

Notes

  • I haven't added a feature to switch back to f32::round_ties_even or f64::round_ties_even, since I don't believe there is substantial value added with such a feature.
  • I have not added tests for the implementation, since it is based on the existing f16 polyfill. However, there are substantial tests for this exact method in this num-traits PR I opened. This PR would just allow us to continue working on no_std support while we wait for that PR to be accepted (or not).

@bushrat011899 bushrat011899 requested a review from a team as a code owner April 21, 2025 10:05
@bushrat011899 bushrat011899 changed the title Add no_std polyfill for round_ties_even for f32 and f64 [naga]: Add no_std polyfill for round_ties_even for f32 and f64 Apr 21, 2025
@ErichDonGubler ErichDonGubler self-assigned this Apr 21, 2025
@cwfitzgerald
Copy link
Member

cwfitzgerald commented Apr 25, 2025

This PR will actually fix cargo check -p naga, whcih is broken


# Check with all features except "std".
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu-types --no-default-features --features strict_asserts,fragile-send-sync-non-atomic-wasm,serde,counters
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p naga --no-default-features --features dot-out,compact
Copy link
Member

Choose a reason for hiding this comment

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

This comment isn't correct for naga - I think you should pull them out into their own lines instead of attaching them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've just updated the comments to be more broad. I do like the two groups (no features, all compatible features), but I'm happy to split it up (either crate by crate or just each line on it's own)

Update comments around `no_std` CI task
@bushrat011899 bushrat011899 requested a review from cwfitzgerald May 7, 2025 23:18
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Good after nit

Co-Authored-By: Connor Fitzgerald <[email protected]>
@cwfitzgerald cwfitzgerald merged commit f04391d into gfx-rs:trunk May 8, 2025
37 checks passed
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.

3 participants