[Mlir-commits] [mlir] [MLIR][Transforms] add eliminate-explicit-rounding pass (PR #93443)
Ivy Zhang
llvmlistbot at llvm.org
Wed May 29 18:53:37 PDT 2024
crazydemo wrote:
> Re the whole attribute thing above, how about this:
>
> 1. Add fast-math flags to `arith.truncf` and `arith.extf` if they don't have them already. While they aren't present in LLVM, that's fine, we're allowed extensions
> 2. Define `contract` for `trunf` and `extf` to allow this fold
> 3. In the various promotion passes, set "contract" on the truncations and extensions in addition to their existing fastmath (maybe make that a default-on option)
> 4. Define a folder or canonicalizer on `arith.extf` and `arith.truncf` that collapses
> ```mlir
> %1 = arith.extf fastmath(contract) %0 : T to U
> %2 = arith.truncf fastmath(contract) %1 : U to T
> ```
>
>
>
>
>
>
>
>
>
>
>
> to just `%0` for all `T` and `U`
Thanks for your suggestions. Currently, this PR and your comment are functionally consistent; the main difference lies in the form of the pass and attribute. I think we can proceed with merging this PR for now.
https://github.com/llvm/llvm-project/pull/93443
More information about the Mlir-commits
mailing list