<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<div class="moz-cite-prefix">On 8/23/19 9:34 AM, Wael Yehia wrote:<br>
</div>
<blockquote type="cite" cite="mid:OFCF747CBC.34BEACCB-ON0025845F.0043D5E8-0025845F.0050105D@notes.na.collabserv.com">
<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>
</font></blockquote>
<p><br>
</p>
<p>Interesting. I recommend posting some TTI patches and we can go from there.<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:OFCF747CBC.34BEACCB-ON0025845F.0043D5E8-0025845F.0050105D@notes.na.collabserv.com">
<font face="Verdana,Arial,Helvetica,sans-serif" size="2">
<div style="">
<div style="font-family: Verdana, Arial, Helvetica,
sans-serif; font-size: small;">
I can share the benchmark if anyone is interested.</div>
</div>
</font></blockquote>
<p><br>
</p>
<p>That sounds useful. Perhaps people can use it to run tests on other targets.</p>
<p> -Hal<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:OFCF747CBC.34BEACCB-ON0025845F.0043D5E8-0025845F.0050105D@notes.na.collabserv.com">
<font face="Verdana,Arial,Helvetica,sans-serif" size="2">
<div style="">
<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;" moz-do-not-send="true">wyehia@ca.ibm.com</a></div>
<br>
<br>
<font style="font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;" face="Default Sans
Serif,Verdana,Arial,Helvetica,sans-serif" color="#000000" size="2"><font color="#990099">-----"Finkel, Hal J." <<a href="mailto:hfinkel@anl.gov" target="_blank" moz-do-not-send="true">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" moz-do-not-send="true">wyehia@ca.ibm.com</a>>, "<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" moz-do-not-send="true">llvm-dev@lists.llvm.org</a>" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" moz-do-not-send="true">llvm-dev@lists.llvm.org</a>><br>
From: "Finkel, Hal J." <<a href="mailto:hfinkel@anl.gov" target="_blank" moz-do-not-send="true">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" moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" moz-do-not-send="true">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>
</blockquote>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>