[Mlir-commits] [mlir] [MLIR][Python] Extend bindings for external projects without duplication (PR #173241)
Maksim Levental
llvmlistbot at llvm.org
Tue Dec 23 09:24:58 PST 2025
makslevental wrote:
> I just want to allow people to easily install mlir and some external projects together for a specific use case, without the need to build llvm.
This is the part that's really not possible - mostly because of intricacies of build systems but also sometimes because of ABI issues e.g., in the other patch I'm working on you will actually have `libnanobind.so` which will have a C++ABI and therefore definitely not safe (in general) to re-link against.
My solution to the problem of "allow people to easily install mlir" is to just provide nightly wheels/distros of LLVM itself from which the bindings can quickly/easily be built: https://github.com/llvm/eudsl/releases/tag/llvm (similar to what you have I think). Using this distro I build various bindings wheels quickly.
> but a refactoring of the core Python files will probably be needed to remove any state.
There is indeed state in the bindings [themselves](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Bindings/Python/Globals.h#L179) but this is not what I'm talking about when I refer to global state in MLIR - I'm talking about e.g., the [`PassRegistry`](https://github.com/llvm/llvm-project/blob/7d7d063c9c393ee936ebfe899cc673df18189e06/mlir/lib/Pass/PassRegistry.cpp#L26-L27). This cannot be refactored in anyway serious way.
https://github.com/llvm/llvm-project/pull/173241
More information about the Mlir-commits
mailing list