This is an archive of the discontinued LLVM Phabricator instance.

[mlir][bufferization] Add specialized lowering for deallocs with one memref but arbitrary retains
ClosedPublic

Authored by maerhart on Aug 11 2023, 2:23 AM.

Details

Summary

It is often the case that many values in the memrefs operand list can be
split off to speparate dealloc operations by the
--buffer-deallocation-simplification pass, however, the retain list has to be
preserved initially. Further canonicalization can often trim it down
considerable, but some retains may remain. In those cases, the general lowering
would be chosen, but is very inefficient. This commit adds another lowering for
those cases which avoids allocation of auxillary memrefs and the helper
function while still producing code that is linear in the number of operands of
the dealloc operation.

Diff Detail

Event Timeline

maerhart created this revision.Aug 11 2023, 2:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2023, 2:23 AM
maerhart requested review of this revision.Aug 11 2023, 2:23 AM
springerm accepted this revision.Aug 11 2023, 3:32 AM
springerm added inline comments.
mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
175

I think you can write ArrayRef(doesNotAliasList).drop_front() here.

This revision is now accepted and ready to land.Aug 11 2023, 3:32 AM
maerhart updated this revision to Diff 549813.Aug 14 2023, 12:51 AM
maerhart marked an inline comment as done.

Address comment

mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
175

That's so much more elegant, thanks!