[Mlir-commits] [mlir] [tosa] Fix crash in shape inference for `tosa.transpose` (PR #74367)

Spenser Bauman llvmlistbot at llvm.org
Mon Dec 4 15:52:17 PST 2023


================
@@ -1310,3 +1310,14 @@ func.func @test_large_constant_permutation() {
   return
 }
 
+// -----
+
+// CHECK-LABEL: test_rank0_transpose_perms
+// Fail to infer the shape but not crash.
+func.func @test_rank0_transpose_perms() {
+  %14 = tensor.empty() : tensor<5x27xi64>
+  %cst = tensor.empty() : tensor<i32>
+  // CHECK: tosa.transpose
+  %72 = tosa.transpose %14, %cst : (tensor<5x27xi64>, tensor<i32>) -> tensor<?x?xi64>
----------------
sabauma wrote:

Based on the description (in the TOSA Spec) of `tosa.transpose` it seems like this op should be illegal. The permutation tensor is expected to be a rank-1 tensor with an element count equal to the rank of the input tensor.

https://github.com/llvm/llvm-project/pull/74367


More information about the Mlir-commits mailing list