This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Use memory effect to detecting allocation
ClosedPublic

Authored by antiagainst on Apr 23 2020, 4:53 AM.

Details

Summary

This commit marks AllocLikeOp as MemAlloc in StandardOps.

Also in Linalg dependency analysis use memory effect to detect
allocation. This allows the dependency analysis to be more
general and recognize other allocation-like operations

Diff Detail

Event Timeline

antiagainst created this revision.Apr 23 2020, 4:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2020, 4:53 AM
nicolasvasilache accepted this revision.Apr 23 2020, 7:36 AM
This revision is now accepted and ready to land.Apr 23 2020, 7:36 AM
rriddle accepted this revision.Apr 23 2020, 11:03 AM

Thanks!

mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
279 ↗(On Diff #259529)

Can we add to AllocLikeOp instead? Ideally marking the returned value directly.

mehdi_amini requested changes to this revision.Apr 23 2020, 10:44 PM
mehdi_amini added inline comments.
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
279 ↗(On Diff #259529)

Should this be rebased on top of https://reviews.llvm.org/D78619 ?

mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
41–42

FYI, less operations:

Operation *defOp = v.getDefiningOp();
if (!defOp) return v;
44

The "MemAlloc" trait can be attached to individual results, I believe that the right way here is to look-up which result is v for the operation and query the interface for the MemAlloc trait for this particular result.

This revision now requires changes to proceed.Apr 23 2020, 10:44 PM
antiagainst marked 2 inline comments as done.Apr 24 2020, 7:06 AM
antiagainst added inline comments.
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
279 ↗(On Diff #259529)

Oh, thanks for the pointer! I'll wait that CL to land and then rebase. :)

antiagainst marked 2 inline comments as done.

Rebase and address comments

antiagainst marked an inline comment as done.Apr 27 2020, 10:04 AM

Can this be exercised by a test? (using a test.alloc op?)

Address comments

Can this be exercised by a test? (using a test.alloc op?)

Actually we have two allocation-like ops in std. I think leveraging them should suffice for a test over the memory effect here.

antiagainst edited the summary of this revision. (Show Details)Apr 28 2020, 1:20 PM
antiagainst edited the summary of this revision. (Show Details)
mravishankar accepted this revision.Apr 29 2020, 9:55 AM

@mehdi_amini: Any further comments?

mehdi_amini accepted this revision.Apr 29 2020, 11:10 PM
This revision is now accepted and ready to land.Apr 29 2020, 11:10 PM
This revision was automatically updated to reflect the committed changes.