[Mlir-commits] [mlir] [MLIR][Arith] add fastMathAttr on arith::extf and arith::truncf (PR #93443)
Zhennan Qin
llvmlistbot at llvm.org
Tue Jun 11 19:09:58 PDT 2024
ZhennanQin wrote:
I want to discuss adding fast-math attr to `extf`/`truncf` ops more deeply. For `truncf` and `extf` folding, the numerical change is from saving rounding operation of `truncf`, while there's no numerical impact from eliminating `extf`. In my opinion, adding `fastmath<contract>` to `extf` op is meaningless and redundant. We only need to add `fastmath<contract>` to `truncf` op and then we can allow folding below code sequence:
```MLIR
%2 = arith.truncf %1 fastmath<contract> : f32 to bf16
%3 = arith.extf %2 : bf16 to f32 // no fast-math attribute
```
https://github.com/llvm/llvm-project/pull/93443
More information about the Mlir-commits
mailing list