[Mlir-commits] [mlir] [mlir][python] Add `walk` method to PyOperationBase (PR #87962)
Maksim Levental
llvmlistbot at llvm.org
Thu Apr 11 07:19:11 PDT 2024
================
@@ -1249,6 +1250,21 @@ void PyOperationBase::writeBytecode(const py::object &fileObject,
.str());
}
+void PyOperationBase::walk(
+ std::function<MlirWalkResult(MlirOperation)> callback,
+ MlirWalkOrder walkOrder) {
+ PyOperation &operation = getOperation();
+ operation.checkValid();
+ MlirOperationWalkCallback walkCallback = [](MlirOperation op,
+ void *userData) {
+ auto *fn =
+ static_cast<std::function<MlirWalkResult(MlirOperation)> *>(userData);
+ return (*fn)(op);
----------------
makslevental wrote:
variant is overkill for sure but `py::function` might work? anyway it's just a thought rather than a hard request so nbd if you don't want to bother.
https://github.com/llvm/llvm-project/pull/87962
More information about the Mlir-commits
mailing list