[llvm] [IR] Add elementwise modifier to atomic loads (PR #204556)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 20:55:27 PDT 2026


================
@@ -12037,11 +12037,20 @@ If the ``load`` is marked as ``atomic``, it takes an extra :ref:`ordering
 Atomic loads produce :ref:`defined <memmodel>` results when they may see
 multiple atomic stores. The type of the pointee must be an integer, pointer,
 floating-point, or vector type whose bit width is a power of two greater than
-or equal to eight. ``align`` must be
-explicitly specified on atomic loads. Note: if the alignment is not greater or
-equal to the size of the `<value>` type, the atomic operation is likely to
-require a lock and have poor performance. ``!nontemporal`` does not have any
-defined semantics for atomic loads.
+or equal to eight.
+
+If the ``elementwise`` modifier is present, the loaded type must be a fixed
+vector type, and each element type must be a valid scalar atomic load type. The
+load has per-element vector atomic semantics: it behaves as if it were expanded
+into one scalar atomic load per element, and the element loads are not ordered
+with respect to each other. Without ``elementwise``, vector atomic loads keep
+whole-value atomic semantics.
+
+``align`` must be explicitly specified on atomic loads. Note: if the alignment
+is not greater than or equal to the size of the ``<ty>`` type, or the element
+type for an ``elementwise`` load, the atomic operation is likely to require a
+lock and have poor performance. ``!nontemporal`` does not have any defined
+semantics for atomic loads.
----------------
ssahasra wrote:

I guess the correct phrasing is that `!nontemporal` is ignored for atomics, i.e, they are treated as having "normal" temporality: neither streaming nor persistent. The question of what temporality means on an atomic just never came up, so at least AMDGPU did not bother to do anything more than default.

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


More information about the llvm-commits mailing list