-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
mlir:pythonMLIR Python bindingsMLIR Python bindings
Description
diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp
index cda4fe19c16f..bd66bbd02ebd 100644
--- a/mlir/lib/Bindings/Python/IRCore.cpp
+++ b/mlir/lib/Bindings/Python/IRCore.cpp
@@ -1626,12 +1626,12 @@ public:
static void bindDerived(ClassTy &c) {
c.def_prop_ro(
- "owner", [](PyOpResult &self) -> nb::typed<nb::object, PyOperation> {
+ "owner", [](PyOpResult &self) -> nb::typed<nb::object, PyOpView> {
assert(mlirOperationEqual(self.getParentOperation()->get(),
mlirOpResultGetOwner(self.get())) &&
"expected the owner of the value in Python to match that in "
"the IR");
- return self.getParentOperation().getObject();
+ return self.getParentOperation()->createOpView();
});
c.def_prop_ro("result_number", [](PyOpResult &self) {
return mlirOpResultGetResultNumber(self.get());
@@ -3553,10 +3553,10 @@ void mlir::python::populateIRCore(nb::module_ &m) {
"or derived from."))
.def_prop_ro("parent",
[](PyOperationBase &self)
- -> std::optional<nb::typed<nb::object, PyOperation>> {
+ -> std::optional<nb::typed<nb::object, PyOpView>> {
auto parent = self.getOperation().getParentOperation();
if (parent)
- return parent->getObject();
+ return {(*parent)->createOpView()};
return {};
})
.def(
@@ -4301,7 +4301,7 @@ void mlir::python::populateIRCore(nb::module_ &m) {
"expected the owner of the value in Python to match "
"that in "
"the IR");
- return self.getParentOperation().getObject();
+ return self.getParentOperation()->createOpView();
}
if (mlirValueIsABlockArgument(v)) {causes
# CHECK: %{{.*}} = memref.subview %[[ALLOC]][1, 1] [3, 3] [1, 1] : memref<10x10xi32> to memref<3x3xi32, strided<[10, 1], offset: 11>>
print(z.owner)
in testSubViewOpInferReturnTypeSemantics in mlir/test/python/dialects/memref.py to break because suddenly the printed op has dynamic offset (i.e., ?). Very weird...
Metadata
Metadata
Assignees
Labels
mlir:pythonMLIR Python bindingsMLIR Python bindings