all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Efraim Flashner <efraim@flashner.co.il>
Cc: 53895@debbugs.gnu.org
Subject: [bug#53895] [PATCH 0/5] More CPU detection
Date: Wed, 09 Feb 2022 11:35:22 +0100	[thread overview]
Message-ID: <87ee4c8h05.fsf_-_@gnu.org> (raw)
In-Reply-To: <848868e0ad4427a976bec55968f82a3469009fb9.1644401681.git.efraim@flashner.co.il> (Efraim Flashner's message of "Wed, 9 Feb 2022 12:21:47 +0200")

Hi!

Efraim Flashner <efraim@flashner.co.il> skribis:

> * guix/cpu.scm (cpu->gcc-architecture): Rewrite detection based on
> detected feature flags.

[...]

>       ;; Transcribed from GCC's 'host_detect_local_cpu' in driver-i386.c.
>       (or (and (= 6 (cpu-family cpu))              ;the "Pentium Pro" family
> -              (letrec-syntax ((model (syntax-rules (=>)
> -                                       ((_) #f)
> -                                       ((_ (candidate => integers ...) rest
> -                                           ...)
> -                                        (or (and (= (cpu-model cpu) integers)
> -                                                 candidate)
> -                                            ...
> -                                            (model rest ...))))))
> -                (model ("bonnel" => #x1c #x26)
> -                       ("silvermont" => #x37 #x4a #x4d #x5a #x5d)
> -                       ("core2" => #x0f #x17 #x1d)
> -                       ("nehalem" => #x1a #x1e #x1f #x2e)
> -                       ("westmere" => #x25 #x2c #x2f)
> -                       ("sandybridge" => #x2a #x2d)
> -                       ("ivybridge" => #x3a #x3e)
> -                       ("haswell" => #x3c #x3f #x45 #x46)
> -                       ("broadwell" => #x3d #x47 #x4f #x56)
> -                       ("skylake" => #x4e #x5e #x8e #x9e)
> -                       ("skylake-avx512" => #x55) ;TODO: cascadelake
> -                       ("knl" => #x57)
> -                       ("cannonlake" => #x66)
> -                       ("knm" => #x85))))
> +              (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 ...))))))
> +
> +                (if-flags ("avx" "avx512vp2intersect" "tsxldtrk" => "sapphirerapids")
> +                          ("avx" "avx512vp2intersect" => "tigerlake")
> +                          ("avx" "avx512bf16" => "cooperlake")
> +                          ("avx" "wbnoinvd" => "icelake-server")
> +                          ("avx" "avx512bitalg" => "icelake-client")
> +                          ("avx" "avx512vbmi" => "cannonlake")

In current master, the logic is:

  if it’s an intel
  then pick the model ID
  if that didn’t work
  then do feature-based detection

Here you’re removing the first part (using the Intel model ID) and
extending the second part.  Perhaps we could extend the second part but
still keep the first one?

The AMD detection code would have to go before the generic fallback case
though.

WDYT?

Ludo’.




  reply	other threads:[~2022-02-09 10:36 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   ` Ludovic Courtès [this message]
2022-02-09 10:45     ` [bug#53895] [PATCH 0/5] More CPU detection 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
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=87ee4c8h05.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=53895@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    /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.