Jingu Kang via llvm-dev
2021-Jun-17 12:51 UTC
[llvm-dev] Enabling Loop Distribution Pass as default in the pipeline of new pass manager
Hi All, My colleague Sanne has found performance improvement with '-enable-loop-distribute' option from hmmer on SPEC2006. On the hmmer, there is a loop with dependence. The Loop Distribute pass splits the loop into three sperate loops. One loop has still dependence, another is vectorizable, the other is vectorizable after running LoopBoundSplit pass which needs to be updated a bit. On AArch64, we have seen 40% improvement with enabling Loop Distribute pass and 80% improvement with enabling Loop Distribute pass and LoopBoundSplit from hmmer on SPEC2006.>From llvm-test-suite and spec benchmarks, I have not seen any performance degradation with enabling the Loop Distribute pass because almost all tests are not handled by Loop Distribute pass with mainly below messages. I think the messages are reasonable.Skipping; memory operations are safe for vectorization Skipping; no unsafe dependences to isolate Skipping; multiple exit blocks For compile time, there is no big change because the almost all tests are not handled by the pass due to mainly above three reasons which comes from cached analysis information. At this moment, we can enable the pass with metadata or command line option. If possible, can we enable the Loop Distribute pass as default in the pipeline of new pass manager please? Thanks JinGu Kang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210617/b71ba55f/attachment.html>
Sjoerd Meijer via llvm-dev
2021-Jun-17 15:06 UTC
[llvm-dev] Enabling Loop Distribution Pass as default in the pipeline of new pass manager
My 2 cents: It's not really convincing if a pass trigger on only benchmark case. But on the other hand, if it is a really cheap pass to run (compile-times) and benefits a case, then why not? Perhaps you need to quantify this to make it more convincing. Additional benefit of enabling it by default is that it gets more exposure and testing, which I think is a good thing. Lastly, is there anything we can learn from GCC here? E.g., do they have this enabled, and perhaps support more/other cases? ________________________________ From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Jingu Kang via llvm-dev <llvm-dev at lists.llvm.org> Sent: 17 June 2021 13:51 To: llvm-dev at lists.llvm.org <llvm-dev at lists.llvm.org> Subject: [llvm-dev] Enabling Loop Distribution Pass as default in the pipeline of new pass manager Hi All, My colleague Sanne has found performance improvement with ‘-enable-loop-distribute’ option from hmmer on SPEC2006. On the hmmer, there is a loop with dependence. The Loop Distribute pass splits the loop into three sperate loops. One loop has still dependence, another is vectorizable, the other is vectorizable after running LoopBoundSplit pass which needs to be updated a bit. On AArch64, we have seen 40% improvement with enabling Loop Distribute pass and 80% improvement with enabling Loop Distribute pass and LoopBoundSplit from hmmer on SPEC2006.>From llvm-test-suite and spec benchmarks, I have not seen any performance degradation with enabling the Loop Distribute pass because almost all tests are not handled by Loop Distribute pass with mainly below messages. I think the messages are reasonable.Skipping; memory operations are safe for vectorization Skipping; no unsafe dependences to isolate Skipping; multiple exit blocks For compile time, there is no big change because the almost all tests are not handled by the pass due to mainly above three reasons which comes from cached analysis information. At this moment, we can enable the pass with metadata or command line option. If possible, can we enable the Loop Distribute pass as default in the pipeline of new pass manager please? Thanks JinGu Kang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210617/b12c4f0a/attachment.html>
Michael Kruse via llvm-dev
2021-Jun-17 18:13 UTC
[llvm-dev] Enabling Loop Distribution Pass as default in the pipeline of new pass manager
The LoopDistribute pass doesn't do anything unless it sees llvm.loop.distribute.enable (`#pragma clang loop distribute(enable)`) because it does not have a profitability heuristic. It cannot say whether loop distribution is good for performance or not. What makes it improve hmmer is that the distributed loops can be vectoried. However, LoopDistribute is located before the vectorizer and cannot say in advance whether a distributed loop will be vectorized or not. If not, then it potentially only increased loop overhead. To make -enable-loop-distribute on by default would mean that we could consider loop distribution to be usually beneficial without causing major regressions. We need a lot more data to support that conclusion. Alternatively, we could consider loop-distribution a canonicalization. A later LoopFuse would do the profitability heuristic to re-fuse loops again if loop distribution did not gain anything. Michael