public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sdack at gmx dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/98361] New: L1/L2 cache characteristics not recognized with -mtune=znver2
Date: Thu, 17 Dec 2020 22:21:17 +0000	[thread overview]
Message-ID: <bug-98361-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2020-12-17 22:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 22:21 sdack at gmx dot com [this message]
2020-12-18  8:53 ` [Bug target/98361] " marxin at gcc dot gnu.org
2020-12-18 14:01 ` sdack at gmx dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98361-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).