[PATCH] D129690: [LLVM][AMDGPU] Specialize 32-bit atomic fadd instruction for generic address space

Shilei Tian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 13:28:43 PDT 2022


tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, arsenm.
Herald added subscribers: kosarev, jsilvanus, foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: All.
tianshilei1992 requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

The 32-bit floating-point atomic add instructions on AMDGPUs does not support a
"flat" or "generic" address space. So, if the address space cannot be determined
statically, the AMDGPU backend will fall back to a CAS loop (which does support
"flat" addressing). Instead, this patch emits runtime address-space checks to
allow native FP atomic add instructions for global and LDS memory (and non-atomic
FP add instructions for private/scratch memory).

In order to do that, this patch introduces a new interface function
`emitExpandAtomicRMW`. It is expected to be called when a common atomic expand
doesn't work for a specific target, such as the case we discussed here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129690

Files:
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/AtomicExpandPass.cpp
  llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  llvm/lib/Target/AMDGPU/SIISelLowering.h
  llvm/test/CodeGen/AMDGPU/atomicrmw-expand.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129690.444405.patch
Type: text/x-patch
Size: 9654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220713/7bf4e47a/attachment.bin>


More information about the llvm-commits mailing list