This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Fix lowering of tensor.pack operations
ClosedPublic

Authored by sabauma on Sep 1 2023, 2:01 PM.

Details

Summary

Tensor pack operations are optimistically lowered to pad + insert_slice
when the pack operation only pads the input tensor. The existing
lowering emits insert_slice operations which do not meet the
rank-reducibility requirements of insert_slice.

This change updates the logic in linalg::lowerPack to first check the
rank-reducibility requirement. When the requirement is not met, the
lowering will emit the full sequence of pad + expand + transpose.

Diff Detail

Event Timeline

sabauma created this revision.Sep 1 2023, 2:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2023, 2:01 PM
sabauma published this revision for review.Sep 1 2023, 2:13 PM
chelini accepted this revision.Sep 4 2023, 4:32 PM

Thanks, looks good to me.

mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
326

nit: tot -> to

This revision is now accepted and ready to land.Sep 4 2023, 4:32 PM
sabauma updated this revision to Diff 555863.Sep 5 2023, 7:25 AM

Spelling fix

@chelini If there are no other comments, would you mind submitting the change. I do not have commit access.

This revision was landed with ongoing or failed builds.Sep 5 2023, 12:14 PM
This revision was automatically updated to reflect the committed changes.