[llvm] [Doc][AMDGPU] Add barrier execution & memory model (PR #170447)
Fabian Ritter via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 19 07:46:21 PST 2026
ritter-x2a wrote:
> > I think if we'd use the term "happens-before" in LLVM, we would need to stick to the relation defined here: https://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations
> That would mean that if an initialized shared variable x is written in one thread A, then A barrier-synchronizes with another thread B, and B reads x after the barrier-sync (and no other accesses happen), B must see the value written by A (which is not the intention, without additional fences/synchronization, as I understood it).
>
> Right. I wonder if I should add `happens-before` to `barrier-executes-before` and wherever I'd use `happens-before`, I instead use `barrier-executes-before` ?
It took a bit of getting used to for me, but I think that makes sense. The point of `barrier-executes-before` would then be to capture all cases where the programmer can be sure that one thing has executed before the other, which can be obtained through barrier synchronization, through program order (in hb), or through memory synchronization (via release/acquire, in hb).
And this kind of executes-before relation should probably also be sufficient to separate barrier inits from subsequent barrier ops.
https://github.com/llvm/llvm-project/pull/170447
More information about the llvm-commits
mailing list