This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Add new lowering mode to vector.contractionOp
ClosedPublic

Authored by ThomasRaoux on May 21 2022, 8:50 AM.

Details

Summary

Add lowering for cases where the reduction dimension is fully unrolled.
It is common to unroll the reduction dimension, therefore we would want
to lower the contractions to an elementwise vector op in this case.

Diff Detail

Event Timeline

ThomasRaoux created this revision.May 21 2022, 8:50 AM
Herald added a project: Restricted Project. · View Herald Transcript
ThomasRaoux requested review of this revision.May 21 2022, 8:50 AM
antiagainst accepted this revision.May 23 2022, 12:00 PM

Nice, thanks for this, Thomas!

mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
169

This need to check the acc's type is a vector type. Otherwise we might generate vector.fma with scalar types, which is invalid.

186

Could use isReductionIterator over Attribute directly here?

204

Nit: using else to wrap L206 might read better.

626

Can use llvm::concat to loop over lhsReductionDims and rhsReductionDims together?

647

Nice stuff with vector.extract and vector.broadcast! :D

This revision is now accepted and ready to land.May 23 2022, 12:00 PM

Address review comments and fix bug

ThomasRaoux marked an inline comment as done.May 24 2022, 7:18 AM
ThomasRaoux added inline comments.
mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
169

good catch! Fixed it and added a test for that case.

204

Turns out this function had some more problem, it is not there anymore in the new version

626

I don't think so since they have to index into different arrays.

This revision was landed with ongoing or failed builds.May 24 2022, 7:23 AM
This revision was automatically updated to reflect the committed changes.