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

Jakub Kuderski llvmlistbot at llvm.org
Wed May 29 20:38:26 PDT 2024


https://github.com/kuhar commented:

> Objective: My goal is to eliminate the intermediate truncf/extf pairs inserted during all f32 promotions to improve performance.
> 
> 1. Why Not Modify the Passes Introducing These Ops:
>    The promotion passes that introduce these op pairs are quite scattered; some are in the math dialect, while others are in the arith dialect. We cannot be sure if future passes might also introduce similar promotions. Therefore, I believe having a separate, dedicated pass to handle these promotion-generated op pairs uniformly is a more robust and maintainable solution.
> 2. Why Only Support bf16/f16:
>    Eliminating these op pairs can introduce some numerical differences. We have tested the elimination of rounding between bf16/f16 and f32 in end-to-end models and found that the impact on precision is minimal and acceptable. However, I haven't conducted similar tests for other data types, so support for them is currently not included.
> 3. Support List:
>    I don't think a support list is necessary because the elimination process is solely related to the data type. Currently, it only supports bf16/f16 to f32. If we need to add support for other data types in the future, we can modify the pass accordingly.

The sounds circular to me. You said that the motivation it to ' eliminate the intermediate truncf/extf pairs inserted during all f32 promotions' and 'handle these promotion-generated op pairs uniformly' yet you only want to support the cast pairs emitted by these two passes and not the other fp data types.

> 4. Regarding @krzysz00‘s Proposal:
>    Functionally, this PR is consistent with krzysz00's proposal. However, I don't believe adding a fast-math attribute is appropriate as it could cause confusion. Eliminating rounding should not be associated with fast-math attributes, as they are conceptually different.

I don't follow this part. What would make it confusing? What do you mean by 'conceptually different'?


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


More information about the Mlir-commits mailing list