hameeza ahmed via llvm-dev
2018-Jan-28 15:30 UTC
[llvm-dev] Polly Dependency Analysis in MyPass
Hello, I need to analyze dependencies in my llvm ir by using polly. i created a new pass called mypass there i added polly dependency analysis pass but when i execute this pass in gdb i get no data. Why is that so? My code is follows; namespace { struct mypass : public FunctionPass { static char ID; mypass() : FunctionPass(ID) { } virtual bool runOnFunction(Function &F) { polly::DependenceInfoWrapperPass dp; auto &SI = *getAnalysis<polly::ScopInfoWrapperPass>().getSI(); for (auto &It : SI) { assert(It.second && "Invalid SCoP object!"); dp.recomputeDependences(It.second.get(), polly::Dependences::AL_Access); } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredTransitive<polly::ScopInfoWrapperPass>(); AU.setPreservesAll(); } }; } char mypass::ID = 0; static RegisterPass<mypass> X("mypass", "mypass World Pass", false, false); please help. i have been trying a lot. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180128/4e71cfeb/attachment.html>
hameeza ahmed via llvm-dev
2018-Jan-28 17:20 UTC
[llvm-dev] Polly Dependency Analysis in MyPass
I have modified the code as follows; now i am using both scopdetection and scopinformation before dependency check but i think link is missing... virtual bool runOnFunction(Function &F) { std::unique_ptr<ScopInfo> Result; std::unique_ptr<ScopDetection> Result2; //polly::ScopDetection pl; auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); auto &RI = getAnalysis<RegionInfoPass>().getRegionInfo(); auto &AA = getAnalysis<AAResultsWrapperPass>().getAAResults(); auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); Result2.reset(new ScopDetection(F, DT, SE, LI, RI, AA)); auto &SD2 = getAnalysis<polly::ScopDetectionWrapperPass>().getSD(); auto &SE2 = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); auto &LI2 = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); auto &AA2 = getAnalysis<AAResultsWrapperPass>().getAAResults(); auto const &DL2 = F.getParent()->getDataLayout(); auto &DT2 = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); auto &AC2 = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); Result.reset(new ScopInfo{DL2, SD2, SE2, LI2, AA2, DT2, AC2}); polly::DependenceInfoWrapperPass dp; auto &SI = *getAnalysis<polly::ScopInfoWrapperPass>().getSI(); for (auto &It : SI) { assert(It.second && "Invalid SCoP object!"); dp.recomputeDependences(It.second.get(), polly::Dependences::AL_Access); } return false; } what to do? please help..... On Sun, Jan 28, 2018 at 8:30 PM, hameeza ahmed <hahmed2305 at gmail.com> wrote:> Hello, > > I need to analyze dependencies in my llvm ir by using polly. i created a > new pass called mypass there i added polly dependency analysis pass but > when i execute this pass in gdb i get no data. > > Why is that so? > > My code is follows; > > > > namespace { > struct mypass : public FunctionPass { > static char ID; > > mypass() : FunctionPass(ID) { > } > virtual bool runOnFunction(Function &F) > { > polly::DependenceInfoWrapperPass dp; > > auto &SI = *getAnalysis<polly::ScopInfoWrapperPass>().getSI(); > > for (auto &It : SI) { > assert(It.second && "Invalid SCoP object!"); > dp.recomputeDependences(It.second.get(), > polly::Dependences::AL_Access); } > virtual void getAnalysisUsage(AnalysisUsage &AU) const > { > > AU.addRequiredTransitive<polly::ScopInfoWrapperPass>(); > AU.setPreservesAll(); > } > }; > } > char mypass::ID = 0; > static RegisterPass<mypass> X("mypass", "mypass World Pass", false, false); > > please help. i have been trying a lot. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180128/ebc83ab4/attachment.html>
Philip Pfaffe via llvm-dev
2018-Jan-28 18:31 UTC
[llvm-dev] Polly Dependency Analysis in MyPass
HI Hameeza, what do mean by link is still missing? Currently it is not possible to use polyhedral information from within in-tree LLVM passes. This is because Polly is not currently part of the LLVM tree, and is only linked into the tools as an external project. I.e., you can't depend on Polly passes in an in-tree pass. What you can do, though, is use Polly from an out-of-tree context. If you build your pass as a loadable library, you're free to link against Polly and include its headers. Cheers, Philip 2018-01-28 18:20 GMT+01:00 hameeza ahmed via llvm-dev < llvm-dev at lists.llvm.org>:> I have modified the code as follows; now i am using both scopdetection and > scopinformation before dependency check but i think link is missing... > > virtual bool runOnFunction(Function &F) > { > > std::unique_ptr<ScopInfo> Result; > std::unique_ptr<ScopDetection> Result2; > //polly::ScopDetection pl; > > auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); > auto &RI = getAnalysis<RegionInfoPass>().getRegionInfo(); > auto &AA = getAnalysis<AAResultsWrapperPass>().getAAResults(); > auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); > auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); > Result2.reset(new ScopDetection(F, DT, SE, LI, RI, AA)); > > > > auto &SD2 = getAnalysis<polly::ScopDetectionWrapperPass>().getSD(); > > > > auto &SE2 = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); > auto &LI2 = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); > auto &AA2 = getAnalysis<AAResultsWrapperPass>().getAAResults(); > auto const &DL2 = F.getParent()->getDataLayout(); > auto &DT2 = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); > auto &AC2 = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); > > Result.reset(new ScopInfo{DL2, SD2, SE2, LI2, AA2, DT2, AC2}); > > > polly::DependenceInfoWrapperPass dp; > > auto &SI = *getAnalysis<polly::ScopInfoWrapperPass>().getSI(); > > for (auto &It : SI) { > assert(It.second && "Invalid SCoP object!"); > dp.recomputeDependences(It.second.get(), > polly::Dependences::AL_Access); > > > > } > > > > return false; > } > > > what to do? please help..... > > On Sun, Jan 28, 2018 at 8:30 PM, hameeza ahmed <hahmed2305 at gmail.com> > wrote: > >> Hello, >> >> I need to analyze dependencies in my llvm ir by using polly. i created a >> new pass called mypass there i added polly dependency analysis pass but >> when i execute this pass in gdb i get no data. >> >> Why is that so? >> >> My code is follows; >> >> >> >> namespace { >> struct mypass : public FunctionPass { >> static char ID; >> >> mypass() : FunctionPass(ID) { >> } >> virtual bool runOnFunction(Function &F) >> { >> polly::DependenceInfoWrapperPass dp; >> >> auto &SI = *getAnalysis<polly::ScopInfoWrapperPass>().getSI(); >> >> for (auto &It : SI) { >> assert(It.second && "Invalid SCoP object!"); >> dp.recomputeDependences(It.second.get(), >> polly::Dependences::AL_Access); } >> virtual void getAnalysisUsage(AnalysisUsage &AU) const >> { >> >> AU.addRequiredTransitive<polly::ScopInfoWrapperPass>(); >> AU.setPreservesAll(); >> } >> }; >> } >> char mypass::ID = 0; >> static RegisterPass<mypass> X("mypass", "mypass World Pass", false, >> false); >> >> please help. i have been trying a lot. >> > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180128/2aa34b87/attachment.html>
Michael Kruse via llvm-dev
2018-Jan-29 15:45 UTC
[llvm-dev] Polly Dependency Analysis in MyPass
How do you compile the code? Within the Polly subdirectory using CMake? How do you run your pass. Using "opt -mypass inputfile.ll"? Michael 2018-01-28 9:30 GMT-06:00 hameeza ahmed via llvm-dev <llvm-dev at lists.llvm.org>:> Hello, > > I need to analyze dependencies in my llvm ir by using polly. i created a new > pass called mypass there i added polly dependency analysis pass but when i > execute this pass in gdb i get no data. > > Why is that so?Are you sure there is a SCoP detected in your input file? "opt mypass -debug" may give you some information.> My code is follows; > > > > namespace { > struct mypass : public FunctionPass { > static char ID; > > mypass() : FunctionPass(ID) { > } > virtual bool runOnFunction(Function &F) > { > polly::DependenceInfoWrapperPass dp; > > auto &SI = *getAnalysis<polly::ScopInfoWrapperPass>().getSI(); > > for (auto &It : SI) { > assert(It.second && "Invalid SCoP object!"); > dp.recomputeDependences(It.second.get(), polly::Dependences::AL_Access); > } > virtual void getAnalysisUsage(AnalysisUsage &AU) const > { > > AU.addRequiredTransitive<polly::ScopInfoWrapperPass>(); > AU.setPreservesAll(); > } > }; > } > char mypass::ID = 0; > static RegisterPass<mypass> X("mypass", "mypass World Pass", false, false); > > please help. i have been trying a lot. > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >
hameeza ahmed via llvm-dev
2018-Jan-29 16:18 UTC
[llvm-dev] Polly Dependency Analysis in MyPass
Thank You. Actually i pass polly canonaclize IR to my new created polly pass called "mypass". Mypass should first detect scops then find depedndencies as the mechanism conventional approach. Now i know how to write llvm pass here i am writing pass as loadable module first afterwards i will integrate it with opt in the end. I tried writing following code. Could you please help me on this? What to modify here? namespace { struct mypass : public FunctionPass { static char ID; mypass() : FunctionPass(ID) { } virtual bool runOnFunction(Function &F) { std::unique_ptr<ScopInfo> Result; std::unique_ptr<ScopDetection> Result2; auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); auto &RI = getAnalysis<RegionInfoPass>().getRegionInfo(); auto &AA = getAnalysis<AAResultsWrapperPass>().getAAResults(); auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); Result2.reset(new ScopDetection(F, DT, SE, LI, RI, AA)); auto &SD2 = getAnalysis<polly::ScopDetectionWrapperPass>().getSD(); auto &SE2 = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); auto &LI2 = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); auto &AA2 = getAnalysis<AAResultsWrapperPass>().getAAResults(); auto const &DL2 = F.getParent()->getDataLayout(); auto &DT2 = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); auto &AC2 = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); Result.reset(new ScopInfo{DL2, SD2, SE2, LI2, AA2, DT2, AC2}); polly::DependenceInfoWrapperPass dp; auto &SI = *getAnalysis<polly::ScopInfoWrapperPass>().getSI(); for (auto &It : SI) { assert(It.second && "Invalid SCoP object!"); dp.recomputeDependences(It.second.get(), polly::Dependences::AL_Access); } return false; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredTransitive<polly::ScopInfoWrapperPass>(); AU.addRequired<LoopInfoWrapperPass>(); AU.addRequired<RegionInfoPass>(); AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequiredTransitive<ScalarEvolutionWrapperPass>(); AU.addRequiredTransitive<polly::ScopDetectionWrapperPass>(); AU.addRequired<AAResultsWrapperPass>(); AU.addRequired<AssumptionCacheTracker>(); // We also need AA and RegionInfo when we are verifying analysis. AU.setPreservesAll(); } }; } char mypass::ID = 0; static RegisterPass<mypass> X("mypass", "mypass World Pass", false, false); On Mon, Jan 29, 2018 at 8:45 PM, Michael Kruse <llvmdev at meinersbur.de> wrote:> How do you compile the code? Within the Polly subdirectory using CMake? > How do you run your pass. Using "opt -mypass inputfile.ll"? > > Michael > > 2018-01-28 9:30 GMT-06:00 hameeza ahmed via llvm-dev < > llvm-dev at lists.llvm.org>: > > Hello, > > > > I need to analyze dependencies in my llvm ir by using polly. i created a > new > > pass called mypass there i added polly dependency analysis pass but when > i > > execute this pass in gdb i get no data. > > > > Why is that so? > > Are you sure there is a SCoP detected in your input file? "opt mypass > -debug" may give you some information. > > > My code is follows; > > > > > > > > namespace { > > struct mypass : public FunctionPass { > > static char ID; > > > > mypass() : FunctionPass(ID) { > > } > > virtual bool runOnFunction(Function &F) > > { > > polly::DependenceInfoWrapperPass dp; > > > > auto &SI = *getAnalysis<polly::ScopInfoWrapperPass>().getSI(); > > > > for (auto &It : SI) { > > assert(It.second && "Invalid SCoP object!"); > > dp.recomputeDependences(It.second.get(), > polly::Dependences::AL_Access); > > } > > virtual void getAnalysisUsage(AnalysisUsage &AU) const > > { > > > > AU.addRequiredTransitive<polly::ScopInfoWrapperPass>(); > > AU.setPreservesAll(); > > } > > }; > > } > > char mypass::ID = 0; > > static RegisterPass<mypass> X("mypass", "mypass World Pass", false, > false); > > > > please help. i have been trying a lot. > > > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180129/c6be9f76/attachment.html>