summaryrefslogtreecommitdiff
path: root/mlir/test/python/dialects/ub.py
blob: 0d88da82c5e7b86e3b60f640e5a6775307c33648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# RUN: %PYTHON %s | FileCheck %s
# This is just a smoke test that the dialect is functional.
from array import array

from mlir.ir import *
from mlir.dialects import ub
from mlir.extras import types as T


def constructAndPrintInModule(f):
    print("\nTEST:", f.__name__)
    with Context(), Location.unknown():
        module = Module.create()
        with InsertionPoint(module.body):
            f()
        print(module)
    return f


# CHECK-LABEL: testSmoke
@constructAndPrintInModule
def testSmoke():
    # CHECK: Value(%{{.*}} = ub.poison : f32
    f32 = F32Type.get()
    poison = ub.poison(f32)
    print(poison)
    assert isinstance(poison, Value)