[PATCH] D112760: Require 'contract' fast-math flag for FMA generation
Andy Kaylor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 28 14:35:15 PDT 2021
andrew.w.kaylor created this revision.
andrew.w.kaylor added reviewers: arsenm, spatel, yaxunl, pengfei, craig.topper, zahiraam.
Herald added subscribers: ecnelises, kerbowa, hiraditya, tpr, nhaehnle, jvesely.
andrew.w.kaylor requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Currently, the target-independent backend codegen will allow the generation of FMA instructions if *either* the 'contract' fast-math flag is set OR TargetOption::AllowFPOpFusion is set to FPOpFusion::Fast OR the TargetOption::UnsafeFPMath flag is set. This allows fp contraction to be controlled by a means other than the IR and prevents the generation of IR (by a front end) that would enable fusion in some functions and disable it in others.
Note: This change would render the clang -ffp-contract=fast-honor-pragma option obsolete. It also makes the llc -fp-contract option non-functional. These options will be removed in a later patch.
Also note: There are 17 additional lit tests that fail with this change. I updated tests for the X86 and AMDGPU backends (to have one I was familiar with and another I wasn't). It's tedious work, so I didn't want to update all the tests without getting feedback on this direction. Obviously, I'd fix all the tests before committing this patch. There may be a change needed to the front end for CUDA and HIP support before this patch is committed, but I'd like to keep that separate.
I'll send an RFC to llvm-dev to draw more attention to this proposed change.
https://reviews.llvm.org/D112760
Files:
clang/test/CodeGenCUDA/fp-contract.cu
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AMDGPU/fdot2.ll
llvm/test/CodeGen/AMDGPU/fma-combine.ll
llvm/test/CodeGen/AMDGPU/fmul-2-combine-multi-use.ll
llvm/test/CodeGen/AMDGPU/fmuladd.f16.ll
llvm/test/CodeGen/AMDGPU/fmuladd.f32.ll
llvm/test/CodeGen/AMDGPU/fmuladd.f64.ll
llvm/test/CodeGen/AMDGPU/fmuladd.v2f16.ll
llvm/test/CodeGen/AMDGPU/mad-combine.ll
llvm/test/CodeGen/AMDGPU/madak.ll
llvm/test/CodeGen/X86/avx512-fma.ll
llvm/test/CodeGen/X86/fma-do-not-commute.ll
llvm/test/CodeGen/X86/fma_patterns.ll
llvm/test/CodeGen/X86/fma_patterns_wide.ll
llvm/test/CodeGen/X86/sqrt-fastmath-mir.ll
llvm/test/CodeGen/X86/sqrt-fastmath.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112760.383167.patch
Type: text/x-patch
Size: 148567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211028/9021d1ab/attachment-0001.bin>
More information about the llvm-commits
mailing list