Page MenuHomePhabricator

[mlir][Vector] Add 2-D vector contract lowering to ReduceOp
ClosedPublic

Authored by nicolasvasilache on Aug 6 2020, 6:01 AM.

Details

Summary

This new pattern mixes vector.transpose and direct lowering to vector.reduce.
This allows more progressive lowering than immediately going to insert/extract and
composes more nicely with other canonicalizations.
This has 2 use cases:

  1. for very wide vectors the generated IR may be much smaller
  2. when we have a custom lowering for transpose ops we can target it directly

rather than rely LLVM

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 6 2020, 6:01 AM
nicolasvasilache requested review of this revision.Aug 6 2020, 6:01 AM
bkramer added inline comments.Aug 6 2020, 6:17 AM
mlir/include/mlir/Dialect/Vector/VectorTransforms.h
302

Not used anywhere?

mlir/lib/Dialect/Vector/VectorTransforms.cpp
1768

This is a dangling reference.

1857

This creates a dangling reference as the temporary initializer_list is destroyed at the end of the full statement. You can store it in an array or just use SmallVector.

nicolasvasilache marked 2 inline comments as done.

Address dangling reference.

nicolasvasilache marked an inline comment as done.Aug 6 2020, 7:38 AM
This revision is now accepted and ready to land.Aug 6 2020, 7:40 AM

Missed a spot.

Fix uninitialized function.

aartbik retitled this revision from [mlir][Vector] Add 2-D vector contract lwoering to ReduceOp to [mlir][Vector] Add 2-D vector contract lowering to ReduceOp.Aug 6 2020, 10:56 AM

Few minor comments, I also fixed the typo in the title

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

nit: an output

mlir/lib/Dialect/Vector/VectorTransforms.cpp
1760

remove name from TODO
(new style of MLIR)

1867

nit: this can be acc instead of op.acc()

This revision was landed with ongoing or failed builds.Aug 7 2020, 3:21 AM
This revision was automatically updated to reflect the committed changes.