Page MenuHomePhabricator

[mlir][linalg][bufferize] Reimplementation of scf.for bufferization
ClosedPublic

Authored by springerm on Dec 1 2021, 9:48 PM.

Details

Summary

Instead of modifying the existing scf.for op, create a new op with memref OpOperands/OpResults and delete the old op.

New allocations / other memrefs can now be yielded from the loop. This functionality is deactivated by default and guarded against by AssertDestinationPassingStyle.

This change also introduces replaceOp, which will be utilized by all other bufferize implementations in future commits. Bufferization will then no longer rely on old (pre-bufferize) ops to DCE away. Instead old ops are deleted on the spot. This improves debuggability because there won't be any duplicate ops anymore (bufferized + not-yet-bufferized) when dumping IR during bufferization. It is also less fragile because unbufferized IR can no longer silently "hang around" due to an implementation bug.

Diff Detail

Event Timeline

springerm created this revision.Dec 1 2021, 9:48 PM
springerm requested review of this revision.Dec 1 2021, 9:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 1 2021, 9:48 PM

Need to table this for now until we discuss the implications of allowing ToTensor / ToMemref in the parent CL.

springerm retitled this revision from [mlir][linalg][bufferize] Partial bufferization of scf.for to [mlir][linalg][bufferize] Reimplementation of scf.for bufferization.Dec 8 2021, 11:47 PM
springerm edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Dec 15 2021, 12:33 AM
This revision was landed with ongoing or failed builds.Dec 15 2021, 1:29 AM
This revision was automatically updated to reflect the committed changes.