Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMDGPU: Add description for new atomicrmw metadata #85052

Merged
merged 24 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2cc2dd6
AMDGPU: Don't use table for metadata docs, and fix section headers
arsenm Mar 13, 2024
29794bc
AMDGPU: Add description for amdgpu.no.access.location.types metadata
arsenm Mar 13, 2024
852d895
Merge branch 'main' into amdgpu-atomic-metadata
arsenm Apr 15, 2024
6155303
Add comments to metadata examples
arsenm Apr 15, 2024
4c5c29f
Split into separate metadata components
arsenm Apr 15, 2024
b8f471c
Fix metadata reference links
arsenm Apr 16, 2024
2ee7ee6
Define denormal mode atomic metadata
arsenm Apr 16, 2024
9a15f6f
Drop host part of no fined grained metadata
arsenm Apr 18, 2024
ec02ead
Add note that amdgpu.no.remote.memory.access is usually sufficient to…
arsenm Apr 18, 2024
79db05f
Rename
arsenm Apr 18, 2024
0678218
Reorder documentation sections
arsenm Apr 18, 2024
e6cb77f
Clarify no remote implies host or peer device
arsenm Apr 18, 2024
e359880
Consistently spell fine-grained
arsenm Apr 18, 2024
f46a8aa
Another note about amdgpu.ignore.denormal.mode
arsenm Apr 18, 2024
47c30e1
Merge branch 'main' into amdgpu-atomic-metadata
arsenm Apr 18, 2024
0516ba2
Fix release notes
arsenm Apr 19, 2024
1c949ff
Merge branch 'main' into amdgpu-atomic-metadata
arsenm Apr 22, 2024
5e68ec4
Remove access from metadata name
arsenm Apr 22, 2024
8c5372d
Merge branch 'main' into amdgpu-atomic-metadata
arsenm May 3, 2024
e3e9985
Merge branch 'main' into amdgpu-atomic-metadata
arsenm May 6, 2024
3fe49d5
Merge branch 'main' into amdgpu-atomic-metadata
arsenm May 9, 2024
7e66bd2
Merge branch 'main' into amdgpu-atomic-metadata
arsenm May 17, 2024
6a286a3
Merge branch 'main' into amdgpu-atomic-metadata
arsenm May 31, 2024
bfcabae
Merge branch 'main' into amdgpu-atomic-metadata
arsenm Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions llvm/docs/AMDGPUUsage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,84 @@ arguments.

%val = load i32, ptr %in, align 4, !amdgpu.last.use !{}

'``amdgpu.no.remote.memory``' Metadata
---------------------------------------------

Asserts a memory operation does not access bytes in host memory, or
remote connected peer device memory (the address must be device
local). This is intended for use with :ref:`atomicrmw <i_atomicrmw>`
and other atomic instructions. This is required to emit a native
hardware instruction for some :ref:`system scope
<amdgpu-memory-scopes>` atomic operations on some subtargets. For most
integer atomic operations, this is a sufficient restriction to emit a
native atomic instruction.

An :ref:`atomicrmw <i_atomicrmw>` without metadata will be treated
conservatively as required to preserve the operation behavior in all
cases. This will typically be used in conjunction with
:ref:`\!amdgpu.no.fine.grained.memory<amdgpu_no_fine_grained_memory>`.


.. code-block:: llvm

; Indicates the atomic does not access fine-grained memory, or
; remote device memory.
%old0 = atomicrmw sub ptr %ptr0, i32 1 acquire, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory !0

; Indicates the atomic does not access peer device memory.
%old2 = atomicrmw sub ptr %ptr2, i32 1 acquire, !amdgpu.no.remote.memory !0

!0 = !{}

.. _amdgpu_no_fine_grained_memory:

'``amdgpu.no.fine.grained.memory``' Metadata
-------------------------------------------------

Asserts a memory access does not access bytes allocated in
fine-grained allocated memory. This is intended for use with
:ref:`atomicrmw <i_atomicrmw>` and other atomic instructions. This is
required to emit a native hardware instruction for some :ref:`system
scope <amdgpu-memory-scopes>` atomic operations on some subtargets. An
:ref:`atomicrmw <i_atomicrmw>` without metadata will be treated
conservatively as required to preserve the operation behavior in all
cases. This will typically be used in conjunction with
:ref:`\!amdgpu.no.remote.memory.access<amdgpu_no_remote_memory_access>`.

.. code-block:: llvm

; Indicates the access does not access fine-grained memory, or
; remote device memory.
%old0 = atomicrmw sub ptr %ptr0, i32 1 acquire, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory.access !0

; Indicates the access does not access fine-grained memory
%old2 = atomicrmw sub ptr %ptr2, i32 1 acquire, !amdgpu.no.fine.grained.memory !0

!0 = !{}

.. _amdgpu_no_remote_memory_access:

'``amdgpu.ignore.denormal.mode``' Metadata
------------------------------------------

For use with :ref:`atomicrmw <i_atomicrmw>` floating-point
operations. Indicates the handling of denormal inputs and results is
insignificant and may be inconsistent with the expected floating-point
mode. This is necessary to emit a native atomic instruction on some
targets for some address spaces where float denormals are
unconditionally flushed. This is typically used in conjunction with
:ref:`\!amdgpu.no.remote.memory.access<amdgpu_no_remote_memory_access>`
and
:ref:`\!amdgpu.no.fine.grained.memory<amdgpu_no_fine_grained_memory>`


.. code-block:: llvm

%res0 = atomicrmw fadd ptr addrspace(1) %ptr, float %value seq_cst, align 4, !amdgpu.ignore.denormal.mode !0
%res1 = atomicrmw fadd ptr addrspace(1) %ptr, float %value seq_cst, align 4, !amdgpu.ignore.denormal.mode !0, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory.access !0

!0 = !{}


LLVM IR Attributes
==================
Expand Down
2 changes: 2 additions & 0 deletions llvm/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ Changes to the AMDGPU Backend
-----------------------------

* Implemented the ``llvm.get.fpenv`` and ``llvm.set.fpenv`` intrinsics.
* Added ``!amdgpu.no.fine.grained.memory`` and
``!amdgpu.no.remote.memory`` metadata to control atomic behavior.

* Implemented :ref:`llvm.get.rounding <int_get_rounding>` and :ref:`llvm.set.rounding <int_set_rounding>`

Expand Down