[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Add option to disable folding (PR #92683)

Matthias Springer llvmlistbot at llvm.org
Mon May 27 00:29:48 PDT 2024


================
@@ -1118,6 +1119,14 @@ struct ConversionConfig {
   // already been modified) and iterators into past IR state cannot be
   // represented at the moment.
   RewriterBase::Listener *listener = nullptr;
+
+  /// If set to "true", the dialect conversion driver attempts to fold
+  /// operations throughout the conversion. This is problematic because op
+  /// folders may assume that the IR is in a valid state at the beginning of
+  /// the folding process. However, the dialect conversion does not guarantee
+  /// that because some IR modifications are delayed until the end of the
+  /// conversion.
+  bool foldOps = true;
----------------
matthias-springer wrote:

These tests are broken with `foldOps = false`:
```
Failed Tests (8):
  MLIR :: Conversion/AffineToStandard/lower-affine.mlir
  MLIR :: Conversion/FuncToLLVM/calling-convention.mlir
  MLIR :: Conversion/MemRefToLLVM/expand-then-convert-to-llvm.mlir
  MLIR :: Conversion/ShapeToStandard/shape-to-standard.mlir
  MLIR :: Conversion/VectorToLLVM/vector-to-llvm.mlir
  MLIR :: Dialect/LLVM/lower-to-llvm-e2e-with-target-tag.mlir
  MLIR :: Dialect/LLVM/lower-to-llvm-e2e-with-top-level-named-sequence.mlir
  MLIR :: Dialect/Vector/linearize.mlir
```

They are mostly FileCheck failures, but `vector-to-llvm.mlir` is actually broken. I'm busy with other stuff right now, so it might take a while. (Or if someone else wants to take this over, feel free to.)


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


More information about the Mlir-commits mailing list