-
From a question on the matrix chat.
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
In short: workgroupBarrier and storageBarrier cannot be used to synchronize memory accesses between different workgroups. From the spec, see https://www.w3.org/TR/WGSL/#scoped-operations and https://www.w3.org/TR/WGSL/#sync-builtin-functions and the last bit of https://www.w3.org/TR/WGSL/#compute-shader-workgroups (where the spec says workgroups execute independently in the sense that one workgroup can't block another workgroup). In hopefully more digestible terms:
Why does WGSL have this limitation. Atomics are a different story. They can provide visibility and availability guarantees in storage address space and across workgroups. From https://www.w3.org/TR/WGSL/#atomic-types
Think of "QueueFamily" as device-wide. I hope I got all that right, and I hope that's helpful. |
Beta Was this translation helpful? Give feedback.
-
If we want to put this explanation in the spec, this becomes editorial? |
Beta Was this translation helpful? Give feedback.
-
I lean against. There is so much more required to explain than this well. E.g. a synchronization chain through barrier -> atomic -> atomic -> barrier. |
Beta Was this translation helpful? Give feedback.
-
WGSL 2023-03-07 Minutes
|
Beta Was this translation helpful? Give feedback.
In short: workgroupBarrier and storageBarrier cannot be used to synchronize memory accesses between different workgroups.
From the spec, see https://www.w3.org/TR/WGSL/#scoped-operations and https://www.w3.org/TR/WGSL/#sync-builtin-functions and the last bit of https://www.w3.org/TR/WGSL/#compute-shader-workgroups (where the spec says workgroups execute independently in the sense that one workgroup can't block another workgroup).
In hopefully more digestible terms:
a workgroupBarrier: coordinates the following among all invocations in the current workgroup: