Skip to content

Conversation

banach-space
Copy link
Contributor

Adds a missing test for when the rank of the output tensor doesn't match
the input tensor rank + number of blocking factors.

Adds a missing test for when the rank of the output tensor doesn't match
the input tensor rank + number of blocking factors.
@llvmbot
Copy link
Member

llvmbot commented Aug 27, 2024

@llvm/pr-subscribers-mlir-tensor

@llvm/pr-subscribers-mlir

Author: Andrzej Warzyński (banach-space)

Changes

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 --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@+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@+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>

@banach-space banach-space merged commit 74d1960 into llvm:main Aug 28, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants