This is an archive of the discontinued LLVM Phabricator instance.

[Polly] [RFC] Allow the client of DependenceInfo to obtain dependences at different granularities.
ClosedPublic

Authored by etherzhhb on Feb 19 2016, 9:51 PM.

Details

Summary

Also allow DependenceInfo generate dependence results at different granularities at the same time.

Please feel free to comment and suggest

Diff Detail

Event Timeline

etherzhhb updated this revision to Diff 48580.Feb 19 2016, 9:51 PM
etherzhhb retitled this revision from to [Polly] [RFC] Allow the client of DependenceInfo to obtain dependences at different granularities..
etherzhhb updated this object.
etherzhhb added a reviewer: grosser.
etherzhhb set the repository for this revision to rL LLVM.
etherzhhb added a subscriber: Restricted Project.
Meinersbur added inline comments.
include/polly/DependenceInfo.h
58

For consistent naming, please refer to the LLVM style guide

lib/Analysis/DependenceInfo.cpp
793–794

ScopPass::getAnalysisUsage(AU)
adds
addRequired<ScopInfo>();
what you'd need with this change is
addRequiredTransitive<ScopInfo>();

To avoid transitive requirements, I suggest per-granularity DependenceInfo passes:
DependenceInfo(Dependences::AnalysisLevel) {}

etherzhhb removed a subscriber: Meinersbur.
etherzhhb added inline comments.Feb 26 2016, 6:18 PM
include/polly/DependenceInfo.h
58

will do

lib/Analysis/DependenceInfo.cpp
793–794

ScopPass::getAnalysisUsage(AU)
adds
addRequired<ScopInfo>();
what you'd need with this change is
addRequiredTransitive<ScopInfo>();

I am confused, could you explain a little bit?

I guess even with the previous DependenceInfo, we also need 'addRequiredTransitive<ScopInfo>();'

Otherwise, why the previous DependenceInfo do not need this, but this change need 'addRequiredTransitive<ScopInfo>();'?

793–794

To avoid transitive requirements, I suggest per-granularity DependenceInfo passes:
DependenceInfo(Dependences::AnalysisLevel) {}

This can also be done, but I need to figure out some implementation details.

grosser edited edge metadata.Feb 26 2016, 7:20 PM
grosser added a subscriber: grosser.

To avoid transitive requirements, I suggest per-granularity DependenceInfo passes:
DependenceInfo(Dependences::AnalysisLevel) {}

This can also be done, but I need to figure out some implementation details.

I am not convinced per-granularity passes are the right thing. I would
personally probably just add functions to ask for the different
dependences and build them on-demand when they are requested to avoid
the permanent overhead of eagerly computing all dependences.

Best,
Tobias

etherzhhb added inline comments.Feb 26 2016, 8:02 PM
lib/Analysis/DependenceInfo.cpp
793–794

ScopPass::getAnalysisUsage(AU)
adds
addRequired<ScopInfo>();
what you'd need with this change is
addRequiredTransitive<ScopInfo>();

I am confused, could you explain a little bit?

I guess even with the previous DependenceInfo, we also need 'addRequiredTransitive<ScopInfo>();'

Otherwise, why the previous DependenceInfo do not need this, but this change need 'addRequiredTransitive<ScopInfo>();'?

I think I know why.

Because originally we compute Dependences in runOnScop, when we call printScop/getDependences, we simply return the calculated Dependences, the Scop do not need to present.

However, practically, all Scop analyses should "addRequiredTransitive<ScopInfo>();", since they are all calculated based on the Scop. If the Scop is invalided, the corresponding analysis results should also be invalided. Especially when the Scop is invalided by the transformations that change CFG and/or memory access behaviors.

I think I know why.

Because originally we compute Dependences in runOnScop, when we call printScop/getDependences, we simply return the calculated Dependences, the Scop do not need to present.

However, practically, all Scop analyses should "addRequiredTransitive<ScopInfo>();", since they are all calculated based on the Scop. If the Scop is invalided, the corresponding analysis results should also be invalided. Especially when the Scop is invalided by the transformations that change CFG and/or memory access behaviors.

Right. We should add RequiredTransitive. Feel free to change this.

Best,
Tobias

etherzhhb updated this revision to Diff 49290.Feb 27 2016, 12:07 AM
etherzhhb edited edge metadata.
etherzhhb removed rL LLVM as the repository for this revision.

Update based on the comments

etherzhhb marked 6 inline comments as done.Feb 27 2016, 12:09 AM
Meinersbur added inline comments.Feb 28 2016, 8:37 AM
lib/Analysis/DependenceInfo.cpp
793–794

Apart from recomputeDependences() the DependenceInfo did not need the Scop anymore. All results were stored in isl_* structures.

However, the analysis results without having the ScopStmt, MemoryAccess they were computed from available might be not that useful, but it is not strictly necessary. So I guess, no problem with always using addRequiredTransitive<ScopInfo>(). Users of DependenceInfo will have a addRequired[Transitive]<ScopInfo>() anyway.

etherzhhb added inline comments.Mar 1 2016, 5:19 PM
lib/Analysis/DependenceInfo.cpp
793–794

Apart from recomputeDependences() the DependenceInfo did not need the Scop anymore. All results were stored in isl_* structures.

However, the analysis results without having the ScopStmt, MemoryAccess they were computed from available might be not that useful, but it is not strictly necessary. So I guess, no problem with always using addRequiredTransitive<ScopInfo>(). Users of DependenceInfo will have a addRequired[Transitive]<ScopInfo>() anyway.

One of the examples about using DependencesInfo without ScopStmt, MemoryAccess is an analysis pass for memory dependencies between llvm instructions based on the access-level dependences, the end users of such a pass is interested in Scop, but llvm instructions.

grosser accepted this revision.Mar 2 2016, 11:29 PM
grosser edited edge metadata.

Hi ether,

this change looks generally good to me.

include/polly/DependenceInfo.h
222

Would clearing the full map also work?

This revision is now accepted and ready to land.Mar 2 2016, 11:29 PM
etherzhhb added inline comments.Mar 2 2016, 11:37 PM
include/polly/DependenceInfo.h
222

D is an array, may be I should look at something like DeleteContainerPointers

Ah, OK. Then this is probably fine.

Best,
Tobias