Skip to content

Commit b87be4f

Browse files
committed
Add check for canonicalization of slice(concat %a, %a)) = %a
1 parent 0aad4d9 commit b87be4f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mlir/test/Dialect/Tosa/canonicalize.mlir

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,17 @@ func.func @canonicalize_tile_slice(%arg0 : tensor<1x12x12x10x10x10xf32>) -> tens
908908

909909
// -----
910910

911+
// CHECK-LABEL: func.func @canonicalize_self_concat_slice
912+
// CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<1x2x3x4xf32>) -> tensor<1x2x3x4xf32> {
913+
// CHECK: return [[PARAM_0_]] : tensor<1x2x3x4xf32>
914+
func.func @canonicalize_self_concat_slice(%arg0 : tensor<1x2x3x4xf32>) -> tensor<1x2x3x4xf32> {
915+
%0 = tosa.concat %arg0, %arg0 {axis = 3 : i32} : (tensor<1x2x3x4xf32>, tensor<1x2x3x4xf32>) -> tensor<1x2x3x8xf32>
916+
%1 = tosa.slice %0 {size = array<i64: 1, 2, 3, 4>, start = array<i64: 0, 0, 0, 0>} : (tensor<1x2x3x8xf32>) -> tensor<1x2x3x4xf32>
917+
return %1 : tensor<1x2x3x4xf32>
918+
}
919+
920+
// -----
921+
911922
// CHECK-LABEL: func.func @canonicalize_tile_slice_zero_dim
912923
// CHECK-SAME: ([[PARAM_0_:%.+]]: tensor<1x12x12x10x10xf32>) -> tensor<1x0x12x10x16xf32> {
913924
// CHECK: [[VAR_0_:%.+]] = tosa.tile [[PARAM_0_]] {multiples = array<i64: 10, 10, 10, 10, 10>} : (tensor<1x12x12x10x10xf32>) -> tensor<10x120x120x100x100xf32>

0 commit comments

Comments
 (0)