This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tosa] Add broadcasting case for tosa.resize to linalg implementation
ClosedPublic

Authored by rsuderman on Dec 13 2022, 12:38 PM.

Details

Summary

When lowering tosa.resize it is possible there is an unary input dimension.
Lowering to a new tosa.resize and explicit broadcast simplifies the
tosa.resize operation to avoid recomputing the identical broadcasted values.

This change reworks the broadcast optimization reuse the tosa.resize generic
implementation.

Diff Detail

Event Timeline

rsuderman created this revision.Dec 13 2022, 12:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 13 2022, 12:38 PM
rsuderman requested review of this revision.Dec 13 2022, 12:38 PM
rsuderman edited the summary of this revision. (Show Details)Dec 13 2022, 12:40 PM
rsuderman added a reviewer: jpienaar.
jpienaar added inline comments.Dec 16 2022, 10:58 AM
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
1431

s/a a /a/

1442

Is ranked verified? Else lets check and return (I know practically things will fail, but if not verified to not be true I'd rather not have an assert here)

2329

Are the benefits here really required? (it would seem these actually make up orthogonal lowerings and so we should be able to guard them such so that we don't rely on benefits here - or just have it be one that dispatches to different rewrite calls).

rsuderman updated this revision to Diff 486066.Jan 3 2023, 1:35 PM

Fixed comment, included RankedTensorType check.

rsuderman marked 3 inline comments as done.Jan 3 2023, 1:39 PM
rsuderman added inline comments.
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
2329

I believe they are. We want to handle all of the broadcasting cases before applying the generic converter, otherwise we may generate the generic case and miss the performance improvements of the ending broadcast.

jpienaar accepted this revision.Jan 3 2023, 2:05 PM
This revision is now accepted and ready to land.Jan 3 2023, 2:05 PM
This revision was landed with ongoing or failed builds.Jan 3 2023, 2:30 PM
This revision was automatically updated to reflect the committed changes.
rsuderman marked an inline comment as done.