[Mlir-commits] [mlir] 45bee6e - [mlir][Python] fix IRInterfaces.h (#181522)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Feb 14 20:01:44 PST 2026
Author: Maksim Levental
Date: 2026-02-15T04:01:39Z
New Revision: 45bee6efe9d69e49ca223bdea77353753549c2c9
URL: https://github.com/llvm/llvm-project/commit/45bee6efe9d69e49ca223bdea77353753549c2c9
DIFF: https://github.com/llvm/llvm-project/commit/45bee6efe9d69e49ca223bdea77353753549c2c9.diff
LOG: [mlir][Python] fix IRInterfaces.h (#181522)
https://github.com/llvm/llvm-project/pull/176920 added `IRInterfaces.h`
but didn't include it in either the list of [installed
headers](https://github.com/llvm/llvm-project/blob/a1d7cda1d7ca4983e02727f589952b02626d2dc8/mlir/python/CMakeLists.txt#L557)
or `mlir/Bindings/Python`. This breaks downstreams. So just move the
header to `mlir/Bindings/Python`
Added:
mlir/include/mlir/Bindings/Python/IRInterfaces.h
Modified:
mlir/lib/Bindings/Python/DialectTransform.cpp
mlir/lib/Bindings/Python/IRInterfaces.cpp
Removed:
mlir/lib/Bindings/Python/IRInterfaces.h
################################################################################
diff --git a/mlir/lib/Bindings/Python/IRInterfaces.h b/mlir/include/mlir/Bindings/Python/IRInterfaces.h
similarity index 89%
rename from mlir/lib/Bindings/Python/IRInterfaces.h
rename to mlir/include/mlir/Bindings/Python/IRInterfaces.h
index 7d0bcc25da210..fb30e030b6c32 100644
--- a/mlir/lib/Bindings/Python/IRInterfaces.h
+++ b/mlir/include/mlir/Bindings/Python/IRInterfaces.h
@@ -20,18 +20,6 @@ namespace mlir {
namespace python {
namespace MLIR_BINDINGS_PYTHON_DOMAIN {
-constexpr static const char *constructorDoc =
- R"(Creates an interface from a given operation/opview object or from a
-subclass of OpView. Raises ValueError if the operation does not implement the
-interface.)";
-
-constexpr static const char *operationDoc =
- R"(Returns an Operation for which the interface was constructed.)";
-
-constexpr static const char *opviewDoc =
- R"(Returns an OpView subclass _instance_ for which the interface was
-constructed)";
-
/// CRTP base class for Python classes representing MLIR Op interfaces.
/// Interface hierarchies are flat so no base class is expected here. The
/// derived class is expected to define the following static fields:
@@ -97,10 +85,16 @@ class PyConcreteOpInterface {
nanobind::class_<ConcreteIface> cls(m, ConcreteIface::pyClassName);
cls.def(nanobind::init<nanobind::object, DefaultingPyMlirContext>(),
nanobind::arg("object"),
- nanobind::arg("context") = nanobind::none(), constructorDoc)
- .def_prop_ro("operation", &PyConcreteOpInterface::getOperationObject,
- operationDoc)
- .def_prop_ro("opview", &PyConcreteOpInterface::getOpView, opviewDoc);
+ nanobind::arg("context") = nanobind::none(),
+ "Creates an interface from a given operation/opview object or from "
+ "a subclass of OpView. Raises ValueError if the operation does not "
+ "implement the interface.")
+ .def_prop_ro(
+ "operation", &PyConcreteOpInterface::getOperationObject,
+ "Returns an Operation for which the interface was constructed.")
+ .def_prop_ro("opview", &PyConcreteOpInterface::getOpView,
+ "Returns an OpView subclass _instance_ for which the "
+ "interface was constructed");
ConcreteIface::bindDerived(cls);
}
diff --git a/mlir/lib/Bindings/Python/DialectTransform.cpp b/mlir/lib/Bindings/Python/DialectTransform.cpp
index 62c6185dab15e..0d9877a1d2a0a 100644
--- a/mlir/lib/Bindings/Python/DialectTransform.cpp
+++ b/mlir/lib/Bindings/Python/DialectTransform.cpp
@@ -8,12 +8,12 @@
#include <string>
-#include "IRInterfaces.h"
#include "Rewrite.h"
#include "mlir-c/Dialect/Transform.h"
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"
#include "mlir/Bindings/Python/IRCore.h"
+#include "mlir/Bindings/Python/IRInterfaces.h"
#include "nanobind/nanobind.h"
#include <nanobind/trampoline.h>
diff --git a/mlir/lib/Bindings/Python/IRInterfaces.cpp b/mlir/lib/Bindings/Python/IRInterfaces.cpp
index 147f2022b2948..ea795dde875c1 100644
--- a/mlir/lib/Bindings/Python/IRInterfaces.cpp
+++ b/mlir/lib/Bindings/Python/IRInterfaces.cpp
@@ -12,12 +12,12 @@
#include <utility>
#include <vector>
-#include "IRInterfaces.h"
#include "mlir-c/BuiltinAttributes.h"
#include "mlir-c/IR.h"
#include "mlir-c/Interfaces.h"
#include "mlir-c/Support.h"
#include "mlir/Bindings/Python/IRCore.h"
+#include "mlir/Bindings/Python/IRInterfaces.h"
namespace nb = nanobind;
More information about the Mlir-commits
mailing list