[Mlir-commits] [mlir] [MLIR][Python] Add a DSL for defining IRDL dialects in Python bindings (PR #169045)
Rolf Morel
llvmlistbot at llvm.org
Mon Dec 8 03:09:46 PST 2025
================
@@ -0,0 +1,308 @@
+# RUN: %PYTHON %s 2>&1 | FileCheck %s
+
+from mlir.ir import *
+from mlir.dialects.irdl import dsl as irdsl
+from mlir.dialects import arith
+import sys
+
+
+def run(f):
+ print("\nTEST:", f.__name__, file=sys.stderr)
+ with Context():
+ f()
+
+
+# CHECK: TEST: testMyInt
+ at run
+def testMyInt():
+ myint = irdsl.Dialect("myint")
+ iattr = irdsl.BaseName("#builtin.integer")
+ i32 = irdsl.IsType(IntegerType.get_signless(32))
+
+ @myint.op("constant")
+ class ConstantOp:
----------------
rolfmorel wrote:
In this scheme, what's the advantage of the new `AView` class, which replaces `A`, versus just inserting `AViewBase` in the MRO of `A`?
I agree with punting additional features to later PRs, though would be great to consider issues that (might) impact syntax of the DSL on this PR just so that users will not experience as much churn.
https://github.com/llvm/llvm-project/pull/169045
More information about the Mlir-commits
mailing list