Wael Yehia via llvm-dev
2019-Aug-22 15:50 UTC
[llvm-dev] [RFC] Adding target-specific overrides for Indirect Call Promotion
<font face="Verdana,Arial,Helvetica,sans-serif" size="2"><div><div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;">Hi,</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;">We see improved performance on the PowerPC platform by increasing the aggressiveness of Indirect Call Promotion (ICP).</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;">In particular, lowering the promotion threshold and increasing the maximum number of promotions helps.</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;">The following command line options (default values shown) control some of the ICP parameters:</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> -icp-max-annotations=3</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> -icp-max-prom=3</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> -icp-remaining-percent-threshold=30</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;">We would like to change their defaults to a target specific value.</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> </font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;">I have few questions:</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> 1. Is anyone else interested in having target specific default values for the above options?</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> 2. Is anyone against making the defaults for the above options target dependent?</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> 3. If I were to make the default values target dependent (but allow user specified option to trump the defaults) the question is whether the following is the best and simplest way to do it:</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> - teach `TargetTransformInfo` (TTI) about the above 3 values (basically add 3 integer-returning query functions).</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> - make `PGOinstrumentationUse`, `PGOIndirectCallPromotion`, and `ModuleSummaryIndexAnalysis` passes require the `TargetIRAnalysis` pass so that they can access the TTI instance, and pass it to `ICallPromotionAnalysis`.</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"> The legacy PM passes would be changed symmetrically.</font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;"><br style="box-sizing: inherit;"></font></div><div style="box-sizing: inherit;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" style="box-sizing: inherit;">Thank you.</font></div></div><div><br></div>Wael Yehia<br>Compiler Development<br>IBM Canada Lab<br><a href="mailto:wyehia@ca.ibm.com">wyehia@ca.ibm.com</a></div></font><BR>
Finkel, Hal J. via llvm-dev
2019-Aug-23 05:54 UTC
[llvm-dev] [RFC] Adding target-specific overrides for Indirect Call Promotion
Hi, Wael, Am I correct in assuming that the reason it makes sense for these to be target dependent is because there's on the dependence on the relative cost of checks vs. the indirect-call overhead? There's also a different from other inlining benefits, but I imagine that's more-weakly target dependent. To what would you like to change the max-annotations value? Should this always match the max-prom value? -Hal On 8/22/19 10:50 AM, Wael Yehia via llvm-dev wrote: Hi, We see improved performance on the PowerPC platform by increasing the aggressiveness of Indirect Call Promotion (ICP). In particular, lowering the promotion threshold and increasing the maximum number of promotions helps. The following command line options (default values shown) control some of the ICP parameters: -icp-max-annotations=3 -icp-max-prom=3 -icp-remaining-percent-threshold=30 We would like to change their defaults to a target specific value. I have few questions: 1. Is anyone else interested in having target specific default values for the above options? 2. Is anyone against making the defaults for the above options target dependent? 3. If I were to make the default values target dependent (but allow user specified option to trump the defaults) the question is whether the following is the best and simplest way to do it: - teach `TargetTransformInfo` (TTI) about the above 3 values (basically add 3 integer-returning query functions). - make `PGOinstrumentationUse`, `PGOIndirectCallPromotion`, and `ModuleSummaryIndexAnalysis` passes require the `TargetIRAnalysis` pass so that they can access the TTI instance, and pass it to `ICallPromotionAnalysis`. The legacy PM passes would be changed symmetrically. Thank you. Wael Yehia Compiler Development IBM Canada Lab wyehia at ca.ibm.com<mailto:wyehia at ca.ibm.com> _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190823/2a3236dd/attachment.html>
Wael Yehia via llvm-dev
2019-Aug-23 14:34 UTC
[llvm-dev] [RFC] Adding target-specific overrides for Indirect Call Promotion
<font face="Verdana,Arial,Helvetica,sans-serif" size="2"><div style=""><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">Hi Hal,</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">Yes, we benchmarked the cost of checks vs indirect-call overhead, and ran SPEC and some internal suites with the chosen parameters.</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">We found that in the worst case (when inlining of the specialized calls is disabled) we see equal or better performance</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">when doing up to 7 specializations and when the specialization targets have at least 6-8% frequency</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">compared to a single indirect call.</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">I can share the benchmark if anyone is interested.</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">Given that the current algorithm in ICP applies the threshold on the frequency compared to the "remaining" values, </div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">we set our threshold (-icp-remaining-percent-threshold) to 10 (so the minimum frequencies for 7 candidates will be: 10%, 9%, 8%, 7%, 7%, 6%, 5%).</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">And yes, we would need the max-annotations to match the max-prom values. </div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">So the PowerPC values would be (might differ for subtargets):</div><div style=""><div style=""><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> -icp-max-annotations=7</font></div><div style=""><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> -icp-max-prom=7</font></div><div style=""><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> -icp-remaining-percent-threshold=10</font></div></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></div><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Wael Yehia</font><br><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Compiler Development</font><br><font face="Verdana, Arial, Helvetica, sans-serif" size="2">IBM Canada Lab</font><br><a href="mailto:wyehia@ca.ibm.com" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">wyehia@ca.ibm.com</a></div><br><br><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2" color="#000000" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><font color="#990099">-----"Finkel, Hal J." <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>> wrote: -----</font><div class="iNotesHistory" style="padding-left:5px;"><div style="padding-right:0px;padding-left:5px;border-left:solid black 2px;">To: Wael Yehia <<a href="mailto:wyehia@ca.ibm.com" target="_blank">wyehia@ca.ibm.com</a>>, "<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>From: "Finkel, Hal J." <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>><br>Date: 08/23/2019 01:54AM<br>Subject: [EXTERNAL] Re: [llvm-dev] [RFC] Adding target-specific overrides for Indirect Call Promotion<br><br> <!--Notes ACF <meta http-equiv="Content-Type" content="text/html; charset=utf8">--> <p>Hi, Wael,</p><p>Am I correct in assuming that the reason it makes sense for these to be target dependent is because there's on the dependence on the relative cost of checks vs. the indirect-call overhead? There's also a different from other inlining benefits, but I imagine that's more-weakly target dependent.</p><p>To what would you like to change the max-annotations value? Should this always match the max-prom value?</p><p> -Hal<br></p><div class="moz-cite-prefix">On 8/22/19 10:50 AM, Wael Yehia via llvm-dev wrote:<br></div><blockquote type="cite" cite="mid:OF7E6EA862.0537FB4D-ON0025845E.0056FB24-0025845E.00570017@notes.na.collabserv.com"><font face="Verdana,Arial,Helvetica,sans-serif" size="2"><div><div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2">Hi,</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2">We see improved performance on the PowerPC platform by increasing the aggressiveness of Indirect Call Promotion (ICP).</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2">In particular, lowering the promotion threshold and increasing the maximum number of promotions helps.</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2">The following command line options (default values shown) control some of the ICP parameters:</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> -icp-max-annotations=3</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> -icp-max-prom=3</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> -icp-remaining-percent-threshold=30</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2">We would like to change their defaults to a target specific value.</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> </font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2">I have few questions:</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> 1. Is anyone else interested in having target specific default values for the above options?</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> 2. Is anyone against making the defaults for the above options target dependent?</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> 3. If I were to make the default values target dependent (but allow user specified option to trump the defaults) the question is whether the following is the best and simplest way to do it:</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> - teach `TargetTransformInfo` (TTI) about the above 3 values (basically add 3 integer-returning query functions).</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> - make `PGOinstrumentationUse`, `PGOIndirectCallPromotion`, and `ModuleSummaryIndexAnalysis` passes require the `TargetIRAnalysis` pass so that they can access the TTI instance, and pass it to `ICallPromotionAnalysis`.</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"> The legacy PM passes would be changed symmetrically.</font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2"><br style="box-sizing: inherit;"></font></div><div style="box-sizing: inherit;"><font style="box-sizing: inherit;" face="Verdana, Arial, Helvetica, sans-serif" size="2">Thank you.</font></div></div><div><br></div>Wael Yehia<br>Compiler Development<br>IBM Canada Lab<br><a href="mailto:wyehia@ca.ibm.com" moz-do-not-send="true">wyehia@ca.ibm.com</a></div></font><br><br><fieldset class="mimeAttachmentHeader"></fieldset><div><font face="Courier New,Courier,monospace" size="2">_______________________________________________<br>LLVM Developers mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br><a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></font></div></blockquote><div><font face="Courier New,Courier,monospace" size="2">-- <br>Hal Finkel<br>Lead, Compiler Technology and Programming Languages<br>Leadership Computing Facility<br>Argonne National Laboratory</font></div> </div></div></font></font><BR>
Finkel, Hal J. via llvm-dev
2019-Aug-26 02:52 UTC
[llvm-dev] [RFC] Adding target-specific overrides for Indirect Call Promotion
On 8/23/19 9:34 AM, Wael Yehia wrote: Hi Hal, Yes, we benchmarked the cost of checks vs indirect-call overhead, and ran SPEC and some internal suites with the chosen parameters. We found that in the worst case (when inlining of the specialized calls is disabled) we see equal or better performance when doing up to 7 specializations and when the specialization targets have at least 6-8% frequency compared to a single indirect call. Interesting. I recommend posting some TTI patches and we can go from there. I can share the benchmark if anyone is interested. That sounds useful. Perhaps people can use it to run tests on other targets. -Hal Given that the current algorithm in ICP applies the threshold on the frequency compared to the "remaining" values, we set our threshold (-icp-remaining-percent-threshold) to 10 (so the minimum frequencies for 7 candidates will be: 10%, 9%, 8%, 7%, 7%, 6%, 5%). And yes, we would need the max-annotations to match the max-prom values. So the PowerPC values would be (might differ for subtargets): -icp-max-annotations=7 -icp-max-prom=7 -icp-remaining-percent-threshold=10 Wael Yehia Compiler Development IBM Canada Lab wyehia at ca.ibm.com<mailto:wyehia at ca.ibm.com> -----"Finkel, Hal J." <hfinkel at anl.gov<mailto:hfinkel at anl.gov>> wrote: ----- To: Wael Yehia <wyehia at ca.ibm.com<mailto:wyehia at ca.ibm.com>>, "llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>" <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> From: "Finkel, Hal J." <hfinkel at anl.gov<mailto:hfinkel at anl.gov>> Date: 08/23/2019 01:54AM Subject: [EXTERNAL] Re: [llvm-dev] [RFC] Adding target-specific overrides for Indirect Call Promotion Hi, Wael, Am I correct in assuming that the reason it makes sense for these to be target dependent is because there's on the dependence on the relative cost of checks vs. the indirect-call overhead? There's also a different from other inlining benefits, but I imagine that's more-weakly target dependent. To what would you like to change the max-annotations value? Should this always match the max-prom value? -Hal On 8/22/19 10:50 AM, Wael Yehia via llvm-dev wrote: Hi, We see improved performance on the PowerPC platform by increasing the aggressiveness of Indirect Call Promotion (ICP). In particular, lowering the promotion threshold and increasing the maximum number of promotions helps. The following command line options (default values shown) control some of the ICP parameters: -icp-max-annotations=3 -icp-max-prom=3 -icp-remaining-percent-threshold=30 We would like to change their defaults to a target specific value. I have few questions: 1. Is anyone else interested in having target specific default values for the above options? 2. Is anyone against making the defaults for the above options target dependent? 3. If I were to make the default values target dependent (but allow user specified option to trump the defaults) the question is whether the following is the best and simplest way to do it: - teach `TargetTransformInfo` (TTI) about the above 3 values (basically add 3 integer-returning query functions). - make `PGOinstrumentationUse`, `PGOIndirectCallPromotion`, and `ModuleSummaryIndexAnalysis` passes require the `TargetIRAnalysis` pass so that they can access the TTI instance, and pass it to `ICallPromotionAnalysis`. The legacy PM passes would be changed symmetrically. Thank you. Wael Yehia Compiler Development IBM Canada Lab wyehia at ca.ibm.com<mailto:wyehia at ca.ibm.com> _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory -- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190826/7edb9c86/attachment.html>