Skip to content

Fix portable-atomic on wgpu-hal #7735

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

Open
wants to merge 11 commits into
base: trunk
Choose a base branch
from

Conversation

bushrat011899
Copy link
Contributor

@bushrat011899 bushrat011899 commented May 30, 2025

Connections

Description

wgpu-hal has a portable-atomic feature, but alloc::sync::Arc is unconditionally used, causing a compilation failure on thumbv6m-none-eabi, as this target does not support atomic pointers. This can be almost trivially resolved by using portable-atomic-util, which provides an API-compatible Arc based on portable-atomic.

Note that while WGPU does not support thumbv6m-none-eabi (and it is not tested in CI), I am using it to represent targets without atomic pointers that the project may wish to support in the future.

Also note that this PR is branched from #7599, as no_std support is required to test the atomics failure condition. Once #7599 is merged, this PR will reduce to its most recent commit.

Finally, to ensure portable-atomic is kept out of the dependency graph, it is up to users to enable once_cell/portable-atomic on their own when required.

Testing

  • Checked compilation on thumbv6m-none-eabi

Squash or Rebase?

Squash

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • 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. N/A

@bushrat011899 bushrat011899 requested review from a team and crowlKats as code owners May 30, 2025 03:45
@bushrat011899 bushrat011899 changed the title Portable atomic wgpu hal Fix portable-atomic on wgpu-hal May 30, 2025
For atomic compatibility, users must enable `once_cell/portable-atomic` on their own.
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.

1 participant