Skip to content
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

[spv-in] Atomics support #4489

Open
schell opened this issue Apr 7, 2023 · 7 comments
Open

[spv-in] Atomics support #4489

schell opened this issue Apr 7, 2023 · 7 comments
Labels
area: naga front-end lang: SPIR-V Vulkan's Shading Language naga Shader Translator type: enhancement New feature or request

Comments

@schell
Copy link
Contributor

schell commented Apr 7, 2023

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.

Follow Up

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

@schell
Copy link
Contributor Author

schell commented Nov 24, 2023

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.

@tombh
Copy link

tombh commented Sep 18, 2024

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?

@cwfitzgerald
Copy link
Member

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

@schell
Copy link
Contributor Author

schell commented Sep 18, 2024

@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.

@cwfitzgerald
Copy link
Member

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

@tombh
Copy link

tombh commented Sep 18, 2024

Great news @schell! I atomically increment your awesomeness 😆

@schell
Copy link
Contributor Author

schell commented Sep 18, 2024

Great news @schell! I atomically increment your awesomeness 😆

OMG that's a good one 🤣 ! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga front-end lang: SPIR-V Vulkan's Shading Language naga Shader Translator type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants