Skip to content

Conversation

@PhenaOfMari
Copy link
Contributor

@PhenaOfMari PhenaOfMari commented Apr 25, 2025

Description
Naga's SpirV ingest currently has support for control barriers, but not memory-only barriers. This PR endeavors to add this support for SpirV in as well as any language out that may make proper use of them. Languages that don't support memory barriers without an execution barrier will follow the existing Control Barrier path.

Additionally, Control Barriers for SpirV in and out have no distinction between workgroup and subgroup memory scopes. Support for that has been added as a separate commit, which can easily be pulled out into a separate pull request if desired.

Testing
I've compiled a simple shader with rust-gpu that utilizes their memory_barrier function. These changes allow the compiled shader to be parsed and executed, where previously the validator would panic that OpMemoryBarrier was unsupported. I've also added a spvasm file to naga/tests/in/spv that compiles to all backends.

Squash or Rebase
Both commits should be able to stand on their own if whoever does the merge prefers to rebase. Either way is fine.

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.

@PhenaOfMari PhenaOfMari force-pushed the spv-memory-barriers branch 3 times, most recently from c867f55 to cf1d916 Compare April 26, 2025 02:15
@PhenaOfMari PhenaOfMari marked this pull request as ready for review April 26, 2025 02:30
@PhenaOfMari PhenaOfMari force-pushed the spv-memory-barriers branch 2 times, most recently from de56a4a to d1ec6c8 Compare May 8, 2025 04:02
@LegNeato
Copy link
Contributor

This looks great, can't wait for it to land!

@PhenaOfMari PhenaOfMari force-pushed the spv-memory-barriers branch from d1ec6c8 to 20d22a5 Compare May 26, 2025 19:42
@jimblandy jimblandy requested a review from teoxoy June 4, 2025 15:14
@teoxoy teoxoy self-assigned this Jun 4, 2025
@PhenaOfMari PhenaOfMari force-pushed the spv-memory-barriers branch from 20d22a5 to 15fb018 Compare June 5, 2025 00:57
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 good overall!

@PhenaOfMari PhenaOfMari force-pushed the spv-memory-barriers branch from 15fb018 to 6eed94b Compare June 11, 2025 01:29
@teoxoy teoxoy merged commit 486a77d into gfx-rs:trunk Jun 16, 2025
40 checks passed
@PhenaOfMari PhenaOfMari deleted the spv-memory-barriers branch June 16, 2025 22:35
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.

4 participants