https://gcc.gnu.org/g:9766f99e6ea365c6ff2c4b1a27a8b9eddb323eb1

commit r16-4009-g9766f99e6ea365c6ff2c4b1a27a8b9eddb323eb1
Author: Jan Hubicka <[email protected]>
Date:   Sun Sep 21 16:52:18 2025 +0200

    Increase auto-fdo profile scaling
    
    Increase scaling factor for auto-fdo profiles.  I origianlly used
    n_bits/2 which is also used by local guessing algorithm.  For local guessing
    algorithm the main factor is to prevent inliner scaling up the profile till
    overflow.
    
    With sane IPA profile large scaling up should essentially never happen. 
Inliner and
    ipa-cp only duplicates code and should only scale down. ipa-icf and tail 
merging merges
    code but not very large number of code paths.
    In practice scaling up still happens when profile is inconsisent, so this 
use
    n_bits-10, which is 50 currently.  The main advantage of this is to reduce 
chances
    things drop to 0 and we hit the various special cases for 0 auto-FDO 
profile.
    
    gcc/ChangeLog:
    
            * auto-profile.cc (autofdo_source_profile::read): Scale profile up 
to
            profile_count::n_bits - 10.

Diff:
---
 gcc/auto-profile.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index ce607a68d2ee..7d867de5bd9d 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -2627,7 +2627,7 @@ autofdo_source_profile::read ()
      bigger than sum_max eventually.  */
   if (afdo_profile_info->sum_max)
     afdo_count_scale
-      = MAX (((gcov_type)1 << (profile_count::n_bits / 2))
+      = MAX (((gcov_type)1 << (profile_count::n_bits - 10))
             / afdo_profile_info->sum_max, 1);
   afdo_profile_info->cutoff *= afdo_count_scale;
   afdo_hot_bb_threshod

Reply via email to