<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 14, 2016, at 7:37 PM, Xinliang David Li <<a href="mailto:davidxl@google.com" class="">davidxl@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">This work now depends on preparation work to hide strides from the LoopAccessInfo creator interface.<div class=""><br class=""></div><div class="">Adam, what is your plan on this one?</div></div></div></blockquote><div><br class=""></div><div>I haven’t started it yet, was busy with a PR but should get to it in the next couple of days.</div><div><br class=""></div><div>Adam</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">thanks,</div><div class=""><br class=""></div><div class="">David</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jun 14, 2016 at 9:13 AM, Xinliang David Li <span dir="ltr" class=""><<a href="mailto:davidxl@google.com" target="_blank" class="">davidxl@google.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Neat. I will give it a try.<span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">David</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jun 14, 2016 at 2:09 AM, Sean Silva <span dir="ltr" class=""><<a href="mailto:chisophugis@gmail.com" target="_blank" class="">chisophugis@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote"><span class="">On Thu, Jun 9, 2016 at 2:53 PM, Xinliang David Li via llvm-commits <span dir="ltr" class=""><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="">Ok.<div class=""><br class=""></div><div class=""><br class=""></div><div class="">There might be more problems. Suppose we make LAI managed by the LoopAnalysisManager in PM. The analysis has the following interface to build LAI on the the fly and cached by LAM:</div><div class=""><br class=""></div><div class="">class LoopAccessInfoAnalysis {</div><div class="">public:</div><div class="">   typedef LoopAccessInfo ResultType;</div><div class="">   ResultType run(LoopInfo *LI) {  return LoopAccessInfo ( ...); }</div><div class="">};</div><div class=""><br class=""></div><div class="">Here is the question for Chandler. As mentioned by Adam, the LV pass is a function pass. With new PM, its run interface is passed with AnalysisManager<Function> reference.   With a function analysis AM, is it possible to get access to the analyis results managed by LAM?</div><div class=""><br class=""></div><div class="">LoopAccessInfo & LAI = AM.getResult<LoopAccessInfoAnalysis>() ?</div><div class=""><br class=""></div><div class="">If not, is there a way to get reference to the LAM instance associated with the Loop from function AM?</div></div></blockquote><div class=""><br class=""></div></span><div class="">If I understand what you are asking correctly (and my understanding of new PM is correct), what you need is the "LoopAnalysisManagerFunctionProxy". E.g. in this code from LoopPassManager.h</div><div class=""><br class=""></div><div class=""><div class="">  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {</div><div class="">    // Setup the loop analysis manager from its proxy.</div><div class="">    LoopAnalysisManager &LAM =</div><div class="">        AM.getResult<LoopAnalysisManagerFunctionProxy>(F).getManager();</div></div><span class=""><font color="#888888" class=""><div class=""> </div><div class=""><br class=""></div><div class="">-- Sean Silva</div><div class=""><br class=""></div></font></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">thanks,</div><div class=""><br class=""></div><div class="">David</div><div class=""><br class=""></div><div class=""><br class=""></div></div><div class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jun 9, 2016 at 2:01 PM, Adam Nemet <span dir="ltr" class=""><<a href="mailto:anemet@apple.com" target="_blank" class="">anemet@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Jun 9, 2016, at 10:28 PM, Xinliang David Li <<a href="mailto:davidxl@google.com" target="_blank" class="">davidxl@google.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jun 9, 2016 at 1:01 PM, Adam Nemet <span dir="ltr" class=""><<a href="mailto:anemet@apple.com" target="_blank" class="">anemet@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class="">David, FYI, this didn’t make it to Phab due to replying inline.<div class=""><br class=""></div><div class="">Anyhow, we could move the map of stride collection to LAA.  I didn’t do that initially as a shortcut but I can look into doing that, just LMK.</div></div></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I have not looked in detail, but looks like client code have different ways to collect strides: see LoopVectorizor and LoopVersioningLICM.    How do you plan to handle this?</div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">The two functions look identical except that LV also exposes the strides as a set.</div><div class=""><br class=""></div><div class="">To further clarify the plan should be to have LAA collect the symbolic strides and then have LoopVersioning emit the run-time checks and rewrite the versioned loop (instead of LoopVersioningLICM).</div><div class=""><br class=""></div><div class="">LV would have to continue to emit the run-time checks itself because it does not yet use LoopVersioning.</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">Adam</div></font></span><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">David</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""></div><div class="">On Jun 9, 2016, at 6:16 PM, Xinliang David Li <<a href="mailto:davidxl@google.com" target="_blank" class="">davidxl@google.com</a>> wrote:<div class=""><div class=""><blockquote type="cite" class=""><br class=""><div class=""><br class=""><br style="font-family:Helvetica;font-size:10px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:10px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Thu, Jun 9, 2016 at 2:37 AM, Adam Nemet<span class=""> </span><span dir="ltr" class=""><<a href="mailto:anemet@apple.com" target="_blank" class="">anemet@apple.com</a>></span><span class=""> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">anemet added inline comments.<br class=""><span class=""><br class="">================<br class="">Comment at: llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h:704-706<br class="">@@ +703,5 @@<br class="">+private:<br class="">+  /// \brief LoopAccessInfo is created on demand. This map caches<br class="">+  /// the computed results.<br class="">+  DenseMap<Loop *, std::unique_ptr<LoopAccessInfo>> LoopAccessInfoMap;<br class="">+<br class="">----------------<br class=""></span><span class="">chandlerc wrote:<br class="">> This doesn't seem like the right design. It leads to the `getInfo().getInfo()` awkward pattern that IMO is only marginally less awkward spelled as `getResult().getInfo()`.<br class="">><br class="">> Instead, I think this pretty clearly wants to be a Loop analysis in the new pass manager. I think that the caching and map should be the new pass manager's caching and map, rather than rolling our own in a function analysis manager.<br class="">><br class="">> As a consequence, I don't think you need this result type at all. I think the LoopAccessInfo is already the correct result type. I think you'll need the DenseMap and logic around it in the legacy pass manager's function analysis, and you'll want a different query path to use the LoopAnalysisManager directly in the new pass manager.<br class="">><br class="">> Does that make sense?<br class=""></span>Just for the record, this had to be a function pass because the loop vectorizer is a function pass with the legacy PM.<br class=""></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class="">This problem is solvable by providing a function level wrapper for loop access info.</div><div class=""><br class=""></div><div class="">The bigger problem is that the current getter interface not only takes a  LoopInfo, but also a map of strides which is computed outside.  IIUC, current analysis manager in new PM can not handle that.  Chandler, any thought? Should we make LoopAccess Analysis a function analysis for now and handle it later when Loop analysis is more mature?</div><div class=""><br class=""></div><div class="">David</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br class="">It would be great to turn this into a loop pass with the new PM.<br class=""><div class=""><div class=""><br class=""><br class="">Repository:<br class=""> <span class=""> </span>rL LLVM<br class=""><br class=""><a href="http://reviews.llvm.org/D20560" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D20560</a></div></div></blockquote></div></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></div>
</div></blockquote></div></div></div><br class=""></div></blockquote></div><br class=""></div>
</div></div><br class=""></div></div><span class="">_______________________________________________<br class="">
llvm-commits mailing list<br class="">
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="">
<br class=""></span></blockquote></div><br class=""></div></div>
</blockquote></div><br class=""></div>
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>