[Mlir-commits] [mlir] [MLIR][Python] Add python bindings for IRDL dialect (PR #158488)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Sep 17 07:04:14 PDT 2025
================
@@ -0,0 +1,66 @@
+# RUN: %PYTHON %s 2>&1 | FileCheck %s
+
+from mlir.ir import *
+from mlir.dialects import irdl
+import sys
+
+
+def run(f):
+ print("\nTEST:", f.__name__, file=sys.stderr)
+ f()
+
+
+# CHECK: TEST: testIRDL
+ at run
+def testIRDL():
+ with Context() as ctx, Location.unknown():
+ module = Module.create()
+ with InsertionPoint(module.body):
+ dialect = irdl.DialectOp("irdl_test")
+ with InsertionPoint(dialect.body):
+ op = irdl.OperationOp("test_op")
+ with InsertionPoint(op.body):
+ f32 = irdl.is_(TypeAttr.get(F32Type.get()))
+ irdl.operands_([f32], ["input"], [irdl.Variadicity.single])
+ type1 = irdl.TypeOp("type1")
----------------
PragmaTwice wrote:
Ahhh you are right. I'll add them.
https://github.com/llvm/llvm-project/pull/158488
More information about the Mlir-commits
mailing list