[llvm] [mlir] [MLIR][Python] reland stubgen v2 (PR #157930)

Maksim Levental via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 12:03:27 PDT 2025


makslevental wrote:

Here's a brief retrospective of the failures involved in the other PRs:

1. We don't have robust testing of all the various types of install/build configs people use;
    - In an effort to improve that I have: 
       - https://github.com/llvm/llvm-project/pull/157944 
       - https://github.com/llvm/llvm-project/pull/158183
2. The reason why the core bindings are safe to generate is because they are independent of all other modules/packages/etc. On the contrary, the dialect bindings are not is because the dialect bindings use `mlir_attribute_subclass`, `mlir_type_subclass`, etc. which all perform an `import mlir` when the types are created, [**i.e., at module load time**](https://github.com/llvm/llvm-project/blob/ef7de8d1447c822dec72d685d85053216936b895/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h#L458). What that means is the location of the core module needs to be known and it must be importable when the dialect modules are loaded;
    - This is a very bad design flaw of dialect bindings (amongst others), one that I've discussed before, and one that can be fixed but will take more work.

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


More information about the llvm-commits mailing list