[Mlir-commits] [mlir] [MLIR][Python] Add a DSL for defining IRDL dialects in Python bindings (PR #169045)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Nov 24 21:05:07 PST 2025
PragmaTwice wrote:
> Could we get a comparison with the xDSL API for defining ops/dialects?
Absolutely, I’ll try to put together a comparison table. Because of some differences in the underlying mechanisms (for example, MLIR Python’s `OpView`/builder story is a bit different), the syntax will likely diverge in a few places, but if we can incorporate the nicer parts of their design, that would definitely be ideal — and some level of API compatibility would be a great bonus.
> I have a local proof-of-concept for exposing MLIR C++ Interfaces' ExternalModels to Python so that their methods can be implemented in Python and the external model attached to any op in Python.
Does this (eventually) imply extending the IRDL dialect to introduce concepts like interfaces and traits? I’m wondering if this overlaps with this issue: [https://github.com/llvm/llvm-project/issues/158066](https://github.com/llvm/llvm-project/issues/158066). I’m really looking forward to seeing this — it sounds like very cool work. I’ve also been thinking about how to extend IRDL to support a more flexible constraint system ([https://github.com/llvm/llvm-project/issues/158049](https://github.com/llvm/llvm-project/issues/158049)), but that’s still in a very early stage.
We can keep these possible IRDL evolutions in mind so that, when we introduce things like interfaces/traits, the DSL in this PR won’t need to change too drastically and users won’t have to rewrite large amounts of code.
https://github.com/llvm/llvm-project/pull/169045
More information about the Mlir-commits
mailing list