[Mlir-commits] [mlir] [mlir][tosa] Fix crash in inferReturnTypes for ReduceOps (PR #69843)

Eric Kunze llvmlistbot at llvm.org
Mon Oct 23 13:53:07 PDT 2023


================
@@ -593,13 +593,3 @@ func.func @fold_abs_abs(%arg0: tensor<?x1xf32>) -> tensor<?x1xf32> {
 }
 
 // -----
-
-// CHECK-LABEL: @fold_reduce_rank_zero
-func.func nested @fold_reduce_rank_zero() {
-  // CHECK-NOT: tosa.reduce_min
-  // CHECK-NOT: tosa.reverse
-  %0 = tensor.empty() : tensor<i32>
-  %1 = tosa.reduce_min %0 {axis = 0 : i32} : (tensor<i32>) -> tensor<1x10xi32>
----------------
eric-k256 wrote:

Hmm. rank 0 is an annoying special case. The TOSA spec requires reduction ops to have rank >=1, but we've been thinking about allowing rank 0 as a special case (in which case we'd need to change the ERROR_IF). 
We could solve this with a special case in the verifier to allow axis=0 when the tensor rank is 0. Then the fold would remove instances of this. I don't know how prevalent instances of rank0 reduction operators are. We don't have them in the tests we run, but the reduction folder being added indicates they do appear on some paths.

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


More information about the Mlir-commits mailing list