Skip to content

Commit e34d2e1

Browse files
authored
[LangRef] Add MMRA documentation (#156310)
MMRAs were missing from LangRef.
1 parent 2b5e105 commit e34d2e1

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

llvm/docs/LangRef.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4480,7 +4480,7 @@ the type size is smaller than the type's store size.
44804480
< vscale x <# elements> x <elementtype> > ; Scalable vector
44814481

44824482
The number of elements is a constant integer value larger than 0;
4483-
elementtype may be any integer, floating-point, pointer type, or a sized
4483+
elementtype may be any integer, floating-point, pointer type, or a sized
44844484
target extension type that has the ``CanBeVectorElement`` property. Vectors
44854485
of size zero are not allowed. For scalable vectors, the total number of
44864486
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.
83518351
The behavior is undefined if the runtime memory address does
83528352
resolve to an object defined in one of the indicated address spaces.
83538353

8354+
'``mmra``' Metadata
8355+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8356+
8357+
The ``mmra`` metadata represents target-defined properties on instructions that
8358+
can be used to selectively relax constraints placed by the memory model.
8359+
8360+
Refer to :doc:`MemoryModelRelaxationAnnotations` for more information on how this metadata
8361+
affects the memory model of a given target.
8362+
8363+
It is attached to memory instructions such as:
8364+
:ref:`atomicrmw <i_atomicrmw>`, :ref:`cmpxchg <i_cmpxchg>`, :ref:`load <i_load>`,
8365+
:ref:`store <i_store>`, :ref:`fence <i_fence>` and
8366+
:ref:`call <i_call>` instructions that read or write memory.
8367+
8368+
The metadata is structured as pairs of strings: a prefix, and suffix that form a MMRA "tag".
8369+
The ``!mmra`` operand can either point to a pair of metadata strings, or a tuple containing
8370+
multiple pairs of metadata strings.
8371+
8372+
Example:
8373+
8374+
.. code-block:: llvm
8375+
8376+
; Simple pair of strings used directly:
8377+
%rmw.valid = atomicrmw and ptr %ptr, i64 %value seq_cst, !mmra !0
8378+
8379+
; Using multiple pairs of strings using a metadata tuple:
8380+
%rmw.valid = atomicrmw and ptr %ptr, i64 %value seq_cst, !mmra !2
8381+
8382+
!0 = !{!"amdgpu-synchronize-as", !"global"}
8383+
!1 = !{!"amdgpu-synchronize-as", !"private"}
8384+
!2 = !{!0, !1}
83548385

83558386
Module Flags Metadata
83568387
=====================

0 commit comments

Comments
 (0)