[Mlir-commits] [mlir] [mlir][tensor] Add a test for invalid tensor.pack (PR #106246)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Aug 27 10:00:46 PDT 2024
https://github.com/banach-space created https://github.com/llvm/llvm-project/pull/106246
Adds a missing test for when the rank of the output tensor doesn't match
the input tensor rank + number of blocking factors.
>From e92b21a4492c67ab3dc88d3ebc2ee68f8f64f64d Mon Sep 17 00:00:00 2001
From: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: Tue, 27 Aug 2024 17:53:23 +0100
Subject: [PATCH] [mlir][tensor] Add a test for invalid tensor.pack
Adds a missing test for when the rank of the output tensor doesn't match
the input tensor rank + number of blocking factors.
---
mlir/test/Dialect/Tensor/invalid.mlir | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mlir/test/Dialect/Tensor/invalid.mlir b/mlir/test/Dialect/Tensor/invalid.mlir
index 41b6529f64afa3..d9db32b8801ac2 100644
--- a/mlir/test/Dialect/Tensor/invalid.mlir
+++ b/mlir/test/Dialect/Tensor/invalid.mlir
@@ -636,6 +636,14 @@ func.func @pack_invalid_duplicate_element_in_outer_perm(%input: tensor<256x128xf
// -----
+func.func @pack_invalid_output_rank(%input: tensor<256x128xf32>, %output: tensor<64x32x16xf32>) -> tensor<64x32x16xf32> {
+ // expected-error at +1 {{packed rank must equal unpacked rank + tiling factors}}
+ %0 = tensor.pack %input inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %output : tensor<256x128xf32> -> tensor<64x32x16xf32>
+ return %0 : tensor<64x32x16xf32>
+}
+
+// -----
+
func.func @unpack_invalid_out_of_bound_outer_perm(%input: tensor<256x128xf32>, %output: tensor<8x8x32x16xf32>) -> tensor<8x8x32x16xf32> {
// expected-error at +1 {{invalid outer_dims_perm vector}}
%0 = tensor.unpack %output outer_dims_perm = [2, 1] inner_dims_pos = [0, 1] inner_tiles = [2, 2] into %input : tensor<8x8x32x16xf32> -> tensor<256x128xf32>
More information about the Mlir-commits
mailing list