This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Canonicalize PadTensorOp with zero source dimension
AbandonedPublic

Authored by springerm on Jun 14 2021, 7:10 PM.

Details

Summary

If at least one source dimension has a static zero dimension, rewrite the PadTensorOp into a tensor::GenerateOp.

Diff Detail

Event Timeline

springerm created this revision.Jun 14 2021, 7:10 PM
springerm requested review of this revision.Jun 14 2021, 7:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2021, 7:10 PM
Herald added a subscriber: limo1996. · View Herald Transcript
ThomasRaoux accepted this revision.Jun 17 2021, 8:31 AM
ThomasRaoux added inline comments.
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
1187–1189

Can we inline the original region instead of cloning it?

I think you should be able to do something like:
rewriter.inlineRegionBefore(padOp.region(), generateOp.getRegion(), generateOp.getRegion().begin());

This revision is now accepted and ready to land.Jun 17 2021, 8:31 AM
springerm abandoned this revision.Jun 17 2021, 8:39 PM

Thanks for the review.
After talking with Nicolas, we decided to not generate tensors with 0 dims in the first place. Abandoning this commit.