[PATCH] D156301: [AMDGPU] Support FAdd/FSub global atomics in AMDGPUAtomicOptimizer.

Pravin Jagtap via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 22:12:12 PDT 2023


pravinjagtap added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp:805-807
+          B.CreateUnaryIntrinsic(Intrinsic::ctpop, Ballot), Int32Ty, false);
+      Value *const CtpopFP = B.CreateUIToFP(Ctpop, Ty);
+      NewV = B.CreateFMul(V, CtpopFP);
----------------
pravinjagtap wrote:
> arsenm wrote:
> > We don't have fast math flags on atomics, but you would need to expand to the add sequence without some kind of reassociate flag
> > 
> > 
> If the logic of `no-of-active-lanes * uniform float value` is not valid here for uniform value case, then can we use the logic implemented in `buildScanIteratively` for divergent values (even if the input value is uniform in atomics).
> 
> Or, we want sequence of additions avoiding the loop (branch instructions) that we have in `buildScanIteratively`. We also need to write back this intermediate values of sequence of additions if results is needed later in the kernel.
CC: @b-sumner @foad 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156301/new/

https://reviews.llvm.org/D156301



More information about the llvm-commits mailing list