This is an archive of the discontinued LLVM Phabricator instance.

[mlir-reduce] Add doc for usage of mlir-reduce
ClosedPublic

Authored by Chia-hungDuan on Jun 4 2021, 4:23 AM.

Diff Detail

Event Timeline

Chia-hungDuan created this revision.Jun 4 2021, 4:23 AM
Chia-hungDuan requested review of this revision.Jun 4 2021, 4:23 AM

Quick pass 🙂

mlir/docs/Tools/MLIRREDUCE.md
1 ↗(On Diff #349815)

Could the filename of the doc match the file name of the tool?

5 ↗(On Diff #349815)

Let's consistently capitalize MLIR

5 ↗(On Diff #349815)

trigger bugs? Unexpected behavior feels passive :-) We want to be able to reduce the size of a reproducer for a bug.

12 ↗(On Diff #349815)

One of the largest ones (the largest?) is simply deleting code not required to reproduce an error. Which is done very heuristically/without maintaining any semantics. I think that's important to have early that it's not an optimization, this changes the program in a way that is "wrong" but useful.

14 ↗(On Diff #349815)

Let's explain interesting right after.

Chia-hungDuan marked 5 inline comments as done.Jun 7 2021, 4:07 AM

Addressed review comments

jpienaar added inline comments.Jun 18 2021, 9:03 AM
mlir/docs/Tools/mlir-reduce.md
6

An MLIR input ? (it need not be a Module)

8–9

describes mlir-reduce, a tool that can reduce the size of the input needed to trigger the error.

11

This whole document is about MLIR reduce, so I think you can remove this heading

13–14

s/.../including/ ?

16

s/a module/an input/g (just to be more general, any top level input could work)

16–17

s/.../is interesting, e.g., exhibits the characteristics that you would like to focus on/ (shorten and combine with next sentence)

19

s/.../invocation fails/ ? (just a little bit more general but I think specific enough still)

21–22

I feel this could go close to the start, just before the last sentence in first paragraph.

24

Lets tag this section with a heading "Available reducer passes" or some such

I would consider doing an example invocation here to show usage before explaining all the different reducers

26

You may have to clarify here what you mean with redundant. I believe it is meant as extraneous to interestingness (e.g., we can remove them and the case remains interesting, rather than they are redundant to the semantics of the input)

27

s/way//

28

s/.../as long as it/

28

Is this true now? I thought we now ran verification too, so the output is still valid.

34

It isn't necessarily that one knows this, it is more that the pattern will be attempted and if it doesn't retain the problem, it will just be discarded (e.g., it would naturally not be explored further wherever the pattern does not retain the interestingness)

40

s/abundant// :) (or potentially we could just say MLIR does not have a fixed set of dialects)

40

In a way all is custom and so nothing is custom. There aren't 2 tiers here, how its defined is uniform. So I'd drop this. Or you could say "dialect specific rewrite patterns"

63

Perhaps, you can freely intermix regular optimization passes (that retain semantics) with reducer specific passes?

79

s/hint/specify/ ?

95

[for follow up] That is a bit surprising. Could we change that? standard in or positional argument is how mlir-opt and the other tools work. Being able to pipe the result from a tool into reduce would be nice too (but I don't know if the input file is too hard coded).

99

And this is only needed if 1) one uses custom syntax, 2) failure is due to verification in dialect, 3) there is dialect-specific reducer patterns?

118

reduce

121

You mean somewhere on disk? Perhaps lets rephrase this, the feature we want is that it should produce the most optimal result thus far when interrupted.

124

OOC why does this matter? As long as it is interesting model, the tool just trying all the things seems OK (potentially inefficient if we know some won't help, but not sure beyond that)

Chia-hungDuan marked 21 inline comments as done.Jun 22 2021, 4:49 AM
Chia-hungDuan added inline comments.
mlir/docs/Tools/mlir-reduce.md
26

Agree, the redundant may be confusing. Removed

28

Yes, mlir-reduce now only accepts/outputs valid file. Explained in down below, "To avoid that...". Just want to remind that the user also needs to provide valid input.

40

Removed. Yes, I think it'll be simpler.

63

Yes, I'm thinking of merging the two passes into one, this may be easier for the user's perspective(only choose the tree traversal strategies, don't bother with the set of regular optimization passes)

I'm planning that now and will have solution soon. We can keep the doc in sync with it during the review.

95

Revisiting this part, will update this afterwards

99

Add the explanation of when we need a custom one.

124

I was uncertain for this one, was thinking the case like, we knew that some patterns won't work then we can exclude them for getting shorter reduce time.

Now I think we should let the user as easy as possible to use it. the item is removed.

Chia-hungDuan marked 5 inline comments as done.

Addressed review comments

Remove description of -opt-reduction-pass which will be removed soon.

jpienaar accepted this revision.Jun 25 2021, 3:16 PM

Nice, thanks!

mlir/docs/Tools/mlir-reduce.md
6

"we" or perhaps even better "developers"

This revision is now accepted and ready to land.Jun 25 2021, 3:16 PM
Chia-hungDuan marked an inline comment as done.

Addressed review comment and fixed the syntax

This revision was landed with ongoing or failed builds.Jun 29 2021, 3:20 AM
This revision was automatically updated to reflect the committed changes.