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

Rolf Morel llvmlistbot at llvm.org
Sat Jan 10 11:59:34 PST 2026


rolfmorel wrote:

Looks awesome, @PragmaTwice ! Will have a more comprehensive look at the code this coming week.

> The only thing to consider is that it's possible that you might want a constraint that is not a type. In xDSL, we used Annotated to lift values to types, and introspected that, but it was not very approcahbe, quite difficult to reason about, and had a few issues with "correctness" with respect to Python's typing mechanisms, when using variables. This might be worth considering for your approach too, how you would express "all operands and results of this op have the same type".

Thanks for highlighting this! I agree with @PragmaTwice that his approach is able to express "all operands and results of this op have the same type". @superlopuh, do you maybe have other constraints that might be hard to express? (Would be great to have as many examples as possible, though they don't need to all be addressed in this PR.) Are you mostly just thinking about IRDL-expressible constraints or are there maybe others as well?

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


More information about the Mlir-commits mailing list