This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Add transpose support to hoist padding.
ClosedPublic

Authored by gysit on Jan 21 2022, 7:47 AM.

Details

Summary

Add a transpose option to hoist padding to transpose the padded tensor before storing it into the packed tensor. The early transpose improves the memory access patterns of the actual compute kernel. The patch introduces a transpose right after the hoisted pad tensor and a second transpose inside the compute loop. The second transpose can either be fused into the compute operation or will canonicalize away when lowering to vector instructions.

Diff Detail

Event Timeline

gysit created this revision.Jan 21 2022, 7:47 AM
gysit requested review of this revision.Jan 21 2022, 7:47 AM
nicolasvasilache accepted this revision.Jan 24 2022, 1:17 AM
nicolasvasilache added inline comments.
mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
160

You could use RankedTensorType::Builder , up to you.

165

Can we add this as a helper somewhere in linalgops.cpp / h or utils ?

396–398

Please add some comment on the fact that we do not modify loop order but just tensor order and so the analysis is the same but the contiguous accesses end up being different.

mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp
114

Can we make the individual strings : separated (i.e. 1:0,0,0) until we can find a better list of list option?
Also plz document this as it is tricky.

This revision is now accepted and ready to land.Jan 24 2022, 1:17 AM
gysit updated this revision to Diff 402504.Jan 24 2022, 6:35 AM
gysit marked 4 inline comments as done.

Address comments.

gysit updated this revision to Diff 402531.Jan 24 2022, 7:51 AM

Improve comment.

gysit updated this revision to Diff 402541.Jan 24 2022, 8:24 AM

Fix warnings.

This revision was landed with ongoing or failed builds.Jan 24 2022, 8:34 AM
This revision was automatically updated to reflect the committed changes.