[Mlir-commits] [mlir] [MLIR][Math] add canonicalize-f32-promotion pass (PR #92482)
Ivy Zhang
llvmlistbot at llvm.org
Wed May 22 01:40:12 PDT 2024
================
@@ -109,4 +135,14 @@ void LegalizeToF32Pass::runOnOperation() {
math::populateLegalizeToF32Patterns(patterns, typeConverter);
if (failed(applyPartialConversion(op, target, std::move(patterns))))
return signalPassFailure();
+
+ if (useCanonicalizeF32Promotion) {
----------------
crazydemo wrote:
1. The pass `option` is for users who concerns about the numerical difference. With the option, they can easily switch on / off the optimization.
2. I really appreciate your `one stage` approach, which directly modifies the `matchAndRewrite()` to determine whether to insert `extf / truncf` at the time of the current op is hit. However, if users creates `extf / truncf` explicitly in the IR, then the op pairs cannot be optimized in this way. I think the `two stage` approach can handle such case way more easily.
https://github.com/llvm/llvm-project/pull/92482
More information about the Mlir-commits
mailing list