[Mlir-commits] [mlir] [mlir][python] C++ API demo (PR #71133)

Maksim Levental llvmlistbot at llvm.org
Mon Nov 6 13:35:19 PST 2023


makslevental wrote:

> FTR, the bindings are based on C API rather than C++ directly for API stability reasons, not because we couldn't make it work with C++.

Upstream (i.e., MLIR) API stability aside I'm curious: did you guys consider [Custom automatic downcasters](https://pybind11.readthedocs.io/en/stable/advanced/classes.html?highlight=llvm#custom-automatic-downcasters), which seems designed with us exactly in mind:

> Sometimes, you might want to provide this automatic downcasting behavior when creating bindings for a class hierarchy that does not use standard C++ polymorphism, such as LLVM [3].

where the footnote is a link to https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html. This suggests we could eschew RTTI in the bindings entirely _and_ get closer affinity with the canonical (C++) implementations...

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


More information about the Mlir-commits mailing list