[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 16:06:03 PDT 2024


================
@@ -182,18 +182,8 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang,
 
   Opts.HIP = Lang == Language::HIP;
   Opts.CUDA = Lang == Language::CUDA || Opts.HIP;
-  if (Opts.HIP) {
-    // HIP toolchain does not support 'Fast' FPOpFusion in backends since it
-    // fuses multiplication/addition instructions without contract flag from
-    // device library functions in LLVM bitcode, which causes accuracy loss in
-    // certain math functions, e.g. tan(-1e20) becomes -0.933 instead of 0.8446.
-    // For device library functions in bitcode to work, 'Strict' or 'Standard'
-    // FPOpFusion options in backends is needed. Therefore 'fast-honor-pragmas'
-    // FP contract option is used to allow fuse across statements in frontend
-    // whereas respecting contract flag in backend.
-    Opts.setDefaultFPContractMode(LangOptions::FPM_FastHonorPragmas);
-  } else if (Opts.CUDA) {
-    if (T.isSPIRV()) {
+  if (Opts.HIP || Opts.CUDA) {
+    if (Opts.CUDA && T.isSPIRV()) {
----------------
rjmccall wrote:

The comment below needs to be updated.

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


More information about the cfe-commits mailing list