This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Cleanup VectorUnroll and create a generic tile iteration utility
ClosedPublic

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

Details

Summary

This change refactors some of the utilities used to unroll larger vector
computations into smaller vector computations. In fact, the indexing
computations used here are rather generic and are useful in other dialects or
downstream projects. Therefore, a utility for iterating over all possible tile
offsets for a particular pair of static (shape, tiled shape) is introduced in
IndexingUtils and replaces the existing computations in the vector unrolling
transformations. This builds off of the refactoring of IndexingUtils introduced
in 203fad476b7e.

Diff Detail

Event Timeline

christopherbate created this revision.May 5 2023, 3:08 PM
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
christopherbate requested review of this revision.May 5 2023, 3:08 PM
nicolasvasilache accepted this revision.Aug 29 2023, 6:43 AM

sorry for missing this

mlir/include/mlir/Dialect/Utils/IndexingUtils.h
258

Some basic comments to describe what each entry is and how it is stored (i.e. I believe tileShape is in the original order while sliceStrides is in loopOrder) ?

mlir/lib/Dialect/Utils/IndexingUtils.cpp
265

Does the padding actually happen ?

271

I find this way of iterating followed by a permutation somewhat confusing.

Would it be possible to rewrite as something like:

SmallVector<int64_t> basis;
basis.reserve(...);
for ... { basis.push_back(...); }
sliceStrides = computeStrides(basis);

?

It is arguably a little less efficient to create a temporary basis vector but I would take the piece of mind of not having to triple check the logic :)

This revision is now accepted and ready to land.Aug 29 2023, 6:43 AM
christopherbate marked 3 inline comments as done.

Address comments, add unittest