[Mlir-commits] [mlir] [mlir][tosa] Fix not to crash with large permutation indexes (PR #69857)
Jacques Pienaar
llvmlistbot at llvm.org
Sat Oct 21 16:40:19 PDT 2023
================
@@ -1272,3 +1272,29 @@ func.func @test_tosa_use_def_chain(%arg0: tensor<1x32x32x3xf32>, %arg1: tensor<1
%1 = tosa.max_pool2d %0 {kernel = array<i64: 2, 2>, pad = array<i64: 0, 0, 0, 0>, stride = array<i64: 2, 2>} : (tensor<?x32x32x16xf32>) -> tensor<?x16x16x16xf32>
return %1 : tensor<?x16x16x16xf32>
}
+
+// -----
+
+// CHECK-LABEL: test_rank_size_constant_permutation
+func.func @test_rank_size_constant_permutation() {
+ %c6 = arith.constant 6 : index
+ %cst_26 = arith.constant dense<[0, 2]> : tensor<2xi32>
+ %14 = tensor.empty(%c6) : tensor<?x27xi64>
+ // Fail to infer the shape but not crash.
+ // CHECK: (tensor<?x27xi64>, tensor<2xi32>) -> tensor<?x27xi64>
+ %72 = tosa.transpose %14, %cst_26 : (tensor<?x27xi64>, tensor<2xi32>) -> tensor<?x27xi64>
+ return
+}
+
+// -----
+
+// CHECK-LABEL: test_large_constant_permutation
+func.func @test_large_constant_permutation() {
+ %c6 = arith.constant 6 : index
+ %cst_26 = arith.constant dense<[1185677355, 332462212]> : tensor<2xi32>
+ %14 = tensor.empty(%c6) : tensor<?x27xi64>
+ // Fail to infer the shape but not crash.
+ // CHECK: (tensor<?x27xi64>, tensor<2xi32>) -> tensor<?x27xi64>
+ %72 = tosa.transpose %14, %cst_26 : (tensor<?x27xi64>, tensor<2xi32>) -> tensor<?x27xi64>
+ return
+}
----------------
jpienaar wrote:
Missing new line at end.
https://github.com/llvm/llvm-project/pull/69857
More information about the Mlir-commits
mailing list