This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tensor][linalg] Add a pattern that generalizes tensor.pack op.
ClosedPublic

Authored by hanchung on Dec 14 2022, 2:42 PM.

Details

Summary

The pattern generalizes a tensor::PackOp into a sequence of tensor +
Linalg ops, when the outer dims are all 1s. It uses the trick of
rank-reduced tensor.extract_slice to get the tile; transpose the tile;
use tensor.insert_slice to insert it to the destination of inner tile.

Diff Detail

Event Timeline

hanchung created this revision.Dec 14 2022, 2:42 PM
hanchung requested review of this revision.Dec 14 2022, 2:42 PM
pifon2a accepted this revision.Dec 14 2022, 11:22 PM
This revision is now accepted and ready to land.Dec 14 2022, 11:22 PM
tyb0807 added inline comments.
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
532

Nit: typo

hanchung updated this revision to Diff 483358.Dec 15 2022, 3:06 PM

fix typo, and capture const to lambda

This revision was landed with ongoing or failed builds.Dec 15 2022, 3:28 PM
This revision was automatically updated to reflect the committed changes.
ftynse added a subscriber: ftynse.Jan 27 2023, 6:18 AM
ftynse added inline comments.
mlir/test/Dialect/Linalg/generalize-tensor-pack.mlir
65–66

Please do not insert "RUN" lines in the middle of the test file, these are really annoying to find if something goes wrong. Just create a new file instead. Filecheck tests are very cheap.