Jungwook Park 2292fd0129
[mlir][spirv] Add support for C-API/python binding to SPIR-V dialect (#76055)
Enable bindings.

---------

Co-authored-by: jungpark-mlir <jungwook@jungwook-22.04>
2024-01-02 08:11:44 -08:00

22 lines
520 B
Python

# 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
@run
def testConstantOps():
with Context() as ctx, Location.unknown():
module = Module.create()
with InsertionPoint(module.body):
i32 = IntegerType.get_signless(32)
spirv.ConstantOp(value=IntegerAttr.get(i32, 42), constant=i32)
# CHECK: spirv.Constant 42 : i32
print(module)