Bug 119270 - [15 Regression] 5% slowdown of 507.cactuBSSN_r on Intel Ice Lake
Summary: [15 Regression] 5% slowdown of 507.cactuBSSN_r on Intel Ice Lake
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 15.0
: P2 normal
Target Milestone: 15.0
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization, needs-bisection
Depends on:
Blocks: spec
  Show dependency treegraph
 
Reported: 2025-03-13 13:59 UTC by Filip Kastl
Modified: 2025-03-24 16:18 UTC (History)
3 users (show)

See Also:
Host: x86_64-linux
Target: x86_64-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Kastl 2025-03-13 13:59:43 UTC
As seen here

https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=800.437.0

there was a 5% exec time slowdown of the 507.cactuBSSN_r SPEC 2017 benchmark between commits

r15-7920-g62a6a53766ba46
r15-7936-gc6b277f1dc6d11

when run with -O2 -march=generic -flto on an Intel Ice Lake (3rd generation Xeon) machine.
Comment 1 Haochen Jiang 2025-03-17 08:39:13 UTC
From my bisect, it might caused by r15-7932 on single copy for Ice Lake.

Guilty Commit: e355fe414aa3aaf215c7dd9dd789ce217a1b458c
Author: Vladimir N. Makarov
Date: 2025-03-11 04:27:51 Tuesday
Diff: -2.45499181669395%
Message: [PR114991][IRA]: Improve reg equiv invariant calculation

In PR test case IRA preferred to allocate hard reg to a pseudo instead
of its equivalence.  This resulted in allocating caller-saved hard reg
and generating save/restore insns in the function prologue/epilogue.
The equivalence is an invariant (stack pointer plus offset) and the
pseudo is used mostly as memory address.  This happened as there was
no simplification of insn after the invariant substitution.  The patch
adds the necessary code.
Comment 2 Vladimir Makarov 2025-03-17 13:12:21 UTC
Thank you for reporting this.  I am working on analogous PR119285.  I think the fix will be ready on this week.
Comment 3 Vladimir Makarov 2025-03-18 15:58:30 UTC
(In reply to Vladimir Makarov from comment #2)
> Thank you for reporting this.  I am working on analogous PR119285.  I think
> the fix will be ready on this week.

Unfortunately, the patch for PR119285 did not solve cactuBSSN slow down.  I'll be working on this issue and try to fix it as soon as possible, definitely on this week.
Comment 4 GCC Commits 2025-03-19 20:11:26 UTC
The master branch has been updated by Vladimir Makarov <vmakarov@gcc.gnu.org>:

https://gcc.gnu.org/g:6c443e128802bd93158a3db7c4edf5fc1fc76c8d

commit r15-8449-g6c443e128802bd93158a3db7c4edf5fc1fc76c8d
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Wed Mar 19 16:06:41 2025 -0400

    [PR119270][IRA]: Ignore equiv init insns for cost calculation for invariants only
    
    My previous patch for PR114991 contains code ignoring equiv init insns
    for increasing cost of usage the equivalence.  Although common sense says
    it is right thing to do, this results in more aggressive usage of
    memory equivalence and significant performance degradation of SPEC2017
    cactuBSSM.  Given patch restores previous cost calculation for all
    equivalences except for invariant ones.
    
    gcc/ChangeLog:
    
            PR target/119270
            * ira-costs.cc (calculate_equiv_gains): Ignore equiv init insns
            only for invariants.
Comment 5 Haochen Jiang 2025-03-20 03:00:41 UTC
From my run, it should have fixed the regression. Thx!
Comment 6 Filip Kastl 2025-03-24 16:18:30 UTC
Looks fixed even on our benchmarking machine :).  Closing.