diff options
author | Maksim Levental <maksim.levental@gmail.com> | 2025-09-22 15:55:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-22 12:55:43 -0700 |
commit | 81cbd970cf64bf6daad3c3db6c3879339f1fa1e4 (patch) | |
tree | 94838a2710c58187633a8244c972885dfa2f19e1 /mlir/lib/Bindings/Python/IRModule.h | |
parent | c526c70648c14ad667e9cda37c313aaaf369eef5 (diff) | |
download | llvm-81cbd970cf64bf6daad3c3db6c3879339f1fa1e4.zip llvm-81cbd970cf64bf6daad3c3db6c3879339f1fa1e4.tar.gz llvm-81cbd970cf64bf6daad3c3db6c3879339f1fa1e4.tar.bz2 |
[MLIR][Python] remove nb::typed to fix bazel build (#160183)
https://github.com/llvm/llvm-project/pull/157930 broke bazel build (see
https://github.com/llvm/llvm-project/pull/157930#issuecomment-3318681217)
because bazel is stricter on implicit conversions (some difference in
flags passed to clang). This PR fixes by moving/removing `nb::typed`.
EDIT: and also the overlay...
Diffstat (limited to 'mlir/lib/Bindings/Python/IRModule.h')
-rw-r--r-- | mlir/lib/Bindings/Python/IRModule.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/mlir/lib/Bindings/Python/IRModule.h b/mlir/lib/Bindings/Python/IRModule.h index 414f37c..6e97c00 100644 --- a/mlir/lib/Bindings/Python/IRModule.h +++ b/mlir/lib/Bindings/Python/IRModule.h @@ -76,7 +76,7 @@ public: /// Releases the object held by this instance, returning it. /// This is the proper thing to return from a function that wants to return /// the reference. Note that this does not work from initializers. - nanobind::typed<nanobind::object, T> releaseObject() { + nanobind::object releaseObject() { assert(referrent && object); referrent = nullptr; auto stolen = std::move(object); @@ -88,12 +88,14 @@ public: assert(referrent && object); return referrent; } - nanobind::typed<nanobind::object, T> getObject() { + nanobind::object getObject() { assert(referrent && object); return object; } operator bool() const { return referrent && object; } + using NBTypedT = nanobind::typed<nanobind::object, T>; + private: T *referrent; nanobind::object object; @@ -680,7 +682,7 @@ public: PyLocation &location, const nanobind::object &ip, bool inferType); /// Creates an OpView suitable for this operation. - nanobind::typed<nanobind::object, PyOpView> createOpView(); + nanobind::object createOpView(); /// Erases the underlying MlirOperation, removes its pointer from the /// parent context's live operations map, and sets the valid bit false. @@ -690,7 +692,7 @@ public: void setInvalid() { valid = false; } /// Clones this operation. - nanobind::typed<nanobind::object, PyOpView> clone(const nanobind::object &ip); + nanobind::object clone(const nanobind::object &ip); PyOperation(PyMlirContextRef contextRef, MlirOperation operation); @@ -890,7 +892,7 @@ public: /// is taken by calling this function. static PyType createFromCapsule(nanobind::object capsule); - nanobind::typed<nanobind::object, PyType> maybeDownCast(); + nanobind::object maybeDownCast(); private: MlirType type; @@ -1020,7 +1022,7 @@ public: /// is taken by calling this function. static PyAttribute createFromCapsule(nanobind::object capsule); - nanobind::typed<nanobind::object, PyAttribute> maybeDownCast(); + nanobind::object maybeDownCast(); private: MlirAttribute attr; @@ -1178,7 +1180,7 @@ public: /// Gets a capsule wrapping the void* within the MlirValue. nanobind::object getCapsule(); - nanobind::typed<nanobind::object, PyValue> maybeDownCast(); + nanobind::object maybeDownCast(); /// Creates a PyValue from the MlirValue wrapped by a capsule. Ownership of /// the underlying MlirValue is still tied to the owning operation. @@ -1269,8 +1271,7 @@ public: /// Returns the symbol (opview) with the given name, throws if there is no /// such symbol in the table. - nanobind::typed<nanobind::object, PyOpView> - dunderGetItem(const std::string &name); + nanobind::object dunderGetItem(const std::string &name); /// Removes the given operation from the symbol table and erases it. void erase(PyOperationBase &symbol); |