This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Vector] Add a VectorUnrollInterface and expose UnrollVectorPattern.
ClosedPublic

Authored by nicolasvasilache on Jul 2 2020, 11:08 AM.

Details

Summary

The UnrollVectorPattern is can be used in a programmable fashion by:

OwningRewritePatternList patterns;
    patterns.insert<UnrollVectorPattern<AddFOp>>(ArrayRef<int64_t>{2, 2}, ctx);
    patterns.insert<UnrollVectorPattern<vector::ContractionOp>>(
        ArrayRef<int64_t>{2, 2, 2}, ctx);
    ...
    applyPatternsAndFoldGreedily(getFunction(), patterns);

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJul 2 2020, 11:08 AM
ftynse added inline comments.Jul 3 2020, 1:42 AM
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
3185

Are there any ops derived from IntArithmeticOp that shouldn't have the interface methods declared? If not, let's add the trait in IntArithmeticOp instead. Same for FloatArithmeticOp and FloatUnaryOp.

mlir/include/mlir/Dialect/Vector/VectorTransforms.h
109

Nit: remove the empty line

134

Given the "matching type" in the name, should there be a check for op types being same, or a static assert on some trait?

mlir/include/mlir/Interfaces/VectorUnrollInterface.h
2

Wrong header. Also, -*- C++ -*-

10

Wrong description

nicolasvasilache marked 6 inline comments as done.

Address review.

mlir/include/mlir/Dialect/Vector/VectorTransforms.h
134

Refactored things a bit and renamed where appropriate.

Cleanup spurious additions.

Harbormaster failed remote builds in B62866: Diff 275429!
Harbormaster failed remote builds in B62865: Diff 275428!

More CMake + liveness bugfix

ftynse accepted this revision.Jul 6 2020, 3:56 AM

Please make sure clang-format is happy

This revision is now accepted and ready to land.Jul 6 2020, 3:56 AM
This revision was automatically updated to reflect the committed changes.
rriddle added inline comments.Jul 6 2020, 7:04 PM
mlir/include/mlir/Dialect/Vector/VectorTransforms.h
14

nit: Where is the Function include used?

mlir/include/mlir/Interfaces/VectorUnrollInterface.h
19

nit: Is this one necessary?