[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 19 09:32:02 PST 2024


llvm-beanz wrote:

Quick sanity check question for @bogner:

In DXC we apply the `fast` flag, which in LLVM 3.7 implies: `nnan ninf nsz arcp` and includes the modern interpretation of `reassoc`

With this change we are applying: `reassoc nnan ninf nsz arcp afn` (no `fast` because its meaning is redefined. The main addition is `afn`.

> Approximate functions - Allow substitution of approximate calculations for functions (sin, log, sqrt, etc). See floating-point intrinsic definitions for places where this can apply to LLVM’s intrinsic math functions.

[source](https://llvm.org/docs/LangRef.html#fast-math-flags)

Two questions:
1) Do we foresee any issue adding `afn` (I suspect not)
2) Do we also need to apply `contract`, which I believe was also implied by `fast` in 3.7 although the docs are unclear?

Also, I think we may need to put implement the backend support for translating the fast math flags to 3.7-equivalents before we merge this. I'm sorry I hadn't thought of that until now, but I expect this change breaks DXIL generation.

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


More information about the cfe-commits mailing list