Skip to content

question: can barriers synchronize memory accesses across workgroups #3935

Answered by dneto0
dneto0 asked this question in Q&A
Discussion options

You must be logged in to vote

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:

    • memory writes to variables in workgroup address space complete, e.g. writes that were initiated actually land in the workgroup add…

Replies: 4 comments

Comment options

dneto0
Jan 25, 2023
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by dneto0
Comment options

You must be logged in to vote
0 replies
Comment options

dneto0
Jan 31, 2023
Maintainer Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
wgsl WebGPU Shading Language Issues whynot Explain why WGSL has or does not have a feature
2 participants
Converted from issue

This discussion was converted from issue #3774 on March 08, 2023 00:09.