[PATCH] D112760: Require 'contract' fast-math flag for FMA generation

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 1 14:59:26 PDT 2021


andrew.w.kaylor added a comment.

In D112760#3097718 <https://reviews.llvm.org/D112760#3097718>, @arsenm wrote:

> I would rephrase the description as removing the global flag for contraction

This change also removes the behavior of the function attribute "unsafe=fp-math" enabling fp-contraction. When I started, I didn't realize that the handling of the global and the handling of the function attributes were so closely related. I guess this needs some more discussion. I'd like to see the function attributes phased out where the same semantics can be expressed by fast-math flags, but as discussed on the llvm-dev email thread this may require updates to keep from breaking out-of-tree front ends.



================
Comment at: clang/test/CodeGenCUDA/fp-contract.cu:3-7
+// FIXME: This test fails. The comment below describes broken behavior.
+//        The front end should generate IR for the semantics it expects and
+//        backends should respect the IR. Backends should never "disregard"
+//        elements of the IR.
+
----------------
tra wrote:
> We do need to have a way to preserve current behavior for CUDA compilation. There are many existing users that implicitly assume it.
> 
> 
When you say you want to preserve "the current behavior" do you mean using "fast" as the default "fp-contract" setting, or also ignoring fp-contract-related pragmas when fp-contract=fast is used?

I certainly understand wanting fp-contract=fast to be the default behavior, but I'm puzzled by the difference in behavior that was introduced between HIP and CUDA, wherein HIP respects the pragmas but CUDA doesn't.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112760/new/

https://reviews.llvm.org/D112760



More information about the llvm-commits mailing list