<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 7, 2018 at 4:05 PM, Philip Pfaffe <span dir="ltr"><<a href="mailto:philip.pfaffe@gmail.com" target="_blank">philip.pfaffe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Vivek,<div><br></div><div>can you elaborate why you're looking for a one-size-fits-all solution? What is the noteworthy benefit over adding a new-pm specific implementation?</div></div></blockquote><div>I am happy with new-pm specific implementation but for example with experimental pass manager  switch clang have to use legacy pm for code generation so in such case if user want to use opt-bisect to investigate code generation passes then we need to add code which will initialize OptBisect class with remaining pass execution count. Or we need to inform that opt-bisect for new pass manager will work for passes that are ported to it.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Several changes you mention are purely for the benefit of supporting the legacy PM (which already has a working, tried, and tested solution). E.g. `getCounterIdForName`, the FIXMEs you mention, and the callbacks. All of these are heavyweight changes, but I don't see an upside of going this direction.</div><div><br></div></div></blockquote><div>I agreed that above mentioned changes are sufficiently big and need thorough testing. But I have a simpler alternative to address above mentioned issue. We can use debug counter added for new-PM in legacy-pm code when ever it is available and OptBisect limit is not set.</div><div>-Vivek</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>Cheers,</div><div>Philip</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2018-05-06 10:59 GMT+02:00 vivek pandya <span dir="ltr"><<a href="mailto:vivekvpandya@gmail.com" target="_blank">vivekvpandya@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello all,<div><br></div><div>After reading OptBisect and DebugCounter related code and playing bit around it I have following simple design:</div><div><br></div><div><div>- Add a debug counter for opt-bisect. Initilize it against option -opt-bisect-limit=<limit>.</div><div>- DebugCounter is a singleton class so can be accessed by both new and legacy passmanager.</div><div>  We may need few more static method like getCounterIdForName(std::strin<wbr>g &Name) etc.</div><div>- Use it to decide if this pass is required to be executed or not.</div><div>- For new passmaager just before executing run() for a pass we can check this counter.</div><div>- For legacy pass manager we can directly use this debug counter in skipFunction()/skipModule() etc method.</div><div>- There is already FIXME: added for moving getDescription() from OptBisect class to respective</div><div>  IR units like Loop, Region etc. So that new pass manager can also use those methods.</div><div>- However to support feature added in this <a href="https://reviews.llvm.org/D44464" target="_blank">https://reviews.llvm.org/D4446<wbr>4</a> we may need to add a callback function </div><div>  pointer that can be set and if present use it instead for normal counter value check to decide if a pass should</div><div>  be executed or not. Or some other mechanism to provide this feature.</div><div>- I am not completely sure but if we are able provide custom callback feature then we may be able to remove OptBiset and OptPassGate</div><div>  class.</div></div><div><br></div><div>Anything missed here?</div><div><br></div><div>Please share your thoughts.</div><span class="m_8779723071390834700HOEnZb"><font color="#888888"><div>-Vivek</div></font></span></div><div class="m_8779723071390834700HOEnZb"><div class="m_8779723071390834700h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 3, 2018 at 12:34 AM, Kaylor, Andrew <span dir="ltr"><<a href="mailto:andrew.kaylor@intel.com" target="_blank">andrew.kaylor@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div class="m_8779723071390834700m_-4661480056693712235m_-2650635576382257744WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">As a point of clarification, optnone is already being handled by the pass itself in the legacy implementation. The skip[IR unit] functions are provided by the
 pass base classes, and the attribute is checked there. This happens any time the legacy wrapper is run, no matter how it is run.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Regarding the opt-bisect design, I’m not particularly fond of the managed static either, but I do want to mention a couple of things that I don’t want to lose
 about the current solution. First, it is important that we continue to print out information about the passes and the IR units as they are run or skipped. Our QA team uses this information as a first step in identifying the source of failures. Second, a change
 was recently introduced to generalizing the opt bisect interface (as obtained through the LLVMContext) so that clients can plug in other mechanism that use other criteria for stopping compilation.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">-Andy<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_8779723071390834700_m_-4661480056693712235_m_-2650635576382257744__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></a></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Philip Pfaffe [mailto:<a href="mailto:philip.pfaffe@gmail.com" target="_blank">philip.pfaffe@gmail.co<wbr>m</a>]
<br>
<b>Sent:</b> Wednesday, May 02, 2018 3:57 AM<br>
<b>To:</b> vivek pandya <<a href="mailto:vivekvpandya@gmail.com" target="_blank">vivekvpandya@gmail.com</a>><br>
<b>Cc:</b> Kaylor, Andrew <<a href="mailto:andrew.kaylor@intel.com" target="_blank">andrew.kaylor@intel.com</a>>; <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] Need guidance to work on NEW PASS managers bugs<u></u><u></u></span></p><div><div class="m_8779723071390834700m_-4661480056693712235h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi Vivek,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">bisect and optnone are certainly low hanging fruit in terms of implementation. On the other hand they need a cleaner design than they have now. E.g., OptBisect today is a managed static, which we absolutely should get rid of. Instead, bisect
 functionality can be much more cleanly implemented on top of the debug counters!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">While the function call for optnone doesn't strike me as similarly bad, there is another angle there. I think optnone should be handled by the passes, and not the manager. Considering running the pass outside of a manager, you'd probably
 expect it to respect optnone.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">In summary, while easy to implement, these things need reconsidering and a solid RFC. So if you want to work on this, you should draft such a design document and post it to the list to collect comments and requests from the community.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Cheers,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Philip<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">2018-05-01 21:01 GMT+02:00 vivek pandya via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, May 1, 2018 at 10:52 PM, Kaylor, Andrew <<a href="mailto:andrew.kaylor@intel.com" target="_blank">andrew.kaylor@intel.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Hi Vivek,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Have you read the mailing list threads on this topic? I don’t believe we’re quite ready to make the
 switch yet. There was a discussion last October about what was left to be done. I’m sure it has been discussed since then too. Here’s a link to the start of the October discussion.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><a href="http://lists.llvm.org/pipermail/llvm-dev/2017-October/118280.html" target="_blank">http://lists.llvm.org/pipermai<wbr>l/llvm-dev/2017-October/118280<wbr>.html</a></span><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal">Yes I have gone through that mail chain. One thing mentioned in that was Code Generation does not use new PM so I wanted to start working in that direction. <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">If you’d like to get involved, one possible area you could contribute is adding optbisect/optnone support
 as mentioned in this bug:</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><a href="https://bugs.llvm.org/show_bug.cgi?id=28316" target="_blank">https://bugs.llvm.org/show_bug<wbr>.cgi?id=28316</a></span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">If that looks like something you’re interested in I can offer some guidance with it.</span><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal">Sure I am happy to work on it. Could you please update the bug with your thoughts on how that needs to be done?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">-Vivek <u></u><u></u></span></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Andy</span><u></u><u></u></p>
<p class="MsoNormal"><a name="m_8779723071390834700_m_-4661480056693712235_m_-2650635576382257744_m_390193726553747951_m_74862985540904827"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span></a><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists<wbr>.llvm.org</a>]
<b>On Behalf Of </b>vivek pandya via llvm-dev<br>
<b>Sent:</b> Saturday, April 28, 2018 9:23 AM<br>
<b>To:</b> llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Subject:</b> [llvm-dev] Need guidance to work on NEW PASS managers bugs</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">Hello LLVM-Devs,<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I am trying to get some starting points for working on following new pass manager related bugs:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://bugs.llvm.org/show_bug.cgi?id=28322" target="_blank">https://bugs.llvm.org/show_bug<wbr>.cgi?id=28322</a> [PM] Remove use of old PM in the middle-end.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://bugs.llvm.org/show_bug.cgi?id=28323" target="_blank">https://bugs.llvm.org/show_bug<wbr>.cgi?id=28323</a> [PM] Use new PM in production for Clang, LLD, libLTO, etc.
 middle-end<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://bugs.llvm.org/show_bug.cgi?id=28321" target="_blank">https://bugs.llvm.org/show_bug<wbr>.cgi?id=28321</a> [PM] Remove use of old PM in the backend<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I read related code but did not get a good starting point.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Can someone guide me through this? Can we add more details to these bugs? Or can we further divide these bugs to smaller workable items?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Any help will be appreciated.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Vivek<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>