[all-commits] [llvm/llvm-project] b76dd4: [AMDGPU] Disable atomic optimization of fadd/fsub ...

Jay Foad via All-commits all-commits at lists.llvm.org
Wed Jul 3 03:36:13 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b76dd4edbfbba5593b691ef92b755f25cf63f445
      https://github.com/llvm/llvm-project/commit/b76dd4edbfbba5593b691ef92b755f25cf63f445
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2024-07-03 (Wed, 03 Jul 2024)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp
    M llvm/test/CodeGen/AMDGPU/GlobalISel/global-atomic-fadd.f32-rtn.ll
    M llvm/test/CodeGen/AMDGPU/global-atomic-fadd.f32-rtn.ll
    M llvm/test/CodeGen/AMDGPU/global-atomicrmw-fadd-wrong-subtarget.ll
    M llvm/test/CodeGen/AMDGPU/global_atomic_optimizer_fp_rtn.ll
    M llvm/test/CodeGen/AMDGPU/local-atomicrmw-fadd.ll

  Log Message:
  -----------
  [AMDGPU] Disable atomic optimization of fadd/fsub with result (#96479)

An atomic fadd instruction like this should return %x:

  ; value at %ptr is %x
  %r = atomicrmw fadd ptr %ptr, float %y

After atomic optimization, if %y is uniform, the result is calculated
as %r = %x + * %y * +0.0. This has a couple of problems:

1. If %y is Inf or NaN, this will return NaN instead of %x.
2. If %x is -0.0 and %y is positive, this will return +0.0 instead of
   -0.0.

Avoid these problems by disabling the "%y is uniform" path if there are
any uses of the result.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list