This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tosa] Swap reshape at end of reduce op with expand_shape
ClosedPublic

Authored by ramiro050 on Mar 13 2023, 1:37 PM.

Details

Summary

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.

Diff Detail

Event Timeline

ramiro050 created this revision.Mar 13 2023, 1:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2023, 1:37 PM
ramiro050 requested review of this revision.Mar 13 2023, 1:37 PM
rsuderman accepted this revision.Mar 13 2023, 3:36 PM
This revision is now accepted and ready to land.Mar 13 2023, 3:36 PM