[Mlir-commits] [mlir] [MLIR][Python] Support Python-defined passes in MLIR (PR #156000)

Rolf Morel llvmlistbot at llvm.org
Mon Sep 8 05:27:41 PDT 2025


================
@@ -301,6 +301,10 @@ mlirFreezeRewritePattern(MlirRewritePatternSet op);
 MLIR_CAPI_EXPORTED void
 mlirFrozenRewritePatternSetDestroy(MlirFrozenRewritePatternSet op);
 
+MLIR_CAPI_EXPORTED MlirLogicalResult mlirApplyPatternsAndFoldGreedilyForOp(
+    MlirOperation op, MlirFrozenRewritePatternSet patterns,
+    MlirGreedyRewriteDriverConfig);
----------------
rolfmorel wrote:

Yep - no rewriter API in Python but you can use relevant methods on ops directly, etc. (Here's one example: https://github.com/libxsmm/tpp-mlir/pull/1064/files#diff-7aa62724b21b998da9cf032da6e6b77bbdb664258a5dca850f9509a5459646f6R110-R118 - @makslevental has more.)

That should be enough to demonstrate that your test pass is actually running and, if kept simple, will not be that ugly.

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


More information about the Mlir-commits mailing list