<div dir="auto">Thank you for your comments. <div dir="auto">I've totally forgot that utilities for analysis that aren't implemented as analysis passes can be candidate. It'll be nice for them to utilize LoopNest as a primary object. <div dir="auto"><br></div><div dir="auto">Best,</div><div dir="auto">Toshiki Maekawa </div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 5, 2021, 10:00 PM Whitney T Tsang <<a href="mailto:whitneyt@ca.ibm.com">whitneyt@ca.ibm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-family:Arial,Helvetica,sans-serif;font-size:10pt"><div dir="ltr">Here are some comments:
<ol> <li>Not sure LoopFusionPass can be changed to be a LoopNest pass, as it operates on more than 1 LoopNest.</li> <li>We can also consider changing analysis on top of transformation. For example, you mentioned LoopCachePrinterPass, which is a transformation that print the result of the analysis/utility LoopCacheAnalysis.</li> <li>Some loop passes used in a loop pipeline can be good candidate in a later phase of the project, when you are more familiar with the idea, e.g. LoopIdiomRecognizePass.</li> <li>I prefer to study the impact and collect data needed for each pass, instead of at the end of the project.</li></ol>
<div>Best,</div>
<div>Whitney Tsang</div></div>
<blockquote dir="ltr" style="border-left:solid #aaaaaa 2px;margin-left:5px;padding-left:5px;direction:ltr;margin-right:0px">----- Original message -----<br>From: uint256_t <<a href="mailto:konndennsa@gmail.com" target="_blank" rel="noreferrer">konndennsa@gmail.com</a>><br>To: Whitney T Tsang <<a href="mailto:whitneyt@ca.ibm.com" target="_blank" rel="noreferrer">whitneyt@ca.ibm.com</a>><br>Cc: Ettore Tiotto <<a href="mailto:etiotto@ca.ibm.com" target="_blank" rel="noreferrer">etiotto@ca.ibm.com</a>>, llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a>><br>Subject: [EXTERNAL] Re: [llvm-dev] [GSoC 2021] Utilize LoopNest Pass<br>Date: Sun, Apr 4, 2021 9:00 PM<br>
<div dir="auto">Hi, it's been a while.
<div dir="auto"> </div>
<div dir="auto">I submitted a draft of project proposal to the website of GSoC.</div>
<div dir="auto">Could you give me some advice about it?</div>
<div dir="auto"> </div>
<div dir="auto">(or should I share a draft on this ML?) </div>
<div dir="auto"> </div>
<div dir="auto">Best,</div>
<div dir="auto">Toshiki Maekawa</div></div>
<div><div dir="ltr">On Tue, Mar 23, 2021, 2:35 PM uint256_t <<a href="mailto:konndennsa@gmail.com" target="_blank" rel="noreferrer">konndennsa@gmail.com</a>> wrote:</div>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">I didn't realize LoopUnrollAndJam used to be implemented as LoopPass. I should have checked the commit log.</div>
<div dir="ltr"> </div>
<div>Thanks,</div>
<div>Toshiki Maekawa</div>
<div><div dir="ltr">2021年3月23日(火) 1:01 Whitney T Tsang <<a href="mailto:whitneyt@ca.ibm.com" rel="noreferrer noreferrer" target="_blank">whitneyt@ca.ibm.com</a>>:</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" style="font-family:Arial,Helvetica,sans-serif;font-size:10pt"><div dir="ltr">LoopUnrollAndJam was changed from LoopPass to FunctionPass, which was a good choice as LoopNestPass didn't exists at that time.</div>
<div dir="ltr"><a href="https://reviews.llvm.org/D72230" rel="noreferrer noreferrer" target="_blank">https://reviews.llvm.org/D72230</a><br> </div>
<div dir="ltr">You can see that `simplifyLoop` and `formLCSSARecursively` was adding in that patch.<br>Those changes may not be needed anymore if we are using LoopNestPass, and if the PassManager itself can make sure the loops are simplified and in LCSSA form.</div>
<div dir="ltr"> </div>
<div dir="ltr">Regards,</div>
<div dir="ltr">Whitney Tsang</div>
<blockquote dir="ltr" style="border-left:2px solid rgb(170,170,170);margin-left:5px;padding-left:5px;direction:ltr;margin-right:0px">----- Original message -----<br>From: uint256_t <<a href="mailto:konndennsa@gmail.com" rel="noreferrer noreferrer" target="_blank">konndennsa@gmail.com</a>><br>To: Whitney T Tsang <<a href="mailto:whitneyt@ca.ibm.com" rel="noreferrer noreferrer" target="_blank">whitneyt@ca.ibm.com</a>><br>Cc: <a href="mailto:etiotto@ca.ibm.com" rel="noreferrer noreferrer" target="_blank">etiotto@ca.ibm.com</a>, llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer noreferrer" target="_blank">llvm-dev@lists.llvm.org</a>><br>Subject: [EXTERNAL] Re: [llvm-dev] [GSoC 2021] Utilize LoopNest Pass<br>Date: Sat, Mar 20, 2021 10:40 AM<br>
<div dir="ltr"><div>Hi,</div>
<div> </div>
<div>I tried to utilize LoopNest pass for LoopUnrollAndJam pass, but found it difficult.</div>
<div>LoopUnrollAndJam is currently implemented as FunctionPass, and using some functions that may add new loops like simplifyLoop().</div>
<div> </div>
<div>We need to track such mutations by LPMUpdater, so need to make the functions that may add loops use the updater.</div>
<div>This could lead to a big code change. What do you think about this change?</div>
<div> </div>
<div>Thanks,</div>
<div>Toshiki Maekawa</div></div>
<div><div dir="ltr">2021年3月17日(水) 0:47 uint256_t <<a href="mailto:konndennsa@gmail.com" rel="noreferrer noreferrer" target="_blank">konndennsa@gmail.com</a>>:</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Thank you for your advice. I understand which passes are good for this change.</div>
<div>I'll avoid transformation passes already used in a loop pipeline as much as possible.</div>
<div> </div>
<div>Best,</div>
<div>Toshiki Maekawa</div>
<div> </div></div>
<div><div dir="ltr">2021年3月15日(月) 22:17 Whitney T Tsang <<a href="mailto:whitneyt@ca.ibm.com" rel="noreferrer noreferrer" target="_blank">whitneyt@ca.ibm.com</a>>:</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p><font size="2">Passes implemented as a loop pass can still be good for this change.</font><br><font size="2">I am referring to passes implemented as a loop pass and used as a loop pass in a loop pipeline </font><b><font size="2">may </font></b><font size="2">not be a good candidate.</font><br><font size="2">Take the LoopFullUnrollPass as an example, LoopFullUnrollPass is added in LPM2 with other loop passes, e.g. LoopIdiomRecognizePass, IndVarSimplifyPass, ...</font><br><font size="2">Loops are processed from inner to outer loop, where each loop is processed by all the passes in LPM2, before process its outer loops.</font><br><font size="2">If we change LoopFullUnrollPass to a LoopNest pass, then there is no way we can preserve the same order of processing loops.</font><br><font size="2">It </font><b><font size="2">may </font></b><font size="2">still be good to change such passes, but there can be huge performance impact, which we need to analyze and handle, and probably not the best choice to look at first.</font><br><br><font size="2">```</font><br><a href="https://llvm.org/doxygen/classllvm_1_1PassManager_3_01Loop_00_01LoopAnalysisManager_00_01LoopStandardAnalysisResults_01_6_00_01LPMUpdater_01_6_01_4.html" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">LoopPassManager</font></a> LPM2(DebugLogging);<br><br>LPM2.addPass(<a href="https://llvm.org/doxygen/classllvm_1_1LoopIdiomRecognizePass.html" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">LoopIdiomRecognizePass</font></a>());<br>LPM2.addPass(<a href="https://llvm.org/doxygen/classllvm_1_1IndVarSimplifyPass.html" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">IndVarSimplifyPass</font></a>());<br><br><font color="#E08000">for</font> (<font color="#008000">auto</font> &<a href="https://llvm.org/doxygen/README__ALTIVEC_8txt.html#a9aacd9146afe44bf656cd664e2a88c8c" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">C</font></a> : LateLoopOptimizationsEPCallbacks)<br><a href="https://llvm.org/doxygen/README__ALTIVEC_8txt.html#a9aacd9146afe44bf656cd664e2a88c8c" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">C</font></a>(LPM2, <a href="https://llvm.org/doxygen/namespacellvm_1_1PICLevel.html#a66ddbf1bb21f90ddc44260d1ca677b6b" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">Level</font></a>);<br><br>LPM2.addPass(<a href="https://llvm.org/doxygen/classllvm_1_1LoopDeletionPass.html" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">LoopDeletionPass</font></a>());<br><br><font color="#E08000">if</font> (<a href="https://llvm.org/doxygen/AArch64FalkorHWPFFix_8cpp.html#a780618ccf661aebc12f8d991d294c950" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">Phase</font></a> != <a href="https://llvm.org/doxygen/namespacellvm.html#a5d737fb4258bb27586a1bffd557fbb49ad94cc56b0a9155d607f2609b0f5c39d3" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">ThinOrFullLTOPhase::ThinLTOPreLink</font></a> || !PGOOpt ||<br>PGOOpt->Action != <a href="https://llvm.org/doxygen/structllvm_1_1PGOOptions.html#a13bd589bcabdfc073bac5711f76dd2b6a9cbf1cb1b0731fc75926a6930592968a" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">PGOOptions::SampleUse</font></a>)<br>LPM2.addPass(<a href="https://llvm.org/doxygen/classllvm_1_1LoopFullUnrollPass.html" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">LoopFullUnrollPass</font></a>(<a href="https://llvm.org/doxygen/namespacellvm_1_1PICLevel.html#a66ddbf1bb21f90ddc44260d1ca677b6b" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">Level</font></a>.getSpeedupLevel(),<br><font color="#800000">/* OnlyWhenForced= */</font> !PTO.<a href="https://llvm.org/doxygen/classllvm_1_1PipelineTuningOptions.html#af5b2b612c2769e79040e34bc4be7a77f" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">LoopUnrolling</font></a>,<br>PTO.<a href="https://llvm.org/doxygen/classllvm_1_1PipelineTuningOptions.html#ac4261b710708d3ffd351693d268dbc2b" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">ForgetAllSCEVInLoopUnroll</font></a>));<br><br><font color="#E08000">for</font> (<font color="#008000">auto</font> &<a href="https://llvm.org/doxygen/README__ALTIVEC_8txt.html#a9aacd9146afe44bf656cd664e2a88c8c" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">C</font></a> : LoopOptimizerEndEPCallbacks)<br>(LPM2, <a href="https://llvm.org/doxygen/namespacellvm_1_1PICLevel.html#a66ddbf1bb21f90ddc44260d1ca677b6b" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">Level</font></a>);<br><br>FPM.<a href="https://llvm.org/doxygen/classllvm_1_1PassManager.html#a314ff184ce4ace8801e1158ef909e22e" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">addPass</font></a>(<a href="https://llvm.org/doxygen/namespacellvm.html#a5118c8cfac85abdec7366d89d023a1ef" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">createFunctionToLoopPassAdaptor</font></a>(<br><a href="https://llvm.org/doxygen/lib_2Target_2ARM_2README_8txt.html#ad3a99906764c35b2694ae90fa57744a5" rel="noreferrer noreferrer" target="_blank"><font color="#4665A2">std::move</font></a>(LPM2), <font color="#800000">/*UseMemorySSA=*/</font><font color="#008000">false</font>, <font color="#800000">/*UseBlockFrequencyInfo=*/</font><font color="#008000">false</font>,<br>DebugLogging));<br><font size="2">```<br><br>Regards,</font><br><font size="2">Whitney Tsang</font><br><br><img alt="Inactive hide details for uint256_t ---2021/03/14 08:48:39 PM---Hello, I have a question about finding good passes for utilizin" border="0" height="16" src="cid:1785d9126d05483523b1" width="16"><font color="#424282" size="2">uint256_t ---2021/03/14 08:48:39 PM---Hello, I have a question about finding good passes for utilizing LoopNest pass.</font><br><br><font color="#5F5F5F" size="2">From: </font><font size="2">uint256_t <<a href="mailto:konndennsa@gmail.com" rel="noreferrer noreferrer" target="_blank">konndennsa@gmail.com</a>></font><br><font color="#5F5F5F" size="2">To: </font><font size="2">Whitney T Tsang <<a href="mailto:whitneyt@ca.ibm.com" rel="noreferrer noreferrer" target="_blank">whitneyt@ca.ibm.com</a>></font><br><font color="#5F5F5F" size="2">Cc: </font><font size="2"><a href="mailto:etiotto@ca.ibm.com" rel="noreferrer noreferrer" target="_blank">etiotto@ca.ibm.com</a>, llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer noreferrer" target="_blank">llvm-dev@lists.llvm.org</a>></font><br><font color="#5F5F5F" size="2">Date: </font><font size="2">2021/03/14 08:48 PM</font><br><font color="#5F5F5F" size="2">Subject: </font><font size="2">[EXTERNAL] Re: [llvm-dev] [GSoC 2021] Utilize LoopNest Pass</font></p>
<hr align="left" size="2" style="color:rgb(128,145,165)" width="100%"><br><br><br>Hello,<br><br>I have a question about finding good passes for utilizing LoopNest pass.<br><br>> The LoopFullUnrollPass is not a good candidate for the change, as it is a loop pass and it is being used as a loop pass.<br>Then you mean that passes which are implemented as not a loop pass (= function pass) and not already used as a loop pass are good for this change? <br>I didn't get that. Could you tell me why it is?<br><br>Thanks in advance,<br>Toshiki Maekawa<br><br>On Fri, Mar 12, 2021, 1:20 AM uint256_t <<a href="mailto:konndennsa@gmail.com" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF">konndennsa@gmail.com</font></u></a>> wrote:
<ul style="list-style-type:none"> <li>Thank you for your advice. As you mentioned, LoopUnrollAndJam seems to be a good candidate.<br> I'm going to find another analyse/transform pass suitable for loop nest pass.<br> <br> Best,<br> Toshiki Maekawa<br> <br> 2021年3月10日(水) 23:32 Whitney T Tsang <<a href="mailto:whitneyt@ca.ibm.com" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF">whitneyt@ca.ibm.com</font></u></a>>:<br> <font size="2">Sure, in this project, we plan to utilize the LoopNest pass in some existing passes.<br> As an example, here is one of the patches to transform the loop interchange pass: </font><a href="https://reviews.llvm.org/D97847" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF" size="2">https://reviews.llvm.org/D97847</font></u></a><font size="2">.<br> On top of doing the code changes, we want to understand what are the pros and cons of the change.<br> We can do that by collecting some data, e.g. compile time.</font><br> <br> <font size="2">There are two loop unroller, LoopFullUnrollPass and LoopUnrollPass.<br> The LoopFullUnrollPass is not a good candidate for the change, as it is a loop pass and it is being used as a loop pass.<br> It is written to be traverse from inner to outer loop, with other loop transformations in between in the loop pipeline.<br> The LoopUnrollPass could be a candidate, but the LoopUnrollAndJamPass can be an easier to understand candidate,<br> as unroll and jam transformation naturally operate on more than one loop (LoopNest).</font><br> <br> <font size="2">Regards,<br> Whitney Tsang</font><br> <br> <img alt="Inactive hide details for uint256_t ---2021/03/10 07:52:17 AM---I'm glad to get in touch with you two. I'm planning to utilize" height="16" src="cid:1785d9126d05483523b1" width="16"><font color="#424282" size="2">uint256_t ---2021/03/10 07:52:17 AM---I'm glad to get in touch with you two. I'm planning to utilize LoopNest pass for some passes like lo</font><br> <br> <font color="#5F5F5F" size="2">From: </font><font size="2">uint256_t <</font><a href="mailto:konndennsa@gmail.com" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF" size="2">konndennsa@gmail.com</font></u></a><font size="2">></font><br> <font color="#5F5F5F" size="2">To:<br> Cc: </font><font size="2">llvm-dev <</font><a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF" size="2">llvm-dev@lists.llvm.org</font></u></a><font size="2">>, </font><a href="mailto:etiotto@ca.ibm.com" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF" size="2">etiotto@ca.ibm.com</font></u></a><font size="2">, </font><a href="mailto:whitneyt@ca.ibm.com" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF" size="2">whitneyt@ca.ibm.com</font></u></a><br> <font color="#5F5F5F" size="2">Date: </font><font size="2">2021/03/10 07:52 AM</font><br> <font color="#5F5F5F" size="2">Subject: </font><font size="2">[EXTERNAL] Re: [llvm-dev] [GSoC 2021] Utilize LoopNest Pass</font>
<hr align="left" size="2" width="100%"><br> <br> <font color="#FFFFFF" size="2">ZjQcmQRYFpfptBannerEnd</font><br> I'm glad to get in touch with you two.<br> I'm planning to utilize LoopNest pass for some passes like loop unrolling.<br> Could you tell me more about this project if any?<br> <br> 2021年3月9日(火) 20:47 Whitney Tsang <<a href="mailto:whitney.uwaterloo@gmail.com" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF">whitney.uwaterloo@gmail.com</font></u></a>>:
<ul style="list-style-type:none"> <li> <ul style="list-style-type:none"> <li>+ Whitney, Ettore<br> <br> On Tue, Mar 9, 2021, 3:00 AM uint256_t via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF">llvm-dev@lists.llvm.org</font></u></a>> wrote:<br> Hello,<br> <br> I'm thinking of participating in GSoC at LLVM.<br> I've already talked about ideas with some project mentors but a newly added project idea "Utilize LoopNest Pass" attracted me.<br> I want to get in touch with its mentors (Whitney Tsang, Ettore Tiotto), whose email I couldn't find out.<br> <br> Sincerely,<br> Toshiki Maekawa<br> _______________________________________________<br> LLVM Developers mailing list<br> <a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF">llvm-dev@lists.llvm.org</font></u></a><br> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer" target="_blank"><u><font color="#0000FF">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</font></u></a></li> </ul> </li> </ul> <br> </li></ul>
<p> </p></div></blockquote></div></div></blockquote></div></blockquote>
<div dir="ltr"> </div></div></blockquote></div></div></blockquote></div></blockquote>
<div dir="ltr"> </div></div>
<br>
</blockquote></div>