[Mlir-commits] [mlir] [mlir][tensor] Add a test for invalid tensor.pack (PR #106246)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Aug 27 10:01:15 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Andrzej WarzyĆski (banach-space)
<details>
<summary>Changes</summary>
Adds a missing test for when the rank of the output tensor doesn't match
the input tensor rank + number of blocking factors.
---
Full diff: https://github.com/llvm/llvm-project/pull/106246.diff
1 Files Affected:
- (modified) mlir/test/Dialect/Tensor/invalid.mlir (+8)
``````````diff
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>
``````````
</details>
https://github.com/llvm/llvm-project/pull/106246
More information about the Mlir-commits
mailing list