[mlir][tosa] Swap reshape at end of reduce op with expand_shape
This commit swaps back the `tosa.reshape` op used at the end of the lowering for reduce ops with the op `tensor.expand_shape`. This is needed to properly support dynamically-sized tensors. In such cases, lowering directly to `tensor.expand_shape` allows us to control which dimension gets expanded at the end using the knowledge of the reduction. This would not be possible when using `tosa.reshape`, since the op does not have a way of knowing that we are only unsqueezing a single dimension. Note: this change had previously been performed in https://reviews.llvm.org/D133877. Reviewed By: rsuderman Differential Revision: https://reviews.llvm.org/D145986
Loading
Please sign in to comment