This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tosa] Add tosa.max_pool2d lowering to linalg int max pooling additions
ClosedPublic

Authored by rsuderman on Apr 2 2021, 5:47 PM.

Details

Summary

Lowerings tosa.max_pool2d to linalg equivalent operations. Includes
adding max pooling operations for linalg, with corresponding tests.

Diff Detail

Event Timeline

rsuderman created this revision.Apr 2 2021, 5:47 PM
rsuderman requested review of this revision.Apr 2 2021, 5:47 PM
rsuderman updated this revision to Diff 335326.Apr 5 2021, 2:33 PM

Fixed clang-tidy error

mravishankar requested changes to this revision.Apr 7 2021, 11:47 AM
mravishankar added inline comments.
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
1435

If pad[0] and pad[1] etc. are integers, you could just create an IntegerAttr. So

OpFoldResult ... = rewriter.createI64IntegerAttr(pad[1])

Also, I dont think createOrFold does anything for ConstantIndexOp . Could just use create (i have made the same mistake previously, so stating comments from then)

This revision now requires changes to proceed.Apr 7 2021, 11:47 AM
rsuderman updated this revision to Diff 335901.Apr 7 2021, 12:25 PM

Remove createOrFold uses

rsuderman marked an inline comment as done.Apr 7 2021, 12:26 PM
rsuderman updated this revision to Diff 335910.Apr 7 2021, 12:43 PM

Fixed build error due to OpFoldResult.

mravishankar requested changes to this revision.Apr 8 2021, 4:09 PM
mravishankar added inline comments.
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
1444

I am not sure I follow this (sorry if my previous comment was not clear). The RHS values are all constants right?

So you could just create an IntegerAttr for these statically known values. Basically there is no need for the ConstantIndexOp used to create any of these values AFAICS.

(Sorry I had commented earlier, but forgot to hit enter)

This revision now requires changes to proceed.Apr 8 2021, 4:09 PM
rsuderman updated this revision to Diff 336268.Apr 8 2021, 4:36 PM

Updated to use constant attributes instead of values for padding behavior.

rsuderman marked an inline comment as done.Apr 8 2021, 4:36 PM
mravishankar accepted this revision.Apr 8 2021, 5:21 PM

Looks fine to me except for use of C++-14 feature which might cause build issues. So LGTM apart from that issue. Please make sure no bots are broken

mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
1459

This is a C++-14 feature. I am not sure what compilers/level of c++14 support the buildbots use. I try to stick to C++11?

This revision is now accepted and ready to land.Apr 8 2021, 5:21 PM
rriddle added inline comments.Apr 8 2021, 5:26 PM
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
1459

LLVM is C++14.