<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="">Hi Diana,<div class=""><br class=""></div><div class="">I’ve actually gone ahead and pushed the fix as I was able to produce a small reproducer.</div><div class=""><br class=""></div><div class="">This is <span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">r304244</span><div><br class=""></div><div>Let me know if you encounter any other problem.</div><div><br class=""></div><div>Cheers,</div><div>-Quentin<br class=""><blockquote type="cite" class=""><div class="">On May 30, 2017, at 7:42 AM, Quentin Colombet via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Thanks Diana.<br class=""><br class="">That is indeed the assumption in the code and this is obviously wrong.<br class=""><br class="">Could you try the attached patch?<br class=""><br class="">(I haven’t even tried to compile it though)<br class=""><br class="">Cheers,<br class="">-Quentin<br class=""><span id="cid:1F6F0F97-86C9-415E-9F99-FC6E97F24E79@apple.com"><localizer_tentative_fix.diff></span><br class=""><blockquote type="cite" class="">On May 30, 2017, at 6:56 AM, Diana Picus <<a href="mailto:diana.picus@linaro.org" class="">diana.picus@linaro.org</a>> wrote:<br class=""><br class="">Hi Quentin,<br class=""><br class="">I've attached a reproducer for the problem.<br class=""><br class="">I've described what I think the problem is in the file, but the short<br class="">version is that the localizer shouldn't assume that the iteration<br class="">order for the uses corresponds to the logical order of instructions in<br class="">a basic block (we're now localizing before the first use that we find,<br class="">but that may be later in the basic block, so we'd end up with uses<br class="">before the def).<br class=""><br class="">I'm not sure it's possible to test this without running a couple of<br class="">passes. You might be able to trigger it only with reg bank select +<br class="">localize, but I haven't tried. Using only the localizer would mean<br class="">that the iteration order for the uses would be the order in which<br class="">they're read in, so you wouldn't have this problem.<br class=""><br class="">Hope that helps,<br class="">Diana<br class=""><br class=""><br class="">On 29 May 2017 at 10:06, Diana Picus <<a href="mailto:diana.picus@linaro.org" class="">diana.picus@linaro.org</a>> wrote:<br class=""><blockquote type="cite" class="">Thanks Quentin, it's in progress now, I'll let you know how it goes.<br class=""><br class="">Cheers,<br class="">Diana<br class=""><br class="">On 27 May 2017 at 03:36, Quentin Colombet <<a href="mailto:qcolombet@apple.com" class="">qcolombet@apple.com</a>> wrote:<br class=""><blockquote type="cite" class="">Hi Kristof,<br class=""><br class="">I’ve pushed the localizer in r304051 and added it in the AArch64 O0 pipeline<br class="">in r304052.<br class=""><br class="">I let Diana investigate the seg fault she was seeing.<br class=""><br class="">@Diana, let me know if you need help.<br class=""><br class="">Cheers,<br class="">-Quentin<br class=""><br class="">On May 25, 2017, at 1:53 PM, Quentin Colombet via llvm-dev<br class=""><<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""><br class="">Hi Kristof,<br class=""><br class="">On May 25, 2017, at 2:09 AM, Kristof Beyls <<a href="mailto:kristof.beyls@arm.com" class="">kristof.beyls@arm.com</a>> wrote:<br class=""><br class=""><br class="">On 24 May 2017, at 22:01, Quentin Colombet <<a href="mailto:qcolombet@apple.com" class="">qcolombet@apple.com</a>> wrote:<br class=""><br class="">Hi Kristof,<br class=""><br class="">Thanks for going back so fast!<br class=""><br class="">On May 24, 2017, at 12:57 PM, Kristof Beyls <<a href="mailto:kristof.beyls@arm.com" class="">kristof.beyls@arm.com</a>> wrote:<br class=""><br class=""><br class="">On 24 May 2017, at 19:31, Quentin Colombet <<a href="mailto:qcolombet@apple.com" class="">qcolombet@apple.com</a>> wrote:<br class=""><br class="">Hi Kristof,<br class=""><br class="">Thanks for the measurements.<br class=""><br class="">On May 24, 2017, at 6:00 AM, Kristof Beyls <<a href="mailto:kristof.beyls@arm.com" class="">kristof.beyls@arm.com</a>> wrote:<br class=""><br class=""><br class="">- Comparing against -O0 without globalisel but with the above regalloc<br class="">options: 5.6% performance drop, 1% code size drop.<br class=""><br class="">In summary, the measurements indicate some good improvements.<br class="">I also haven't measure the impact on compile time.<br class=""><br class=""><br class="">Do you have a mean to make this measurement?<br class="">Ahmed did a bunch of compile time measurements on our side and I wanted to<br class="">see if I need to put him on the hook again :).<br class=""><br class=""><br class="">I did a quick setup with CTMark (part of the test-suite). I ran each of<br class="">* '-O0 -g',<br class="">* '-O0 -g -mllvm -global-isel=true -mllvm -global-isel-abort=0', and<br class="">* '-O0 -g -mllvm -global-isel=true -mllvm -global-isel-abort=0 -mllvm<br class="">-optimize-regalloc -mllvm -regalloc=greedy'<br class="">5 times, cross-compiling from X86 to AArch64, and took the median measured<br class="">compile times.<br class="">In summary, I see GlobalISel having a compile time that's 3.5% higher than<br class="">the current -O0 default.<br class="">With enabling the greedy register allocator, this increases to 28%.<br class="">28% is probably too high?<br class=""><br class=""><br class="">I think it is yes.<br class="">I have attached a quick hack to the greedy allocator to feature a fast mode.<br class="">Could you give it a try?<br class=""><br class="">To enable the fast mode, please use (-mllvm) -regalloc-greedy-fast=true<br class="">(default is false).<br class=""><br class=""><br class="">I'm afraid it doesn't seem to save much compile time. On geomean, I see<br class="">about 26% compile time increase against the current -O0 default (compared to<br class="">28% increase for regalloc greedy without your patch).<br class=""><br class=""><br class="">Interesting, I guess a lot of time is spent in the coalescer. Could you give<br class="">a try with -join-liveintervals=false?<br class=""><br class=""><br class="">With adding -join-liveintervals=false, I see the compile time increase going<br class="">up to 28% again.<br class=""><br class=""><br class="">Heh, I am mildly surprised we hand much more live-ranges to the allocator<br class="">when we do that.<br class=""><br class=""><br class=""><br class="">Do you know where the time is spent (-time-passes)?<br class=""><br class=""><br class="">I'm afraid I won't have time to have a closer look in the next couple of<br class="">days - I don't know where the time is spent at the moment.<br class=""><br class=""><br class="">Fair enough, will investigate later.<br class=""><br class=""><br class=""><br class="">Anyhow, fixing all of those, although this is I think the right approach,<br class="">will take time, so we can go with the localizer.<br class=""><br class=""><br class="">Right, I don't understand the register allocator well enough to know if that<br class="">compile time overhead can be fixed, while still getting the necessary<br class="">codegen benefits the greedy allocator gives.<br class="">Is there any specific help you're looking for with getting the localizer<br class="">work well enough for production use?<br class=""><br class=""><br class="">I’ll clean-up the WIP patch for the localizer, then you guys can fix the bug<br class="">that you found.<br class=""><br class="">I’ll do that tomorrow.<br class=""><br class="">Cheers,<br class="">-Quentin<br class=""><br class=""><br class="">Thanks,<br class=""><br class="">Kristof<br class=""><br class=""><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""><br class=""><br class=""></blockquote></blockquote><localizer-mo-order.mir><br class=""></blockquote><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></div></blockquote></div><br class=""></div></body></html>