diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2025-06-21 05:37:24 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@ucw.cz> | 2025-06-21 05:37:24 +0200 |
commit | d29cf57f9e4e9e16285a627a1717269ef7cf131b (patch) | |
tree | e64a76e267aaebf263f56bc91e1baab970180abd /gcc/common/config/m68k/m68k-common.cc | |
parent | 8f40a8e8f8d1ebe931d52f914533036c2f950814 (diff) | |
download | gcc-master.zip gcc-master.tar.gz gcc-master.tar.bz2 |
This patch makes the AFDO's VPT to happen during early inlining. This should
make the einline pass inside afdo pass unnecesary, but some inlining still
happens there - I will need to debug why that happens and will try to drop the
afdo's inliner incrementally.
get_inline_stack_in_node can now be used to produce inline stack out of
callgraph nodes which are marked as inline clones, so we do not need to iterate
tree-inline and IPA decisions phases like old code did. I also added some
debug facilities - dumping of decisions and inline stacks, so one can match
them with data in gcov profile.
Former VPT pass identified all caes where in train run indirect call was inlined
and the inlined callee collected some samples. In this case it forced inline without
doing any checks, such as whether inlining is possible.
New code simply introduces speculative edges into callgraph and lets afdo inlining
to decide. Old code also marked statements that were introduced during promotion
to prevent doing double speculation i.e.
if (ptr == foo)
.. inlined foo ...
else
ptr ();
to
if (ptr == foo)
.. inlined foo ...
else if (ptr == foo)
foo (); // for IPA inlining
else
ptr ();
Since inlning now happens much earlier, tracking the statements would be quite hard.
Instead I simply remove the targets from profile data which sould have same effect.
I also noticed that there is nothing setting max_count so all non-0 profile is
considered hot which I fixed too.
Training with ref run I now get
500.perlbench_r 1 160 9.93 * 1 162 9.84 *
502.gcc_r NR NR
505.mcf_r 1 186 8.68 * 1 194 8.34 *
520.omnetpp_r 1 183 7.15 * 1 208 6.32 *
523.xalancbmk_r NR NR
525.x264_r 1 85.2 20.5 * 1 85.8 20.4 *
531.deepsjeng_r 1 165 6.93 * 1 176 6.51 *
541.leela_r 1 268 6.18 * 1 282 5.87 *
548.exchange2_r 1 86.3 30.4 * 1 88.9 29.5 *
557.xz_r 1 224 4.81 * 1 224 4.82 *
Est. SPECrate2017_int_base 9.72
Est. SPECrate2017_int_peak 9.33
503.bwaves_r NR NR
507.cactuBSSN_r 1 107 11.9 * 1 105 12.0 *
508.namd_r 1 108 8.79 * 1 116 8.18 *
510.parest_r 1 143 18.3 * 1 156 16.8 *
511.povray_r 1 188 12.4 * 1 163 14.4 *
519.lbm_r 1 72.0 14.6 * 1 75.0 14.1 *
521.wrf_r 1 106 21.1 * 1 106 21.1 *
526.blender_r 1 147 10.3 * 1 147 10.4 *
527.cam4_r 1 110 15.9 * 1 118 14.8 *
538.imagick_r 1 104 23.8 * 1 105 23.7 *
544.nab_r 1 146 11.6 * 1 143 11.8 *
549.fotonik3d_r 1 134 29.0 * 1 169 23.1 *
554.roms_r 1 86.6 18.4 * 1 89.3 17.8 *
Est. SPECrate2017_fp_base 15.4
Est. SPECrate2017_fp_peak 14.9
Base is without profile feedback and peak is AFDO.
gcc/ChangeLog:
* auto-profile.cc (dump_inline_stack): New function.
(get_inline_stack_in_node): New function.
(get_relative_location_for_stmt): Add FN parameter.
(has_indirect_call): Remove.
(function_instance::find_icall_target_map): Add FN parameter.
(function_instance::remove_icall_target): New function.
(function_instance::read_function_instance): Set sum_max.
(autofdo_source_profile::get_count_info): Add NODE parameter.
(autofdo_source_profile::update_inlined_ind_target): Add NODE parameter.
(autofdo_source_profile::remove_icall_target): New function.
(afdo_indirect_call): Add INDIRECT_EDGE parameter; dump reason
for failure; do not check for recursion; do not inline call.
(afdo_vpt): Add INDIRECT_EDGE parameter.
(afdo_set_bb_count): Do not take PROMOTED set.
(afdo_vpt_for_early_inline): Remove.
(afdo_annotate_cfg): Do not take PROMOTED set.
(auto_profile): Do not call afdo_vpt_for_early_inline.
(afdo_callsite_hot_enough_for_early_inline): Dump count.
(remove_afdo_speculative_target): New function.
* auto-profile.h (afdo_vpt_for_early_inline): Declare.
(remove_afdo_speculative_target): Declare.
* ipa-inline.cc (inline_functions_by_afdo): Do VPT.
(early_inliner): Redirecct edges if inlining happened.
* tree-inline.cc (expand_call_inline): Add sanity check.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-prof/afdo-vpt-earlyinline.c: Update template.
* gcc.dg/tree-prof/indir-call-prof-2.c: Update template.
Diffstat (limited to 'gcc/common/config/m68k/m68k-common.cc')
0 files changed, 0 insertions, 0 deletions