[llvm] [NVPTX] Respect FTZ flag when lowering atomicrmw fadd. (PR #200732)
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 14:47:21 PDT 2026
jlebar wrote:
Yeah, this could regress the performance of some programs.
IME code generators like Triton often use inline asm when they Care Deeply about what exactly gets generated. Today that's kind of the only option you have if you want to express that a particular operation gets lowered to a particular set of PTX instructions. If the net effect of this patch is that we push people towards using inline asm for their atom.add's, I don't think that's the wrong direction (at least, until LLVM grows the ability to specify these operations more surgically).
Also, this one was particularly bad because even when FTZ was disabled we'd generate atom.add.f32, silently *introducing* FTZ behavior. If we wanted "moar FTZ" we could enable atom.add on the generic and shared address spaces when function-level FTZ is enabled.
> we don't have any evidence any real user code cares about.
We also don't have evidence that real user code is slowed down by these additional loops, though.
I'm reminded of an XLA:GPU change we made at Waymo that upgraded the precision of some mathematical operations. Folks argued that we should do this because it was faster and a strict improvement to the mathematical accuracy. My argument was that we shouldn't do it because it was semantically incorrect. We ended up guarding it with a flag, because we didn't have evidence from real users either way. Some months later we found real programs that were broken by the upgraded precision.
https://github.com/llvm/llvm-project/pull/200732
More information about the llvm-commits
mailing list