This is an archive of the discontinued LLVM Phabricator instance.

[tosa] Add option to disable tosa.apply_scale lowering in TosaToStandard
ClosedPublic

Authored by rsuderman on Apr 1 2022, 5:04 PM.

Details

Summary

Apply scale should be optionally disabled when lowering via TosaToStandard.
In most cases it should persist until the lowering to specific backend.

Diff Detail

Event Timeline

rsuderman created this revision.Apr 1 2022, 5:04 PM
Herald added a project: Restricted Project. · View Herald Transcript
rsuderman requested review of this revision.Apr 1 2022, 5:04 PM
jpienaar accepted this revision.Apr 1 2022, 5:39 PM
jpienaar added inline comments.
mlir/include/mlir/Conversion/Passes.td
758

s/standard/arith/? Or are there other ones along? (I was mentioning to Mehdi I don't know how to rename the ShapeToStandard pass with Standard exploding :)) [you can also defer if this is multiple dialects being lowered to]

mlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
41

Could we add a comment somewhere in code (perhaps in pass description so that it makes it into the generated docs) as to the why.

mlir/test/Conversion/TosaToStandard/tosa-to-standard.mlir
1

Test with it false? (don't have to repeat all CHECK's, just a spot check)

This revision is now accepted and ready to land.Apr 1 2022, 5:39 PM
rsuderman updated this revision to Diff 419906.Apr 1 2022, 7:01 PM

Split TosaToStandard split to TosaToArith and TosaToTensor

rsuderman updated this revision to Diff 419908.Apr 1 2022, 7:07 PM

Added the additional comments in.

rsuderman marked 3 inline comments as done.Apr 1 2022, 7:08 PM
rsuderman added inline comments.
mlir/include/mlir/Conversion/Passes.td
758

I split everything between TosaToArith and TosaToTensor as each defines a different party of the work.

mlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
41

Added details to the Passes.td file for while the ApplyScale is optionally included.

jpienaar added inline comments.Apr 4 2022, 11:10 AM
mlir/include/mlir/Conversion/Passes.td
714

Up to you, but I'd just drop ops and have everything on one line (or drop tosa. as this is a tosa-to-arith pass so the dialect is implicit for me)

mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
21 ↗(On Diff #419908)

This and addTosaToArithPasses seem to overlap quite a bit, when would one use one vs the other?

mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h
1 ↗(On Diff #419908)

optimization pass? TOSA to Tensor legalization pass ?

mlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
1

Tensor

mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp
1 ↗(On Diff #419908)

Tensor

9 ↗(On Diff #419908)

Tensor

mlir/test/Conversion/TosaToTensor/tosa-to-tensor.mlir
1 ↗(On Diff #419908)

verify-diagnostics doesn't seem needed here

rsuderman updated this revision to Diff 420255.Apr 4 2022, 11:21 AM
rsuderman marked 2 inline comments as done.

Updated for cleanup comments.

rsuderman marked 6 inline comments as done.Apr 4 2022, 11:22 AM