This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg][bufferize] Generalize destination-passing style detection
ClosedPublic

Authored by springerm on Jan 5 2022, 12:12 PM.

Details

Summary

If not allow-return-memref, raise an error if a new memory allocation is returned/yielded from a block. We do not check for new allocations directly, but for ops that yield/return values that are not equivalent to values that are defined outside of the current of the block.

Note: We still need to check that scf.for yield values and bbArgs are aliasing to ensure that getAliasingOpOperand/getAliasingOpResult is correct.

Depends On D117424

Diff Detail

Event Timeline

springerm created this revision.Jan 5 2022, 12:12 PM
springerm requested review of this revision.Jan 5 2022, 12:12 PM

This is also related to D115706 (cc @silvas).

mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp
586

Add a TODO to reflect D115706 ?

591

This seems like it is uninitialized, which makes me think you are missing info given the signature:

static bool happensBefore(Operation *a, Operation *b, const DominanceInfo &domInfo);

OTOH digging deeper there is a mutable keyword there ..

615

Is this path tested ?
I don't see a new test that seems to cover this.
Maybe it is already tested previously?

This seems fishy given the DominanceInfo caching / mutable behavior, I'd double check to be sure.

springerm updated this revision to Diff 400369.Jan 16 2022, 4:16 AM
springerm marked an inline comment as done.

address comments

springerm edited the summary of this revision. (Show Details)Jan 16 2022, 4:16 AM
springerm added inline comments.
mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp
586

forgot what to do here...

591

initializing it with op now just to be sure

615

Added 2 new test cases. The ones that uses scf.execute_region.

springerm marked an inline comment as done.Jan 16 2022, 4:17 AM
nicolasvasilache added inline comments.
mlir/test/Dialect/Linalg/comprehensive-module-bufferize.mlir
1

Can we split tests that require the "allow-return-memref" flag from the rest (in a followup)?

4

same here

This revision is now accepted and ready to land.Jan 19 2022, 12:16 AM