[llvm] [LangRef] Add MMRA documentation (PR #156310)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 03:48:03 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Pierre van Houtryve (Pierre-vh)
<details>
<summary>Changes</summary>
MMRAs were missing from LangRef.
---
Full diff: https://github.com/llvm/llvm-project/pull/156310.diff
1 Files Affected:
- (modified) llvm/docs/LangRef.rst (+32-1)
``````````diff
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index b122fd352eaf5..5c56f3e9f56e7 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -4480,7 +4480,7 @@ the type size is smaller than the type's store size.
< vscale x <# elements> x <elementtype> > ; Scalable vector
The number of elements is a constant integer value larger than 0;
-elementtype may be any integer, floating-point, pointer type, or a sized
+elementtype may be any integer, floating-point, pointer type, or a sized
target extension type that has the ``CanBeVectorElement`` property. Vectors
of size zero are not allowed. For scalable vectors, the total number of
elements is a constant multiple (called vscale) of the specified number
@@ -8351,6 +8351,37 @@ spaces. The interpretation of the address space values is target specific.
The behavior is undefined if the runtime memory address does
resolve to an object defined in one of the indicated address spaces.
+'``mmra``' Metadata
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The ``mmra`` metadata represents target-defined properties on instructions that
+can be used to selectively relax constraints placed by the memory model.
+
+Refer to :doc:`MemoryModelRelaxationAnnotations` for more information on how this metadata
+affects the memory model of a given target.
+
+It is attached to memory instructions such as:
+:ref:`atomicrmw <i_atomicrmw>`, :ref:`cmpxchg <i_cmpxchg>`, :ref:`load <i_load>`,
+:ref:`store <i_store>`, :ref:`fence <i_fence>` and
+:ref:`call <i_call>` instructions that read or write memory.
+
+The metadata is structured as pairs of strings: a prefix, and suffix that form a MMRA "tag".
+The ``!mmra`` operand can either point to a pair of metadata strings, or a tuple containing
+multiple pairs of metadata strings.
+
+Example:
+
+.. code-block:: llvm
+
+ ; Simple pair of strings used directly:
+ %rmw.valid = atomicrmw and ptr %ptr, i64 %value seq_cst, !mmra !0
+
+ ; Using multiple pairs of strings using a metadata tuple:
+ %rmw.valid = atomicrmw and ptr %ptr, i64 %value seq_cst, !mmra !2
+
+ !0 = !{!"amdgpu-synchronize-as", !"global"}
+ !1 = !{!"amdgpu-synchronize-as", !"private"}
+ !2 = !{!0, !1}
Module Flags Metadata
=====================
``````````
</details>
https://github.com/llvm/llvm-project/pull/156310
More information about the llvm-commits
mailing list