Skip to content

Commit 73554ee

Browse files
committed
fixup! [mlir][tensor] Restrict the verifier for tensor.pack/tensor.unpack
Update tests
1 parent 714250b commit 73554ee

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

mlir/test/Dialect/Linalg/transform-lower-pack.mlir

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ module attributes {transform.with_named_sequence} {
586586

587587
// Check that we can lower unpack "as unpad" with dynamic dims.
588588
// CHECK-LABEL: func.func @unpack_as_pad_dynamic(
589-
// CHECK-SAME: %[[ARG0:.*]]: tensor<1x1x1x1x?x?x?x?xf32>, %[[ARG1:.*]]: tensor<?x?x?x?xf32>
589+
// CHECK-SAME: %[[ARG0:.*]]: tensor<1x1x1x1x136x64x16x16xf32>, %[[ARG1:.*]]: tensor<?x?x?x?xf32>
590590
// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index
591591
// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index
592592
// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index
@@ -602,10 +602,10 @@ module attributes {transform.with_named_sequence} {
602602
// CHECK-SAME: [1, 1, 1, 1, %[[DIM0]], %[[DIM1]], %[[DIM2]], %[[DIM3]]]
603603
// strides multiplers.
604604
// CHECK-SAME: [1, 1, 1, 1, 1, 1, 1, 1]
605-
// CHECK-SAME: : tensor<1x1x1x1x?x?x?x?xf32> to tensor<?x?x?x?xf32>
606-
func.func @unpack_as_pad_dynamic(%arg0: tensor<1x1x1x1x?x?x?x?xf32>, %arg1: tensor<?x?x?x?xf32>) -> tensor<?x?x?x?xf32> {
605+
// CHECK-SAME: : tensor<1x1x1x1x136x64x16x16xf32> to tensor<?x?x?x?xf32>
606+
func.func @unpack_as_pad_dynamic(%arg0: tensor<1x1x1x1x136x64x16x16xf32>, %arg1: tensor<?x?x?x?xf32>) -> tensor<?x?x?x?xf32> {
607607
%pack = tensor.unpack %arg0 inner_dims_pos = [0, 1, 2, 3] inner_tiles = [136, 64, 16, 16] into %arg1
608-
: tensor<1x1x1x1x?x?x?x?xf32> -> tensor<?x?x?x?xf32>
608+
: tensor<1x1x1x1x136x64x16x16xf32> -> tensor<?x?x?x?xf32>
609609
return %pack : tensor<?x?x?x?xf32>
610610
}
611611

mlir/test/Dialect/Tensor/fold-empty-op.mlir

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ func.func @pack_empty(%arg0: tensor<8x8x32x32xf32>) -> tensor<8x8x32x32xf32> {
7777
// CHECK-NOT: tensor.pack
7878
// CHECK: return %[[T]] : tensor<8x8x32x32xf32>
7979

80-
func.func @pack_empty_dynamic(%arg0: tensor<?x?x?x?xf32>, %dim0: index, %dim1: index) -> tensor<?x?x?x?xf32> {
80+
func.func @pack_empty_dynamic(%arg0: tensor<?x?x32x32xf32>, %dim0: index, %dim1: index) -> tensor<?x?x32x32xf32> {
8181
%empty_unpacked = tensor.empty(%dim0, %dim1) : tensor<?x?xf32>
8282
%packed = tensor.pack %empty_unpacked
8383
inner_dims_pos = [0, 1] inner_tiles = [32, 32]
84-
into %arg0 : tensor<?x?xf32> -> tensor<?x?x?x?xf32>
85-
return %packed : tensor<?x?x?x?xf32>
84+
into %arg0 : tensor<?x?xf32> -> tensor<?x?x32x32xf32>
85+
return %packed : tensor<?x?x32x32xf32>
8686
}
8787

8888
// CHECK-LABEL: func.func @pack_empty_dynamic(
89-
// CHECK-SAME: %[[T:.+]]: tensor<?x?x?x?xf32>,
89+
// CHECK-SAME: %[[T:.+]]: tensor<?x?x32x32xf32>,
9090
// CHECK-SAME: %[[DIM0:[a-zA-Z0-9_]+]]: index,
9191
// CHECK-SAME: %[[DIM1:[a-zA-Z0-9_]+]]: index
9292
// CHECK-NOT: tensor.pack
93-
// CHECK: return %[[T]] : tensor<?x?x?x?xf32>
93+
// CHECK: return %[[T]] : tensor<?x?x32x32xf32>
9494

9595
func.func @unpack_empty(%arg0: tensor<256x256xf32>) -> tensor<256x256xf32> {
9696
%empty_packed = tensor.empty() : tensor<8x8x32x32xf32>
@@ -105,20 +105,18 @@ func.func @unpack_empty(%arg0: tensor<256x256xf32>) -> tensor<256x256xf32> {
105105
// CHECK-NOT: tensor.unpack
106106
// CHECK: return %[[T]] : tensor<256x256xf32>
107107

108-
func.func @unpack_empty_dynamic(%arg0: tensor<?x?xf32>, %dim0: index, %dim1: index, %dim2: index, %dim3: index) -> tensor<?x?xf32> {
109-
%empty_packed = tensor.empty(%dim0, %dim1, %dim2, %dim3) : tensor<?x?x?x?xf32>
108+
func.func @unpack_empty_dynamic(%arg0: tensor<?x?xf32>, %dim0: index, %dim1: index) -> tensor<?x?xf32> {
109+
%empty_packed = tensor.empty(%dim0, %dim1) : tensor<?x?x32x32xf32>
110110
%unpacked = tensor.unpack %empty_packed
111111
inner_dims_pos = [0, 1] inner_tiles = [32, 32]
112-
into %arg0 : tensor<?x?x?x?xf32> -> tensor<?x?xf32>
112+
into %arg0 : tensor<?x?x32x32xf32> -> tensor<?x?xf32>
113113
return %unpacked : tensor<?x?xf32>
114114
}
115115

116116
// CHECK-LABEL: func.func @unpack_empty_dynamic(
117117
// CHECK-SAME: %[[T:.+]]: tensor<?x?xf32>,
118118
// CHECK-SAME: %[[DIM0:[a-zA-Z0-9_]+]]: index,
119-
// CHECK-SAME: %[[DIM1:[a-zA-Z0-9_]+]]: index,
120-
// CHECK-SAME: %[[DIM2:[a-zA-Z0-9_]+]]: index,
121-
// CHECK-SAME: %[[DIM3:[a-zA-Z0-9_]+]]: index
119+
// CHECK-SAME: %[[DIM1:[a-zA-Z0-9_]+]]: index
122120
// CHECK-NOT: tensor.unpack
123121
// CHECK: return %[[T]] : tensor<?x?xf32>
124122

0 commit comments

Comments
 (0)