<html><body><p>Hi Ta-Wei,<br><br>> We might also need a LNPMUpdater (LoopNestPassManagerUpdater) which disallows adding inner-loops back into the pipeline, and LoopNestPassManager will simply be PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResult &, LNPMUpdater &>.<br><br>LNPMUpdater should have some functionalities of LPMUpdater, e.g. adding sibling loop nest, revisit the current loop nest, etc. <br><br>> One question I have is whether the IRUnit LoopNestPass operates on should be Loop or LoopNest, since I'm not quite sure about the usage of LoopNest and why it should be constructed with a ScalarEvolution.<br><br>That's a good point, we can make ScalarEvolution optional for LoopNest. Currently, the only use case is to check if the loop nest is perfect, which can provide a more conservative result if ScalarEvolution is not given. <br>Having said that, ScalarEvolution is one of the analyses in LoopStandardAnalysisResults, so all LoopPasses already have access to ScalarEvolution.<br>LoopNest provides some useful utilities, although it is still not at a manual phrase. <br>My personal opinion is all the mechanism of the LoopNest, e.g. LoopNestPassManager, LPMUpdater, etc, should operates on Loop. While IRUnitT which is used by loop nest transformations/analyses should operates on LoopNest.<br>@etiotto What's your opinion on that?<br><br>> Also, it is stated that "we want to create a LoopNestPass, where transformations intended for loop nest can inherit from it" in the original GSoC project description, but I believe that inheriting from a Pass subclass is no longer required in the New Pass Manager. So should we also implement a LoopNestPass subclass that allows implementing loop-nest-passes for the Legacy Pass Manager?<br><br>Right, the wording should be corrected. Given that the New Pass Manager will soon be the default Pass Manager, we should not spend extra effort to create LoopNestPass in Legacy Pass Manager.<br><br>> Finally, I have some questions that might not be very relevant to the project. But currently, how does the LegacyPassManager and the NewPassManager interact? Also, is it possible to add passes designed for LegacyPassManager into the NewPassManager and vice versa? <br><br>Most transformations have both for LegacyPassManager and NewPassManager, and have the actual implementation of the transformations in a separate class, or a static function that can be call by both.<br>e.g. LoopFuseLegacy is for LegacyPassManager , <a href="https://llvm.org/doxygen/classllvm_1_1LoopFusePass.html#a971f40ada3f1410759faede02bfbace7"><u><font color="#4665A2">LoopFusePass</font></u></a> is for NewPassManager, and both create LoopFuser and do the transformation there.<br><br>Looking forward to your first patch!<br><br>Regards,<br>Whitney Tsang<br><br><br><img width="16" height="16" src="cid:1__=8FBB0F3ADFF4EF668f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Ta-Wei Tu ---2020/07/18 07:38:44 AM---Hi, Thanks for your help! I've checked the sources that you men"><font size="2" color="#424282">Ta-Wei Tu ---2020/07/18 07:38:44 AM---Hi, Thanks for your help! I've checked the sources that you mentioned.</font><br><br><font size="2" color="#5F5F5F">From: </font><font size="2">Ta-Wei Tu <tu.da.wei@gmail.com></font><br><font size="2" color="#5F5F5F">To: </font><font size="2">Whitney Tsang <whitney.uwaterloo@gmail.com></font><br><font size="2" color="#5F5F5F">Cc: </font><font size="2">llvm-dev <llvm-dev@lists.llvm.org>, whitneyt@ca.ibm.com</font><br><font size="2" color="#5F5F5F">Date: </font><font size="2">2020/07/18 07:38 AM</font><br><font size="2" color="#5F5F5F">Subject: </font><font size="2">[EXTERNAL] Re: [llvm-dev] Regarding the project "Create LoopNestPass"</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br>Hi,<br><br>Thanks for your help! I've checked the sources that you mentioned. Currently, I think that I would need to implement a FunctionToLoopNestPassAdaptor which is essentially the same as the FunctionToLoopPassAdaptor but operates only on LI.getTopLevelLoops(). <br><br>We might also need a LNPMUpdater (LoopNestPassManagerUpdater) which disallows adding inner-loops back into the pipeline, and LoopNestPassManager will simply be PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResult &, LNPMUpdater &>.<br><br>One question I have is whether the IRUnit LoopNestPass operates on should be Loop or LoopNest, since I'm not quite sure about the usage of LoopNest and why it should be constructed with a ScalarEvolution.<br><br>Also, it is stated that "we want to create a LoopNestPass, where transformations intended for loop nest can inherit from it" in the original GSoC project description, but I believe that inheriting from a Pass subclass is no longer required in the New Pass Manager. So should we also implement a LoopNestPass subclass that allows implementing loop-nest-passes for the Legacy Pass Manager?<br><br>Finally, I have some questions that might not be very relevant to the project. But currently, how does the LegacyPassManager and the NewPassManager interact? Also, is it possible to add passes designed for LegacyPassManager into the NewPassManager and vice versa? <br><br>What do you think about the plan? I'm quite likely to miss something important, so please kindly correct me if I'm in the wrong direction.<br><br>Thank you very much!<br>Sincerely, Ta-Wei Tu<br><br>Whitney Tsang <<a href="mailto:whitney.uwaterloo@gmail.com"><u><font color="#0000FF">whitney.uwaterloo@gmail.com</font></u></a>> 於 2020年7月15日 週三 下午6:14寫道:
<ul><font color="#121212" face="Helvetica Neue">Hi Wayne,</font><br><br><font color="#121212" face="Helvetica Neue">As far as I know, no one is working on this project. Your contribution is always appreciated.</font><br><br><font color="#121212" face="Helvetica Neue">This project aims to create LoopNestPass in the new pass manager (NPM).</font><br><font color="#121212" face="Helvetica Neue">In </font><a href="https://www.youtube.com/watch?v=3pRhvQi7Z10" target="_blank"><u><font color="#4178BE" face="Helvetica Neue">https://www.youtube.com/watch?v=3pRhvQi7Z10</font></u></a><font color="#121212" face="Helvetica Neue"> , you can try to follow along to create a LLVM loop pass in NPM.<br></font><br><font color="#121212" face="Helvetica Neue">There exist different kinds of passes in the NPM, e.g. ModulePass, FunctionPass, LoopPass. </font><br><font color="#121212" face="Helvetica Neue">One or more loop passes can be added in a LoopPassManager, which then can be added in FunctionPassManager through createFunctionToLoopPassAdaptor. </font><br><font color="#121212" face="Helvetica Neue">Examples can be found in llvm/lib/Passes/PassBuilder.cpp. </font><br><font color="#121212" face="Helvetica Neue">There exist passes that best operate as a loop nest, e.g. LoopInterchange. For those passes, currently can be written as either FunctionPass or LoopPass.</font><br><font color="#121212" face="Helvetica Neue">However, choosing one or the other needs to sacrifice the ability of the other. </font><br><font color="#121212" face="Helvetica Neue">The idea of a LoopNestPass is to combine the benefits of FunctionPass and LoopPass needed for a loop nest.</font><br><br><font color="#121212" face="Helvetica Neue">On top of LoopNest I would suggest to also get familiar with different PassAdaptor classes (e.g. FunctionToLoopPassAdaptor).<br>- llvm/include/llvm/Transforms/Scalar/LoopPassManager.h</font><br><br><font color="#121212" face="Helvetica Neue">I am happy to provide feedback once you have a plan of how to proceed, or review your patches on Phabricator.</font><br><br><font color="#121212" face="Helvetica Neue">Regards,</font><br><font color="#121212" face="Helvetica Neue">Whitney Tsang</font><br><br>On Wed, Jul 15, 2020 at 5:49 AM Wayne Tu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><u><font color="#0000FF">llvm-dev@lists.llvm.org</font></u></a>> wrote:<br>Hi,<br><br>I'm a college student who is quite new to the community and is interested in contributing to the LLVM project. Although I haven't applied to GSoC, I notice that the project "Create LoopNestPass" seems to be unassigned. <br>So I'm curious whether anyone is currently working on it, and if not, is it possible for me to work on it as a side-project?<br><br>I've been programming in C++ for quite a while, and I've walked through the `LoopPass`, `LoopNest`, and some other LLVM classes that I think would probably be related to this project. I've also watched some of the videos in the llvm-dev conference regarding loops, so I now have a rough idea on how to implement the LoopNestPass.<br><br>I'm looking forward to working on this project. <br><br>Thank you very much.<br><br>Sincerely,<br>Ta-Wei Tu<br>_______________________________________________<br>LLVM Developers mailing list<u><font color="#0000FF"><br></font></u><a href="mailto:llvm-dev@lists.llvm.org" target="_blank"><u><font color="#0000FF">llvm-dev@lists.llvm.org</font></u></a><u><font color="#0000FF"><br></font></u><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank"><u><font color="#0000FF">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</font></u></a><br><br></ul><BR>
</body></html>