From: Efraim Flashner <efraim@flashner.co.il>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 53895@debbugs.gnu.org
Subject: [bug#53895] [PATCH 0/5] More CPU detection
Date: Wed, 9 Feb 2022 12:54:14 +0200 [thread overview]
Message-ID: <YgOdViGlmBFwLYw9@3900XT> (raw)
In-Reply-To: <878ruk8gmu.fsf_-_@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2856 bytes --]
On Wed, Feb 09, 2022 at 11:43:21AM +0100, Ludovic Courtès wrote:
> Efraim Flashner <efraim@flashner.co.il> skribis:
>
> > * guix/cpu.scm <cpu>: Add vendor field.
> > (current-cpu): Also fill in the 'vendor' field.
> > (cpu->gcc-architecture): Add detection logic for AMD CPUs.
>
> [...]
>
> > + (and (equal? "AuthenticAMD" (cpu-vendor cpu))
>
> Isn’t that equivalent to (= (cpu-family cpu) some-value)?
It looks to me like 'family' started as the prefix for iX86, so Intel is
mostly using family 6, except when a couple of other processors slip in.
I wasn't able to find a hard and fast rule for what family AMD typically
uses, on my machine its 23. In driver-i386.c it's sort by vendor first:
if (vendor == VENDOR_AMD)
> > + (letrec-syntax ((if-flags (syntax-rules (=>)
> > + ((_)
> > + #f)
> > + ((_ (flags ... => name) rest ...)
> > + (if (every (lambda (flag)
> > + (set-contains? (cpu-flags cpu)
> > + flag))
> > + '(flags ...))
> > + name
> > + (if-flags rest ...))))))
> > +
> > + (when (= 22 (cpu-family cpu))
> > + (if-flags ("movbe" => "btver2")))
> > + (when (= 6 (cpu-family cpu))
> > + (if-flags ("3dnowp" => "athalon")))
>
> This has no effect (because ‘if-flags’ returns a value that is ignored
> since it’s not returned.)
>
> What we could do is extend ‘if-flags’ so that it can optionally check
> for a family number:
>
> (if-flags ((family 22) "movbe" => "btver2")
> …)
That sounds like a good idea.
> > + (if-flags ("vaes" => "znver3")
> > + ("clwb" => "znver2")
> > + ("clzero" => "znver1")
>
> However, the code in driver-i386.c seems to look at model IDs (the big
> “switch (processor)” thing) and not feature flags. Or am I overlooking
> something?
switch (processor) comes after all the AMD chips are sorted. It looks
like all of Intel's i686 and x86_64 are PROCESSOR_PENTIUMPRO, while AMD
has a separate processor per chip design. The AMD chips are sorted about
90 lines above the switch (processor) line
> Thanks,
> Ludo’.
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-02-09 10:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 10:16 [bug#53895] [PATCH 0/5] More CPU detection Efraim Flashner
2022-02-09 10:21 ` [bug#53895] [PATCH 1/5] guix: cpu: Rewrite based on feature flags Efraim Flashner
2022-02-09 10:35 ` [bug#53895] [PATCH 0/5] More CPU detection Ludovic Courtès
2022-02-09 10:45 ` Efraim Flashner
2022-02-10 20:42 ` Ludovic Courtès
2022-02-09 10:21 ` [bug#53895] [PATCH 2/5] gnu: cpu: Add detection for AMD CPUs Efraim Flashner
2022-02-09 10:43 ` [bug#53895] [PATCH 0/5] More CPU detection Ludovic Courtès
2022-02-09 10:54 ` Efraim Flashner [this message]
2022-02-09 11:41 ` Efraim Flashner
2022-02-10 20:42 ` Ludovic Courtès
2022-02-13 13:04 ` bug#53895: " Efraim Flashner
2022-02-09 10:21 ` [bug#53895] [PATCH 3/5] gnu: gcc: Add compiler-cpu-architectures for aarch64 Efraim Flashner
2022-02-09 10:21 ` [bug#53895] [PATCH 4/5] gnu: gcc: Add compiler-cpu-architectures for armhf Efraim Flashner
2022-02-09 10:21 ` [bug#53895] [PATCH 5/5] WIP: guix: cpu: Add detection for aarch64 CPUs Efraim Flashner
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=YgOdViGlmBFwLYw9@3900XT \
--to=efraim@flashner.co.il \
--cc=53895@debbugs.gnu.org \
--cc=ludo@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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.