1# RUN: %PYTHON %s | FileCheck %s 2 3from mlir.ir import * 4import mlir.dialects.builtin as builtin 5import mlir.dialects.vector as vector 6 7def run(f): 8 print("\nTEST:", f.__name__) 9 f() 10 11# CHECK-LABEL: TEST: testPrintOp 12@run 13def testPrintOp(): 14 with Context() as ctx, Location.unknown(): 15 module = Module.create() 16 with InsertionPoint(module.body): 17 @builtin.FuncOp.from_py_func(VectorType.get((12, 5), F32Type.get())) 18 def print_vector(arg): 19 return vector.PrintOp(arg) 20 21 # CHECK-LABEL: func @print_vector( 22 # CHECK-SAME: %[[ARG:.*]]: vector<12x5xf32>) { 23 # CHECK: vector.print %[[ARG]] : vector<12x5xf32> 24 # CHECK: return 25 # CHECK: } 26 print(module) 27