This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg][bufferize] Eliminate InitTensorOps of InsertSliceOp sources
ClosedPublic

Authored by springerm on Oct 17 2021, 12:16 AM.

Details

Summary

An InitTensorOp is replaced with an ExtractSliceOp on the InsertSliceOp's destination. This optimization is applied after analysis and only to InsertSliceOps that were decided to bufferize inplace. Another analysis on the new ExtractSliceOp is needed after the rewrite.

Depends On D111928

Diff Detail

Event Timeline

springerm created this revision.Oct 17 2021, 12:16 AM
springerm requested review of this revision.Oct 17 2021, 12:16 AM
springerm added inline comments.Oct 17 2021, 12:47 AM
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
1225–1226

Not part of this revision. This is already landed. I have to rebase....

1371

Not part of this revision. This is already landed. I have to rebase....

nicolasvasilache added inline comments.
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
2836

why not save the ops you want to erase and just erase them rather than creating a behavior dependency (i.e. ignore inittensor without uses) across functions ?

This revision is now accepted and ready to land.Oct 21 2021, 12:01 AM
springerm marked an inline comment as done.Oct 21 2021, 5:31 AM
springerm added inline comments.
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
2836

That's potentially dangerous because the op is still in the alias set and I can't remove it from there. Could cause a crash down the road if someone accesses aliasing Values during bufferization.

This revision was landed with ongoing or failed builds.Oct 21 2021, 5:43 AM
This revision was automatically updated to reflect the committed changes.
springerm marked an inline comment as done.