Hi Martin,
I noticed ~4.9% performance regression of SPEC CPU 2017 x264 on AArch64
with PGO after this patch.
After a quick look at the perf data, I saw some IPA-CP specializations
are missing. I don't fully understand how this patch works, but if I
increase the value of param ipa-cp-profile-runtime-scaling (default 19)
to 21, the benchmark score can recover.
Could you explain how the default value 19 was chosen? Is it potentially
too conservative for PGO?
Thanks,
Pengfei
On 05/10/2026 16:10, Martin Jambor wrote:
Hello,
On Fri, Sep 04 2026, Martin Jambor wrote:
Hi,
With profile-feedback, the run-times used for opportunity evaluations
is not currently scaled to the total measured run time of the
program/compilation unit, which is an obvious mistake. This patch
adds such scaling by run-time which is however itself also scaled down
so that the resulting scores rougly fall in line with the scores on
hot loops we get using guessed profile.
Kugan, please have a look if this helps addressing the issues you see
with AutoFDO (though I have not looked at whether the default value of
ipa-cp-profile-runtime-scaling is appropriate also for AutoFDO).
I have bootstrapped and tested this on an x86_64-linux in a normal way
and then also did a bootstrap with LTO, PGO and -O3 optimization level.
OK for master?
Martin
gcc/ChangeLog:
2026-05-15 Martin Jambor <[email protected]>
* ipa-cp.cc (overall_scaled_runtime): New.
(good_cloning_opportunity_p): Scale PGO evaluations by
overall_scaled_runtime.
(ipcp_propagate_stage): Calculate also overall_scaled_runtime and
print it and unscaled time.
(ipa_cp_cc_finalize): Set overall_scaled_runtime to zero.
* params.opt (ipa-cp-profile-runtime-scaling): New.
* doc/params.texi (ipa-cp-profile-runtime-scaling): New.
After this was approved by Honza in person, I have pushed this as commit
f9b60a8bd75.
Martin