Re: L1/L2 cache characteristics and -mtune=znver2 versus run-time detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Could some of the GCC experts please share their knowledge on this issue?


On 05/12/2020 17:46, Sven C. Dack wrote:
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





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux