mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-09 19:03:27 +00:00
[mlir][NFC] Update textual references of func
to func.func
in tool/runner tests
The special case parsing of `func` operations is being removed.
This commit is contained in:
parent
6a99d29022
commit
63237cddc1
@ -14,7 +14,7 @@
|
||||
// rsqrt.
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
func @rsqrt() {
|
||||
func.func @rsqrt() {
|
||||
// Sanity-check that the scalar rsqrt still works OK.
|
||||
// CHECK: inf
|
||||
%0 = arith.constant 0.0 : f32
|
||||
@ -34,7 +34,7 @@ func @rsqrt() {
|
||||
return
|
||||
}
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
call @rsqrt(): () -> ()
|
||||
return
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_async_runtime%shlibext \
|
||||
// RUN: | FileCheck %s --dump-input=always
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%false = arith.constant 0 : i1
|
||||
|
||||
// ------------------------------------------------------------------------ //
|
||||
|
@ -13,7 +13,7 @@
|
||||
// to keep the bot green for now.
|
||||
// UNSUPPORTED: asan
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%c1 = arith.constant 1 : index
|
||||
%c5 = arith.constant 5 : index
|
||||
|
||||
@ -46,4 +46,4 @@ func @main() {
|
||||
return
|
||||
}
|
||||
|
||||
func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
|
||||
func.func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
|
||||
|
@ -6,7 +6,7 @@
|
||||
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_async_runtime%shlibext \
|
||||
// RUN: | FileCheck %s --dump-input=always
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
|
||||
// ------------------------------------------------------------------------ //
|
||||
// Blocking async.await outside of the async.execute.
|
||||
@ -74,5 +74,5 @@ func @main() {
|
||||
return
|
||||
}
|
||||
|
||||
func private @print_memref_f32(memref<*xf32>)
|
||||
func.func private @print_memref_f32(memref<*xf32>)
|
||||
attributes { llvm.emit_c_interface }
|
||||
|
@ -6,7 +6,7 @@
|
||||
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_async_runtime%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%i0 = arith.constant 0 : index
|
||||
%i1 = arith.constant 1 : index
|
||||
%i2 = arith.constant 2 : index
|
||||
@ -76,6 +76,6 @@ func @main() {
|
||||
return
|
||||
}
|
||||
|
||||
func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
|
||||
func.func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
|
||||
|
||||
func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
@ -5,7 +5,7 @@
|
||||
// one. 'main' calls 'simple_add1_add2_test' with {1, 1} and {2, 2} so {2, 2}
|
||||
// and {4, 4} are the expected outputs.
|
||||
|
||||
func @simple_add1_add2_test(%arg0: memref<2xf32>, %arg1: memref<2xf32>) {
|
||||
func.func @simple_add1_add2_test(%arg0: memref<2xf32>, %arg1: memref<2xf32>) {
|
||||
%c2 = arith.constant 2 : index
|
||||
%c0 = arith.constant 0 : index
|
||||
%c1 = arith.constant 1 : index
|
||||
@ -28,11 +28,11 @@ func @simple_add1_add2_test(%arg0: memref<2xf32>, %arg1: memref<2xf32>) {
|
||||
// External declarations.
|
||||
llvm.func @malloc(i64) -> !llvm.ptr<i8>
|
||||
llvm.func @free(!llvm.ptr<i8>)
|
||||
func private @printF32(%arg0: f32)
|
||||
func private @printComma()
|
||||
func private @printNewline()
|
||||
func.func private @printF32(%arg0: f32)
|
||||
func.func private @printComma()
|
||||
func.func private @printNewline()
|
||||
|
||||
func @main()
|
||||
func.func @main()
|
||||
{
|
||||
%c2 = arith.constant 2 : index
|
||||
%c0 = arith.constant 0 : index
|
||||
|
@ -3,9 +3,9 @@
|
||||
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
func @main() -> () {
|
||||
func.func @main() -> () {
|
||||
%c0 = arith.constant 0 : index
|
||||
%c1 = arith.constant 1 : index
|
||||
%c42 = arith.constant 42.0 : f32
|
||||
|
@ -1,11 +1,11 @@
|
||||
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-arith-to-llvm),convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext | FileCheck %s
|
||||
|
||||
func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func private @print_memref_i32(memref<*xi32>) attributes { llvm.emit_c_interface }
|
||||
func private @printNewline() -> ()
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_i32(memref<*xi32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @printNewline() -> ()
|
||||
|
||||
memref.global "private" @gv0 : memref<4xf32> = dense<[0.0, 1.0, 2.0, 3.0]>
|
||||
func @test1DMemref() {
|
||||
func.func @test1DMemref() {
|
||||
%0 = memref.get_global @gv0 : memref<4xf32>
|
||||
%U = memref.cast %0 : memref<4xf32> to memref<*xf32>
|
||||
// CHECK: rank = 1
|
||||
@ -34,7 +34,7 @@ func @test1DMemref() {
|
||||
}
|
||||
|
||||
memref.global constant @gv1 : memref<3x2xi32> = dense<[[0, 1],[2, 3],[4, 5]]>
|
||||
func @testConstantMemref() {
|
||||
func.func @testConstantMemref() {
|
||||
%0 = memref.get_global @gv1 : memref<3x2xi32>
|
||||
%U = memref.cast %0 : memref<3x2xi32> to memref<*xi32>
|
||||
// CHECK: rank = 2
|
||||
@ -50,7 +50,7 @@ func @testConstantMemref() {
|
||||
}
|
||||
|
||||
memref.global "private" @gv2 : memref<4x2xf32> = dense<[[0.0, 1.0], [2.0, 3.0], [4.0, 5.0], [6.0, 7.0]]>
|
||||
func @test2DMemref() {
|
||||
func.func @test2DMemref() {
|
||||
%0 = memref.get_global @gv2 : memref<4x2xf32>
|
||||
%U = memref.cast %0 : memref<4x2xf32> to memref<*xf32>
|
||||
// CHECK: rank = 2
|
||||
@ -83,7 +83,7 @@ func @test2DMemref() {
|
||||
}
|
||||
|
||||
memref.global @gv3 : memref<i32> = dense<11>
|
||||
func @testScalarMemref() {
|
||||
func.func @testScalarMemref() {
|
||||
%0 = memref.get_global @gv3 : memref<i32>
|
||||
%U = memref.cast %0 : memref<i32> to memref<*xi32>
|
||||
// CHECK: rank = 0
|
||||
@ -96,7 +96,7 @@ func @testScalarMemref() {
|
||||
return
|
||||
}
|
||||
|
||||
func @main() -> () {
|
||||
func.func @main() -> () {
|
||||
call @test1DMemref() : () -> ()
|
||||
call @testConstantMemref() : () -> ()
|
||||
call @test2DMemref() : () -> ()
|
||||
|
@ -8,7 +8,7 @@
|
||||
// -------------------------------------------------------------------------- //
|
||||
// Tanh.
|
||||
// -------------------------------------------------------------------------- //
|
||||
func @tanh() {
|
||||
func.func @tanh() {
|
||||
// CHECK: 0.848284
|
||||
%0 = arith.constant 1.25 : f32
|
||||
%1 = math.tanh %0 : f32
|
||||
@ -35,7 +35,7 @@ func @tanh() {
|
||||
// -------------------------------------------------------------------------- //
|
||||
// Log.
|
||||
// -------------------------------------------------------------------------- //
|
||||
func @log() {
|
||||
func.func @log() {
|
||||
// CHECK: 2.64704
|
||||
%0 = arith.constant 14.112233 : f32
|
||||
%1 = math.log %0 : f32
|
||||
@ -74,7 +74,7 @@ func @log() {
|
||||
return
|
||||
}
|
||||
|
||||
func @log2() {
|
||||
func.func @log2() {
|
||||
// CHECK: 3.81887
|
||||
%0 = arith.constant 14.112233 : f32
|
||||
%1 = math.log2 %0 : f32
|
||||
@ -113,7 +113,7 @@ func @log2() {
|
||||
return
|
||||
}
|
||||
|
||||
func @log1p() {
|
||||
func.func @log1p() {
|
||||
// CHECK: 0.00995033
|
||||
%0 = arith.constant 0.01 : f32
|
||||
%1 = math.log1p %0 : f32
|
||||
@ -155,7 +155,7 @@ func @log1p() {
|
||||
// -------------------------------------------------------------------------- //
|
||||
// Erf.
|
||||
// -------------------------------------------------------------------------- //
|
||||
func @erf() {
|
||||
func.func @erf() {
|
||||
// CHECK: -0.000274406
|
||||
%val1 = arith.constant -2.431864e-4 : f32
|
||||
%erfVal1 = math.erf %val1 : f32
|
||||
@ -227,7 +227,7 @@ func @erf() {
|
||||
// -------------------------------------------------------------------------- //
|
||||
// Exp.
|
||||
// -------------------------------------------------------------------------- //
|
||||
func @exp() {
|
||||
func.func @exp() {
|
||||
// CHECK: 2.71828
|
||||
%0 = arith.constant 1.0 : f32
|
||||
%1 = math.exp %0 : f32
|
||||
@ -266,7 +266,7 @@ func @exp() {
|
||||
return
|
||||
}
|
||||
|
||||
func @expm1() {
|
||||
func.func @expm1() {
|
||||
// CHECK: 1e-10
|
||||
%0 = arith.constant 1.0e-10 : f32
|
||||
%1 = math.expm1 %0 : f32
|
||||
@ -307,7 +307,7 @@ func @expm1() {
|
||||
// -------------------------------------------------------------------------- //
|
||||
// Sin.
|
||||
// -------------------------------------------------------------------------- //
|
||||
func @sin() {
|
||||
func.func @sin() {
|
||||
// CHECK: 0
|
||||
%0 = arith.constant 0.0 : f32
|
||||
%sin_0 = math.sin %0 : f32
|
||||
@ -346,7 +346,7 @@ func @sin() {
|
||||
// cos.
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
func @cos() {
|
||||
func.func @cos() {
|
||||
// CHECK: 1
|
||||
%0 = arith.constant 0.0 : f32
|
||||
%cos_0 = math.cos %0 : f32
|
||||
@ -385,7 +385,7 @@ func @cos() {
|
||||
// Atan.
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
func @atan() {
|
||||
func.func @atan() {
|
||||
// CHECK: -0.785184
|
||||
%0 = arith.constant -1.0 : f32
|
||||
%atan_0 = math.atan %0 : f32
|
||||
@ -429,7 +429,7 @@ func @atan() {
|
||||
// Atan2.
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
func @atan2() {
|
||||
func.func @atan2() {
|
||||
%zero = arith.constant 0.0 : f32
|
||||
%one = arith.constant 1.0 : f32
|
||||
%two = arith.constant 2.0 : f32
|
||||
@ -498,7 +498,7 @@ func @atan2() {
|
||||
}
|
||||
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
call @tanh(): () -> ()
|
||||
call @log(): () -> ()
|
||||
call @log2(): () -> ()
|
||||
|
@ -3,9 +3,9 @@
|
||||
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext \
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
func @main() -> () {
|
||||
func.func @main() -> () {
|
||||
%c0 = arith.constant 0 : index
|
||||
%c1 = arith.constant 1 : index
|
||||
|
||||
@ -35,7 +35,7 @@ func @main() -> () {
|
||||
return
|
||||
}
|
||||
|
||||
func @cast_ranked_memref_to_static_shape(%input : memref<2x3xf32>) {
|
||||
func.func @cast_ranked_memref_to_static_shape(%input : memref<2x3xf32>) {
|
||||
%output = memref.reinterpret_cast %input to
|
||||
offset: [0], sizes: [6, 1], strides: [1, 1]
|
||||
: memref<2x3xf32> to memref<6x1xf32>
|
||||
@ -53,7 +53,7 @@ func @cast_ranked_memref_to_static_shape(%input : memref<2x3xf32>) {
|
||||
return
|
||||
}
|
||||
|
||||
func @cast_ranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
|
||||
func.func @cast_ranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
|
||||
%c0 = arith.constant 0 : index
|
||||
%c1 = arith.constant 1 : index
|
||||
%c6 = arith.constant 6 : index
|
||||
@ -69,7 +69,7 @@ func @cast_ranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
|
||||
return
|
||||
}
|
||||
|
||||
func @cast_unranked_memref_to_static_shape(%input : memref<2x3xf32>) {
|
||||
func.func @cast_unranked_memref_to_static_shape(%input : memref<2x3xf32>) {
|
||||
%unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
|
||||
%output = memref.reinterpret_cast %unranked_input to
|
||||
offset: [0], sizes: [6, 1], strides: [1, 1]
|
||||
@ -88,7 +88,7 @@ func @cast_unranked_memref_to_static_shape(%input : memref<2x3xf32>) {
|
||||
return
|
||||
}
|
||||
|
||||
func @cast_unranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
|
||||
func.func @cast_unranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
|
||||
%unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
|
||||
%c0 = arith.constant 0 : index
|
||||
%c1 = arith.constant 1 : index
|
||||
|
@ -4,9 +4,9 @@
|
||||
// RUN: | FileCheck %s
|
||||
|
||||
|
||||
func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
func @main() -> () {
|
||||
func.func @main() -> () {
|
||||
%c0 = arith.constant 0 : index
|
||||
%c1 = arith.constant 1 : index
|
||||
|
||||
@ -48,7 +48,7 @@ func @main() -> () {
|
||||
return
|
||||
}
|
||||
|
||||
func @reshape_ranked_memref_to_ranked(%input : memref<2x3xf32>,
|
||||
func.func @reshape_ranked_memref_to_ranked(%input : memref<2x3xf32>,
|
||||
%shape : memref<2xindex>) {
|
||||
%output = memref.reshape %input(%shape)
|
||||
: (memref<2x3xf32>, memref<2xindex>) -> memref<?x?xf32>
|
||||
@ -62,7 +62,7 @@ func @reshape_ranked_memref_to_ranked(%input : memref<2x3xf32>,
|
||||
return
|
||||
}
|
||||
|
||||
func @reshape_unranked_memref_to_ranked(%input : memref<2x3xf32>,
|
||||
func.func @reshape_unranked_memref_to_ranked(%input : memref<2x3xf32>,
|
||||
%shape : memref<2xindex>) {
|
||||
%unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
|
||||
%output = memref.reshape %input(%shape)
|
||||
@ -77,7 +77,7 @@ func @reshape_unranked_memref_to_ranked(%input : memref<2x3xf32>,
|
||||
return
|
||||
}
|
||||
|
||||
func @reshape_ranked_memref_to_unranked(%input : memref<2x3xf32>,
|
||||
func.func @reshape_ranked_memref_to_unranked(%input : memref<2x3xf32>,
|
||||
%shape : memref<2xindex>) {
|
||||
%dyn_size_shape = memref.cast %shape : memref<2xindex> to memref<?xindex>
|
||||
%output = memref.reshape %input(%dyn_size_shape)
|
||||
@ -91,7 +91,7 @@ func @reshape_ranked_memref_to_unranked(%input : memref<2x3xf32>,
|
||||
return
|
||||
}
|
||||
|
||||
func @reshape_unranked_memref_to_unranked(%input : memref<2x3xf32>,
|
||||
func.func @reshape_unranked_memref_to_unranked(%input : memref<2x3xf32>,
|
||||
%shape : memref<2xindex>) {
|
||||
%unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
|
||||
%dyn_size_shape = memref.cast %shape : memref<2xindex> to memref<?xindex>
|
||||
|
@ -7,7 +7,7 @@
|
||||
llvm.mlir.global internal constant @str_global("String to print\0A")
|
||||
llvm.func @print_c_string(!llvm.ptr<i8>)
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%0 = llvm.mlir.addressof @str_global : !llvm.ptr<array<16 x i8>>
|
||||
%1 = llvm.mlir.constant(0 : index) : i64
|
||||
%2 = llvm.getelementptr %0[%1, %1]
|
||||
|
@ -1,6 +1,6 @@
|
||||
// RUN: mlir-opt -pass-pipeline="func.func(convert-linalg-to-loops,lower-affine,convert-scf-to-cf,convert-arith-to-llvm),convert-vector-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" %s | mlir-cpu-runner -O3 -e main -entry-point-result=void -shared-libs=%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext | FileCheck %s
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%A = memref.alloc() : memref<16x16xf32>
|
||||
%B = memref.alloc() : memref<16x16xf32>
|
||||
%C = memref.alloc() : memref<16x16xf32>
|
||||
@ -49,7 +49,7 @@ func @main() {
|
||||
}
|
||||
// CHECK: 17
|
||||
|
||||
func @sgemm_naive(%arg0: memref<16x16xf32>, %arg1: memref<16x16xf32>, %arg2: memref<16x16xf32>) {
|
||||
func.func @sgemm_naive(%arg0: memref<16x16xf32>, %arg1: memref<16x16xf32>, %arg2: memref<16x16xf32>) {
|
||||
%c0 = arith.constant 0 : index
|
||||
affine.for %arg3 = 0 to 16 {
|
||||
affine.for %arg4 = 0 to 16 {
|
||||
@ -72,5 +72,5 @@ func @sgemm_naive(%arg0: memref<16x16xf32>, %arg1: memref<16x16xf32>, %arg2: mem
|
||||
return
|
||||
}
|
||||
|
||||
func private @print_flops(f64)
|
||||
func private @rtclock() -> f64
|
||||
func.func private @print_flops(f64)
|
||||
func.func private @rtclock() -> f64
|
||||
|
@ -35,7 +35,7 @@
|
||||
// CHECK-SAME: sizes = [4, 3]
|
||||
// CHECK-SAME: strides = [3, 1]
|
||||
// CHECK-COUNT-4: [1, 1, 1]
|
||||
func @main() -> () {
|
||||
func.func @main() -> () {
|
||||
%A = memref.alloc() : memref<10x3xf32, 0>
|
||||
%f2 = arith.constant 2.00000e+00 : f32
|
||||
%f5 = arith.constant 5.00000e+00 : f32
|
||||
@ -73,10 +73,10 @@ func @main() -> () {
|
||||
return
|
||||
}
|
||||
|
||||
func private @print_memref_i8(memref<*xi8>) attributes { llvm.emit_c_interface }
|
||||
func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_i8(memref<*xi8>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
func @return_two_var_memref_caller() {
|
||||
func.func @return_two_var_memref_caller() {
|
||||
%0 = memref.alloca() : memref<4x3xf32>
|
||||
%c0f32 = arith.constant 1.0 : f32
|
||||
linalg.fill ins(%c0f32 : f32) outs(%0 : memref<4x3xf32>)
|
||||
@ -86,12 +86,12 @@ func @return_two_var_memref_caller() {
|
||||
return
|
||||
}
|
||||
|
||||
func @return_two_var_memref(%arg0: memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) {
|
||||
func.func @return_two_var_memref(%arg0: memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) {
|
||||
%0 = memref.cast %arg0 : memref<4x3xf32> to memref<*xf32>
|
||||
return %0, %0 : memref<*xf32>, memref<*xf32>
|
||||
}
|
||||
|
||||
func @return_var_memref_caller() {
|
||||
func.func @return_var_memref_caller() {
|
||||
%0 = memref.alloca() : memref<4x3xf32>
|
||||
%c0f32 = arith.constant 1.0 : f32
|
||||
linalg.fill ins(%c0f32 : f32) outs(%0 : memref<4x3xf32>)
|
||||
@ -100,15 +100,15 @@ func @return_var_memref_caller() {
|
||||
return
|
||||
}
|
||||
|
||||
func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> {
|
||||
func.func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> {
|
||||
%0 = memref.cast %arg0: memref<4x3xf32> to memref<*xf32>
|
||||
return %0 : memref<*xf32>
|
||||
}
|
||||
|
||||
func private @printU64(index) -> ()
|
||||
func private @printNewline() -> ()
|
||||
func.func private @printU64(index) -> ()
|
||||
func.func private @printNewline() -> ()
|
||||
|
||||
func @dim_op_of_unranked() {
|
||||
func.func @dim_op_of_unranked() {
|
||||
%ranked = memref.alloca() : memref<4x3xf32>
|
||||
%unranked = memref.cast %ranked: memref<4x3xf32> to memref<*xf32>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e print_3d -entry-point-result=void -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-3D
|
||||
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e vector_splat_2d -entry-point-result=void -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-VECTOR-SPLAT-2D
|
||||
|
||||
func @print_0d() {
|
||||
func.func @print_0d() {
|
||||
%f = arith.constant 2.00000e+00 : f32
|
||||
%A = memref.alloc() : memref<f32>
|
||||
memref.store %f, %A[]: memref<f32>
|
||||
@ -15,7 +15,7 @@ func @print_0d() {
|
||||
// PRINT-0D: Unranked Memref base@ = {{.*}} rank = 0 offset = 0 sizes = [] strides = [] data =
|
||||
// PRINT-0D: [2]
|
||||
|
||||
func @print_1d() {
|
||||
func.func @print_1d() {
|
||||
%f = arith.constant 2.00000e+00 : f32
|
||||
%A = memref.alloc() : memref<16xf32>
|
||||
%B = memref.cast %A: memref<16xf32> to memref<?xf32>
|
||||
@ -28,7 +28,7 @@ func @print_1d() {
|
||||
// PRINT-1D: Unranked Memref base@ = {{.*}} rank = 1 offset = 0 sizes = [16] strides = [1] data =
|
||||
// PRINT-1D-NEXT: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
|
||||
|
||||
func @print_3d() {
|
||||
func.func @print_3d() {
|
||||
%f = arith.constant 2.00000e+00 : f32
|
||||
%f4 = arith.constant 4.00000e+00 : f32
|
||||
%A = memref.alloc() : memref<3x4x5xf32>
|
||||
@ -49,11 +49,11 @@ func @print_3d() {
|
||||
// PRINT-3D-NEXT: 2, 2, 4, 2, 2
|
||||
// PRINT-3D-NEXT: 2, 2, 2, 2, 2
|
||||
|
||||
func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
||||
!vector_type_C = type vector<4x4xf32>
|
||||
!matrix_type_CC = type memref<1x1x!vector_type_C>
|
||||
func @vector_splat_2d() {
|
||||
func.func @vector_splat_2d() {
|
||||
%c0 = arith.constant 0 : index
|
||||
%f10 = arith.constant 10.0 : f32
|
||||
%vf10 = vector.splat %f10: !vector_type_C
|
||||
@ -70,4 +70,4 @@ func @vector_splat_2d() {
|
||||
// PRINT-VECTOR-SPLAT-2D: Memref base@ = {{.*}} rank = 2 offset = 0 sizes = [1, 1] strides = [1, 1] data =
|
||||
// PRINT-VECTOR-SPLAT-2D-NEXT: [((10, 10, 10, 10), (10, 10, 10, 10), (10, 10, 10, 10), (10, 10, 10, 10))]
|
||||
|
||||
func private @print_memref_vector_4x4xf32(memref<?x?x!vector_type_C>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_vector_4x4xf32(memref<?x?x!vector_type_C>) attributes { llvm.emit_c_interface }
|
||||
|
@ -7,7 +7,7 @@
|
||||
// CHECK: llvm.func @async_execute_fn_0{{.*}}attributes{{.*}}"coroutine.presplit", "0"
|
||||
// CHECK: llvm.func @async_execute_fn_1{{.*}}attributes{{.*}}"coroutine.presplit", "0"
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%i0 = arith.constant 0 : index
|
||||
%i1 = arith.constant 1 : index
|
||||
%i2 = arith.constant 2 : index
|
||||
@ -65,6 +65,6 @@ func @main() {
|
||||
return
|
||||
}
|
||||
|
||||
func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
|
||||
func.func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()
|
||||
|
||||
func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
func.func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
|
||||
|
@ -1,22 +1,22 @@
|
||||
// RUN: mlir-opt --split-input-file --verify-diagnostics %s 2> %t && FileCheck --input-file %t %s
|
||||
// RUN: cat %t
|
||||
|
||||
func @main() {return}
|
||||
func.func @main() {return}
|
||||
|
||||
// -----
|
||||
|
||||
// expected-note @+1 {{see existing symbol definition here}}
|
||||
func @foo() { return }
|
||||
func.func @foo() { return }
|
||||
// CHECK: warning: near miss with file split marker
|
||||
// CHECK: ----
|
||||
// ----
|
||||
|
||||
// expected-error @+1 {{redefinition of symbol named 'foo'}}
|
||||
func @foo() { return }
|
||||
func.func @foo() { return }
|
||||
// CHECK: warning: near miss with file split marker
|
||||
// CHECK: ----
|
||||
// ----
|
||||
func @bar2() {return }
|
||||
func.func @bar2() {return }
|
||||
|
||||
// No error flagged at the end for a near miss.
|
||||
// ----
|
||||
|
@ -3,18 +3,18 @@
|
||||
// "test.op_crash_long" should be replaced with a shorter form "test.op_crash_short".
|
||||
|
||||
// CHECK-NOT: func @simple1() {
|
||||
func @simple1() {
|
||||
func.func @simple1() {
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @simple2(%arg0: i32, %arg1: i32, %arg2: i32) {
|
||||
func @simple2(%arg0: i32, %arg1: i32, %arg2: i32) {
|
||||
func.func @simple2(%arg0: i32, %arg1: i32, %arg2: i32) {
|
||||
// CHECK-LABEL: %0 = "test.op_crash_short"() : () -> i32
|
||||
%0 = "test.op_crash_long" (%arg0, %arg1, %arg2) : (i32, i32, i32) -> i32
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-NOT: func @simple5() {
|
||||
func @simple5() {
|
||||
func.func @simple5() {
|
||||
return
|
||||
}
|
||||
|
@ -5,13 +5,13 @@
|
||||
// removed by the dead code elimination pass.
|
||||
|
||||
// CHECK-NOT: func private @dead_private_function
|
||||
func private @dead_private_function()
|
||||
func.func private @dead_private_function()
|
||||
|
||||
// CHECK-NOT: func nested @dead_nested_function
|
||||
func nested @dead_nested_function()
|
||||
func.func nested @dead_nested_function()
|
||||
|
||||
// CHECK-LABEL: func @simple1(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
|
||||
func @simple1(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
|
||||
func.func @simple1(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
|
||||
"test.op_crash" () : () -> ()
|
||||
return
|
||||
}
|
||||
|
@ -5,23 +5,23 @@
|
||||
// containing the interesting behavior.
|
||||
|
||||
// CHECK-NOT: func @simple1() {
|
||||
func @simple1() {
|
||||
func.func @simple1() {
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-NOT: func @simple2() {
|
||||
func @simple2() {
|
||||
func.func @simple2() {
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @simple3() {
|
||||
func @simple3() {
|
||||
func.func @simple3() {
|
||||
"test.op_crash" () : () -> ()
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-NOT: func @simple4() {
|
||||
func @simple4(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
|
||||
func.func @simple4(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
|
||||
cf.cond_br %arg0, ^bb1, ^bb2
|
||||
^bb1:
|
||||
cf.br ^bb3(%arg1 : memref<2xf32>)
|
||||
@ -34,6 +34,6 @@ func @simple4(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
|
||||
}
|
||||
|
||||
// CHECK-NOT: func @simple5() {
|
||||
func @simple5() {
|
||||
func.func @simple5() {
|
||||
return
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// UNSUPPORTED: system-windows
|
||||
// RUN: mlir-reduce %s -reduction-tree='traversal-mode=0 test=%S/test.sh'
|
||||
|
||||
func @simple1(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
|
||||
func.func @simple1(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
|
||||
cf.cond_br %arg0, ^bb1, ^bb2
|
||||
^bb1:
|
||||
cf.br ^bb3(%arg1 : memref<2xf32>)
|
||||
|
@ -1,7 +1,7 @@
|
||||
// RUN: mlir-opt %s
|
||||
// RUN: not mlir-opt %s -test-mlir-reducer -pass-test function-reducer
|
||||
|
||||
func @test() {
|
||||
func.func @test() {
|
||||
"test.op_crash"() : () -> ()
|
||||
return
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ module attributes {
|
||||
gpu.return
|
||||
}
|
||||
}
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%input = memref.alloc() : memref<6xi32>
|
||||
%output = memref.alloc() : memref<6xi32>
|
||||
%four = arith.constant 4 : i32
|
||||
@ -62,6 +62,6 @@ module attributes {
|
||||
return
|
||||
}
|
||||
|
||||
func private @fillI32Buffer(%arg0 : memref<?xi32>, %arg1 : i32)
|
||||
func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
func.func private @fillI32Buffer(%arg0 : memref<?xi32>, %arg1 : i32)
|
||||
func.func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ module attributes {
|
||||
}
|
||||
}
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%input1 = memref.alloc() : memref<3xf32>
|
||||
%input2 = memref.alloc() : memref<3x3xf32>
|
||||
%output = memref.alloc() : memref<3x3x3xf32>
|
||||
@ -54,8 +54,8 @@ module attributes {
|
||||
call @print_memref_f32(%result) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
func private @fillF32Buffer1D(%arg0 : memref<?xf32>, %arg1 : f32)
|
||||
func private @fillF32Buffer2D(%arg0 : memref<?x?xf32>, %arg1 : f32)
|
||||
func private @fillF32Buffer3D(%arg0 : memref<?x?x?xf32>, %arg1 : f32)
|
||||
func private @print_memref_f32(%arg0 : memref<*xf32>)
|
||||
func.func private @fillF32Buffer1D(%arg0 : memref<?xf32>, %arg1 : f32)
|
||||
func.func private @fillF32Buffer2D(%arg0 : memref<?x?xf32>, %arg1 : f32)
|
||||
func.func private @fillF32Buffer3D(%arg0 : memref<?x?x?xf32>, %arg1 : f32)
|
||||
func.func private @print_memref_f32(%arg0 : memref<*xf32>)
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
// CHECK-LABEL: @test_roundtrip_parameter_parsers
|
||||
// CHECK: !test.type_with_format<111, three = #test<"attr_ugly begin 5 : index end">, two = "foo">
|
||||
// CHECK: !test.type_with_format<2147, three = "hi", two = "hi">
|
||||
func private @test_roundtrip_parameter_parsers(!test.type_with_format<111, three = #test<"attr_ugly begin 5 : index end">, two = "foo">) -> !test.type_with_format<2147, two = "hi", three = "hi">
|
||||
func.func private @test_roundtrip_parameter_parsers(!test.type_with_format<111, three = #test<"attr_ugly begin 5 : index end">, two = "foo">) -> !test.type_with_format<2147, two = "hi", three = "hi">
|
||||
attributes {
|
||||
// CHECK: #test.attr_with_format<3 : two = "hello", four = [1, 2, 3] : 42 : i64>
|
||||
attr0 = #test.attr_with_format<3 : two = "hello", four = [1, 2, 3] : 42 : i64>,
|
||||
@ -53,7 +53,7 @@ attributes {
|
||||
// CHECK: !test.custom_type_string<"foo" foo>
|
||||
// CHECK: !test.custom_type_string<"bar" bar>
|
||||
|
||||
func private @test_roundtrip_default_parsers_struct(
|
||||
func.func private @test_roundtrip_default_parsers_struct(
|
||||
!test.no_parser<255, [1, 2, 3, 4, 5], "foobar", 4>
|
||||
) -> (
|
||||
!test.struct_capture_all<v3 = 3, v1 = 1, v2 = 2, v0 = 0>,
|
||||
|
@ -1,27 +1,27 @@
|
||||
// RUN: mlir-opt --split-input-file %s --verify-diagnostics
|
||||
|
||||
func private @test_ugly_attr_cannot_be_pretty() -> () attributes {
|
||||
func.func private @test_ugly_attr_cannot_be_pretty() -> () attributes {
|
||||
// expected-error@+1 {{expected 'begin'}}
|
||||
attr = #test.attr_ugly
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_ugly_attr_no_mnemonic() -> () attributes {
|
||||
func.func private @test_ugly_attr_no_mnemonic() -> () attributes {
|
||||
// expected-error@+1 {{expected valid keyword}}
|
||||
attr = #test<"">
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_ugly_attr_parser_dispatch() -> () attributes {
|
||||
func.func private @test_ugly_attr_parser_dispatch() -> () attributes {
|
||||
// expected-error@+1 {{expected 'begin'}}
|
||||
attr = #test<"attr_ugly">
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_ugly_attr_missing_parameter() -> () attributes {
|
||||
func.func private @test_ugly_attr_missing_parameter() -> () attributes {
|
||||
// expected-error@+2 {{failed to parse TestAttrUgly parameter 'attr'}}
|
||||
// expected-error@+1 {{expected non-function type}}
|
||||
attr = #test<"attr_ugly begin">
|
||||
@ -29,21 +29,21 @@ func private @test_ugly_attr_missing_parameter() -> () attributes {
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_ugly_attr_missing_literal() -> () attributes {
|
||||
func.func private @test_ugly_attr_missing_literal() -> () attributes {
|
||||
// expected-error@+1 {{expected 'end'}}
|
||||
attr = #test<"attr_ugly begin \"string_attr\"">
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_pretty_attr_expects_less() -> () attributes {
|
||||
func.func private @test_pretty_attr_expects_less() -> () attributes {
|
||||
// expected-error@+1 {{expected '<'}}
|
||||
attr = #test.attr_with_format
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_pretty_attr_missing_param() -> () attributes {
|
||||
func.func private @test_pretty_attr_missing_param() -> () attributes {
|
||||
// expected-error@+2 {{expected integer value}}
|
||||
// expected-error@+1 {{failed to parse TestAttrWithFormat parameter 'one'}}
|
||||
attr = #test.attr_with_format<>
|
||||
@ -51,7 +51,7 @@ func private @test_pretty_attr_missing_param() -> () attributes {
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_parse_invalid_param() -> () attributes {
|
||||
func.func private @test_parse_invalid_param() -> () attributes {
|
||||
// Test parameter parser failure is propagated
|
||||
// expected-error@+2 {{expected integer value}}
|
||||
// expected-error@+1 {{failed to parse TestAttrWithFormat parameter 'one'}}
|
||||
@ -60,14 +60,14 @@ func private @test_parse_invalid_param() -> () attributes {
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_pretty_attr_invalid_syntax() -> () attributes {
|
||||
func.func private @test_pretty_attr_invalid_syntax() -> () attributes {
|
||||
// expected-error@+1 {{expected ':'}}
|
||||
attr = #test.attr_with_format<42>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_struct_missing_key() -> () attributes {
|
||||
func.func private @test_struct_missing_key() -> () attributes {
|
||||
// expected-error@+2 {{expected valid keyword}}
|
||||
// expected-error@+1 {{expected a parameter name in struct}}
|
||||
attr = #test.attr_with_format<42 :>
|
||||
@ -75,28 +75,28 @@ func private @test_struct_missing_key() -> () attributes {
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_struct_unknown_key() -> () attributes {
|
||||
func.func private @test_struct_unknown_key() -> () attributes {
|
||||
// expected-error@+1 {{duplicate or unknown struct parameter}}
|
||||
attr = #test.attr_with_format<42 : nine = "foo">
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_struct_duplicate_key() -> () attributes {
|
||||
func.func private @test_struct_duplicate_key() -> () attributes {
|
||||
// expected-error@+1 {{duplicate or unknown struct parameter}}
|
||||
attr = #test.attr_with_format<42 : two = "foo", two = "bar">
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_struct_not_enough_values() -> () attributes {
|
||||
func.func private @test_struct_not_enough_values() -> () attributes {
|
||||
// expected-error@+1 {{expected ','}}
|
||||
attr = #test.attr_with_format<42 : two = "foo">
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_parse_param_after_struct() -> () attributes {
|
||||
func.func private @test_parse_param_after_struct() -> () attributes {
|
||||
// expected-error@+2 {{expected non-function type}}
|
||||
// expected-error@+1 {{failed to parse TestAttrWithFormat parameter 'three'}}
|
||||
attr = #test.attr_with_format<42 : two = "foo", four = [1, 2, 3] : >
|
||||
@ -105,30 +105,30 @@ func private @test_parse_param_after_struct() -> () attributes {
|
||||
// -----
|
||||
|
||||
// expected-error@+1 {{expected '<'}}
|
||||
func private @test_invalid_type() -> !test.type_with_format
|
||||
func.func private @test_invalid_type() -> !test.type_with_format
|
||||
|
||||
// -----
|
||||
|
||||
// expected-error@+2 {{expected integer value}}
|
||||
// expected-error@+1 {{failed to parse TestTypeWithFormat parameter 'one'}}
|
||||
func private @test_pretty_type_invalid_param() -> !test.type_with_format<>
|
||||
func.func private @test_pretty_type_invalid_param() -> !test.type_with_format<>
|
||||
|
||||
// -----
|
||||
|
||||
// expected-error@+2 {{expected ':'}}
|
||||
// expected-error@+1 {{failed to parse TestTypeWithFormat parameter 'three'}}
|
||||
func private @test_type_syntax_error() -> !test.type_with_format<42, two = "hi", three = #test.attr_with_format<42>>
|
||||
func.func private @test_type_syntax_error() -> !test.type_with_format<42, two = "hi", three = #test.attr_with_format<42>>
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_verifier_fails() -> () attributes {
|
||||
func.func private @test_verifier_fails() -> () attributes {
|
||||
// expected-error@+1 {{expected 'one' to equal 'four.size()'}}
|
||||
attr = #test.attr_with_format<42 : two = "hello", four = [1, 2, 3] : 42 : i64>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func private @test_attr_with_type_failed_to_parse_type() -> () attributes {
|
||||
func.func private @test_attr_with_type_failed_to_parse_type() -> () attributes {
|
||||
// expected-error@+2 {{invalid kind of type specified}}
|
||||
// expected-error@+1 {{failed to parse TestAttrWithTypeParam parameter 'int_type'}}
|
||||
attr = #test.attr_with_type<vector<4xi32>, vector<4xi32>>
|
||||
|
@ -1,7 +1,7 @@
|
||||
// RUN: mlir-opt -test-derived-attr -verify-diagnostics %s | FileCheck %s
|
||||
|
||||
// CHECK-LABEL: verifyDerivedAttributes
|
||||
func @verifyDerivedAttributes() {
|
||||
func.func @verifyDerivedAttributes() {
|
||||
// expected-remark @+2 {{element_dtype = f32}}
|
||||
// expected-remark @+1 {{size = 320}}
|
||||
%0 = "test.derived_type_attr"() : () -> tensor<10xf32>
|
||||
|
@ -310,7 +310,7 @@ test.format_qual_cpmd_nested_attr nested #test.cmpnd_nested_outer<i <42 <1, !tes
|
||||
|
||||
// Check the `qualified` directive in the declarative assembly format.
|
||||
// CHECK: @qualifiedCompoundNestedExplicit(%arg0: !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>)
|
||||
func @qualifiedCompoundNestedExplicit(%arg0: !test.cmpnd_nested_outer<i !test.cmpnd_inner<42 <1, !test.smpla, [5, 6]>>>) -> () {
|
||||
func.func @qualifiedCompoundNestedExplicit(%arg0: !test.cmpnd_nested_outer<i !test.cmpnd_inner<42 <1, !test.smpla, [5, 6]>>>) -> () {
|
||||
// Verify that the type prefix is not elided
|
||||
// CHECK: format_qual_cpmd_nested_type %arg0 nested !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>
|
||||
test.format_qual_cpmd_nested_type %arg0 nested !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>
|
||||
@ -377,7 +377,7 @@ test.format_custom_directive_with_optional_operand_ref %i64 : 1
|
||||
// CHECK: test.format_custom_directive_with_optional_operand_ref : 0
|
||||
test.format_custom_directive_with_optional_operand_ref : 0
|
||||
|
||||
func @foo() {
|
||||
func.func @foo() {
|
||||
// CHECK: test.format_custom_directive_successors ^bb1, ^bb2
|
||||
test.format_custom_directive_successors ^bb1, ^bb2
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// RUN: mlir-opt -test-patterns -mlir-print-debuginfo -mlir-print-local-scope %s | FileCheck %s
|
||||
|
||||
// CHECK-LABEL: verifyFusedLocs
|
||||
func @verifyFusedLocs(%arg0 : i32) -> i32 {
|
||||
func.func @verifyFusedLocs(%arg0 : i32) -> i32 {
|
||||
%0 = "test.op_a"(%arg0) {attr = 10 : i32} : (i32) -> i32 loc("a")
|
||||
%result = "test.op_a"(%0) {attr = 20 : i32} : (i32) -> i32 loc("b")
|
||||
|
||||
@ -11,7 +11,7 @@ func @verifyFusedLocs(%arg0 : i32) -> i32 {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyDesignatedLoc
|
||||
func @verifyDesignatedLoc(%arg0 : i32) -> i32 {
|
||||
func.func @verifyDesignatedLoc(%arg0 : i32) -> i32 {
|
||||
%0 = "test.loc_src"(%arg0) : (i32) -> i32 loc("loc3")
|
||||
%1 = "test.loc_src"(%0) : (i32) -> i32 loc("loc2")
|
||||
%2 = "test.loc_src"(%1) : (i32) -> i32 loc("loc1")
|
||||
@ -25,14 +25,14 @@ func @verifyDesignatedLoc(%arg0 : i32) -> i32 {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyZeroResult
|
||||
func @verifyZeroResult(%arg0 : i32) {
|
||||
func.func @verifyZeroResult(%arg0 : i32) {
|
||||
// CHECK: "test.op_i"(%arg0) : (i32) -> ()
|
||||
"test.op_h"(%arg0) : (i32) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyZeroArg
|
||||
func @verifyZeroArg() -> i32 {
|
||||
func.func @verifyZeroArg() -> i32 {
|
||||
// CHECK: "test.op_k"() : () -> i32
|
||||
%0 = "test.op_j"() : () -> i32
|
||||
return %0 : i32
|
||||
@ -40,7 +40,7 @@ func @verifyZeroArg() -> i32 {
|
||||
|
||||
// CHECK-LABEL: testIgnoreArgMatch
|
||||
// CHECK-SAME: (%{{[a-z0-9]*}}: i32 loc({{[^)]*}}), %[[ARG1:[a-z0-9]*]]: i32 loc({{[^)]*}}),
|
||||
func @testIgnoreArgMatch(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: f32) {
|
||||
func.func @testIgnoreArgMatch(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: f32) {
|
||||
// CHECK: "test.ignore_arg_match_dst"(%[[ARG1]]) {f = 15 : i64}
|
||||
"test.ignore_arg_match_src"(%arg0, %arg1, %arg2) {d = 42, e = 24, f = 15} : (i32, i32, i32) -> ()
|
||||
|
||||
@ -56,14 +56,14 @@ func @testIgnoreArgMatch(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: f32) {
|
||||
|
||||
// CHECK-LABEL: verifyInterleavedOperandAttribute
|
||||
// CHECK-SAME: %[[ARG0:.*]]: i32 loc({{[^)]*}}), %[[ARG1:.*]]: i32 loc({{[^)]*}})
|
||||
func @verifyInterleavedOperandAttribute(%arg0: i32, %arg1: i32) {
|
||||
func.func @verifyInterleavedOperandAttribute(%arg0: i32, %arg1: i32) {
|
||||
// CHECK: "test.interleaved_operand_attr2"(%[[ARG0]], %[[ARG1]]) {attr1 = 15 : i64, attr2 = 42 : i64}
|
||||
"test.interleaved_operand_attr1"(%arg0, %arg1) {attr1 = 15, attr2 = 42} : (i32, i32) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyBenefit
|
||||
func @verifyBenefit(%arg0 : i32) -> i32 {
|
||||
func.func @verifyBenefit(%arg0 : i32) -> i32 {
|
||||
%0 = "test.op_d"(%arg0) : (i32) -> i32
|
||||
%1 = "test.op_g"(%arg0) : (i32) -> i32
|
||||
%2 = "test.op_g"(%1) : (i32) -> i32
|
||||
@ -74,7 +74,7 @@ func @verifyBenefit(%arg0 : i32) -> i32 {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyNativeCodeCall
|
||||
func @verifyNativeCodeCall(%arg0: i32, %arg1: i32) -> (i32, i32) {
|
||||
func.func @verifyNativeCodeCall(%arg0: i32, %arg1: i32) -> (i32, i32) {
|
||||
// CHECK: %0 = "test.native_code_call2"(%arg0) {attr = [42, 24]} : (i32) -> i32
|
||||
// CHECK: return %0, %arg1
|
||||
%0 = "test.native_code_call1"(%arg0, %arg1) {choice = true, attr1 = 42, attr2 = 24} : (i32, i32) -> (i32)
|
||||
@ -83,7 +83,7 @@ func @verifyNativeCodeCall(%arg0: i32, %arg1: i32) -> (i32, i32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyAuxiliaryNativeCodeCall
|
||||
func @verifyAuxiliaryNativeCodeCall(%arg0: i32) -> (i32) {
|
||||
func.func @verifyAuxiliaryNativeCodeCall(%arg0: i32) -> (i32) {
|
||||
// CHECK: test.op_i
|
||||
// CHECK: test.op_k
|
||||
%0 = "test.native_code_call3"(%arg0) : (i32) -> (i32)
|
||||
@ -91,7 +91,7 @@ func @verifyAuxiliaryNativeCodeCall(%arg0: i32) -> (i32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyNativeCodeCallBinding
|
||||
func @verifyNativeCodeCallBinding(%arg0 : i32) -> (i32) {
|
||||
func.func @verifyNativeCodeCallBinding(%arg0 : i32) -> (i32) {
|
||||
%0 = "test.op_k"() : () -> (i32)
|
||||
// CHECK: %[[A:.*]], %[[B:.*]] = "test.native_code_call5"(%1, %1) : (i32, i32) -> (i32, i32)
|
||||
%1, %2 = "test.native_code_call4"(%0) : (i32) -> (i32, i32)
|
||||
@ -115,7 +115,7 @@ func@verifyMultipleNativeCodeCallBinding(%arg0 : i32) -> (i32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyAllAttrConstraintOf
|
||||
func @verifyAllAttrConstraintOf() -> (i32, i32, i32) {
|
||||
func.func @verifyAllAttrConstraintOf() -> (i32, i32, i32) {
|
||||
// CHECK: "test.all_attr_constraint_of2"
|
||||
%0 = "test.all_attr_constraint_of1"() {attr = [0, 1]} : () -> (i32)
|
||||
// CHECK: "test.all_attr_constraint_of1"
|
||||
@ -127,7 +127,7 @@ func @verifyAllAttrConstraintOf() -> (i32, i32, i32) {
|
||||
|
||||
// CHECK-LABEL: verifyManyArgs
|
||||
// CHECK-SAME: (%[[ARG:.*]]: i32 loc({{[^)]*}}))
|
||||
func @verifyManyArgs(%arg: i32) {
|
||||
func.func @verifyManyArgs(%arg: i32) {
|
||||
// CHECK: "test.many_arguments"(%[[ARG]], %[[ARG]], %[[ARG]], %[[ARG]], %[[ARG]], %[[ARG]], %[[ARG]], %[[ARG]], %[[ARG]])
|
||||
// CHECK-SAME: {attr1 = 24 : i64, attr2 = 42 : i64, attr3 = 42 : i64, attr4 = 42 : i64, attr5 = 42 : i64, attr6 = 42 : i64, attr7 = 42 : i64, attr8 = 42 : i64, attr9 = 42 : i64}
|
||||
"test.many_arguments"(%arg, %arg, %arg, %arg, %arg, %arg, %arg, %arg, %arg) {
|
||||
@ -138,7 +138,7 @@ func @verifyManyArgs(%arg: i32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyEqualArgs
|
||||
func @verifyEqualArgs(%arg0: i32, %arg1: i32) {
|
||||
func.func @verifyEqualArgs(%arg0: i32, %arg1: i32) {
|
||||
// def TestEqualArgsPattern : Pat<(OpN $a, $a), (OpO $a)>;
|
||||
|
||||
// CHECK: "test.op_o"(%arg0) : (i32) -> i32
|
||||
@ -151,7 +151,7 @@ func @verifyEqualArgs(%arg0: i32, %arg1: i32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyNestedOpEqualArgs
|
||||
func @verifyNestedOpEqualArgs(
|
||||
func.func @verifyNestedOpEqualArgs(
|
||||
%arg0: i32, %arg1: i32, %arg2 : i32, %arg3 : i32, %arg4 : i32, %arg5 : i32) {
|
||||
// def TestNestedOpEqualArgsPattern :
|
||||
// Pat<(OpN $b, (OpP $a, $b, $c, $d, $e, $f)), (replaceWithValue $b)>;
|
||||
@ -171,7 +171,7 @@ func @verifyNestedOpEqualArgs(
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyNestedSameOpAndSameArgEquality
|
||||
func @verifyNestedSameOpAndSameArgEquality(%arg0: i32, %arg1: i32) -> i32 {
|
||||
func.func @verifyNestedSameOpAndSameArgEquality(%arg0: i32, %arg1: i32) -> i32 {
|
||||
// def TestNestedSameOpAndSameArgEqualityPattern:
|
||||
// Pat<(OpN (OpN $_, $x), $x), (replaceWithValue $x)>;
|
||||
|
||||
@ -182,7 +182,7 @@ func @verifyNestedSameOpAndSameArgEquality(%arg0: i32, %arg1: i32) -> i32 {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyMultipleEqualArgs
|
||||
func @verifyMultipleEqualArgs(
|
||||
func.func @verifyMultipleEqualArgs(
|
||||
%arg0: i32, %arg1 : i32, %arg2 : i32, %arg3 : i32, %arg4 : i32) {
|
||||
// def TestMultipleEqualArgsPattern :
|
||||
// Pat<(OpP $a, $b, $a, $a, $b, $c), (OpN $c, $b)>;
|
||||
@ -211,7 +211,7 @@ func @verifyMultipleEqualArgs(
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: symbolBinding
|
||||
func @symbolBinding(%arg0: i32) -> i32 {
|
||||
func.func @symbolBinding(%arg0: i32) -> i32 {
|
||||
// An op with one use is matched.
|
||||
// CHECK: %0 = "test.symbol_binding_b"(%arg0)
|
||||
// CHECK: %1 = "test.symbol_binding_c"(%0)
|
||||
@ -227,7 +227,7 @@ func @symbolBinding(%arg0: i32) -> i32 {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: symbolBindingNoResult
|
||||
func @symbolBindingNoResult(%arg0: i32) {
|
||||
func.func @symbolBindingNoResult(%arg0: i32) {
|
||||
// CHECK: test.symbol_binding_b
|
||||
"test.symbol_binding_no_result"(%arg0) : (i32) -> ()
|
||||
return
|
||||
@ -238,42 +238,42 @@ func @symbolBindingNoResult(%arg0: i32) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: succeedMatchOpAttr
|
||||
func @succeedMatchOpAttr() -> i32 {
|
||||
func.func @succeedMatchOpAttr() -> i32 {
|
||||
// CHECK: "test.match_op_attribute2"() {default_valued_attr = 3 : i32, more_attr = 4 : i32, optional_attr = 2 : i32, required_attr = 1 : i32}
|
||||
%0 = "test.match_op_attribute1"() {required_attr = 1: i32, optional_attr = 2: i32, default_valued_attr = 3: i32, more_attr = 4: i32} : () -> (i32)
|
||||
return %0: i32
|
||||
}
|
||||
|
||||
// CHECK-LABEL: succeedMatchMissingOptionalAttr
|
||||
func @succeedMatchMissingOptionalAttr() -> i32 {
|
||||
func.func @succeedMatchMissingOptionalAttr() -> i32 {
|
||||
// CHECK: "test.match_op_attribute2"() {default_valued_attr = 3 : i32, more_attr = 4 : i32, required_attr = 1 : i32}
|
||||
%0 = "test.match_op_attribute1"() {required_attr = 1: i32, default_valued_attr = 3: i32, more_attr = 4: i32} : () -> (i32)
|
||||
return %0: i32
|
||||
}
|
||||
|
||||
// CHECK-LABEL: succeedMatchMissingDefaultValuedAttr
|
||||
func @succeedMatchMissingDefaultValuedAttr() -> i32 {
|
||||
func.func @succeedMatchMissingDefaultValuedAttr() -> i32 {
|
||||
// CHECK: "test.match_op_attribute2"() {default_valued_attr = 42 : i32, more_attr = 4 : i32, optional_attr = 2 : i32, required_attr = 1 : i32}
|
||||
%0 = "test.match_op_attribute1"() {required_attr = 1: i32, optional_attr = 2: i32, more_attr = 4: i32} : () -> (i32)
|
||||
return %0: i32
|
||||
}
|
||||
|
||||
// CHECK-LABEL: failedMatchAdditionalConstraintNotSatisfied
|
||||
func @failedMatchAdditionalConstraintNotSatisfied() -> i32 {
|
||||
func.func @failedMatchAdditionalConstraintNotSatisfied() -> i32 {
|
||||
// CHECK: "test.match_op_attribute1"()
|
||||
%0 = "test.match_op_attribute1"() {required_attr = 1: i32, optional_attr = 2: i32, more_attr = 5: i32} : () -> (i32)
|
||||
return %0: i32
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyConstantAttr
|
||||
func @verifyConstantAttr(%arg0 : i32) -> i32 {
|
||||
func.func @verifyConstantAttr(%arg0 : i32) -> i32 {
|
||||
// CHECK: "test.op_b"(%arg0) {attr = 17 : i32} : (i32) -> i32 loc("a")
|
||||
%0 = "test.op_c"(%arg0) : (i32) -> i32 loc("a")
|
||||
return %0 : i32
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyUnitAttr
|
||||
func @verifyUnitAttr() -> (i32, i32) {
|
||||
func.func @verifyUnitAttr() -> (i32, i32) {
|
||||
// Unit attribute present in the matched op is propagated as attr2.
|
||||
// CHECK: "test.match_op_attribute4"() {attr1, attr2} : () -> i32
|
||||
%0 = "test.match_op_attribute3"() {attr} : () -> i32
|
||||
@ -290,7 +290,7 @@ func @verifyUnitAttr() -> (i32, i32) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: testConstOp
|
||||
func @testConstOp() -> (i32) {
|
||||
func.func @testConstOp() -> (i32) {
|
||||
// CHECK-NEXT: [[C0:%.+]] = "test.constant"() {value = 1
|
||||
%0 = "test.constant"() {value = 1 : i32} : () -> i32
|
||||
|
||||
@ -299,7 +299,7 @@ func @testConstOp() -> (i32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: testConstOpUsed
|
||||
func @testConstOpUsed() -> (i32) {
|
||||
func.func @testConstOpUsed() -> (i32) {
|
||||
// CHECK-NEXT: [[C0:%.+]] = "test.constant"() {value = 1
|
||||
%0 = "test.constant"() {value = 1 : i32} : () -> i32
|
||||
|
||||
@ -311,7 +311,7 @@ func @testConstOpUsed() -> (i32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: testConstOpReplaced
|
||||
func @testConstOpReplaced() -> (i32) {
|
||||
func.func @testConstOpReplaced() -> (i32) {
|
||||
// CHECK-NEXT: [[C0:%.+]] = "test.constant"() {value = 1
|
||||
%0 = "test.constant"() {value = 1 : i32} : () -> i32
|
||||
%1 = "test.constant"() {value = 2 : i32} : () -> i32
|
||||
@ -324,7 +324,7 @@ func @testConstOpReplaced() -> (i32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: testConstOpMatchFailure
|
||||
func @testConstOpMatchFailure() -> (i64) {
|
||||
func.func @testConstOpMatchFailure() -> (i64) {
|
||||
// CHECK-DAG: [[C0:%.+]] = "test.constant"() {value = 1
|
||||
%0 = "test.constant"() {value = 1 : i64} : () -> i64
|
||||
|
||||
@ -339,7 +339,7 @@ func @testConstOpMatchFailure() -> (i64) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: testConstOpMatchNonConst
|
||||
func @testConstOpMatchNonConst(%arg0 : i32) -> (i32) {
|
||||
func.func @testConstOpMatchNonConst(%arg0 : i32) -> (i32) {
|
||||
// CHECK-DAG: [[C0:%.+]] = "test.constant"() {value = 1
|
||||
%0 = "test.constant"() {value = 1 : i32} : () -> i32
|
||||
|
||||
@ -357,14 +357,14 @@ func @testConstOpMatchNonConst(%arg0 : i32) -> (i32) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: verifyI32EnumAttr
|
||||
func @verifyI32EnumAttr() -> i32 {
|
||||
func.func @verifyI32EnumAttr() -> i32 {
|
||||
// CHECK: "test.i32_enum_attr"() {attr = 10 : i32}
|
||||
%0 = "test.i32_enum_attr"() {attr = 5: i32} : () -> i32
|
||||
return %0 : i32
|
||||
}
|
||||
|
||||
// CHECK-LABEL: verifyI64EnumAttr
|
||||
func @verifyI64EnumAttr() -> i32 {
|
||||
func.func @verifyI64EnumAttr() -> i32 {
|
||||
// CHECK: "test.i64_enum_attr"() {attr = 10 : i64}
|
||||
%0 = "test.i64_enum_attr"() {attr = 5: i64} : () -> i32
|
||||
return %0 : i32
|
||||
@ -375,14 +375,14 @@ func @verifyI64EnumAttr() -> i32 {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: rewrite_i32elementsattr
|
||||
func @rewrite_i32elementsattr() -> () {
|
||||
func.func @rewrite_i32elementsattr() -> () {
|
||||
// CHECK: attr = dense<0> : tensor<i32>
|
||||
"test.i32ElementsAttr"() {attr = dense<[3, 5]>:tensor<2xi32>} : () -> ()
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK-LABEL: rewrite_f64elementsattr
|
||||
func @rewrite_f64elementsattr() -> () {
|
||||
func.func @rewrite_f64elementsattr() -> () {
|
||||
"test.float_elements_attr"() {
|
||||
// Should match
|
||||
// CHECK: scalar_f32_attr = dense<[5.000000e+00, 6.000000e+00]> : tensor<2xf32>
|
||||
@ -404,7 +404,7 @@ func @rewrite_f64elementsattr() -> () {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @useMultiResultOpToReplaceWhole
|
||||
func @useMultiResultOpToReplaceWhole() -> (i32, f32, f32) {
|
||||
func.func @useMultiResultOpToReplaceWhole() -> (i32, f32, f32) {
|
||||
// CHECK: %[[A:.*]], %[[B:.*]], %[[C:.*]] = "test.another_three_result"()
|
||||
// CHECK: return %[[A]], %[[B]], %[[C]]
|
||||
%0:3 = "test.three_result"() {kind = 1} : () -> (i32, f32, f32)
|
||||
@ -412,7 +412,7 @@ func @useMultiResultOpToReplaceWhole() -> (i32, f32, f32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @useMultiResultOpToReplacePartial1
|
||||
func @useMultiResultOpToReplacePartial1() -> (i32, f32, f32) {
|
||||
func.func @useMultiResultOpToReplacePartial1() -> (i32, f32, f32) {
|
||||
// CHECK: %[[A:.*]], %[[B:.*]] = "test.two_result"()
|
||||
// CHECK: %[[C:.*]] = "test.one_result1"()
|
||||
// CHECK: return %[[A]], %[[B]], %[[C]]
|
||||
@ -421,7 +421,7 @@ func @useMultiResultOpToReplacePartial1() -> (i32, f32, f32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @useMultiResultOpToReplacePartial2
|
||||
func @useMultiResultOpToReplacePartial2() -> (i32, f32, f32) {
|
||||
func.func @useMultiResultOpToReplacePartial2() -> (i32, f32, f32) {
|
||||
// CHECK: %[[A:.*]] = "test.one_result2"()
|
||||
// CHECK: %[[B:.*]], %[[C:.*]] = "test.another_two_result"()
|
||||
// CHECK: return %[[A]], %[[B]], %[[C]]
|
||||
@ -430,7 +430,7 @@ func @useMultiResultOpToReplacePartial2() -> (i32, f32, f32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @useMultiResultOpResultsSeparately
|
||||
func @useMultiResultOpResultsSeparately() -> (i32, f32, f32) {
|
||||
func.func @useMultiResultOpResultsSeparately() -> (i32, f32, f32) {
|
||||
// CHECK: %[[A:.*]], %[[B:.*]] = "test.two_result"()
|
||||
// CHECK: %[[C:.*]] = "test.one_result1"()
|
||||
// CHECK: %[[D:.*]], %[[E:.*]] = "test.two_result"()
|
||||
@ -440,7 +440,7 @@ func @useMultiResultOpResultsSeparately() -> (i32, f32, f32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @constraintOnSourceOpResult
|
||||
func @constraintOnSourceOpResult() -> (i32, f32, i32) {
|
||||
func.func @constraintOnSourceOpResult() -> (i32, f32, i32) {
|
||||
// CHECK: %[[A:.*]], %[[B:.*]] = "test.two_result"()
|
||||
// CHECK: %[[C:.*]] = "test.one_result2"()
|
||||
// CHECK: %[[D:.*]] = "test.one_result1"()
|
||||
@ -451,7 +451,7 @@ func @constraintOnSourceOpResult() -> (i32, f32, i32) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @useAuxiliaryOpToReplaceMultiResultOp
|
||||
func @useAuxiliaryOpToReplaceMultiResultOp() -> (i32, f32, f32) {
|
||||
func.func @useAuxiliaryOpToReplaceMultiResultOp() -> (i32, f32, f32) {
|
||||
// An auxiliary op is generated to help building the op for replacing the
|
||||
// matched op.
|
||||
// CHECK: %[[A:.*]], %[[B:.*]] = "test.two_result"()
|
||||
@ -468,7 +468,7 @@ func @useAuxiliaryOpToReplaceMultiResultOp() -> (i32, f32, f32) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: @replaceOneVariadicOutOneVariadicInOp
|
||||
func @replaceOneVariadicOutOneVariadicInOp(%arg0: i32, %arg1: i32, %arg2: i32) -> (i32, i32, i32, i32, i32, i32) {
|
||||
func.func @replaceOneVariadicOutOneVariadicInOp(%arg0: i32, %arg1: i32, %arg2: i32) -> (i32, i32, i32, i32, i32, i32) {
|
||||
// CHECK: %[[cnt1:.*]] = "test.one_variadic_out_one_variadic_in2"(%arg0)
|
||||
// CHECK: %[[cnt2:.*]]:2 = "test.one_variadic_out_one_variadic_in2"(%arg0, %arg1)
|
||||
// CHECK: %[[cnt3:.*]]:3 = "test.one_variadic_out_one_variadic_in2"(%arg0, %arg1, %arg2)
|
||||
@ -481,7 +481,7 @@ func @replaceOneVariadicOutOneVariadicInOp(%arg0: i32, %arg1: i32, %arg2: i32) -
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @replaceMixedVariadicInputOp
|
||||
func @replaceMixedVariadicInputOp(%arg0: i32, %arg1: f32, %arg2: i32) -> () {
|
||||
func.func @replaceMixedVariadicInputOp(%arg0: i32, %arg1: f32, %arg2: i32) -> () {
|
||||
// CHECK: "test.mixed_variadic_in2"(%arg1)
|
||||
// CHECK: "test.mixed_variadic_in2"(%arg0, %arg1, %arg2)
|
||||
// CHECK: "test.mixed_variadic_in2"(%arg0, %arg0, %arg1, %arg2, %arg2)
|
||||
@ -493,7 +493,7 @@ func @replaceMixedVariadicInputOp(%arg0: i32, %arg1: f32, %arg2: i32) -> () {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @replaceMixedVariadicOutputOp
|
||||
func @replaceMixedVariadicOutputOp() -> (f32, i32, f32, i32, i32, i32, f32, i32, i32) {
|
||||
func.func @replaceMixedVariadicOutputOp() -> (f32, i32, f32, i32, i32, i32, f32, i32, i32) {
|
||||
// CHECK: %[[cnt1:.*]] = "test.mixed_variadic_out2"()
|
||||
// CHECK: %[[cnt3_a:.*]], %[[cnt3_b:.*]], %[[cnt3_c:.*]] = "test.mixed_variadic_out2"()
|
||||
// CHECK: %[[cnt5_a:.*]]:2, %[[cnt5_b:.*]], %[[cnt5_c:.*]]:2 = "test.mixed_variadic_out2"()
|
||||
@ -506,7 +506,7 @@ func @replaceMixedVariadicOutputOp() -> (f32, i32, f32, i32, i32, i32, f32, i32,
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @generateVariadicOutputOpInNestedPattern
|
||||
func @generateVariadicOutputOpInNestedPattern() -> (i32) {
|
||||
func.func @generateVariadicOutputOpInNestedPattern() -> (i32) {
|
||||
// CHECK: %[[cnt5_a:.*]], %[[cnt5_b:.*]]:2, %[[cnt5_c:.*]]:2 = "test.mixed_variadic_out3"()
|
||||
// CHECK: %[[res:.*]] = "test.mixed_variadic_in3"(%[[cnt5_a]], %[[cnt5_b]]#0, %[[cnt5_b]]#1, %[[cnt5_c]]#0, %[[cnt5_c]]#1)
|
||||
// CHECK: return %[[res]]
|
||||
@ -520,7 +520,7 @@ func @generateVariadicOutputOpInNestedPattern() -> (i32) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK-LABEL: redundantTest
|
||||
func @redundantTest(%arg0: i32) -> i32 {
|
||||
func.func @redundantTest(%arg0: i32) -> i32 {
|
||||
%0 = "test.op_m"(%arg0) : (i32) -> i32
|
||||
// CHECK: "test.op_m"(%arg0) {optional_attr = 314159265 : i32} : (i32) -> i32
|
||||
return %0 : i32
|
||||
@ -531,7 +531,7 @@ func @redundantTest(%arg0: i32) -> i32 {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CHECK: @either_dag_leaf_only
|
||||
func @either_dag_leaf_only_1(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
|
||||
func.func @either_dag_leaf_only_1(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
|
||||
// CHECK: "test.either_op_b"(%arg1) : (i16) -> i32
|
||||
%0 = "test.either_op_a"(%arg0, %arg1, %arg2) : (i32, i16, i8) -> i32
|
||||
// CHECK: "test.either_op_b"(%arg1) : (i16) -> i32
|
||||
@ -540,7 +540,7 @@ func @either_dag_leaf_only_1(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
|
||||
}
|
||||
|
||||
// CHECK: @either_dag_leaf_dag_node
|
||||
func @either_dag_leaf_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
|
||||
func.func @either_dag_leaf_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
|
||||
%0 = "test.either_op_b"(%arg0) : (i32) -> i32
|
||||
// CHECK: "test.either_op_b"(%arg1) : (i16) -> i32
|
||||
%1 = "test.either_op_a"(%0, %arg1, %arg2) : (i32, i16, i8) -> i32
|
||||
@ -550,7 +550,7 @@ func @either_dag_leaf_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
|
||||
}
|
||||
|
||||
// CHECK: @either_dag_node_dag_node
|
||||
func @either_dag_node_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
|
||||
func.func @either_dag_node_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
|
||||
%0 = "test.either_op_b"(%arg0) : (i32) -> i32
|
||||
%1 = "test.either_op_b"(%arg1) : (i16) -> i32
|
||||
// CHECK: "test.either_op_b"(%arg1) : (i16) -> i32
|
||||
@ -564,21 +564,21 @@ func @either_dag_node_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
|
||||
// Test that ops without type deduction can be created with type builders.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func @explicitReturnTypeTest(%arg0 : i64) -> i8 {
|
||||
func.func @explicitReturnTypeTest(%arg0 : i64) -> i8 {
|
||||
%0 = "test.source_op"(%arg0) {tag = 11 : i32} : (i64) -> i8
|
||||
// CHECK: "test.op_x"(%arg0) : (i64) -> i32
|
||||
// CHECK: "test.op_x"(%0) : (i32) -> i8
|
||||
return %0 : i8
|
||||
}
|
||||
|
||||
func @returnTypeBuilderTest(%arg0 : i1) -> i8 {
|
||||
func.func @returnTypeBuilderTest(%arg0 : i1) -> i8 {
|
||||
%0 = "test.source_op"(%arg0) {tag = 22 : i32} : (i1) -> i8
|
||||
// CHECK: "test.op_x"(%arg0) : (i1) -> i1
|
||||
// CHECK: "test.op_x"(%0) : (i1) -> i8
|
||||
return %0 : i8
|
||||
}
|
||||
|
||||
func @multipleReturnTypeBuildTest(%arg0 : i1) -> i1 {
|
||||
func.func @multipleReturnTypeBuildTest(%arg0 : i1) -> i1 {
|
||||
%0 = "test.source_op"(%arg0) {tag = 33 : i32} : (i1) -> i1
|
||||
// CHECK: "test.one_to_two"(%arg0) : (i1) -> (i64, i32)
|
||||
// CHECK: "test.op_x"(%0#0) : (i64) -> i32
|
||||
@ -587,14 +587,14 @@ func @multipleReturnTypeBuildTest(%arg0 : i1) -> i1 {
|
||||
return %0 : i1
|
||||
}
|
||||
|
||||
func @copyValueType(%arg0 : i8) -> i32 {
|
||||
func.func @copyValueType(%arg0 : i8) -> i32 {
|
||||
%0 = "test.source_op"(%arg0) {tag = 44 : i32} : (i8) -> i32
|
||||
// CHECK: "test.op_x"(%arg0) : (i8) -> i8
|
||||
// CHECK: "test.op_x"(%0) : (i8) -> i32
|
||||
return %0 : i32
|
||||
}
|
||||
|
||||
func @multipleReturnTypeDifferent(%arg0 : i1) -> i64 {
|
||||
func.func @multipleReturnTypeDifferent(%arg0 : i1) -> i64 {
|
||||
%0 = "test.source_op"(%arg0) {tag = 55 : i32} : (i1) -> i64
|
||||
// CHECK: "test.one_to_two"(%arg0) : (i1) -> (i1, i64)
|
||||
// CHECK: "test.two_to_one"(%0#0, %0#1) : (i1, i64) -> i64
|
||||
@ -605,7 +605,7 @@ func @multipleReturnTypeDifferent(%arg0 : i1) -> i64 {
|
||||
// Test that multiple trailing directives can be mixed in patterns.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func @returnTypeAndLocation(%arg0 : i32) -> i1 {
|
||||
func.func @returnTypeAndLocation(%arg0 : i32) -> i1 {
|
||||
%0 = "test.source_op"(%arg0) {tag = 66 : i32} : (i32) -> i1
|
||||
// CHECK: "test.op_x"(%arg0) : (i32) -> i32 loc("loc1")
|
||||
// CHECK: "test.op_x"(%arg0) : (i32) -> i32 loc("loc2")
|
||||
@ -617,7 +617,7 @@ func @returnTypeAndLocation(%arg0 : i32) -> i1 {
|
||||
// Test that patterns can create ConstantStrAttr
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
func @testConstantStrAttr() -> () {
|
||||
func.func @testConstantStrAttr() -> () {
|
||||
// CHECK: test.has_str_value {value = "foo"}
|
||||
test.no_str_value {value = "bar"}
|
||||
return
|
||||
|
@ -3,7 +3,7 @@
|
||||
// CHECK-LABEL: testCreateFunctions
|
||||
// This function tests invoking the create method with different inference
|
||||
// methods. The attributes of the ops inside are used to test creation.
|
||||
func @testCreateFunctions(%arg0 : tensor<10xf32>, %arg1 : tensor<20xi32>) {
|
||||
func.func @testCreateFunctions(%arg0 : tensor<10xf32>, %arg1 : tensor<20xi32>) {
|
||||
// CHECK: "test.no_attributes"
|
||||
%good = "test.no_attributes"(%arg0, %arg0) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xf32>
|
||||
// CHECK: "test.op_with_shaped_type_infer_type_if"
|
||||
@ -23,7 +23,7 @@ func @testCreateFunctions(%arg0 : tensor<10xf32>, %arg1 : tensor<20xi32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @testReturnTypeOpInterface(%arg0 : tensor<10xf32>) {
|
||||
func.func @testReturnTypeOpInterface(%arg0 : tensor<10xf32>) {
|
||||
// expected-error@+1 {{incompatible with return type}}
|
||||
%bad = "test.op_with_infer_type_if"(%arg0, %arg0) : (tensor<10xf32>, tensor<10xf32>) -> tensor<*xf32>
|
||||
return
|
||||
@ -31,7 +31,7 @@ func @testReturnTypeOpInterface(%arg0 : tensor<10xf32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @testReturnTypeOpInterfaceMismatch(%arg0 : tensor<10xf32>, %arg1 : tensor<20xf32>) {
|
||||
func.func @testReturnTypeOpInterfaceMismatch(%arg0 : tensor<10xf32>, %arg1 : tensor<20xf32>) {
|
||||
// expected-error@+1 {{operand type mismatch}}
|
||||
%bad = "test.op_with_infer_type_if"(%arg0, %arg1) : (tensor<10xf32>, tensor<20xf32>) -> tensor<*xf32>
|
||||
return
|
||||
@ -40,7 +40,7 @@ func @testReturnTypeOpInterfaceMismatch(%arg0 : tensor<10xf32>, %arg1 : tensor<2
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: testReifyFunctions
|
||||
func @testReifyFunctions(%arg0 : tensor<10xf32>, %arg1 : tensor<20xf32>) {
|
||||
func.func @testReifyFunctions(%arg0 : tensor<10xf32>, %arg1 : tensor<20xf32>) {
|
||||
// expected-remark@+1 {{arith.constant 10}}
|
||||
%0 = "test.op_with_shaped_type_infer_type_if"(%arg0, %arg1) : (tensor<10xf32>, tensor<20xf32>) -> tensor<10xi17>
|
||||
// expected-remark@+1 {{arith.constant 20}}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// CHECK-LABEL: func private @compoundA()
|
||||
// CHECK-SAME: #test.cmpnd_a<1, !test.smpla, [5, 6]>
|
||||
func private @compoundA() attributes {foo = #test.cmpnd_a<1, !test.smpla, [5, 6]>}
|
||||
func.func private @compoundA() attributes {foo = #test.cmpnd_a<1, !test.smpla, [5, 6]>}
|
||||
|
||||
// CHECK: test.result_has_same_type_as_attr #test<"attr_with_self_type_param i32"> -> i32
|
||||
%a = test.result_has_same_type_as_attr #test<"attr_with_self_type_param i32"> -> i32
|
||||
@ -12,4 +12,4 @@ func private @compoundA() attributes {foo = #test.cmpnd_a<1, !test.smpla, [5, 6]
|
||||
|
||||
// CHECK-LABEL: @qualifiedAttr()
|
||||
// CHECK-SAME: #test.cmpnd_nested_outer_qual<i #test.cmpnd_nested_inner<42 <1, !test.smpla, [5, 6]>>>
|
||||
func private @qualifiedAttr() attributes {foo = #test.cmpnd_nested_outer_qual<i #test.cmpnd_nested_inner<42 <1, !test.smpla, [5, 6]>>>}
|
||||
func.func private @qualifiedAttr() attributes {foo = #test.cmpnd_nested_outer_qual<i #test.cmpnd_nested_inner<42 <1, !test.smpla, [5, 6]>>>}
|
||||
|
@ -4,23 +4,23 @@
|
||||
// Tests the types in the 'Test' dialect, not the ones in 'typedefs.mlir'
|
||||
|
||||
// CHECK: @simpleA(%arg0: !test.smpla)
|
||||
func @simpleA(%A : !test.smpla) -> () {
|
||||
func.func @simpleA(%A : !test.smpla) -> () {
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK: @compoundA(%arg0: !test.cmpnd_a<1, !test.smpla, [5, 6]>)
|
||||
func @compoundA(%A : !test.cmpnd_a<1, !test.smpla, [5, 6]>)-> () {
|
||||
func.func @compoundA(%A : !test.cmpnd_a<1, !test.smpla, [5, 6]>)-> () {
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK: @compoundNested(%arg0: !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>)
|
||||
func @compoundNested(%arg0: !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>) -> () {
|
||||
func.func @compoundNested(%arg0: !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>) -> () {
|
||||
return
|
||||
}
|
||||
|
||||
// Same as above, but we're parsing the complete spec for the inner type
|
||||
// CHECK: @compoundNestedExplicit(%arg0: !test.cmpnd_nested_outer<i <42 <1, !test.smpla, [5, 6]>>>)
|
||||
func @compoundNestedExplicit(%arg0: !test.cmpnd_nested_outer<i !test.cmpnd_inner<42 <1, !test.smpla, [5, 6]>>>) -> () {
|
||||
func.func @compoundNestedExplicit(%arg0: !test.cmpnd_nested_outer<i !test.cmpnd_inner<42 <1, !test.smpla, [5, 6]>>>) -> () {
|
||||
// Verify that the type prefix is elided and optional
|
||||
// CHECK: format_cpmd_nested_type %arg0 nested <i <42 <1, !test.smpla, [5, 6]>>>
|
||||
// CHECK: format_cpmd_nested_type %arg0 nested <i <42 <1, !test.smpla, [5, 6]>>>
|
||||
@ -31,14 +31,14 @@ func @compoundNestedExplicit(%arg0: !test.cmpnd_nested_outer<i !test.cmpnd_inner
|
||||
|
||||
// CHECK-LABEL: @compoundNestedQual
|
||||
// CHECK-SAME: !test.cmpnd_nested_outer_qual<i !test.cmpnd_inner<42 <1, !test.smpla, [5, 6]>>>
|
||||
func private @compoundNestedQual(%arg0: !test.cmpnd_nested_outer_qual<i !test.cmpnd_inner<42 <1, !test.smpla, [5, 6]>>>) -> ()
|
||||
func.func private @compoundNestedQual(%arg0: !test.cmpnd_nested_outer_qual<i !test.cmpnd_inner<42 <1, !test.smpla, [5, 6]>>>) -> ()
|
||||
|
||||
// CHECK: @testInt(%arg0: !test.int<signed, 8>, %arg1: !test.int<unsigned, 2>, %arg2: !test.int<none, 1>)
|
||||
func @testInt(%A : !test.int<s, 8>, %B : !test.int<unsigned, 2>, %C : !test.int<n, 1>) {
|
||||
func.func @testInt(%A : !test.int<s, 8>, %B : !test.int<unsigned, 2>, %C : !test.int<n, 1>) {
|
||||
return
|
||||
}
|
||||
|
||||
// CHECK: @structTest(%arg0: !test.struct<{field1,!test.smpla}, {field2,!test.int<none, 3>}>)
|
||||
func @structTest (%A : !test.struct< {field1, !test.smpla}, {field2, !test.int<none, 3>} > ) {
|
||||
func.func @structTest (%A : !test.struct< {field1, !test.smpla}, {field2, !test.int<none, 3>} > ) {
|
||||
return
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
// CHECK-LABEL: func @testSingleInvolution
|
||||
// CHECK-SAME: ([[ARG0:%.+]]: i32)
|
||||
func @testSingleInvolution(%arg0 : i32) -> i32 {
|
||||
func.func @testSingleInvolution(%arg0 : i32) -> i32 {
|
||||
// CHECK: [[INVOLUTION:%.+]] = "test.op_involution_trait_no_operation_fold"([[ARG0]])
|
||||
%0 = "test.op_involution_trait_no_operation_fold"(%arg0) : (i32) -> i32
|
||||
// CHECK: return [[INVOLUTION]]
|
||||
@ -15,7 +15,7 @@ func @testSingleInvolution(%arg0 : i32) -> i32 {
|
||||
|
||||
// CHECK-LABEL: func @testDoubleInvolution
|
||||
// CHECK-SAME: ([[ARG0:%.+]]: i32)
|
||||
func @testDoubleInvolution(%arg0: i32) -> i32 {
|
||||
func.func @testDoubleInvolution(%arg0: i32) -> i32 {
|
||||
%0 = "test.op_involution_trait_no_operation_fold"(%arg0) : (i32) -> i32
|
||||
%1 = "test.op_involution_trait_no_operation_fold"(%0) : (i32) -> i32
|
||||
// CHECK: return [[ARG0]]
|
||||
@ -24,7 +24,7 @@ func @testDoubleInvolution(%arg0: i32) -> i32 {
|
||||
|
||||
// CHECK-LABEL: func @testTripleInvolution
|
||||
// CHECK-SAME: ([[ARG0:%.+]]: i32)
|
||||
func @testTripleInvolution(%arg0: i32) -> i32 {
|
||||
func.func @testTripleInvolution(%arg0: i32) -> i32 {
|
||||
// CHECK: [[INVOLUTION:%.+]] = "test.op_involution_trait_no_operation_fold"([[ARG0]])
|
||||
%0 = "test.op_involution_trait_no_operation_fold"(%arg0) : (i32) -> i32
|
||||
%1 = "test.op_involution_trait_no_operation_fold"(%0) : (i32) -> i32
|
||||
@ -39,7 +39,7 @@ func @testTripleInvolution(%arg0: i32) -> i32 {
|
||||
|
||||
// CHECK-LABEL: func @testFailingOperationFolder
|
||||
// CHECK-SAME: ([[ARG0:%.+]]: i32)
|
||||
func @testFailingOperationFolder(%arg0: i32) -> i32 {
|
||||
func.func @testFailingOperationFolder(%arg0: i32) -> i32 {
|
||||
%0 = "test.op_involution_trait_failing_operation_fold"(%arg0) : (i32) -> i32
|
||||
%1 = "test.op_involution_trait_failing_operation_fold"(%0) : (i32) -> i32
|
||||
// CHECK: return [[ARG0]]
|
||||
@ -52,7 +52,7 @@ func @testFailingOperationFolder(%arg0: i32) -> i32 {
|
||||
|
||||
// CHECK-LABEL: func @testInhibitInvolution
|
||||
// CHECK-SAME: ([[ARG0:%.+]]: i32)
|
||||
func @testInhibitInvolution(%arg0: i32) -> i32 {
|
||||
func.func @testInhibitInvolution(%arg0: i32) -> i32 {
|
||||
// CHECK: [[OP:%.+]] = "test.op_involution_trait_succesful_operation_fold"([[ARG0]])
|
||||
%0 = "test.op_involution_trait_succesful_operation_fold"(%arg0) : (i32) -> i32
|
||||
%1 = "test.op_involution_trait_succesful_operation_fold"(%0) : (i32) -> i32
|
||||
@ -66,7 +66,7 @@ func @testInhibitInvolution(%arg0: i32) -> i32 {
|
||||
|
||||
// CHECK-LABEL: func @testSingleIdempotent
|
||||
// CHECK-SAME: ([[ARG0:%.+]]: i32)
|
||||
func @testSingleIdempotent(%arg0 : i32) -> i32 {
|
||||
func.func @testSingleIdempotent(%arg0 : i32) -> i32 {
|
||||
// CHECK: [[IDEMPOTENT:%.+]] = "test.op_idempotent_trait"([[ARG0]])
|
||||
%0 = "test.op_idempotent_trait"(%arg0) : (i32) -> i32
|
||||
// CHECK: return [[IDEMPOTENT]]
|
||||
@ -75,7 +75,7 @@ func @testSingleIdempotent(%arg0 : i32) -> i32 {
|
||||
|
||||
// CHECK-LABEL: func @testDoubleIdempotent
|
||||
// CHECK-SAME: ([[ARG0:%.+]]: i32)
|
||||
func @testDoubleIdempotent(%arg0: i32) -> i32 {
|
||||
func.func @testDoubleIdempotent(%arg0: i32) -> i32 {
|
||||
// CHECK: [[IDEMPOTENT:%.+]] = "test.op_idempotent_trait"([[ARG0]])
|
||||
%0 = "test.op_idempotent_trait"(%arg0) : (i32) -> i32
|
||||
%1 = "test.op_idempotent_trait"(%0) : (i32) -> i32
|
||||
@ -85,7 +85,7 @@ func @testDoubleIdempotent(%arg0: i32) -> i32 {
|
||||
|
||||
// CHECK-LABEL: func @testTripleIdempotent
|
||||
// CHECK-SAME: ([[ARG0:%.+]]: i32)
|
||||
func @testTripleIdempotent(%arg0: i32) -> i32 {
|
||||
func.func @testTripleIdempotent(%arg0: i32) -> i32 {
|
||||
// CHECK: [[IDEMPOTENT:%.+]] = "test.op_idempotent_trait"([[ARG0]])
|
||||
%0 = "test.op_idempotent_trait"(%arg0) : (i32) -> i32
|
||||
%1 = "test.op_idempotent_trait"(%0) : (i32) -> i32
|
||||
@ -96,7 +96,7 @@ func @testTripleIdempotent(%arg0: i32) -> i32 {
|
||||
|
||||
// CHECK-LABEL: func @testBinaryIdempotent
|
||||
// CHECK-SAME: ([[ARG0:%.+]]: i32)
|
||||
func @testBinaryIdempotent(%arg0 : i32) -> i32 {
|
||||
func.func @testBinaryIdempotent(%arg0 : i32) -> i32 {
|
||||
%0 = "test.op_idempotent_trait_binary"(%arg0, %arg0) : (i32, i32) -> i32
|
||||
// CHECK: return [[ARG0]]
|
||||
return %0: i32
|
||||
|
@ -1,6 +1,6 @@
|
||||
// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
|
||||
|
||||
func @correct_int_types_success() {
|
||||
func.func @correct_int_types_success() {
|
||||
"test.int_types"() : () -> (i16, si32, ui64, i8)
|
||||
"test.int_types"() : () -> (si16, si32, ui64, ui64)
|
||||
"test.int_types"() : () -> (ui16, si32, ui64, si128)
|
||||
@ -9,7 +9,7 @@ func @correct_int_types_success() {
|
||||
|
||||
// -----
|
||||
|
||||
func @wrong_int_type_signedness_failure() {
|
||||
func.func @wrong_int_type_signedness_failure() {
|
||||
// expected-error @+1 {{result #1 must be 32-bit signed integer, but got 'ui32'}}
|
||||
"test.int_types"() : () -> (ui16, ui32, ui64, si8)
|
||||
return
|
||||
@ -17,7 +17,7 @@ func @wrong_int_type_signedness_failure() {
|
||||
|
||||
// -----
|
||||
|
||||
func @wrong_int_type_signedness_failure() {
|
||||
func.func @wrong_int_type_signedness_failure() {
|
||||
// expected-error @+1 {{result #2 must be 64-bit unsigned integer, but got 'si64'}}
|
||||
"test.int_types"() : () -> (ui16, si32, si64, ui8)
|
||||
return
|
||||
@ -25,7 +25,7 @@ func @wrong_int_type_signedness_failure() {
|
||||
|
||||
// -----
|
||||
|
||||
func @wrong_int_type_failure() {
|
||||
func.func @wrong_int_type_failure() {
|
||||
// expected-error @+1 {{result #0 must be 16-bit integer, but got 'f16'}}
|
||||
"test.int_types"() : () -> (f16, si32, ui64, i16)
|
||||
return
|
||||
@ -33,7 +33,7 @@ func @wrong_int_type_failure() {
|
||||
|
||||
// -----
|
||||
|
||||
func @wrong_int_type_failure() {
|
||||
func.func @wrong_int_type_failure() {
|
||||
// expected-error @+1 {{result #3 must be integer, but got 'f64'}}
|
||||
"test.int_types"() : () -> (i16, si32, ui64, f64)
|
||||
return
|
||||
@ -42,7 +42,7 @@ func @wrong_int_type_failure() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @complex_f64_success
|
||||
func @complex_f64_success() {
|
||||
func.func @complex_f64_success() {
|
||||
"test.complex_f64"() : () -> (complex<f64>)
|
||||
return
|
||||
}
|
||||
@ -50,14 +50,14 @@ func @complex_f64_success() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @complex_f64_tensor_success
|
||||
func @complex_f64_tensor_success() {
|
||||
func.func @complex_f64_tensor_success() {
|
||||
"test.complex_f64_tensor"() : () -> (tensor<complex<f64>>)
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @complex_f64_failure() {
|
||||
func.func @complex_f64_failure() {
|
||||
// expected-error@+1 {{op result #0 must be complex type with 64-bit float elements, but got 'f64'}}
|
||||
"test.complex_f64"() : () -> (f64)
|
||||
return
|
||||
@ -66,7 +66,7 @@ func @complex_f64_failure() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @tuple_success
|
||||
func @tuple_success() {
|
||||
func.func @tuple_success() {
|
||||
"test.tuple_32_bit"() : () -> (tuple<i32>)
|
||||
return
|
||||
}
|
||||
@ -74,21 +74,21 @@ func @tuple_success() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @tuple_mixed_success
|
||||
func @tuple_mixed_success() {
|
||||
func.func @tuple_mixed_success() {
|
||||
"test.tuple_32_bit"() : () -> (tuple<i32, f32>)
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @tuple_empty_success() {
|
||||
func.func @tuple_empty_success() {
|
||||
"test.tuple_32_bit"() : () -> (tuple<>)
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @tuple_wrong_type_scalar() {
|
||||
func.func @tuple_wrong_type_scalar() {
|
||||
// expected-error@+1 {{must be tuple with any combination of 32-bit signless integer or 32-bit float values}}
|
||||
"test.tuple_32_bit"() : () -> (tuple<i64>)
|
||||
return
|
||||
@ -96,7 +96,7 @@ func @tuple_wrong_type_scalar() {
|
||||
|
||||
// -----
|
||||
|
||||
func @tuple_wrong_type_tensor() {
|
||||
func.func @tuple_wrong_type_tensor() {
|
||||
// expected-error@+1 {{must be tuple with any combination of 32-bit signless integer or 32-bit float values}}
|
||||
"test.tuple_32_bit"() : () -> (tuple<tensor<i32>>)
|
||||
return
|
||||
@ -105,7 +105,7 @@ func @tuple_wrong_type_tensor() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @nested_tuple_empty_success
|
||||
func @nested_tuple_empty_success() {
|
||||
func.func @nested_tuple_empty_success() {
|
||||
"test.nested_tuple_32_bit"() : () -> (tuple<>)
|
||||
return
|
||||
}
|
||||
@ -113,7 +113,7 @@ func @nested_tuple_empty_success() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @nested_tuple_one_level_success
|
||||
func @nested_tuple_one_level_success() {
|
||||
func.func @nested_tuple_one_level_success() {
|
||||
"test.nested_tuple_32_bit"() : () -> (tuple<i32>)
|
||||
return
|
||||
}
|
||||
@ -121,7 +121,7 @@ func @nested_tuple_one_level_success() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @nested_tuple_multi_level_success
|
||||
func @nested_tuple_multi_level_success() {
|
||||
func.func @nested_tuple_multi_level_success() {
|
||||
"test.nested_tuple_32_bit"() : () -> (tuple<i32, tuple<i32, tuple<i32>>>)
|
||||
return
|
||||
}
|
||||
@ -129,14 +129,14 @@ func @nested_tuple_multi_level_success() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @nested_tuple_multi_level_mixed_success
|
||||
func @nested_tuple_multi_level_mixed_success() {
|
||||
func.func @nested_tuple_multi_level_mixed_success() {
|
||||
"test.nested_tuple_32_bit"() : () -> (tuple<i32, tuple<f32, tuple<i32>>>)
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @nested_tuple_multi_level_wrong_type() {
|
||||
func.func @nested_tuple_multi_level_wrong_type() {
|
||||
// expected-error@+1 {{must be nested tuple with any combination of 32-bit signless integer or 32-bit float values}}
|
||||
"test.nested_tuple_32_bit"() : () -> (tuple<i32, tuple<i32, tuple<i64>>>)
|
||||
return
|
||||
@ -145,7 +145,7 @@ func @nested_tuple_multi_level_wrong_type() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: func @rank_less_than_2_I8_F32_memref_success
|
||||
func @rank_less_than_2_I8_F32_memref_success() {
|
||||
func.func @rank_less_than_2_I8_F32_memref_success() {
|
||||
"test.rank_less_than_2_I8_F32_memref"() : () -> (memref<i8>)
|
||||
"test.rank_less_than_2_I8_F32_memref"() : () -> (memref<3xi8>)
|
||||
"test.rank_less_than_2_I8_F32_memref"() : () -> (memref<f32>)
|
||||
@ -155,7 +155,7 @@ func @rank_less_than_2_I8_F32_memref_success() {
|
||||
|
||||
// -----
|
||||
|
||||
func @rank_less_than_2_I8_F32_memref_bad_type() {
|
||||
func.func @rank_less_than_2_I8_F32_memref_bad_type() {
|
||||
// expected-error@+1 {{must be 0D/1D memref of 8-bit signless integer or 32-bit float values}}
|
||||
"test.rank_less_than_2_I8_F32_memref"() : () -> (memref<i16>)
|
||||
return
|
||||
@ -163,7 +163,7 @@ func @rank_less_than_2_I8_F32_memref_bad_type() {
|
||||
|
||||
// -----
|
||||
|
||||
func @rank_less_than_2_I8_F32_memref_bad_rank() {
|
||||
func.func @rank_less_than_2_I8_F32_memref_bad_rank() {
|
||||
// expected-error@+1 {{must be 0D/1D memref of 8-bit signless integer or 32-bit float values}}
|
||||
"test.rank_less_than_2_I8_F32_memref"() : () -> (memref<1x2xi8>)
|
||||
return
|
||||
@ -171,14 +171,14 @@ func @rank_less_than_2_I8_F32_memref_bad_rank() {
|
||||
|
||||
// -----
|
||||
|
||||
func @nd_tensor_of_success(%arg0: tensor<f32>, %arg1: tensor<10xf32>, %arg2: tensor<20x30xi16>, %arg3: tensor<40x50x60xi16>, %arg4: tensor<70x80x90x100xi16>) {
|
||||
func.func @nd_tensor_of_success(%arg0: tensor<f32>, %arg1: tensor<10xf32>, %arg2: tensor<20x30xi16>, %arg3: tensor<40x50x60xi16>, %arg4: tensor<70x80x90x100xi16>) {
|
||||
"test.nd_tensor_of"(%arg0, %arg1, %arg2, %arg3, %arg4) : (tensor<f32>, tensor<10xf32>, tensor<20x30xi16>, tensor<40x50x60xi16>, tensor<70x80x90x100xi16>) -> ()
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @nd_tensor_of_success_wrong_type_0d(%arg0: tensor<f32>, %arg1: tensor<10xf32>, %arg2: tensor<20x30xi16>, %arg3: tensor<40x50x60xi16>, %arg4: tensor<70x80x90x100xi32>) {
|
||||
func.func @nd_tensor_of_success_wrong_type_0d(%arg0: tensor<f32>, %arg1: tensor<10xf32>, %arg2: tensor<20x30xi16>, %arg3: tensor<40x50x60xi16>, %arg4: tensor<70x80x90x100xi32>) {
|
||||
// expected-error @+1 {{'test.nd_tensor_of' op operand #0 must be 0D tensor of 32-bit float values}}
|
||||
"test.nd_tensor_of"(%arg1, %arg1, %arg2, %arg3, %arg4) : (tensor<10xf32>, tensor<10xf32>, tensor<20x30xi16>, tensor<40x50x60xi16>, tensor<70x80x90x100xi32>) -> ()
|
||||
return
|
||||
@ -186,7 +186,7 @@ func @nd_tensor_of_success_wrong_type_0d(%arg0: tensor<f32>, %arg1: tensor<10xf3
|
||||
|
||||
// -----
|
||||
|
||||
func @nd_tensor_of_success_wrong_type_4d(%arg0: tensor<f32>, %arg1: tensor<10xf32>, %arg2: tensor<20x30xi16>, %arg3: tensor<40x50x60xi16>, %arg4: tensor<70x80x90x100xi32>) {
|
||||
func.func @nd_tensor_of_success_wrong_type_4d(%arg0: tensor<f32>, %arg1: tensor<10xf32>, %arg2: tensor<20x30xi16>, %arg3: tensor<40x50x60xi16>, %arg4: tensor<70x80x90x100xi32>) {
|
||||
// expected-error @+1 {{'test.nd_tensor_of' op operand #4 must be 4D tensor of 16-bit signless integer values}}
|
||||
"test.nd_tensor_of"(%arg0, %arg1, %arg2, %arg3, %arg3) : (tensor<f32>, tensor<10xf32>, tensor<20x30xi16>, tensor<40x50x60xi16>, tensor<40x50x60xi16>) -> ()
|
||||
return
|
||||
@ -194,7 +194,7 @@ func @nd_tensor_of_success_wrong_type_4d(%arg0: tensor<f32>, %arg1: tensor<10xf3
|
||||
|
||||
// -----
|
||||
|
||||
func @ranked_tensor_success(%arg0: tensor<i8>, %arg1: tensor<1xi32>, %arg2: tensor<?x?xf32>) {
|
||||
func.func @ranked_tensor_success(%arg0: tensor<i8>, %arg1: tensor<1xi32>, %arg2: tensor<?x?xf32>) {
|
||||
"test.ranked_tensor_op"(%arg0) : (tensor<i8>) -> ()
|
||||
"test.ranked_tensor_op"(%arg1) : (tensor<1xi32>) -> ()
|
||||
"test.ranked_tensor_op"(%arg2) : (tensor<?x?xf32>) -> ()
|
||||
@ -203,7 +203,7 @@ func @ranked_tensor_success(%arg0: tensor<i8>, %arg1: tensor<1xi32>, %arg2: tens
|
||||
|
||||
// -----
|
||||
|
||||
func @ranked_tensor_success(%arg0: tensor<*xf32>) {
|
||||
func.func @ranked_tensor_success(%arg0: tensor<*xf32>) {
|
||||
// expected-error @+1 {{must be ranked tensor of any type values}}
|
||||
"test.ranked_tensor_op"(%arg0) : (tensor<*xf32>) -> ()
|
||||
return
|
||||
@ -211,7 +211,7 @@ func @ranked_tensor_success(%arg0: tensor<*xf32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @ranked_tensor_success(%arg0: vector<2xf32>) {
|
||||
func.func @ranked_tensor_success(%arg0: vector<2xf32>) {
|
||||
// expected-error @+1 {{must be ranked tensor of any type values}}
|
||||
"test.ranked_tensor_op"(%arg0) : (vector<2xf32>) -> ()
|
||||
return
|
||||
@ -219,7 +219,7 @@ func @ranked_tensor_success(%arg0: vector<2xf32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @multi_tensor_rank_of_success(%arg0: tensor<i8>, %arg1: tensor<i32>, %arg2: tensor<f32>, %arg3: tensor<1xi8>, %arg4: tensor<1xi32>, %arg5: tensor<1xf32>) {
|
||||
func.func @multi_tensor_rank_of_success(%arg0: tensor<i8>, %arg1: tensor<i32>, %arg2: tensor<f32>, %arg3: tensor<1xi8>, %arg4: tensor<1xi32>, %arg5: tensor<1xf32>) {
|
||||
"test.multi_tensor_rank_of"(%arg0) : (tensor<i8>) -> ()
|
||||
"test.multi_tensor_rank_of"(%arg1) : (tensor<i32>) -> ()
|
||||
"test.multi_tensor_rank_of"(%arg2) : (tensor<f32>) -> ()
|
||||
@ -231,7 +231,7 @@ func @multi_tensor_rank_of_success(%arg0: tensor<i8>, %arg1: tensor<i32>, %arg2:
|
||||
|
||||
// -----
|
||||
|
||||
func @multi_tensor_rank_of_wrong_unranked_type(%arg0: tensor<2x2xi8>) {
|
||||
func.func @multi_tensor_rank_of_wrong_unranked_type(%arg0: tensor<2x2xi8>) {
|
||||
// expected-error @+1 {{'test.multi_tensor_rank_of' op operand #0 must be 0D/1D tensor of 8-bit signless integer or 32-bit signless integer or 32-bit float values}}
|
||||
"test.multi_tensor_rank_of"(%arg0) : (tensor<2x2xi8>) -> ()
|
||||
return
|
||||
@ -239,7 +239,7 @@ func @multi_tensor_rank_of_wrong_unranked_type(%arg0: tensor<2x2xi8>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @multi_tensor_rank_of_wrong_element_type(%arg0: tensor<2xi16>) {
|
||||
func.func @multi_tensor_rank_of_wrong_element_type(%arg0: tensor<2xi16>) {
|
||||
// expected-error @+1 {{'test.multi_tensor_rank_of' op operand #0 must be 0D/1D tensor of 8-bit signless integer or 32-bit signless integer or 32-bit float values}}
|
||||
"test.multi_tensor_rank_of"(%arg0) : (tensor<2xi16>) -> ()
|
||||
return
|
||||
@ -248,7 +248,7 @@ func @multi_tensor_rank_of_wrong_element_type(%arg0: tensor<2xi16>) {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @fixed_element_types
|
||||
func @fixed_element_types(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>, %mi32 : memref<2x3xi32>, %vf32 : vector<2xf32>) {
|
||||
func.func @fixed_element_types(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>, %mi32 : memref<2x3xi32>, %vf32 : vector<2xf32>) {
|
||||
"test.arg_and_res_have_fixed_element_types"(%ti32, %tf32) : (tensor<* x i32>, tensor<* x f32>) -> tensor<* x i16>
|
||||
"test.arg_and_res_have_fixed_element_types"(%mi32, %vf32) : (memref<2x3xi32>, vector<2xf32>) -> memref<1x2xi16>
|
||||
return
|
||||
@ -256,7 +256,7 @@ func @fixed_element_types(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>, %mi32
|
||||
|
||||
// -----
|
||||
|
||||
func @fixed_element_types(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
func.func @fixed_element_types(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
// expected-error@+1 {{'res' is 16-bit signless integer}}
|
||||
"test.arg_and_res_have_fixed_element_types"(%arg0, %arg1) : (tensor<* x i32>, tensor<* x f32>) -> tensor<* x i32>
|
||||
return
|
||||
@ -264,7 +264,7 @@ func @fixed_element_types(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @fixed_element_types(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
func.func @fixed_element_types(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
// expected-error@+1 {{fixed type combination}}
|
||||
"test.arg_and_res_have_fixed_element_types"(%arg1, %arg0) : (tensor<* x f32>, tensor<* x i32>) -> tensor<* x i16>
|
||||
return
|
||||
@ -273,7 +273,7 @@ func @fixed_element_types(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: same_element_types_success
|
||||
func @same_element_types_success(%ti32: tensor<* x i32>, %i32 : i32, %mi32 : memref<2x3xi32>) {
|
||||
func.func @same_element_types_success(%ti32: tensor<* x i32>, %i32 : i32, %mi32 : memref<2x3xi32>) {
|
||||
"test.operands_have_same_element_type"(%ti32, %ti32): (tensor<* x i32>, tensor<* x i32>) -> ()
|
||||
"test.operands_have_same_element_type"(%i32, %ti32): (i32, tensor<* x i32>) -> ()
|
||||
"test.operands_have_same_element_type"(%i32, %mi32): (i32, memref<2x3xi32>) -> ()
|
||||
@ -283,7 +283,7 @@ func @same_element_types_success(%ti32: tensor<* x i32>, %i32 : i32, %mi32 : mem
|
||||
|
||||
// -----
|
||||
|
||||
func @same_element_types_failure(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
func.func @same_element_types_failure(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
// expected-error@+1 {{verify that all of {x, y} have same element type}}
|
||||
"test.operands_have_same_element_type"(%arg1, %arg0): (tensor<* x f32>, tensor<* x i32>) -> ()
|
||||
return
|
||||
@ -292,7 +292,7 @@ func @same_element_types_failure(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>)
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: same_element_types_success
|
||||
func @same_element_types_success(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) {
|
||||
func.func @same_element_types_success(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) {
|
||||
"test.operand0_and_result_have_same_element_type"(%tf32, %ti32) : (tensor<* x f32>, tensor<* x i32>) -> tensor<* x f32>
|
||||
"test.operand0_and_result_have_same_element_type"(%tf32, %ti32) : (tensor<* x f32>, tensor<* x i32>) -> memref<2x3xf32>
|
||||
"test.operand0_and_result_have_same_element_type"(%tf32, %ti32) : (tensor<* x f32>, tensor<* x i32>) -> f32
|
||||
@ -301,7 +301,7 @@ func @same_element_types_success(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>)
|
||||
|
||||
// -----
|
||||
|
||||
func @same_element_types_failure(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
func.func @same_element_types_failure(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
// expected-error@+1 {{all of {x, res} have same element type}}
|
||||
"test.operand0_and_result_have_same_element_type"(%arg1, %arg0) : (tensor<* x f32>, tensor<* x i32>) -> tensor<* x i32>
|
||||
return
|
||||
@ -310,7 +310,7 @@ func @same_element_types_failure(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>)
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: same_types
|
||||
func @same_types(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) {
|
||||
func.func @same_types(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) {
|
||||
"test.operands_have_same_type"(%ti32, %ti32) : (tensor<* x i32>, tensor<* x i32>) -> ()
|
||||
"test.operand0_and_result_have_same_type"(%ti32, %tf32) : (tensor<* x i32>, tensor<* x f32>) -> tensor<* x i32>
|
||||
return
|
||||
@ -318,7 +318,7 @@ func @same_types(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @same_types_failure(%ti32: tensor<* x i32>, %i32: i32) {
|
||||
func.func @same_types_failure(%ti32: tensor<* x i32>, %i32: i32) {
|
||||
// expected-error@+1 {{all of {x, y} have same type}}
|
||||
"test.operands_have_same_type"(%ti32, %i32) : (tensor<* x i32>, i32) -> ()
|
||||
return
|
||||
@ -326,7 +326,7 @@ func @same_types_failure(%ti32: tensor<* x i32>, %i32: i32) {
|
||||
|
||||
// -----
|
||||
|
||||
func @same_types_element_mismatch(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) {
|
||||
func.func @same_types_element_mismatch(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) {
|
||||
// expected-error@+1 {{all of {x, y} have same type}}
|
||||
"test.operands_have_same_type"(%ti32, %tf32) : (tensor<* x i32>, tensor<* x f32>) -> ()
|
||||
return
|
||||
@ -334,7 +334,7 @@ func @same_types_element_mismatch(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>
|
||||
|
||||
// -----
|
||||
|
||||
func @same_types_shape_mismatch(%arg0: tensor<1x2xi32>, %arg1: tensor<2x1xi32>) {
|
||||
func.func @same_types_shape_mismatch(%arg0: tensor<1x2xi32>, %arg1: tensor<2x1xi32>) {
|
||||
// expected-error@+1 {{all of {x, y} have same type}}
|
||||
"test.operands_have_same_type"(%arg0, %arg1) : (tensor<1x2xi32>, tensor<2x1xi32>) -> ()
|
||||
return
|
||||
@ -343,7 +343,7 @@ func @same_types_shape_mismatch(%arg0: tensor<1x2xi32>, %arg1: tensor<2x1xi32>)
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: same_rank_success
|
||||
func @same_rank_success(%t1xi : tensor<1xi32>, %t2xf : tensor<2xf32>, %m3xi : memref<3xi32>, %t1x2xf : tensor<1x2xf32>, %t1x2xi : tensor<1x2xi32>) {
|
||||
func.func @same_rank_success(%t1xi : tensor<1xi32>, %t2xf : tensor<2xf32>, %m3xi : memref<3xi32>, %t1x2xf : tensor<1x2xf32>, %t1x2xi : tensor<1x2xi32>) {
|
||||
"test.operands_have_same_rank"(%t1xi, %t2xf) : (tensor<1xi32>, tensor<2xf32>) -> ()
|
||||
"test.operands_have_same_rank"(%t1xi, %m3xi) : (tensor<1xi32>, memref<3xi32>) -> ()
|
||||
"test.operand0_and_result_have_same_rank"(%t1xi, %t1x2xf) : (tensor<1xi32>, tensor<1x2xf32>) -> (tensor<3xf32>)
|
||||
@ -353,7 +353,7 @@ func @same_rank_success(%t1xi : tensor<1xi32>, %t2xf : tensor<2xf32>, %m3xi : me
|
||||
|
||||
// -----
|
||||
|
||||
func @same_rank_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) {
|
||||
func.func @same_rank_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) {
|
||||
// expected-error@+1 {{all of {x, y} have same rank}}
|
||||
"test.operands_have_same_rank"(%arg0, %arg1) : (tensor<1xi32>, tensor<1x2xf32>) -> ()
|
||||
return
|
||||
@ -361,7 +361,7 @@ func @same_rank_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @same_rank_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) {
|
||||
func.func @same_rank_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) {
|
||||
// expected-error@+1 {{all of {x, res} have same rank}}
|
||||
"test.operand0_and_result_have_same_rank"(%arg0, %arg1) : (tensor<1xi32>, tensor<1x2xf32>) -> (tensor<i32>)
|
||||
return
|
||||
@ -369,7 +369,7 @@ func @same_rank_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @same_rank_failure(%arg0: tensor<1x2xi32>, %arg1: tensor<1x2xf32>) {
|
||||
func.func @same_rank_failure(%arg0: tensor<1x2xi32>, %arg1: tensor<1x2xf32>) {
|
||||
// expected-error@+1 {{all of {x, res} have same rank}}
|
||||
"test.operand0_and_result_have_same_rank"(%arg0, %arg1) : (tensor<1x2xi32>, tensor<1x2xf32>) -> (tensor<3xi32>)
|
||||
return
|
||||
@ -378,7 +378,7 @@ func @same_rank_failure(%arg0: tensor<1x2xi32>, %arg1: tensor<1x2xf32>) {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: same_shape_success
|
||||
func @same_shape_success(%t2x3: tensor<2x3xi32>, %m2x3: memref<2x3xf32>, %v2x3 : vector<2x3xi32>, %t4x5 : tensor<4x5xi32>) {
|
||||
func.func @same_shape_success(%t2x3: tensor<2x3xi32>, %m2x3: memref<2x3xf32>, %v2x3 : vector<2x3xi32>, %t4x5 : tensor<4x5xi32>) {
|
||||
"test.operand0_and_result_have_same_shape"(%t2x3, %t4x5) : (tensor<2x3xi32>, tensor<4x5xi32>) -> (tensor<2x3xf32>)
|
||||
"test.operand0_and_result_have_same_shape"(%t2x3, %t4x5) : (tensor<2x3xi32>, tensor<4x5xi32>) -> (memref<2x3xf32>)
|
||||
"test.operand0_and_result_have_same_shape"(%t2x3, %t4x5) : (tensor<2x3xi32>, tensor<4x5xi32>) -> (vector<2x3xf32>)
|
||||
@ -387,7 +387,7 @@ func @same_shape_success(%t2x3: tensor<2x3xi32>, %m2x3: memref<2x3xf32>, %v2x3 :
|
||||
|
||||
// -----
|
||||
|
||||
func @same_shape_failure(%t2x3: tensor<2x3xi32>, %t4x5 : tensor<4x5xi32>) {
|
||||
func.func @same_shape_failure(%t2x3: tensor<2x3xi32>, %t4x5 : tensor<4x5xi32>) {
|
||||
// expected-error@+1 {{all of {x, res} have same shape}}
|
||||
"test.operand0_and_result_have_same_shape"(%t2x3, %t4x5) : (tensor<2x3xi32>, tensor<4x5xi32>) -> (tensor<1x3xf32>)
|
||||
return
|
||||
@ -396,7 +396,7 @@ func @same_shape_failure(%t2x3: tensor<2x3xi32>, %t4x5 : tensor<4x5xi32>) {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: same_element_count_success
|
||||
func @same_element_count_success(%arg0: tensor<36xi32>, %arg1: tensor<1x2xf32>, %arg3: tensor<f32>) {
|
||||
func.func @same_element_count_success(%arg0: tensor<36xi32>, %arg1: tensor<1x2xf32>, %arg3: tensor<f32>) {
|
||||
"test.operand0_and_result_have_same_element_count"(%arg0, %arg1) : (tensor<36xi32>, tensor<1x2xf32>) -> (tensor<3x4x3xf32>)
|
||||
"test.operand0_and_result_have_same_element_count"(%arg0, %arg1) : (tensor<36xi32>, tensor<1x2xf32>) -> (tensor<3x12xf64>)
|
||||
"test.operand0_and_result_have_same_element_count"(%arg3, %arg1) : (tensor<f32>, tensor<1x2xf32>) -> (memref<1x1x1xi32>)
|
||||
@ -405,7 +405,7 @@ func @same_element_count_success(%arg0: tensor<36xi32>, %arg1: tensor<1x2xf32>,
|
||||
|
||||
// -----
|
||||
|
||||
func @same_element_count_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) {
|
||||
func.func @same_element_count_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) {
|
||||
// expected-error@+1 {{all of {x, res} have same element count}}
|
||||
"test.operand0_and_result_have_same_element_count"(%arg0, %arg1) : (tensor<1xi32>, tensor<1x2xf32>) -> (tensor<2xi32>)
|
||||
return
|
||||
@ -413,7 +413,7 @@ func @same_element_count_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @four_equals_five() {
|
||||
func.func @four_equals_five() {
|
||||
// expected-error@+1 {{failed to verify that 4 equals 5}}
|
||||
"test.four_equals_five"() : () -> ()
|
||||
return
|
||||
@ -421,7 +421,7 @@ func @four_equals_five() {
|
||||
|
||||
// -----
|
||||
|
||||
func @operand_rank_equals_result_size_success(%arg : tensor<1x2x3x4xi32>) {
|
||||
func.func @operand_rank_equals_result_size_success(%arg : tensor<1x2x3x4xi32>) {
|
||||
"test.operand_rank_equals_result_size"(%arg) : (tensor<1x2x3x4xi32>) -> tensor<4xi32>
|
||||
"test.operand_rank_equals_result_size"(%arg) : (tensor<1x2x3x4xi32>) -> memref<2x2xf32>
|
||||
return
|
||||
@ -429,7 +429,7 @@ func @operand_rank_equals_result_size_success(%arg : tensor<1x2x3x4xi32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @operand_rank_equals_result_size_failure(%arg : tensor<1x2x3x4xi32>) {
|
||||
func.func @operand_rank_equals_result_size_failure(%arg : tensor<1x2x3x4xi32>) {
|
||||
// expected-error@+1 {{failed to verify that operand rank equals result size}}
|
||||
"test.operand_rank_equals_result_size"(%arg) : (tensor<1x2x3x4xi32>) -> tensor<2xi32>
|
||||
return
|
||||
@ -437,7 +437,7 @@ func @operand_rank_equals_result_size_failure(%arg : tensor<1x2x3x4xi32>) {
|
||||
|
||||
// -----
|
||||
|
||||
func @same_types_element_mismatch(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
func.func @same_types_element_mismatch(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) {
|
||||
// expected-error@+1 {{op failed to verify that all of {x, res} have same type}}
|
||||
"test.operand0_and_result_have_same_type"(%arg0, %arg1) : (tensor<* x i32>, tensor<* x f32>) -> tensor<* x f32>
|
||||
return
|
||||
@ -445,7 +445,7 @@ func @same_types_element_mismatch(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>
|
||||
|
||||
// -----
|
||||
|
||||
func @same_types_shape_mismatch(%arg0: tensor<1x2xi32>, %arg1: tensor<2x1xi32>) {
|
||||
func.func @same_types_shape_mismatch(%arg0: tensor<1x2xi32>, %arg1: tensor<2x1xi32>) {
|
||||
// expected-error@+1 {{op failed to verify that all of {x, res} have same type}}
|
||||
"test.operand0_and_result_have_same_type"(%arg0, %arg1) : (tensor<1x2xi32>, tensor<2x1xi32>) -> tensor<2x1xi32>
|
||||
return
|
||||
@ -453,7 +453,7 @@ func @same_types_shape_mismatch(%arg0: tensor<1x2xi32>, %arg1: tensor<2x1xi32>)
|
||||
|
||||
// -----
|
||||
|
||||
func @does_not_have_i32(%arg0: tensor<1x2xi32>, %arg1: none) {
|
||||
func.func @does_not_have_i32(%arg0: tensor<1x2xi32>, %arg1: none) {
|
||||
// expected-error@+1 {{either both none type operands or first is not none}}
|
||||
"test.if_first_operand_is_none_then_so_is_second"(%arg1, %arg0) : (none, tensor<1x2xi32>) -> ()
|
||||
return
|
||||
@ -461,14 +461,14 @@ func @does_not_have_i32(%arg0: tensor<1x2xi32>, %arg1: none) {
|
||||
|
||||
// -----
|
||||
|
||||
func @does_not_have_static_memref(%arg0: memref<?xi32>) {
|
||||
func.func @does_not_have_static_memref(%arg0: memref<?xi32>) {
|
||||
// expected-error@+1 {{'test.takes_static_memref' op operand #0 must be statically shaped memref of any type values}}
|
||||
"test.takes_static_memref"(%arg0) : (memref<?xi32>) -> ()
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @elements_attr_not_i32_f32() {
|
||||
func.func @elements_attr_not_i32_f32() {
|
||||
// expected-error@+1 {{32-bit signless integer elements attribute}}
|
||||
"test.i32ElementsAttr"() {attr = dense<[1.0, 20.0]>:tensor<2xf32>} : () -> ()
|
||||
return
|
||||
@ -476,7 +476,7 @@ func @elements_attr_not_i32_f32() {
|
||||
|
||||
// -----
|
||||
|
||||
func @elements_attr_not_i32_i64() {
|
||||
func.func @elements_attr_not_i32_i64() {
|
||||
// expected-error@+1 {{32-bit signless integer elements attribute}}
|
||||
"test.i32ElementsAttr"() {attr = dense<[1, 20]>:tensor<2xi64>} : () -> ()
|
||||
return
|
||||
@ -485,21 +485,21 @@ func @elements_attr_not_i32_i64() {
|
||||
|
||||
// -----
|
||||
|
||||
func @elements_attr_i32(%arg0: tensor<1x2xi32>) {
|
||||
func.func @elements_attr_i32(%arg0: tensor<1x2xi32>) {
|
||||
"test.i32ElementsAttr"() {attr = dense<[1, 2]>:tensor<2xi32>} : () -> ()
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @elements_attr_index() {
|
||||
func.func @elements_attr_index() {
|
||||
"test.indexElementsAttr"() {attr = dense<[1, 2]>:tensor<2xindex>} : () -> ()
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @elements_attr_not_index() {
|
||||
func.func @elements_attr_not_index() {
|
||||
// expected-error@+1 {{index elements attribute}}
|
||||
"test.indexElementsAttr"() {attr = dense<[1, 2]>:tensor<2xi32>} : () -> ()
|
||||
return
|
||||
@ -508,7 +508,7 @@ func @elements_attr_not_index() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @struct_success
|
||||
func @struct_success() {
|
||||
func.func @struct_success() {
|
||||
"test.simple_struct"() : () -> (!test.struct<{a, i32}, {b, f64}>)
|
||||
return
|
||||
}
|
||||
@ -516,14 +516,14 @@ func @struct_success() {
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: @struct_with_field_names_like_types
|
||||
func @struct_with_field_names_like_types() {
|
||||
func.func @struct_with_field_names_like_types() {
|
||||
"test.struct_with_field_names_like_types"() : () -> (!test.struct<{i32, i32}, {f64, f64}>)
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @struct_bad_keywords() {
|
||||
func.func @struct_bad_keywords() {
|
||||
// expected-error@+1 {{expected valid keyword}}
|
||||
"test.struct_bad_keywords"() : () -> (!test.struct<{42, i32}>)
|
||||
return
|
||||
|
@ -8,6 +8,6 @@
|
||||
// UNREGOK: cannot be converted to LLVM IR
|
||||
// REGONLY: operation being parsed with an unregistered dialect
|
||||
|
||||
func @trivial() {
|
||||
func.func @trivial() {
|
||||
"simple.terminator"() : () -> ()
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ module attributes {
|
||||
}
|
||||
}
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%arg0 = memref.alloc() : memref<8xf32>
|
||||
%arg1 = memref.alloc() : memref<8xf32>
|
||||
%arg2 = memref.alloc() : memref<8xf32>
|
||||
@ -44,7 +44,7 @@ module attributes {
|
||||
call @print_memref_f32(%arg6) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
func private @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
|
||||
func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ module attributes {
|
||||
}
|
||||
}
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%arg0 = memref.alloc() : memref<8xi32>
|
||||
%arg1 = memref.alloc() : memref<8x8xi32>
|
||||
%arg2 = memref.alloc() : memref<8x8x8xi32>
|
||||
@ -43,9 +43,9 @@ module attributes {
|
||||
call @print_memref_i32(%arg6) : (memref<*xi32>) -> ()
|
||||
return
|
||||
}
|
||||
func private @fillResource1DInt(%0 : memref<?xi32>, %1 : i32)
|
||||
func private @fillResource2DInt(%0 : memref<?x?xi32>, %1 : i32)
|
||||
func private @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
|
||||
func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
func.func private @fillResource1DInt(%0 : memref<?xi32>, %1 : i32)
|
||||
func.func private @fillResource2DInt(%0 : memref<?x?xi32>, %1 : i32)
|
||||
func.func private @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
|
||||
func.func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ module attributes {
|
||||
}
|
||||
}
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%arg0 = memref.alloc() : memref<8xi8>
|
||||
%arg1 = memref.alloc() : memref<8x8xi8>
|
||||
%arg2 = memref.alloc() : memref<8x8x8xi32>
|
||||
@ -44,8 +44,8 @@ module attributes {
|
||||
call @print_memref_i32(%arg6) : (memref<*xi32>) -> ()
|
||||
return
|
||||
}
|
||||
func private @fillResource1DInt8(%0 : memref<?xi8>, %1 : i8)
|
||||
func private @fillResource2DInt8(%0 : memref<?x?xi8>, %1 : i8)
|
||||
func private @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
|
||||
func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
func.func private @fillResource1DInt8(%0 : memref<?xi8>, %1 : i8)
|
||||
func.func private @fillResource2DInt8(%0 : memref<?x?xi8>, %1 : i8)
|
||||
func.func private @fillResource3DInt(%0 : memref<?x?x?xi32>, %1 : i32)
|
||||
func.func private @print_memref_i32(%ptr : memref<*xi32>)
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ module attributes {
|
||||
}
|
||||
}
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%arg0 = memref.alloc() : memref<4x4xf32>
|
||||
%arg1 = memref.alloc() : memref<4x4xf32>
|
||||
%arg2 = memref.alloc() : memref<4x4xf32>
|
||||
@ -45,7 +45,7 @@ module attributes {
|
||||
call @print_memref_f32(%arg6) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
func private @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
|
||||
func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ module attributes {
|
||||
}
|
||||
}
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%arg0 = memref.alloc() : memref<8x4x4xf32>
|
||||
%arg1 = memref.alloc() : memref<4x4xf32>
|
||||
%arg2 = memref.alloc() : memref<8x4x4xf32>
|
||||
@ -47,7 +47,7 @@ module attributes {
|
||||
call @print_memref_f32(%arg6) : (memref<*xf32>) -> ()
|
||||
return
|
||||
}
|
||||
func private @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
|
||||
func private @fillResource3DFloat(%0 : memref<?x?x?xf32>, %1 : f32)
|
||||
func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @fillResource2DFloat(%0 : memref<?x?xf32>, %1 : f32)
|
||||
func.func private @fillResource3DFloat(%0 : memref<?x?x?xf32>, %1 : f32)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ module attributes {
|
||||
}
|
||||
}
|
||||
|
||||
func @main() {
|
||||
func.func @main() {
|
||||
%arg0 = memref.alloc() : memref<16384xf32>
|
||||
%arg1 = memref.alloc() : memref<16384xf32>
|
||||
%arg2 = memref.alloc() : memref<16384xf32>
|
||||
@ -50,7 +50,7 @@ module attributes {
|
||||
%arg6 = memref.cast %arg5 : memref<?xf32> to memref<*xf32>
|
||||
return
|
||||
}
|
||||
func private @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
|
||||
func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
func.func private @fillResource1DFloat(%0 : memref<?xf32>, %1 : f32)
|
||||
func.func private @print_memref_f32(%ptr : memref<*xf32>)
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ static LogicalResult lowerToLLVMDialect(ModuleOp module) {
|
||||
|
||||
TEST(MLIRExecutionEngine, AddInteger) {
|
||||
std::string moduleStr = R"mlir(
|
||||
func @foo(%arg0 : i32) -> i32 attributes { llvm.emit_c_interface } {
|
||||
func.func @foo(%arg0 : i32) -> i32 attributes { llvm.emit_c_interface } {
|
||||
%res = arith.addi %arg0, %arg0 : i32
|
||||
return %res : i32
|
||||
}
|
||||
@ -82,7 +82,7 @@ TEST(MLIRExecutionEngine, AddInteger) {
|
||||
|
||||
TEST(MLIRExecutionEngine, SubtractFloat) {
|
||||
std::string moduleStr = R"mlir(
|
||||
func @foo(%arg0 : f32, %arg1 : f32) -> f32 attributes { llvm.emit_c_interface } {
|
||||
func.func @foo(%arg0 : f32, %arg1 : f32) -> f32 attributes { llvm.emit_c_interface } {
|
||||
%res = arith.subf %arg0, %arg1 : f32
|
||||
return %res : f32
|
||||
}
|
||||
@ -112,7 +112,7 @@ TEST(NativeMemRefJit, ZeroRankMemref) {
|
||||
ASSERT_EQ(*a->data, 42);
|
||||
a[{}] = 0;
|
||||
std::string moduleStr = R"mlir(
|
||||
func @zero_ranked(%arg0 : memref<f32>) attributes { llvm.emit_c_interface } {
|
||||
func.func @zero_ranked(%arg0 : memref<f32>) attributes { llvm.emit_c_interface } {
|
||||
%cst42 = arith.constant 42.0 : f32
|
||||
memref.store %cst42, %arg0[] : memref<f32>
|
||||
return
|
||||
@ -146,7 +146,7 @@ TEST(NativeMemRefJit, RankOneMemref) {
|
||||
}
|
||||
|
||||
std::string moduleStr = R"mlir(
|
||||
func @one_ranked(%arg0 : memref<?xf32>) attributes { llvm.emit_c_interface } {
|
||||
func.func @one_ranked(%arg0 : memref<?xf32>) attributes { llvm.emit_c_interface } {
|
||||
%cst42 = arith.constant 42.0 : f32
|
||||
%cst5 = arith.constant 5 : index
|
||||
memref.store %cst42, %arg0[%cst5] : memref<?xf32>
|
||||
@ -198,7 +198,7 @@ TEST(NativeMemRefJit, BasicMemref) {
|
||||
}
|
||||
}
|
||||
std::string moduleStr = R"mlir(
|
||||
func @rank2_memref(%arg0 : memref<?x?xf32>, %arg1 : memref<?x?xf32>) attributes { llvm.emit_c_interface } {
|
||||
func.func @rank2_memref(%arg0 : memref<?x?xf32>, %arg1 : memref<?x?xf32>) attributes { llvm.emit_c_interface } {
|
||||
%x = arith.constant 2 : index
|
||||
%y = arith.constant 1 : index
|
||||
%cst42 = arith.constant 42.0 : f32
|
||||
@ -243,8 +243,8 @@ TEST(NativeMemRefJit, JITCallback) {
|
||||
elt = count++;
|
||||
|
||||
std::string moduleStr = R"mlir(
|
||||
func private @callback(%arg0: memref<?x?xf32>, %coefficient: i32) attributes { llvm.emit_c_interface }
|
||||
func @caller_for_callback(%arg0: memref<?x?xf32>, %coefficient: i32) attributes { llvm.emit_c_interface } {
|
||||
func.func private @callback(%arg0: memref<?x?xf32>, %coefficient: i32) attributes { llvm.emit_c_interface }
|
||||
func.func @caller_for_callback(%arg0: memref<?x?xf32>, %coefficient: i32) attributes { llvm.emit_c_interface } {
|
||||
%unranked = memref.cast %arg0: memref<?x?xf32> to memref<*xf32>
|
||||
call @callback(%arg0, %coefficient) : (memref<?x?xf32>, i32) -> ()
|
||||
return
|
||||
|
@ -26,7 +26,7 @@ class ValueShapeRangeTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
const char *ir = R"MLIR(
|
||||
func @map(%arg : tensor<1xi64>) {
|
||||
func.func @map(%arg : tensor<1xi64>) {
|
||||
%0 = arith.constant dense<[10]> : tensor<1xi64>
|
||||
%1 = arith.addi %arg, %0 : tensor<1xi64>
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user