You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But when compiling I get an error saying this is not supported yet.
error: store_with_flags is not supported yet: MemFlags(VOLATILE)
--> /home/peyton/.rustup/toolchains/nightly-2025-06-30-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:2180:9
|
2180 | intrinsics::volatile_store(dst, src);| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It would be very useful to be able to specify this in loads. It seems like its possible in SPIRV using Memory Operands is there any way to do this currently?
SPIR-V doesn't have an equivalent to volatile. And I do not understand how this would be useful in any way either.
For intra-workgroup communication (within compute shaders) there's shared memory and subgroup ops.
But if you really want cross-workgroup communication, you need to have a look at the Vulkan Memory Model, specifically Acquire, Release, MakeAvailable and MakeVisible, all of which are so rarely used that you won't find any samples for it and likely a lot of driver bugs.
Ok thanks for the help on MakeAvailable and MakeVisible as that actually fixed my problem. I think reading though the specs I got a bit confused finding volatile within the Memory Operands for loads / stores.
Adding a memory barrier to my code after my writes fixed this bug for me:
I still wonder if it would be possible to define the memory semantics in the load / store operation it's self so I could drop this memory barrier and use MakePointerVisible and MakePointerAvailable on the memory operations themselves.
Probably not anytime soon, there's just too many other basic things to get working first (like Option...)
But it's super interesting to me that you are indeed doing cross-workgroup communication! Cause I've been looking for examples of that online and couldn't find any.
Just be aware for the forward progress guarantee that Vulkan requires of your shader, according to spec you can't be idling infinitely waiting for some other workgroup to send you data, as on a small enough GPU that other workgroup may not spawn due to the resources being occupied by e.g. the waiting workgroup.
Alright yeah that makes sense. I mean it's working for now so that's good! I'm working on a lock free queue and worker system for the GPU so cross workgroup communication is needed for synchronization. Once I've got it working I'll probably put it up on GitHub so maybe it will be useful to see as a use case with Rust GPU.
Activity
Firestar99 commentedon Jan 13, 2026
SPIR-V doesn't have an equivalent to volatile. And I do not understand how this would be useful in any way either.
For intra-workgroup communication (within compute shaders) there's shared memory and subgroup ops.
But if you really want cross-workgroup communication, you need to have a look at the Vulkan Memory Model, specifically Acquire, Release, MakeAvailable and MakeVisible, all of which are so rarely used that you won't find any samples for it and likely a lot of driver bugs.
voxelbee commentedon Jan 13, 2026
Ok thanks for the help on MakeAvailable and MakeVisible as that actually fixed my problem. I think reading though the specs I got a bit confused finding volatile within the Memory Operands for loads / stores.
Adding a memory barrier to my code after my writes fixed this bug for me:
I still wonder if it would be possible to define the memory semantics in the load / store operation it's self so I could drop this memory barrier and use
MakePointerVisibleandMakePointerAvailableon the memory operations themselves.Firestar99 commentedon Jan 13, 2026
Probably not anytime soon, there's just too many other basic things to get working first (like
Option...)But it's super interesting to me that you are indeed doing cross-workgroup communication! Cause I've been looking for examples of that online and couldn't find any.
Just be aware for the forward progress guarantee that Vulkan requires of your shader, according to spec you can't be idling infinitely waiting for some other workgroup to send you data, as on a small enough GPU that other workgroup may not spawn due to the resources being occupied by e.g. the waiting workgroup.
voxelbee commentedon Jan 15, 2026
Alright yeah that makes sense. I mean it's working for now so that's good! I'm working on a lock free queue and worker system for the GPU so cross workgroup communication is needed for synchronization. Once I've got it working I'll probably put it up on GitHub so maybe it will be useful to see as a use case with Rust GPU.