[PATCH] [RFC, PGO+LTO] Missed function specialization + partial devirtualization

luoxhu luoxhu@linux.ibm.com
Wed Jun 19 08:50:00 GMT 2019


Hi Martin,

On 2019/6/18 18:21, Martin Liška wrote:
> On 6/18/19 3:45 AM, Xiong Hu Luo wrote:
>>      6.2.  SPEC2017 peakrate:
>>          523.xalancbmk_r (+4.87%); 538.imagick_r (+4.59%); 511.povray_r (+13.33%);
>>          525.x264_r (-5.29%).
> 
> Can you please elaborate what are the key indirect call promotions that are needed
> to achieve such a significant speed up? Are we talking about calls to virtual functions
> or C-style indirect calls?

For benchmark 511.povray_r, no speculations and indirect call promotion
happened from povray_r.wpa.069i.profile_estimate:

     994 171 indirect calls trained.
     995 0 (0.00%) have common target.
     996 0 (0.00%) targets was not found.
     997 0 (0.00%) targets had parameter count mismatch.
     998 0 (0.00%) targets was not in polymorphic call target list.
     999 0 (0.00%) speculations seems useless.
    1000 0 (0.00%) speculations produced.


After applying my patch:

    1259 171 indirect calls trained.
    1260 60 (35.09%) have common target.
    1261 41 (23.98%) targets was not found.
    1262 0 (0.00%) targets had parameter count mismatch.
    1263 0 (0.00%) targets was not in polymorphic call target list.
    1264 57 (33.33%) speculations seems useless.
    1265 5 (2.92%) speculations produced.

Below indirect calls conversion will take effect, as all of these calls
are hot functions, performance boosts a lot by the combination optimization
of later stage ipa/inline/clone.

ls *.*i.* | xargs grep "Expanding speculative call" 

povray_r.ltrans5.076i.inline:Expanding speculative call of 
create_ray.constprop/75445 -> Inside_CSG_Intersection/76219 count: 291083 
(adjusted)
povray_r.ltrans5.076i.inline:Expanding speculative call of 
create_ray.constprop/75445 -> Inside_Plane/76221 count: 387811 (adjusted)
povray_r.ltrans5.076i.inline:Expanding speculative call of 
initialize_ray_container_state_tree/54575 -> Inside_CSG_Intersection/75997 
count: 3784081 (adjusted)
povray_r.ltrans5.076i.inline:Expanding speculative call of 
initialize_ray_container_state_tree/54575 -> Inside_Plane/76062 count: 
5041557 (adjusted)
povray_r.ltrans5.076i.inline:Expanding speculative call of Trace/54564 -> 
All_CSG_Intersect_Intersections/76183 count: 8983544 (adjusted)
povray_r.ltrans5.076i.inline:Expanding speculative call of Trace/54564 -> 
All_Sphere_Intersections/76184 count: 31488162 (adjusted)
povray_r.ltrans5.076i.inline:Expanding speculative call of Trace/54564 -> 
Inside_Plane/76197 count: 19044626 (adjusted)
povray_r.ltrans5.076i.inline:Expanding speculative call of 
All_CSG_Intersect_Intersections/9843 -> All_Sphere_Intersections/76011 
count: 22068935 (adjusted)
povray_r.ltrans5.076i.inline:Expanding speculative call of 
All_CSG_Intersect_Intersections/9843 -> Inside_Plane/76031 count: 13347702 
(adjusted)
povray_r.ltrans6.076i.inline:Expanding speculative call of 
block_light_source/26304 -> All_CSG_Intersect_Intersections/76130 count: 
5434215 (adjusted)
povray_r.ltrans6.076i.inline:Expanding speculative call of 
block_light_source/26304 -> All_Sphere_Intersections/76139 count: 19047432 
(adjusted)
povray_r.ltrans6.076i.inline:Expanding speculative call of 
block_light_source/26304 -> Inside_Plane/76134 count: 11520241 (adjusted)
povray_r.ltrans6.076i.inline:Expanding speculative call of 
Inside_CSG_Union/9845 -> Inside_Plane/76081 count: 830538 (adjusted)
povray_r.ltrans6.076i.inline:Expanding speculative call of 
All_CSG_Union_Intersections/9842 -> All_Plane_Intersections/76049 count: 
1636158 (adjusted)

> 
> Thanks,
> Martin
> 



More information about the Gcc-patches mailing list