aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/python/dialects/spirv_dialect.py
blob: d5b9e6cedb5d31ad1214b5710002550270315f54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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)