Does git-commit-after-all print correctly after all the passes? Maybe I messed it up and it skip some passes, therefore having less to do?<div><br></div><div>Either that, or piping has a higher cost than writing to file. Looks like it surprisingly spends much less time in system more when going through file. Maybe that's because the file is consistently around the same size and is mmapped into memory continuously, while piping require regular (more than once per module) context switches between the two processes?</div><div><br></div><div>Honestly, I would say something is wrong (aka. first paragraph). I didn't build that with efficiency in mind in any way...</div><div><br><div class="gmail_quote"><div dir="ltr">On Thu, Mar 15, 2018, 07:47 Fedor Sergeev via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hmm...<br>
<br>
I tried Alexandre's fix from D44244 and surprisingly it appears that<br>
just using -print-module-scope w/o<br>
any additional git actions is waaaay slower on my testcase than<br>
-git-commit-module-all.<br>
<br>
Hell, even a plan -print-after-all is slower:<br>
<br>
] time R/bin/opt -O3 some-ir.ll -disable-output -git-commit-after-all<br>
2>/dev/null<br>
real 0m8.041s<br>
user 0m7.133s<br>
sys 0m0.936s<br>
] time R/bin/opt -O3 some-ir.ll -disable-output -print-after-all 2>/dev/null<br>
<br>
real 0m13.575s<br>
user 0m6.179s<br>
sys 0m7.394s<br>
<br>
I cant really explain that...<br>
<br>
regards,<br>
Fedor.<br>
<br>
On 03/15/2018 04:30 PM, Fedor Sergeev via llvm-dev wrote:<br>
><br>
><br>
> On 03/15/2018 01:32 PM, Fedor Sergeev via llvm-dev wrote:<br>
>> For this to be really usable in this setup we need additionally to:<br>
>> - extend -print-module-scope to cover basic block passes<br>
>> - introduce a clear way to separate module IRs as those are being<br>
>> printed by -print-after-all<br>
>><br>
>> But yes, it should work, and a wrapper that pipes to git fast-import<br>
>> seems to be the best way to handle it.<br>
> A simple 20-lines perl script does the trick pretty easily:<br>
> <a href="https://pastebin.com/4J0b5Tr8" rel="noreferrer" target="_blank">https://pastebin.com/4J0b5Tr8</a><br>
><br>
> (this assumes my local modification to introduce the *** END OF ** IR<br>
> DUMP marked at the end of -print-module-scope's IR module dump)<br>
><br>
> ] git init<br>
> ] RA/bin/opt -O3 some-ir.ll -disable-output -print-after-all<br>
> -print-module-scope 2>&1 | filter-LLVM-ir-print.pl | git fast-import<br>
> --done --date-format=now<br>
> ....<br>
><br>
> Majority of time is spent to actually print the IR (~2m for my testcase).<br>
> Fast-import takes just a second.<br>
><br>
> regards,<br>
> Fedor.<br>
><br>
>><br>
>> regards,<br>
>> Fedor.<br>
>><br>
>> On 03/15/2018 12:31 AM, Daniel Neilson via llvm-dev wrote:<br>
>>> The print-module-after-all type of option exists in upstream:<br>
>>> -print-module-scope - When<br>
>>> printing IR for print-[before|after]{-all} always print a module IR<br>
>>><br>
>>> commit 7d160f714357f6784ead669ce516e94991c12e5a<br>
>>> Author: Fedor Sergeev <<a href="mailto:fedor.sergeev@azul.com" target="_blank">fedor.sergeev@azul.com</a><br>
>>> <mailto:<a href="mailto:fedor.sergeev@azul.com" target="_blank">fedor.sergeev@azul.com</a>>><br>
>>> Date: Fri Dec 1 17:42:46 2017 +0000<br>
>>><br>
>>> IR printing improvement for function passes - introducing<br>
>>> -print-module-scope<br>
>>><br>
>>><br>
>>> Summary:<br>
>>> When debugging function passes it happens to be rather useful to<br>
>>> dump<br>
>>> the whole module before the transformation and then use this dump<br>
>>> to analyze this single transformation by running it separately<br>
>>> on that particular module state.<br>
>>><br>
>>><br>
>>> Introducing<br>
>>> -print-module-scope<br>
>>> debugging option that forces all the function-level IR dumps<br>
>>> to become whole-module dumps.<br>
>>><br>
>>><br>
>>> This option builds on top of normal dumping controls like<br>
>>> -print-before/after<br>
>>> -filter-print-funcs<br>
>>><br>
>>><br>
>>> The plan is to eventually extend this option to cover other<br>
>>> local passes<br>
>>> (at least loop passes) but that should go as a separate change.<br>
>>><br>
>>><br>
>>> Loop passes here:<br>
>>> commit 5608259c999fb77c5d6093895696f4daebe6b8cd<br>
>>> Author: Fedor Sergeev <<a href="mailto:fedor.sergeev@azul.com" target="_blank">fedor.sergeev@azul.com</a><br>
>>> <mailto:<a href="mailto:fedor.sergeev@azul.com" target="_blank">fedor.sergeev@azul.com</a>>><br>
>>> Date: Fri Dec 1 18:33:58 2017 +0000<br>
>>><br>
>>> IR printing improvement for loop passes - handle<br>
>>> -print-module-scope<br>
>>><br>
>>><br>
>>> -Daniel<br>
>>><br>
>>><br>
>>>> On Mar 14, 2018, at 3:51 PM, Philip Reames via llvm-dev<br>
>>>> <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a> <mailto:<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>> wrote:<br>
>>>><br>
>>>> This is interesting, and might be useful. I don't know that this<br>
>>>> is broadly useful enough for upstream inclusion, but if you could<br>
>>>> post this to github somewhere, I might play with it.<br>
>>>><br>
>>>> There might also be room to factor out common functionality. We've<br>
>>>> also run into the need to print whole-module instead of containing<br>
>>>> construct (i.e. this loop). If we added upstream support for<br>
>>>> something along the lines of -print-module-after-all, building the<br>
>>>> git history could easily be done as a post processing step.<br>
>>>><br>
>>>> Philip<br>
>>>><br>
>>>><br>
>>>> On 03/06/2018 10:43 AM, Alexandre Isoard via llvm-dev wrote:<br>
>>>>> Hello,<br>
>>>>><br>
>>>>> I had a stupid idea recently that turned out not so stupid after<br>
>>>>> all. I wanted to be able to "see" an entire pass pipeline in<br>
>>>>> action to find unnecessary transformations and/or missed<br>
>>>>> opportunities and generally improve the debug-ability of LLVM.<br>
>>>>><br>
>>>>> So as the title suggest, I implemented an equivalent of<br>
>>>>> "-print-after-all" but instead of printing into stdout I dump into<br>
>>>>> a file that get commit into a temporary git. There are some quirks<br>
>>>>> with it but it's working and is actually awesome. For example, at<br>
>>>>> first sight, I see multiple time lcssa and instcombine cancelling<br>
>>>>> each other's work.<br>
>>>>><br>
>>>>> Of course, that has a big impact on compile time when enabled, but<br>
>>>>> that's still practical (git being quite good at its job) when<br>
>>>>> debugging.<br>
>>>>><br>
>>>>> There are improvement I can make, but would you guys be interested<br>
>>>>> in such feature?<br>
>>>>><br>
>>>>> --<br>
>>>>> *Alexandre Isoard*<br>
>>>>><br>
>>>>><br>
>>>>> _______________________________________________<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> LLVM Developers mailing list<br>
>>>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a> <mailto:<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>><br>
>> _______________________________________________<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
> _______________________________________________<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
_______________________________________________<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>