[Mlir-commits] [mlir] [MLIR][Python] Add a DSL for defining IRDL dialects in Python bindings (PR #169045)

Rolf Morel llvmlistbot at llvm.org
Mon Nov 24 03:52:45 PST 2025


rolfmorel wrote:

Nice -- this has been on my wishlist!

Could we get a comparison with the xDSL API for defining ops/dialects? E.g. versus https://github.com/xdslproject/xdsl/blob/main/tests/irdl/test_operation_definition.py. Surely they have "lessons learnt" we should consider and there might be _some_ utility in having API compatibility. 

(P.S. @PragmaTwice, 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. For now the API is rather low-level, i.e. actually implement the ExternalModel as a separate class and attach it to a op. The long-term vision is that such a op-definition DSL would allow for multiple inheritance so that you just specify the interfaces as additional parent classes and implement their interface's methods alongside other Python methods on the op. Some Python metaprogramming magic would take care of still making the appropriate ExternalModels and attaching them to the op, upon the op getting registered.)

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


More information about the Mlir-commits mailing list