[Mlir-commits] [mlir] [mlir][spirv] Add support for C-API/python binding to SPIR-V dialect (PR #76055)

Jungwook Park llvmlistbot at llvm.org
Wed Dec 20 08:00:35 PST 2023


================
@@ -0,0 +1,22 @@
+# RUN: %PYTHON %s | FileCheck %s
+
+from mlir.ir import *
+import mlir.dialects.spirv as spirv
+
+
+def run(f):
+    print("\nTEST:", f.__name__)
+    f()
+
+
+# CHECK-LABEL: TEST: testConstantOp
+ at run
+def testConstantOps():
+    with Context() as ctx, Location.unknown():
+        module = Module.create()
+        with InsertionPoint(module.body):
+            spirv.ConstantOp(
+                value=FloatAttr.get(F32Type.get(), 42.42), constant=F32Type.get()
+            )
+        # CHECK:         %cst_f32 = spirv.Constant 4.242000e+01 : f32
----------------
jungpark-mlir wrote:

switched to test integer '42'.

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


More information about the Mlir-commits mailing list