public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* L1/L2 cache characteristics and -mtune=znver2 versus run-time detection
@ 2020-12-05 17:46 Sven C. Dack
  2020-12-16 16:30 ` Sven C. Dack
  0 siblings, 1 reply; 4+ messages in thread
From: Sven C. Dack @ 2020-12-05 17:46 UTC (permalink / raw)
  To: gcc-help

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


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-05 17:46 L1/L2 cache characteristics and -mtune=znver2 versus run-time detection Sven C. Dack
2020-12-16 16:30 ` Sven C. Dack
2020-12-16 17:33   ` Segher Boessenkool
     [not found]     ` <3f4c127e-3cdd-5a4e-ef56-d5d62a88e30a@gmx.com>
     [not found]       ` <20201218101512.GQ2672@gate.crashing.org>
     [not found]         ` <20201218101912.GR2672@gate.crashing.org>
2020-12-18 13:32           ` Sven C. Dack

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