[Mlir-commits] [mlir] [mlir][tosa] Fix tosa-infer-shapes crash (PR #87234)

Spenser Bauman llvmlistbot at llvm.org
Mon Apr 1 12:25:12 PDT 2024


================
@@ -1177,6 +1177,120 @@ func.func @while_test(%arg0 : tensor<i32>, %arg1 : tensor<1xi32>) -> () {
 
 // -----
 
+// This test locks down a fix for a crash in the type inference process.
+// The relevant pattern is a while loop whose body contains a TOSA operation which is
+// consumed by a non-inferrable user in the same body.
+// Previously, this would trigger a crash due to how types are cached and then
+// reapplied to the operations in the loops body.
+
+// CHECK-LABEL: @while_dont_crash
+func.func @while_dont_crash(%arg0 : tensor<i32>) -> (tensor<*xi32>) {
+  %0 = tosa.add %arg0, %arg0 : (tensor<i32>, tensor<i32>) -> tensor<*xi32>
+
----------------
sabauma wrote:

Trimmed out all the whitespace. I was just following the structure of prior tests. Arguably, the filecheck directives are not that important, since we're just ensuring the pass does not crash.

I would also be happy moving this to a different file, rather than having it inline with all the correctness tests.

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


More information about the Mlir-commits mailing list