public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/114532] New: gcc -fno-common option causes performance degradation on certain architectures
@ 2024-03-30  9:47 h13958451065 at 163 dot com
  2024-03-30 18:48 ` [Bug middle-end/114532] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: h13958451065 at 163 dot com @ 2024-03-30  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114532
           Summary: gcc -fno-common option causes performance degradation
                    on certain architectures
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: h13958451065 at 163 dot com
  Target Milestone: ---

gcc 10.3 has turnd off -fcommon into fno-common by default, which led to
performance decrease about 7% (CPU intel sapphire rapids) on UnixBench dhry2reg
subtest.

We found that L1-dcache-load-misses increased under -fno-common option than
-fcommon, which we  suspect is the cause of the performance decrease. 
L1 dcache size is 48K per core in CPU intel sapphire rapids (32 KB instruction
+ 48 KB data).

We have compared the binary layout of the executables generated under -fcommon
and -fno-common, we found that the location offset of XXX_Time and XXX_Glob
global variables in BSS section increased about 10K under -fno-common.
Maybe the increase of bss gap influence the probability of L1-dcache-load-miss.

I am not sure about this conclusion, is there any way to verify our conjecture?

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

* [Bug middle-end/114532] gcc -fno-common option causes performance degradation on certain architectures
  2024-03-30  9:47 [Bug c/114532] New: gcc -fno-common option causes performance degradation on certain architectures h13958451065 at 163 dot com
@ 2024-03-30 18:48 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-30 18:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-03-30
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
Rec_Pointer     Ptr_Glob,
                Next_Ptr_Glob;
int             Int_Glob;
Boolean         Bool_Glob;
char            Ch_1_Glob,
                Ch_2_Glob;
int             Arr_1_Glob [50];
int             Arr_2_Glob [50] [50];
```

Maybe the order of these changed in the layout of the final executable.
In the case of -fcommon, the layout of these are handled by the linker while
with -fno-common, they are handled by compiler into the assembly into the
specific section (and then the sections are combined/laid out by the linker).

So maybe look at the linker map and compare it to what GCC does with
-fno-common in the .s file.

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

end of thread, other threads:[~2024-03-30 18:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-30  9:47 [Bug c/114532] New: gcc -fno-common option causes performance degradation on certain architectures h13958451065 at 163 dot com
2024-03-30 18:48 ` [Bug middle-end/114532] " pinskia 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).