<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 25 Jun 2021, at 12:23, Sanne Wouda <<a href="mailto:Sanne.Wouda@arm.com" class="">Sanne.Wouda@arm.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Hi,</span><br class=""></div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; line-break: after-white-space;" class=""><blockquote itemscope="" itemtype="https://schemas.microsoft.com/QuotedText" style="border-color: rgb(200, 200, 200); border-left-width: 3px; border-left-style: solid; padding-left: 1ex; margin-left: 0.8ex;" class=""><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Do you have any data on how often LoopDistribute triggers on a larger set of programs (like llvm-test-suite + SPEC)? AFAIK the implementation is very limited at the moment (geared towards catching the case in hmmer) and I suspect lack of generality is one of the reasons why it is not enabled by default yet.</span></div></blockquote><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">It would be good to have some fresh numbers on how often LoopDistribute triggers. From what I remember, there are a handful of cases in the test suite, but nothing that significantly affects performance (other than hmmer, obviously).</span></div><blockquote itemscope="" itemtype="https://schemas.microsoft.com/QuotedText" style="border-color: rgb(200, 200, 200); border-left-width: 3px; border-left-style: solid; padding-left: 1ex; margin-left: 0.8ex;" class=""><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Also, there’s been an effort to improve the cost-modeling for LoopDistribute (</span><a href="https://reviews.llvm.org/D100381" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">https://reviews.llvm.org/D100381</span></a><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">) Should we make progress in that direction first, before enabling by default?</span></div></blockquote><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Unfortunately, there were some problems with this effort.</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span class="Apple-converted-space"> </span>First, the current implementation of LoopDistribute relies heavily on LoopAccessAnalysis, which made it difficult to adapt.</span><br class=""></div><div class=""><br class=""></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">More</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><span class="Apple-converted-space"> </span>importantly though, I'm not convinced that LoopDistribute will be beneficial other than in cases where it enables more vectorization. (The memcpy detection gcc might be interesting, I didn't look at that.) It reduces both ILP and MLP, which in some cases might be made up by lower register or cache pressure, but this is hard or impossible for the compiler to know.</span></div><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></span></div></div></div></blockquote><div><br class=""></div><div>I think we should be able to make an educated guess at least if we wanted to, although it won’t be straightforward. I think there can be cases where loop distribution can be beneficial on its own, especially for large loops where enough parallelism remains after distributing, but they can be highly target-specific.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="caret-color: rgb(0, 0, 0); font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; line-break: after-white-space;" class=""><div class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">While working on this, with a more aggressive LoopDistribute across several benchmarks, I did not see any improvements that didn't turn out to be noise, and plenty of cases where it was actively degrading performance.</span></div><div class="" style="font-family: Helvetica; font-size: 12px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></span></div></div></div></blockquote><div><br class=""></div>Thanks for the update! It might be good to close the loop on the review as well?</div><div><br class=""></div><div><br class=""></div><div>Cheers,</div><div>Florian</div></body></html>