public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade
@ 2024-09-08 10:22 joern274 at googlemail dot com
  2024-09-08 12:56 ` [Bug c++/116645] " joern274 at googlemail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: joern274 at googlemail dot com @ 2024-09-08 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 116645
           Summary: Huge performance loss after 13.2.0 compiler upgrade
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joern274 at googlemail dot com
  Target Milestone: ---

After upgrading g++ compiler from version 11.4.0 (Ubuntu 22.04 LTS) to version
13.2.0 (Ubuntu 24.04 LTS) the compile time for auto-generated verilator code
increased by a factor of *five*.

According to -ftime-report this is mostly due to "reload CSE regs" but I don't
know what this means.

Using this line to compile:
g++ -Os  -I.  -MMD -I/usr/local/share/verilator/include
-I/usr/local/share/verilator/include/vltstd -DVM_COVERAGE=0 -DVM_SC=0
-DVM_TIMING=0 -DVM_TRACE=1 -DVM_TRACE_FST=0 -DVM_TRACE_VCD=1 -faligned-new
-fcf-protection=none -Wno-bool-operation -Wno-shadow -Wno-sign-compare
-Wno-tautological-compare -Wno-uninitialized -Wno-unused-but-set-parameter
-Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable    -O3
-I/usr/include   -c -o Vanalytic_filter_h_a4__ALL.o
Vanalytic_filter_h_a4__ALL.cpp

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

* [Bug c++/116645] Huge performance loss after 13.2.0 compiler upgrade
  2024-09-08 10:22 [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade joern274 at googlemail dot com
@ 2024-09-08 12:56 ` joern274 at googlemail dot com
  2024-09-08 13:43 ` [Bug rtl-optimization/116645] [13/14/15 regression] " sjames at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: joern274 at googlemail dot com @ 2024-09-08 12:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jörn Langheinrich <joern274 at googlemail dot com> ---
Created attachment 59077
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59077&action=edit
ii-file created by -save-temps

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

* [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade
  2024-09-08 10:22 [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade joern274 at googlemail dot com
  2024-09-08 12:56 ` [Bug c++/116645] " joern274 at googlemail dot com
@ 2024-09-08 13:43 ` sjames at gcc dot gnu.org
  2024-09-08 13:48 ` joern274 at googlemail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-09-08 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Huge performance loss after |[13/14/15 regression] Huge
                   |13.2.0 compiler upgrade     |performance loss after
                   |                            |13.2.0 compiler upgrade
          Component|c++                         |rtl-optimization

--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
Please share the full -ftime-report output too.

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

* [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade
  2024-09-08 10:22 [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade joern274 at googlemail dot com
  2024-09-08 12:56 ` [Bug c++/116645] " joern274 at googlemail dot com
  2024-09-08 13:43 ` [Bug rtl-optimization/116645] [13/14/15 regression] " sjames at gcc dot gnu.org
@ 2024-09-08 13:48 ` joern274 at googlemail dot com
  2024-09-08 18:59 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: joern274 at googlemail dot com @ 2024-09-08 13:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jörn Langheinrich <joern274 at googlemail dot com> ---
Created attachment 59078
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59078&action=edit
Output from -ftime-report

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

* [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade
  2024-09-08 10:22 [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade joern274 at googlemail dot com
                   ` (2 preceding siblings ...)
  2024-09-08 13:48 ` joern274 at googlemail dot com
@ 2024-09-08 18:59 ` pinskia at gcc dot gnu.org
  2024-09-09  8:13 ` [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade; reload CSE regs has scalability issues rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-08 18:59 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.4
           Keywords|                            |needs-bisection,
                   |                            |needs-reduction

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

* [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade; reload CSE regs has scalability issues
  2024-09-08 10:22 [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade joern274 at googlemail dot com
                   ` (3 preceding siblings ...)
  2024-09-08 18:59 ` pinskia at gcc dot gnu.org
@ 2024-09-09  8:13 ` rguenth at gcc dot gnu.org
  2024-09-09  8:13 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-09-09  8:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-09-09
            Summary|[13/14/15 regression] Huge  |[13/14/15 regression] Huge
                   |performance loss after      |performance loss after
                   |13.2.0 compiler upgrade     |13.2.0 compiler upgrade;
                   |                            |reload CSE regs has
                   |                            |scalability issues

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
I measure 41s with GCC 13.2, 57% spent in reload CSE regs, vs. 14s with GCC
11.4, 7% spent in reload CSE regs.

The compile-time with -O2 behaves similarly with GCC 13.2 but increases to 36s
with GCC 11.4, also showing the 63% reload CSE regs figure.  So I'd probably
blame inliner heuristic changes for the observed difference but the problem
exposed looks latent.

With -O1, the suggested option for large auto-generated code when you
experience
compile-time or memory-usage issues, GCC 11.4 takes 20s, GCC 13.2 similar
(again both with 53% in reload CSE regs).  Also confirmed with GCC 14.2 and
a somewhat old trunk (r15-2794).

So confirmed.

I don't think bisection will reveal anything interesting.  Somebody needs
to sit down and look at postreload why it takes so long for this testcase.
A profile for GCC 14.2 shows

Samples: 89K of event 'cycles:Pu', Event count (approx.): 114469365450          
Overhead       Samples  Command  Shared Object         Symbol                   
  37.58%         33298  cc1plus  cc1plus               [.]
_ZN10hash_tableI13cselib_hasherLb0E11xcallocatorE19find_slot_with_hashERKPNS0_3keyEj13insert_option
  14.25%         12619  cc1plus  cc1plus               [.]
_Z22rtx_equal_for_cselib_1P7rtx_defS0_12machine_modei
   4.27%          3776  cc1plus  cc1plus               [.]
_Z14bitmap_set_bitP11bitmap_headi

so I'd say it's a bad hash (again).

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

* [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade; reload CSE regs has scalability issues
  2024-09-08 10:22 [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade joern274 at googlemail dot com
                   ` (4 preceding siblings ...)
  2024-09-09  8:13 ` [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade; reload CSE regs has scalability issues rguenth at gcc dot gnu.org
@ 2024-09-09  8:13 ` rguenth at gcc dot gnu.org
  2024-09-09  8:17 ` rguenth at gcc dot gnu.org
  2024-09-09  8:56 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-09-09  8:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 59080
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59080&action=edit
unincluded testcase

This testcase works with all GCCs from 11.4 to trunk.

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

* [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade; reload CSE regs has scalability issues
  2024-09-08 10:22 [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade joern274 at googlemail dot com
                   ` (5 preceding siblings ...)
  2024-09-09  8:13 ` rguenth at gcc dot gnu.org
@ 2024-09-09  8:17 ` rguenth at gcc dot gnu.org
  2024-09-09  8:56 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-09-09  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm checking if it was fixed by r15-2218-g44e065a52fa606

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

* [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade; reload CSE regs has scalability issues
  2024-09-08 10:22 [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade joern274 at googlemail dot com
                   ` (6 preceding siblings ...)
  2024-09-09  8:17 ` rguenth at gcc dot gnu.org
@ 2024-09-09  8:56 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-09-09  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> I'm checking if it was fixed by r15-2218-g44e065a52fa606

Nope.  The profile is still

Samples: 93K of event 'cycles:Pu', Event count (approx.): 122100166487          
Overhead       Samples  Command  Shared Object         Symbol                   
  37.71%         35113  cc1plus  cc1plus               [.]
_ZN10hash_tableI13cselib_hasherLb0E11xcallocatorE19find_slot_with_hashERKPNS0_3keyEj13insert_option
  12.84%         11958  cc1plus  cc1plus               [.]
_Z22rtx_equal_for_cselib_1P7rtx_defS0_12machine_modei
   5.75%          5359  cc1plus  cc1plus               [.]
_ZL13autoinc_splitP7rtx_defPS0_12machine_mode

what looks still dubious is the uses of new_cselib_val with 'next_uid' as
hash and how they are put into the hashtable (how we ever going to find those
again).

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

end of thread, other threads:[~2024-09-09  8:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-08 10:22 [Bug c++/116645] New: Huge performance loss after 13.2.0 compiler upgrade joern274 at googlemail dot com
2024-09-08 12:56 ` [Bug c++/116645] " joern274 at googlemail dot com
2024-09-08 13:43 ` [Bug rtl-optimization/116645] [13/14/15 regression] " sjames at gcc dot gnu.org
2024-09-08 13:48 ` joern274 at googlemail dot com
2024-09-08 18:59 ` pinskia at gcc dot gnu.org
2024-09-09  8:13 ` [Bug rtl-optimization/116645] [13/14/15 regression] Huge performance loss after 13.2.0 compiler upgrade; reload CSE regs has scalability issues rguenth at gcc dot gnu.org
2024-09-09  8:13 ` rguenth at gcc dot gnu.org
2024-09-09  8:17 ` rguenth at gcc dot gnu.org
2024-09-09  8:56 ` rguenth 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).