[llvm] [AMDGPU] Disable atomic optimization of fadd/fsub with result (PR #96479)

Pravin Jagtap via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 21:36:43 PDT 2024


================
@@ -224,7 +224,14 @@ void AMDGPUAtomicOptimizerImpl::visitAtomicRMWInst(AtomicRMWInst &I) {
     return;
   }
 
-  const bool ValDivergent = UA->isDivergentUse(I.getOperandUse(ValIdx));
+  bool ValDivergent = UA->isDivergentUse(I.getOperandUse(ValIdx));
+
+  if ((Op == AtomicRMWInst::FAdd || Op == AtomicRMWInst::FSub) &&
+      !I.use_empty()) {
+    // Disable the uniform return value calculation using fmul because it
+    // mishandles infinities, NaNs and signed zeros. FIXME.
+    ValDivergent = true;
----------------
pravinjagtap wrote:

If I understand correctly, are we forcing atomic fadd/fsub to take either Iterative/DPP approach by setting `ValDivergent = true` for all the cases (including mishandled cases and normal/valid uniform float values)?

https://github.com/llvm/llvm-project/pull/96479


More information about the llvm-commits mailing list