[Mlir-commits] [mlir] [MLIR][Transforms] add eliminate-explicit-rounding pass (PR #93443)

Krzysztof Drewniak llvmlistbot at llvm.org
Wed May 29 12:51:36 PDT 2024


krzysz00 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`



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


More information about the Mlir-commits mailing list