Skip to content

Commit 74d1960

Browse files
authored
[mlir][tensor] Add a test for invalid tensor.pack (#106246)
Adds a missing test for when the rank of the output tensor doesn't match the input tensor rank + number of blocking factors.
1 parent 7808541 commit 74d1960

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mlir/test/Dialect/Tensor/invalid.mlir

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,14 @@ func.func @pack_invalid_duplicate_element_in_outer_perm(%input: tensor<256x128xf
636636

637637
// -----
638638

639+
func.func @pack_invalid_output_rank(%input: tensor<256x128xf32>, %output: tensor<64x32x16xf32>) -> tensor<64x32x16xf32> {
640+
// expected-error@+1 {{packed rank must equal unpacked rank + tiling factors}}
641+
%0 = tensor.pack %input inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %output : tensor<256x128xf32> -> tensor<64x32x16xf32>
642+
return %0 : tensor<64x32x16xf32>
643+
}
644+
645+
// -----
646+
639647
func.func @unpack_invalid_out_of_bound_outer_perm(%input: tensor<256x128xf32>, %output: tensor<8x8x32x16xf32>) -> tensor<8x8x32x16xf32> {
640648
// expected-error@+1 {{invalid outer_dims_perm vector}}
641649
%0 = tensor.unpack %output outer_dims_perm = [2, 1] inner_dims_pos = [0, 1] inner_tiles = [2, 2] into %input : tensor<8x8x32x16xf32> -> tensor<256x128xf32>

0 commit comments

Comments
 (0)