28 lines · python
1# RUN: %PYTHON %s | FileCheck %s2# This is just a smoke test that the dialect is functional.3from array import array4 5from mlir.ir import *6from mlir.dialects import ub7from mlir.extras import types as T8 9 10def constructAndPrintInModule(f):11 print("\nTEST:", f.__name__)12 with Context(), Location.unknown():13 module = Module.create()14 with InsertionPoint(module.body):15 f()16 print(module)17 return f18 19 20# CHECK-LABEL: testSmoke21@constructAndPrintInModule22def testSmoke():23 # CHECK: Value(%{{.*}} = ub.poison : f3224 f32 = F32Type.get()25 poison = ub.poison(f32)26 print(poison)27 assert isinstance(poison, Value)28