[llvm] [LangRef] Rewrite the elementwise atomic description and reject seq_cst elementwise atomics (PR #209931)

Ralf Jung via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 04:04:28 PDT 2026


================
@@ -4181,6 +4181,29 @@ Otherwise, an atomic operation that is not marked
 monotonic modification order with other operations that are not marked
 `syncscope("singlethread")` or `syncscope("<target-scope>")`.
 
+(elementwise-atomics)=
+
+### Elementwise Atomic Operations
+
+Certain atomic instructions, such as {ref}`atomicrmw <i_atomicrmw>`,
+and {ref}`atomic load <i_load>`, may be marked `elementwise`. The access type
+must then be a fixed vector type whose total bit width is a power of two greater
+than or equal to eight, and whose element type is supported by the corresponding
+scalar atomic instruction.
+
+For the purposes of the happens-before relation, the instruction behaves as if
+one thread were spawned per element, each performing the corresponding scalar
+atomic operation on that element, and then joining after completion. For the
+purposes of `syncscope`, each scalar operation is still considered to execute
+in the same thread as the original instruction. Synchronizing with one of the
+scalar operations does not, by itself, establish a happens-before relationship
+with another scalar operation from the same `elementwise` instruction.
+
+The instruction's `syncscope` and {ref}`ordering <ordering>` apply
+independently to each scalar operation and the `ordering` may not be `seq_cst`.
----------------
RalfJung wrote:

What does the "apply independently" here mean that's not already said in the previous paragraph?

https://github.com/llvm/llvm-project/pull/209931


More information about the llvm-commits mailing list