<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::string &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">https://reviews.llvm.org/D44464</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><div>-Vivek</div></div><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_-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_-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.<wbr>com</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="h5">
<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/<wbr>pipermail/llvm-dev/2017-<wbr>October/118280.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_<wbr>bug.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_-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@<wbr>lists.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_<wbr>bug.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_<wbr>bug.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_<wbr>bug.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>