Stefanos Baziotis via llvm-dev
2020-May-22 14:42 UTC
[llvm-dev] Creating a copy Pass of DependenceAnalysis
Hi, I want to create a copy of DependenceAnalysis downstream. At first I tried the HelloWorld tutorial. But then I figured, maybe I should move on to create my pass by mimicking some other pass in LLVM. So, I tried copying DependenceAnalysis itself [1] Although after a lot of time of trying it compiled, I'm pretty sure I have done it completely in the wrong way. What is more, I can't access my pass with the argument I put (-rt-dep-checks). Then, I watched this tutorial [2]. Apart from the fact that there seem to be way too many steps just to create hello world pass, I don't think that passes like DependenceAnalysis follow it. So, what should I do? What is the "correct" to create the copy; like an external library as the HelloWorld tutorial shows ? Thanks, Stefanos [1] https://github.com/baziotis/llvm-project/tree/dep_analysis [2] https://www.youtube.com/watch?v=ar7cJl2aBuU -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200522/f26574fb/attachment.html>
Florian Hahn via llvm-dev
2020-May-22 15:20 UTC
[llvm-dev] Creating a copy Pass of DependenceAnalysis
> On May 22, 2020, at 15:42, Stefanos Baziotis via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > > I want to create a copy of DependenceAnalysis downstream. > > At first I tried the HelloWorld tutorial. But then I figured, maybe I should move on > to create my pass by mimicking some other pass in LLVM. > > So, I tried copying DependenceAnalysis itself [1] > > Although after a lot of time of trying it compiled, I'm pretty sure I have done it > completely in the wrong way. What is more, I can't access my pass with the argument > I put (-rt-dep-checks). >For the new pass manager I think you have to add your pass to llvm/lib/Passes/PassRegistry.def. I’d recommend taking a look at how the DominatorTree analysis is set up. Also note that analysis passes on their own are invoked a little bit differently to transformation passes: old PM: `opt -domtree -analyze foo.ll`, new PM: `opt -passes='print<domtree>’ foo.ll`> Then, I watched this tutorial [2]. Apart from the fact that there seem to be > way too many steps just to create hello world pass, I don't think that passes like > DependenceAnalysis follow it.IIRC the tutorial is mostly focusing on out-of-tree passes, so the steps are different to an in-tree pass. It looks like the in-tree docs also mostly cover out-of-tree passes (http://llvm.org/docs/WritingAnLLVMPass.html). Improvements to the docs in that area would definitely be welcomed.> [1] https://github.com/baziotis/llvm-project/tree/dep_analysisI had a quick look and it looks like your new pass is called RuntimeDependenceChecks. Just in case you are not aware, there is already infrastructure to create runtime checks for dependences in loops in tree: https://github.com/llvm/llvm-project/blob/master/llvm/lib/Analysis/LoopAccessAnalysis.cpp Cheers, Florian
Stefanos Baziotis via llvm-dev
2020-May-22 15:54 UTC
[llvm-dev] Creating a copy Pass of DependenceAnalysis
> For the new pass manager I think you have to add your pass tollvm/lib/Passes/PassRegistry.def. Oh ok, I'll try it.> I’d recommend taking a look at how the DominatorTree analysis is set up.Also note that analysis passes on their own are invoked a little bit differently to transformation passes: old PM: `opt -domtree -analyze foo.ll`, new PM: `opt -passes='print<domtree>’ foo.ll` I'll take a look, but the way I see it, copying passes ends up being more complicated.> IIRC the tutorial is mostly focusing on out-of-tree passes, so the stepsare different to an in-tree pass. It looks like the in-tree docs also mostly cover out-of-tree passes (http://llvm.org/docs/WritingAnLLVMPass.html). Improvements to the docs in that area would definitely be welcomed. I don't necessarily want an in-tree pass and the way I see it I better stick to: - Old pass manager - Out-of-tree passes at least for now.> Just in case you are not aware, there is already infrastructure to createruntime checks for dependences in loops in tree: https://github.com/llvm/llvm-project/blob/master/llvm/lib/Analysis/LoopAccessAnalysis.cpp Yep, I know, although I have to look more into that. The thing is, I pretty much understand all the theoretical background of DependenceAnalysis, the way it is implemented is very clear and I somewhat can think how to use its dependence tests to create run-time checks. So I wanted to experiment to see how much of LoopAccessAnalysis I'll need. Because LoopAccessAnalysis on the other hand, maybe partly because it's focused on the loop vectorizer, is not at all clear to me. :) Thanks for the help, Stefanos Στις Παρ, 22 Μαΐ 2020 στις 6:20 μ.μ., ο/η Florian Hahn < florian_hahn at apple.com> έγραψε:> > > > On May 22, 2020, at 15:42, Stefanos Baziotis via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > > Hi, > > > > I want to create a copy of DependenceAnalysis downstream. > > > > At first I tried the HelloWorld tutorial. But then I figured, maybe I > should move on > > to create my pass by mimicking some other pass in LLVM. > > > > So, I tried copying DependenceAnalysis itself [1] > > > > Although after a lot of time of trying it compiled, I'm pretty sure I > have done it > > completely in the wrong way. What is more, I can't access my pass with > the argument > > I put (-rt-dep-checks). > > > > For the new pass manager I think you have to add your pass to > llvm/lib/Passes/PassRegistry.def. > > I’d recommend taking a look at how the DominatorTree analysis is set up. > Also note that analysis passes on their own are invoked a little bit > differently to transformation passes: old PM: `opt -domtree -analyze > foo.ll`, new PM: `opt -passes='print<domtree>’ foo.ll` > > > Then, I watched this tutorial [2]. Apart from the fact that there seem > to be > > way too many steps just to create hello world pass, I don't think that > passes like > > DependenceAnalysis follow it. > > IIRC the tutorial is mostly focusing on out-of-tree passes, so the steps > are different to an in-tree pass. It looks like the in-tree docs also > mostly cover out-of-tree passes ( > http://llvm.org/docs/WritingAnLLVMPass.html). Improvements to the docs in > that area would definitely be welcomed. > > > > [1] https://github.com/baziotis/llvm-project/tree/dep_analysis > > I had a quick look and it looks like your new pass is called > RuntimeDependenceChecks. > > Just in case you are not aware, there is already infrastructure to create > runtime checks for dependences in loops in tree: > https://github.com/llvm/llvm-project/blob/master/llvm/lib/Analysis/LoopAccessAnalysis.cpp > > Cheers, > Florian-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200522/2b296528/attachment.html>