Skip to content

[spv-in] Atomics support #4489

Closed
Closed

Description

@schell

Naga's SPIR-V frontend does not currently handle atomic operations. Using an atomic operation (in this case spirv_std::arch::atomic_i_increment in a rust-gpu shader) leads to a parse error:

UnsupportedInstruction(Function, AtomicIIncrement)

I'm treating this as the tracking issue for adding atomics to the spv frontend.

Milestone 1

Completion of milestone 1 will be a proof-of-strategy, after which that strategy can be re-applied to complete atomics support for all operations. First atomic operations support will be documented in the renderling devlog as a method / PoC to help in the completion of other operations.

Milestone 2

Rinse and repeat, adding support for more atomic operations, until all have been exhausted.

Milestone 3 & Follow up work

Cleaning up tests, bugfixes that might pop up, and generally making this feature more maintainable - tying up any loose ends.

Activity

  1. transferred this issue fromgfx-rs/nagaon Oct 25, 2023
  2. schell commented on Nov 24, 2023

    @schell
    ContributorAuthor

    I've submitted a proposal to NLNet to fund this issue. If they accept my proposal I'll likely pick this up after the holidays.

  3. tombh commented on Sep 18, 2024

    @tombh

    So AtomicIIncrement is working in v22.0? I'm just wondering if Bevy's upcoming v0.15 release (the current release is still on naga v0.20.0) will support some SPIRV atomics. Though I understand we'll have to wait for #5824 to get more functions, like say AtomicIDecrement. Also, I wonder if that will be a patch bump so that we can use Cargo's [patch.crates-io] to get more atomics?

  4. cwfitzgerald commented on Sep 18, 2024

    @cwfitzgerald
    Member

    This is just parsing, not fully translating them, as far as im aware. @schell is that a correct assessment?

  5. schell commented on Sep 18, 2024

    @schell
    ContributorAuthor

    @tombh AtomicIIncrement should indeed be working in 0.22! Please let me know if naga does not accept your shader that uses this op!

    @cwfitzgerald #5702 was the parsing portion of support for AtomicIIncrement and #5775 is actually the bulk of atomics support (it's the whole type-upgrade thing). #5824 add support for parsing more ops and after it lands naga will support all atomic ops except for AtomicCompareExchange, which is going to take just a bit more infrastructure to support.

  6. cwfitzgerald commented on Sep 18, 2024

    @cwfitzgerald
    Member

    Oh snap, how did I miss that! That's awesome

  7. tombh commented on Sep 18, 2024

    @tombh

    Great news @schell! I atomically increment your awesomeness 😆

  8. schell commented on Sep 18, 2024

    @schell
    ContributorAuthor

    Great news @schell! I atomically increment your awesomeness 😆

    OMG that's a good one 🤣 ! 🙇

  9. schell commented on Dec 17, 2024

    @schell
    ContributorAuthor

    Well - this has been great. This work is now all wrapped up and tied with a bow!

    Thanks @jimblandy ! 🙇

    😿 😄 🚀 ☕ ☕ ☕

  10. cwfitzgerald commented on Dec 17, 2024

    @cwfitzgerald
    Member

    This is amazing! Thank you so much!

  11. schell commented on Dec 17, 2024

    @schell
    ContributorAuthor

    Thank you too, @cwfitzgerald 🙇 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions