This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Add a Linalg DRR test to go from matmul to vectors
ClosedPublic

Authored by nicolasvasilache on Jan 29 2020, 11:45 AM.

Details

Summary

This diff builds a simple fused pass consisting of 2 levels of tiling, memory promotion and
vectorization using linalg transformations written as composable pattern rewrites.

Diff Detail

Event Timeline

Drop spurious change.

Unit tests: pass. 62308 tests passed, 0 failed and 838 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

Unit tests: pass. 62308 tests passed, 0 failed and 838 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

aartbik added inline comments.Jan 29 2020, 5:21 PM
mlir/test/lib/Transforms/TestLinalgMatmulToVector.cpp
39

would it help to have two passes of greedily applying patterns, each with their own set, or do we have interaction between the two sets?

rriddle added inline comments.Jan 29 2020, 11:46 PM
mlir/test/lib/Transforms/TestLinalgMatmulToVector.cpp
36

This sounds like a visitation ordering problem, i.e. you want to visit the source operand(AffineApplyOp) before the user(ViewOp). Greedy walks reverse order so you run into the problem here. Am I understanding this correctly?

tetuante accepted this revision.Jan 31 2020, 3:19 AM
This revision is now accepted and ready to land.Jan 31 2020, 3:19 AM
mehdi_amini requested changes to this revision.Mar 27 2020, 7:05 PM

I don't understand why is this all a test for upstream, it seems rather like an "example" of something or some work in progress on a transformation.

This revision now requires changes to proceed.Mar 27 2020, 7:05 PM

@mehdi_amini this is a custom test pass that tests all the patterns compose nicely all the way to vector.
Last I tried they actually didn't compose nicely and I need to debug.
How is this an example more than a test pass?

mehdi_amini added a comment.EditedMar 27 2020, 9:48 PM

@mehdi_amini this is a custom test pass that tests all the patterns compose nicely all the way to vector.
Last I tried they actually didn't compose nicely and I need to debug.
How is this an example more than a test pass?

You testing pass is testing patterns that are in the test directory as well. This looks all self-contained to me: so it isn't clear to me what is this testing that isn't already tested.

it isn't clear to me what is this testing that isn't already tested.

It wants to test that these patterns compose and atm they don't, something is off that I have not been able to debug yet.
Once debugged and the pass can be standalone I sure want to guarantee these patterns will compose forever, hence a test.

nicolasvasilache marked 2 inline comments as done.Mar 28 2020, 9:53 AM
nicolasvasilache added inline comments.
mlir/test/lib/Transforms/TestLinalgMatmulToVector.cpp
36

I still do not know, I'll pick up again next week.

39

the goal is to have a single pass.

Make patterns compose end-to-end.

nicolasvasilache edited the summary of this revision. (Show Details)Apr 7 2020, 12:56 PM
mehdi_amini added inline comments.Apr 8 2020, 10:39 AM
mlir/test/Dialect/Linalg/matmul-to-vector.mlir
2

Did you solve why we need a canonicalize here?

nicolasvasilache edited the summary of this revision. (Show Details)

Update the test to use the fused pass.

@mehdi_amini had forgotten to update the test, fixed.

Things now work as expected, my intuition is that a change interfered with this revision at the time I created it: 9dfcddfaae50a3138173311a15e7ab19d36c1860 was landed on Jan 29th which is the day I also created this revision.
I submitted 3cb1f35df2a560d5a8ce2047b87cba8e3c904170 recently to deal with the affine_min case and things now work properly.

nicolasvasilache marked an inline comment as done.Apr 8 2020, 12:03 PM
nicolasvasilache marked 2 inline comments as done.
mehdi_amini accepted this revision.Apr 8 2020, 1:45 PM
This revision is now accepted and ready to land.Apr 8 2020, 1:45 PM