public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/98361] New: L1/L2 cache characteristics not recognized with -mtune=znver2
@ 2020-12-17 22:21 sdack at gmx dot com
  2020-12-18  8:53 ` [Bug target/98361] " marxin at gcc dot gnu.org
  2020-12-18 14:01 ` sdack at gmx dot com
  0 siblings, 2 replies; 3+ messages in thread
From: sdack at gmx dot com @ 2020-12-17 22:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98361
           Summary: L1/L2 cache characteristics not recognized with
                    -mtune=znver2
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sdack at gmx dot com
  Target Milestone: ---

Hello,

I've come across an unexpected behaviour of gcc and wanted to ask for
help. I've noticed that when I specify '-march=znver2' does gcc use the
incorrect values for the L1/L2 cache. Only when '-march=native' was used
and gcc detected the CPU at run-time does it use the correct values. For
example on a Ryzen 7 3800X (a Zen 2 CPU):

$ gcc -march=znver2 --help=params -Q|fgrep cache
  --param=l1-cache-line-size=         32
  --param=l1-cache-size=              64
  --param=l2-cache-size=              512

versus:

$ gcc -march=native --help=params -Q|fgrep cache
  --param=l1-cache-line-size=         64
  --param=l1-cache-size=              32
  --param=l2-cache-size=              512

GCC does detect the CPU as 'znver2':

$ gcc -march=native --help=target -Q|fgrep march
  -march=                             znver2

I've also verified this behaviour with '-mtune=znver2', and again does
GCC only use the correct values when it uses auto-detection.

Why does GCC not use the correct L1/L2 cache values when '-march=znver2'
or '-mtune=znver2' is specified?

Sven

PS: I've now also checked parts of the gcc source code and
gcc/config/i386/x86-tune-costs.h (around line 1557) does hold the correct
values and it appears these only don't get used somehow.

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

* [Bug target/98361] L1/L2 cache characteristics not recognized with -mtune=znver2
  2020-12-17 22:21 [Bug target/98361] New: L1/L2 cache characteristics not recognized with -mtune=znver2 sdack at gmx dot com
@ 2020-12-18  8:53 ` marxin at gcc dot gnu.org
  2020-12-18 14:01 ` sdack at gmx dot com
  1 sibling, 0 replies; 3+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-12-18  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
It's already fixed by r11-2755-ga7bbb5b1b1eb09db and the corresponding change
also landed to GCC 10 branch: g:f7e39d1f137202a5d554849f6930ade58c312acd.

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

* [Bug target/98361] L1/L2 cache characteristics not recognized with -mtune=znver2
  2020-12-17 22:21 [Bug target/98361] New: L1/L2 cache characteristics not recognized with -mtune=znver2 sdack at gmx dot com
  2020-12-18  8:53 ` [Bug target/98361] " marxin at gcc dot gnu.org
@ 2020-12-18 14:01 ` sdack at gmx dot com
  1 sibling, 0 replies; 3+ messages in thread
From: sdack at gmx dot com @ 2020-12-18 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sven <sdack at gmx dot com> ---
Thank you.

I did ask about the issue on gcc-help, but I never got a notice about a fix.
Some ninja appears to have cherry-picked it for 10.2.x a few days after my
initial mail.

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

end of thread, other threads:[~2020-12-18 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 22:21 [Bug target/98361] New: L1/L2 cache characteristics not recognized with -mtune=znver2 sdack at gmx dot com
2020-12-18  8:53 ` [Bug target/98361] " marxin at gcc dot gnu.org
2020-12-18 14:01 ` sdack at gmx dot com

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).