[Mlir-commits] [mlir] [mlir][Transforms] Add missing check in applyPermutation (PR #102099)

donald chen llvmlistbot at llvm.org
Thu Aug 8 05:59:22 PDT 2024


================
@@ -36,3 +36,14 @@ func.func @rfft2d_with_non_float_type(%arg0 : tensor<1x1x1xi32>) -> (tensor<1x1x
   %real, %imag = tosa.rfft2d %arg0 : (tensor<1x1x1xi32>) -> (tensor<1x1x1xi32>, tensor<1x1x1xi32>)
   return %real, %imag : tensor<1x1x1xi32>, tensor<1x1x1xi32>
 }
+
+// -----
+
+// CHECK-LABEL: @test_invalid_constant_permutation
+func.func @test_invalid_constant_permutation() {
+  // expected-error at +3 {{permutation must be within input bounds}}
+	%14 = tensor.empty() : tensor<3x4x5xi32>
+	%c1 = arith.constant dense<[3, 0, 1]> : tensor<3xi32>
+	%72 = tosa.transpose %14, %c1 : (tensor<3x4x5xi32>, tensor<3xi32>) -> tensor<3x4x5xi32>
----------------
cxy-1993 wrote:

You should pay more attention to the test format: reduce the use of tabs. Additionally, the variable names are too casual. %c1 doesn't match your value meaning at all, it is confusing. If you're unsure about naming variables, it's recommended to start with %0.

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


More information about the Mlir-commits mailing list