This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Expose the VectorUnroll transform as a function and a Transform IR op.
AcceptedPublic

Authored by christopherbate on May 5 2023, 3:43 PM.

Details

Summary

This change is NFC with regards to the VectorUnroll transform patterns.
Previously, the vector unrolling transform could only be applied by running a
set of rewrite patterns, and parameters such as the target shape need to be
provided via a callback. This can make it awkward to write transformations that
could compose with unrolling directly.

This change exposes the unrolling transform as a function, vector::unroll,
that accepts any VectorUnrollOpInterface op and returns (1) a set of operations
corresponding to the unrolled target and (2) the replacement value. The various
different patterns in the VectorUnroll transform are replaced by a single
rewrite pattern operating on the VectorUnrollOpInterface.

A transform operation transform.vector.unroll is added.

Depends on D150000.

Diff Detail

Event Timeline

christopherbate created this revision.May 5 2023, 3:43 PM
Herald added a project: Restricted Project. · View Herald Transcript
christopherbate requested review of this revision.May 5 2023, 3:43 PM
christopherbate retitled this revision from [mlir] Expose the VectorUnroll transform as a function and a Transform IR op. to [mlir][vector] Expose the VectorUnroll transform as a function and a Transform IR op..May 5 2023, 3:43 PM
christopherbate added a reviewer: ThomasRaoux.

Nice improvements, thank you @christopherbate !

mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
31

Can we return OpFoldResults here and let the called materialize with getValueOrCreateConstantIndexOp ?
The need for Values is because the vector transfer operations do not take the mixed form.

35

while we are at it, can we reorder parameters to be builder, loc, rest ?
this will improve consistency to match standalone transform APIs.

513

TypeSwitch should be nicer here.

nicolasvasilache accepted this revision.Aug 29 2023, 6:54 AM
This revision is now accepted and ready to land.Aug 29 2023, 6:54 AM