This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][TOSA] Added Tosa to Standard/SCF Lowerings (const, if, while)
ClosedPublic

Authored by rsuderman on Feb 23 2021, 6:35 PM.

Details

Summary

Includes a lowering for tosa.const, tosa.if, and tosa.while to Standard/SCF dialects. TosaToStandard is
used for constant lowerings and TosaToSCF handles the if/while ops.

Diff Detail

Event Timeline

rsuderman created this revision.Feb 23 2021, 6:35 PM
rsuderman requested review of this revision.Feb 23 2021, 6:35 PM

Fixed linter errors.

test cases?

Fixed upload

silvas added inline comments.Feb 24 2021, 1:38 PM
mlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
49

it feels like these could be in TosaToSCF and convert to scf.if/scf.while. Would be easier to write them as patterns too.

rriddle added inline comments.Feb 24 2021, 1:40 PM
mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp
78

Remove all of the mlir:: in this commit.

rriddle added inline comments.Feb 24 2021, 1:42 PM
mlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
49

+1

rsuderman updated this revision to Diff 326279.Feb 24 2021, 9:42 PM

Moved control flow lowerings to a TosaToSCF set of passes.

rsuderman marked 3 inline comments as done.Feb 24 2021, 9:44 PM

Fixed arc lint error.

clang-tidy error

silvas accepted this revision.Feb 25 2021, 1:45 PM
silvas added inline comments.
mlir/include/mlir/Conversion/TosaToStandard/TosaToStandard.h
24

decl not needed?

mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp
3

nit: formatting

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

specify in td file.

39

you should only need ConstantOp legal.

46

use partial conversion so you don't need markUnknownOpDynamicallyLegal

mlir/test/Conversion/TosaToSCF/tosa-to-scf.mlir
40

nit: indent

This revision is now accepted and ready to land.Feb 25 2021, 1:45 PM
rriddle added inline comments.Feb 25 2021, 1:49 PM
mlir/lib/Conversion/TosaToSCF/TosaToSCF.cpp
27

Functions should be marked static and at the top-level, only classes should be in anonymous namespaces.

31

nit: Spell out auto here.

32

Remove trivial braces.

43

This seems sketchy, how does this work with rollbacks? Why not rewriter.erase?

67

Same comment here.

mlir/lib/Conversion/TosaToSCF/TosaToSCFPass.cpp
30

Why does this need to be a FuncOp pass?

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

Same comment, why is this a FuncOp pass?

rsuderman updated this revision to Diff 326508.Feb 25 2021, 2:29 PM

silvas@ and rriddle@ comments

rsuderman marked 13 inline comments as done.Feb 25 2021, 2:30 PM
rsuderman retitled this revision from [MLIR][TOSA] Added Tosa to Standard Lowerings (const, if, while) to [MLIR][TOSA] Added Tosa to Standard/SCF Lowerings (const, if, while).Feb 25 2021, 2:34 PM
rsuderman edited the summary of this revision. (Show Details)
This revision was landed with ongoing or failed builds.Feb 25 2021, 2:43 PM
This revision was automatically updated to reflect the committed changes.