[spv-in] Atomics support
schell opened this issue ยท 7 comments
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.
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.
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?
This is just parsing, not fully translating them, as far as im aware. @schell is that a correct assessment?
@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.
Oh snap, how did I miss that! That's awesome