Page MenuHomePhabricator

[mlir][tosa] Add tosa.resize lowering to linalg generic

Authored by rsuderman on Apr 21 2021, 7:14 PM.



Includes tests and implementation for both integer and floating point values.
Both nearest neighbor and bilinear interpolation is included.

Diff Detail

Event Timeline

rsuderman created this revision.Apr 21 2021, 7:14 PM
rsuderman requested review of this revision.Apr 21 2021, 7:14 PM
silvas accepted this revision.Apr 22 2021, 1:43 PM

LGTM. The code looks reasonable, assuming you verified the outputs are correct on a few cases (always tricky to statically inspect the code).

please wait for @sjarus who is more familiar with the spec of this op for a second look, due to the complexity

This revision is now accepted and ready to land.Apr 22 2021, 1:43 PM

This seems to look fine functionally, modulo the inline aesthetic comments.

Tip: in case you also want to see an implementation of TOSA ops that looks C-like, please take a look at the reference model source: , e.g. src/ops/ in this case.


This block is mode invariant .


I know these are equivalent to the xPred/yPred approach in Nearest Neighbor mode, but does it make sense to make this common code ? In case additional modes are defined that leverage the same logic, it would avoid further duplication of the same intent.

Fixed for suraj@ comments

rsuderman marked 2 inline comments as done.Apr 23 2021, 12:39 PM
rsuderman added inline comments.

There are a few tweaks I could do but with the clamp helper its about as minimal overlap as we are going to get (especially because nearest needs to do its wrapping separately). Overall I expect if more sampling methods are introduced we will likely produce different converters for each configuration.

rsuderman marked an inline comment as done.Apr 23 2021, 12:49 PM
This revision was landed with ongoing or failed builds.Apr 23 2021, 12:50 PM
This revision was automatically updated to reflect the committed changes.