Memory Synchronization Failure #6629
-
Context: The wgpu project that I'm working on seems to produce a race condition which causes different threads to see different values even after a Apologies that the example isn't more minimal. The relevant code is essentially just this line which checks the same location and writes to different locations in the same storage buffer on different threads. The value should be My questions are:
Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This is a petty common misconception about storageBarrier(), it only applies within the workgroup. That is, that ensures the entire workgroup will see all of the workgroups writes to global memory. If you need to synchronize the entire dispatch, you need to use two dispatches. |
Beta Was this translation helpful? Give feedback.
This is a petty common misconception about storageBarrier(), it only applies within the workgroup. That is, that ensures the entire workgroup will see all of the workgroups writes to global memory. If you need to synchronize the entire dispatch, you need to use two dispatches.