[llvm] [LangRef] Clarify what "not ordered" means in the elementwise description and reject seq_cst elementwise atomics (PR #209931)
Ralf Jung via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 15 23:21:30 PDT 2026
RalfJung wrote:
> Is it necessarily a contradiction? How is it different from two seq_cst operations performed by two threads? They are in some order, and that order can be different for every execution. As long as all threads in a given execution agree on the order in which the elementwise seq_cst happened, does it matter if the instruction itself does not specify an ordering as seen by the programmer?
The point is that there is not mean to be a total order of the per-element accesses in the SC order. The backend does not emit enough fences to achieve such a total order. So we have to either adjust how backends compile `elementwise` or we have to adjust the LangRef to match reality -- and it is very unclear what reality looks like because we'd have to somehow make SC not a total order any more, or something like that.
In lieu of a good usecase for even wanting SC here, and in lieu of any idea what the exact semantics should be, it seems best to simply forbid this case for now (especially for the imminent LLVM 23 branching).
https://github.com/llvm/llvm-project/pull/209931
More information about the llvm-commits
mailing list