<div dir="ltr">Hi Arnaud,<div><br></div><div>Sorry for the delay. It has been a while time since I looked at the spill cost estimation code so I had to think about this a bit.</div><div><br></div><div>It looks like this code has no impact on greedy, so if you have measured an improvement in PBQP's allocations with this patch I'm happy for it to go in.</div><div><br></div><div>That said, I hope to come back soon and re-work these estimates to use a more consistent model. Ideally everything should be either estimated cycles of overhead (when compiling for speed) or estimated code-size overhead (when compiling for size). As you mentioned, this will all have to change when we fix the spill placement, so that might be a good time to revisit this.</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 22, 2014 at 6:24 AM, Arnaud A. de Grandmaison <span dir="ltr"><<a href="mailto:arnaud.degrandmaison@arm.com" target="_blank">arnaud.degrandmaison@arm.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-GB" link="blue" vlink="purple"><div><p class="MsoNormal">Hi Lang,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Could you please review the attached patch ? This is the first out of three.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">This patch improves how the different costs (register, interference, spill<u></u><u></u></p><p class="MsoNormal">and coalescing) relates together. The assumption is now that:<u></u><u></u></p><p class="MsoNormal"> - coalescing (or any other "side effect" of reg alloc) is negative, and<u></u><u></u></p><p class="MsoNormal">   instead of being derived from a spill cost, they use the block<u></u><u></u></p><p class="MsoNormal">   frequency info.<u></u><u></u></p><p class="MsoNormal"> - spill costs are in the [MinSpillCost:+inf( range<u></u><u></u></p><p class="MsoNormal"> - register or interference costs are in [0.0:MinSpillCost( or +inf<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The current MinSpillCost is set to 10.0, which is a random value high<u></u><u></u></p><p class="MsoNormal">enough that the current constraint builders do not need to worry about<u></u><u></u></p><p class="MsoNormal">when settings costs. It would however be worth adding a normalization<u></u><u></u></p><p class="MsoNormal">step for register and interference costs as the last step in the<u></u><u></u></p><p class="MsoNormal">constraint builder chain to ensure they are not greater than SpillMinCost<u></u><u></u></p><p class="MsoNormal">(unless this has some sense for some architectures). This would work well<u></u><u></u></p><p class="MsoNormal">with the current builder pipeline, where all costs are tweaked relatively<u></u><u></u></p><p class="MsoNormal">to each other’s, but could grow above MinSpillCost if the pipeline is<u></u><u></u></p><p class="MsoNormal">deep enough.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The current heuristic is tuned to depend rather on the number of uses of<u></u><u></u></p><p class="MsoNormal">a live interval rather than a density of uses, as used by the greedy<u></u><u></u></p><p class="MsoNormal">allocator. This heuristic provides a few percent improvement on a number<u></u><u></u></p><p class="MsoNormal">of benchmarks (eembc, spec, ...) and will definitely need to change once<u></u><u></u></p><p class="MsoNormal">spill placement is implemented: the current spill placement is really<u></u><u></u></p><p class="MsoNormal">inefficient, so making the cost proportional to the number of use is a<u></u><u></u></p><p class="MsoNormal">clear win.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">This is the only patch in this PBQP improvement serie without a testcase<u></u><u></u></p><p class="MsoNormal">because this patch widely changes allocation, and it is hard to isolate simple and<u></u><u></u></p><p class="MsoNormal">meaningful testcases for it. The 2 following patches, which are addressing specific<u></u><u></u></p><p class="MsoNormal">areas of the allocator have a testcase.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Cheers,<u></u><u></u></p><p class="MsoNormal"><span>--<u></u><u></u></span></p><p class="MsoNormal"><span>Arnaud A. de Grandmaison<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p></div></div></blockquote></div><br></div>