public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/115462] New: 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0
@ 2024-06-12 15:04 jamborm at gcc dot gnu.org
  2024-06-13  7:24 ` [Bug target/115462] [15 regression] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jamborm at gcc dot gnu.org @ 2024-06-12 15:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115462

            Bug ID: 115462
           Summary: 416.gamess regressed 4-6% on x86_64 since
                    r15-882-g1d6199e5f8c1c0
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jamborm at gcc dot gnu.org
                CC: crazylht at gmail dot com
            Blocks: 26163
  Target Milestone: ---

Benchmark 416.gamess from SPECINT 2006 recently regressed on all
x86_64 CPUs we track using many of the compiler options we track.  I
have bisected the one on Zen3 CPU using -O2 -flto (so -march=generic)
to r15-882-g1d6199e5f8c1c0 (liuhongt: Reduce cost of MEM (A + imm)).

Regressing hosts and options:

  - zen2 -O2 -flto: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=292.50.0
  - zen2 -O2 -march=native: 6%:
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=291.50.0
  - zen2 -O2 -flto -march=native: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=290.50.0
  - zen2 -Ofast: 4%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=300.50.0

  - skylake -O2: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=784.50.0
  - skylake -O2 flto: 4%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=799.50.0
  - skylake -O2 -march=native: 6%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=787.50.0
  - skylake -O2 -flto -march=native: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=788.50.0
  - skylake -Ofast: 4%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=789.50.0

  - zen3 -O2 -flto: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=469.50.0
  - zen3 -O2 -flto -fprofile-use: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=464.50.0
  - zen3 -O2 -flto -march=native: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=465.50.0
  - zen3 -Ofast: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=466.50.0

  - zen4 -O2 -flto: 4%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=956.50.0
  - zen4 -O2 -march=native: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=961.50.0
  - zen4 -O2 -flto -march=native: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=993.50.0
  - zen4 -Ofast: 4%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=967.50.0
  - zen4 -Ofast -march=native: 6%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=965.50.0
  - zen4 -Ofast -flto -march=native: 5%
https://lnt.opensuse.org/db_default/v4/SPEC/graph?plot.0=992.50.0


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/115462] [15 regression] 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0
  2024-06-12 15:04 [Bug target/115462] New: 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0 jamborm at gcc dot gnu.org
@ 2024-06-13  7:24 ` rguenth at gcc dot gnu.org
  2024-06-13  9:09 ` liuhongt at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-13  7:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115462

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|14.0                        |15.0
           Keywords|                            |missed-optimization
             Target|                            |x86_64-*-*
   Target Milestone|---                         |15.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
it might possibly affect IVOPTs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/115462] [15 regression] 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0
  2024-06-12 15:04 [Bug target/115462] New: 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0 jamborm at gcc dot gnu.org
  2024-06-13  7:24 ` [Bug target/115462] [15 regression] " rguenth at gcc dot gnu.org
@ 2024-06-13  9:09 ` liuhongt at gcc dot gnu.org
  2024-06-20  2:00 ` lin1.hu at intel dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2024-06-13  9:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115462

Hongtao Liu <liuhongt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |liuhongt at gcc dot gnu.org

--- Comment #2 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> it might possibly affect IVOPTs

Probably, we're investigating.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/115462] [15 regression] 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0
  2024-06-12 15:04 [Bug target/115462] New: 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0 jamborm at gcc dot gnu.org
  2024-06-13  7:24 ` [Bug target/115462] [15 regression] " rguenth at gcc dot gnu.org
  2024-06-13  9:09 ` liuhongt at gcc dot gnu.org
@ 2024-06-20  2:00 ` lin1.hu at intel dot com
  2024-06-20  6:35 ` lin1.hu at intel dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: lin1.hu at intel dot com @ 2024-06-20  2:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115462

Hu Lin <lin1.hu at intel dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lin1.hu at intel dot com

--- Comment #3 from Hu Lin <lin1.hu at intel dot com> ---
I looked up the hotspot for this test. 

At int2a.F:570 (we output its .f file int2a.fppized.f.), its source code is 

 566       DO 200 K = 1,MAX
 567       MX = NX+KLX(K)
 568       MY = NY+KLY(K)
 569       MZ = NZ+KLZ(K)
 570       N = N1+KLGT(K)
 571   200 GHONDO(N) = ( XIN(MX )*YIN(MY )*ZIN(MZ ) +XIN(MX+625)*YIN(MY+625)*
 572      +     ZIN(MZ+625) +XIN(MX+1250)*YIN(MY+1250)*ZIN(MZ+1250) )*D1*
 573      +     DKL(K)+GHONDO(N)
.

At this loop's beginning, the original ASM code is                              
mov         0x271e3c98(,%rdx,4),%edi                                            
mov         0x271e401c(,%rdx,4),%esi                                            
mov         0x271e43a0(,%rdx,4),%ecx                                            
mov         0x271e3914(,%rdx,4),%r8d                                            
.
But after r15-882-g1d6199e5f8c1c0, the ASM code is
mov $0x27bf6c98, %r10d
mov $0x27bf701c, %r9d
mov $0x27bf73a0, %esi
movl  (%rbx,%rdx,4), %ecx
movl  (%r10,%rdx,4), %edi
movl  (%r9,%rdx,4), %r8d
movl  (%rsi,%rdx,4), %esi
.
In addition to this loop other places also have some similar extra
instructions. These instructions increase the instruction retired by about the
similar percentage as the regression.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/115462] [15 regression] 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0
  2024-06-12 15:04 [Bug target/115462] New: 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0 jamborm at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-06-20  2:00 ` lin1.hu at intel dot com
@ 2024-06-20  6:35 ` lin1.hu at intel dot com
  2024-06-27  6:14 ` cvs-commit at gcc dot gnu.org
  2024-06-27  6:15 ` liuhongt at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: lin1.hu at intel dot com @ 2024-06-20  6:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115462

--- Comment #4 from Hu Lin <lin1.hu at intel dot com> ---
Created attachment 58470
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58470&action=edit
A short case

I tested the file with
1) -Ofast -flto -march=skylake-avx512 -mfpmath=sse -funroll-loops
2) -O2 -march=native (on an Icelake server)

Both generate redundant mov.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/115462] [15 regression] 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0
  2024-06-12 15:04 [Bug target/115462] New: 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0 jamborm at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-06-20  6:35 ` lin1.hu at intel dot com
@ 2024-06-27  6:14 ` cvs-commit at gcc dot gnu.org
  2024-06-27  6:15 ` liuhongt at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-27  6:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115462

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:b8153b5417bed02f47354a14ad36100785dfdc47

commit r15-1673-gb8153b5417bed02f47354a14ad36100785dfdc47
Author: liuhongt <hongtao.liu@intel.com>
Date:   Mon Jun 24 17:53:22 2024 +0800

    Fix wrong cost of MEM when addr is a lea.

    416.gamess regressed 4-6% on x86_64 since my r15-882-g1d6199e5f8c1c0.
    The commit adjust rtx_cost of mem to reduce cost of (add op0 disp).
    But Cost of ADDR could be cheaper than XEXP (addr, 0) when it's a lea.
    It is the case in the PR, the patch adjust rtx_cost to only handle reg
    + disp, for other forms, they're basically all LEA which doesn't have
    additional cost of ADD.

    gcc/ChangeLog:

            PR target/115462
            * config/i386/i386.cc (ix86_rtx_costs): Make cost of MEM (reg +
            disp) just a little bit more than MEM (reg).

    gcc/testsuite/ChangeLog:
            * gcc.target/i386/pr115462.c: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/115462] [15 regression] 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0
  2024-06-12 15:04 [Bug target/115462] New: 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0 jamborm at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-06-27  6:14 ` cvs-commit at gcc dot gnu.org
@ 2024-06-27  6:15 ` liuhongt at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2024-06-27  6:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115462

Hongtao Liu <liuhongt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
Fixed in GCC15.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-06-27  6:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-12 15:04 [Bug target/115462] New: 416.gamess regressed 4-6% on x86_64 since r15-882-g1d6199e5f8c1c0 jamborm at gcc dot gnu.org
2024-06-13  7:24 ` [Bug target/115462] [15 regression] " rguenth at gcc dot gnu.org
2024-06-13  9:09 ` liuhongt at gcc dot gnu.org
2024-06-20  2:00 ` lin1.hu at intel dot com
2024-06-20  6:35 ` lin1.hu at intel dot com
2024-06-27  6:14 ` cvs-commit at gcc dot gnu.org
2024-06-27  6:15 ` liuhongt at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).