pub fn sync_storage()Expand description
[sync_cube] over storage memory (input args) rather than shared memory, and the one
synchronization that reaches past the cube.
Every unit of the cube must reach it, and it is a [sync_cube] as well as what follows, so a
value one unit leaves in shared memory before it is readable by the rest after it. On top of
that cube barrier it is a release and an acquire at device scope: every write this cube made to storage before it is
visible to any other cube that calls it afterwards, and every write another cube published
before its own call is visible here after it. That is what lets cubes hand each other partial
results — publish, sync_storage, then announce through an atomic — with no second dispatch.
Only where the runtime says so. WebGPU’s memory model promises nothing across workgroups,
so on a backend whose
device_memory_scope is false this is a cube
barrier and no more, and a cube reading another’s writes may read them stale. Ask before
launching a kernel that depends on the promise.