[Mlir-commits] [mlir] [MLIR][Python][Transform] Expose PatternDescriptorOpInterface to Python (PR #184331)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Mar 3 04:43:47 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- mlir/include/mlir-c/Dialect/Transform.h mlir/include/mlir-c/Rewrite.h mlir/lib/Bindings/Python/DialectTransform.cpp mlir/lib/Bindings/Python/Rewrite.cpp mlir/lib/Bindings/Python/Rewrite.h mlir/lib/CAPI/Dialect/Transform.cpp mlir/lib/CAPI/Transforms/Rewrite.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Bindings/Python/Rewrite.cpp b/mlir/lib/Bindings/Python/Rewrite.cpp
index dc5fc0699..e573c3f2a 100644
--- a/mlir/lib/Bindings/Python/Rewrite.cpp
+++ b/mlir/lib/Bindings/Python/Rewrite.cpp
@@ -379,10 +379,9 @@ void PyRewritePatternSet::bind(nb::module_ &m) {
             new (&self) PyRewritePatternSet(context.get()->get());
           },
           "context"_a = nb::none())
-      .def(
-          "add", &PyRewritePatternSet::add, nb::arg("root"), nb::arg("fn"),
-          nb::arg("benefit") = 1,
-          R"(Add a new rewrite pattern on the specified root operation, using
+      .def("add", &PyRewritePatternSet::add, nb::arg("root"), nb::arg("fn"),
+           nb::arg("benefit") = 1,
+           R"(Add a new rewrite pattern on the specified root operation, using
              the provided callable for matching and rewriting, and assign it the
              given benefit.
 
diff --git a/mlir/lib/CAPI/Dialect/Transform.cpp b/mlir/lib/CAPI/Dialect/Transform.cpp
index eb7b65467..1ed14255b 100644
--- a/mlir/lib/CAPI/Dialect/Transform.cpp
+++ b/mlir/lib/CAPI/Dialect/Transform.cpp
@@ -329,9 +329,9 @@ public:
     return transform::PatternDescriptorOpInterface::getInterfaceID();
   }
 
-  static bool classof(
-      const mlir::transform::detail::PatternDescriptorOpInterfaceInterfaceTraits::
-          Concept *op) {
+  static bool
+  classof(const mlir::transform::detail::
+              PatternDescriptorOpInterfaceInterfaceTraits::Concept *op) {
     // Enable casting back to the FallbackModel from the Interface. This is
     // necessary as attachInterface(...) default-constructs the FallbackModel
     // without being able to pass in the callbacks and returns just the Concept.

``````````

</details>


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


More information about the Mlir-commits mailing list