From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iP9VDrmbA2IxuQAAgWs5BA (envelope-from ) for ; Wed, 09 Feb 2022 11:47:21 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UCmoC7mbA2KuSQAA9RJhRA (envelope-from ) for ; Wed, 09 Feb 2022 11:47:21 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A396DE337 for ; Wed, 9 Feb 2022 11:47:20 +0100 (CET) Received: from localhost ([::1]:59276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHkVJ-0005Mj-NN for larch@yhetil.org; Wed, 09 Feb 2022 05:47:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHkV4-0005La-0j for guix-patches@gnu.org; Wed, 09 Feb 2022 05:47:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:56119) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHkV3-0001xq-MK for guix-patches@gnu.org; Wed, 09 Feb 2022 05:47:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nHkV3-0000K1-Kf for guix-patches@gnu.org; Wed, 09 Feb 2022 05:47:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53895] [PATCH 0/5] More CPU detection Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Feb 2022 10:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53895 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 53895@debbugs.gnu.org Received: via spool by 53895-submit@debbugs.gnu.org id=B53895.16444035781142 (code B ref 53895); Wed, 09 Feb 2022 10:47:01 +0000 Received: (at 53895) by debbugs.gnu.org; 9 Feb 2022 10:46:18 +0000 Received: from localhost ([127.0.0.1]:50015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHkUM-0000IL-6l for submit@debbugs.gnu.org; Wed, 09 Feb 2022 05:46:18 -0500 Received: from flashner.co.il ([178.62.234.194]:50516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHkUK-0000I0-0u for 53895@debbugs.gnu.org; Wed, 09 Feb 2022 05:46:17 -0500 Received: from localhost (unknown [37.46.46.251]) by flashner.co.il (Postfix) with ESMTPSA id 0738D40297; Wed, 9 Feb 2022 10:46:09 +0000 (UTC) Date: Wed, 9 Feb 2022 12:45:35 +0200 From: Efraim Flashner Message-ID: Mail-Followup-To: Efraim Flashner , Ludovic =?UTF-8?Q?Court=C3=A8s?= , 53895@debbugs.gnu.org References: <848868e0ad4427a976bec55968f82a3469009fb9.1644401681.git.efraim@flashner.co.il> <87ee4c8h05.fsf_-_@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7HBfkYMFZGvymHTa" Content-Disposition: inline In-Reply-To: <87ee4c8h05.fsf_-_@gnu.org> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644403641; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=sgcurfbJTc1L7lcqi1SfFEca3GqlDww4ZMWyndy7pZg=; b=cFCcINCO2DY2p06w2RW3xSUTG/NnHL5mXaU4j0OkQ3FPeDoUyXtNtOBI+bo2Hyu87FN5fj BwReMilHMN0AunU7bNtBtI+wXKQWwIPUJMwPLLh/UU3+HZajIIMw5zd89YORW38iV2by9O riUbs00eDwa4d3kxbFYXcGpb1j1TcdiEyhdBMj5ptEt5O9aK8XD9LcMbGHRoQhzyqVb/Gg HigIi5BdYPjBp5NaOBXSl5mxDmYDsOEH70vc9gRXXvXjVdaJnDoNMwSgVGwCr8G5S2WjQS gg2wNGE0gTRD2MDfQ+1T2o2bhds/pA6Gk70cqPkMWd6dVTM8f3sXZu0oc7Pw4w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644403641; a=rsa-sha256; cv=none; b=fjtKiY7RK3dNpY8hu/+M/uTx88d3QtwwtRoEKifo3hzaqmXXnZFKOXASO1pcZM8VBGpMHD TlDyQ4dZUpx5IumQy4o1P+heAavXvK1HQpo/0Mw40ujtE02+me3S0mS4YiJIj/7Rc8NPma ztBA5ZOoRxzp+3ZZM7lmuGId0mN7e4E8Oxs3eMeo8gqheQIvB9JdvL4dG0NEpgPM18yFQD a55KUjm+y/ByhpDlRdF1QVI1BMqJVp8rHt2zL+soTLA0rtyc4Xu7mC7vpbrIVzpS8gKod0 YaiNAgoWIae2t2RjFEuWOIPVg+LxgCu4ZYpo4yF+yqwq4S/SR9/sxWH0qAzGHw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.23 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: A396DE337 X-Spam-Score: -5.23 X-Migadu-Scanner: scn0.migadu.com X-TUID: /C686dGQW1LT --7HBfkYMFZGvymHTa Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 09, 2022 at 11:35:22AM +0100, Ludovic Court=C3=A8s wrote: > Hi! >=20 > Efraim Flashner skribis: >=20 > > * guix/cpu.scm (cpu->gcc-architecture): Rewrite detection based on > > detected feature flags. >=20 > [...] >=20 > > ;; Transcribed from GCC's 'host_detect_local_cpu' in driver-i386.= c. > > (or (and (=3D 6 (cpu-family cpu)) ;the "Pentium Pro"= family > > - (letrec-syntax ((model (syntax-rules (=3D>) > > - ((_) #f) > > - ((_ (candidate =3D> integers ..= =2E) rest > > - ...) > > - (or (and (=3D (cpu-model cpu) = integers) > > - candidate) > > - ... > > - (model rest ...)))))) > > - (model ("bonnel" =3D> #x1c #x26) > > - ("silvermont" =3D> #x37 #x4a #x4d #x5a #x5d) > > - ("core2" =3D> #x0f #x17 #x1d) > > - ("nehalem" =3D> #x1a #x1e #x1f #x2e) > > - ("westmere" =3D> #x25 #x2c #x2f) > > - ("sandybridge" =3D> #x2a #x2d) > > - ("ivybridge" =3D> #x3a #x3e) > > - ("haswell" =3D> #x3c #x3f #x45 #x46) > > - ("broadwell" =3D> #x3d #x47 #x4f #x56) > > - ("skylake" =3D> #x4e #x5e #x8e #x9e) > > - ("skylake-avx512" =3D> #x55) ;TODO: cascadelake > > - ("knl" =3D> #x57) > > - ("cannonlake" =3D> #x66) > > - ("knm" =3D> #x85)))) > > + (letrec-syntax ((if-flags (syntax-rules (=3D>) > > + ((_) > > + #f) > > + ((_ (flags ... =3D> name) re= st ...) > > + (if (every (lambda (flag) > > + (set-contains?= (cpu-flags cpu) > > + = flag)) > > + '(flags ...)) > > + name > > + (if-flags rest ...)))))) > > + > > + (if-flags ("avx" "avx512vp2intersect" "tsxldtrk" =3D> = "sapphirerapids") > > + ("avx" "avx512vp2intersect" =3D> "tigerlake") > > + ("avx" "avx512bf16" =3D> "cooperlake") > > + ("avx" "wbnoinvd" =3D> "icelake-server") > > + ("avx" "avx512bitalg" =3D> "icelake-client") > > + ("avx" "avx512vbmi" =3D> "cannonlake") >=20 > In current master, the logic is: >=20 > if it=E2=80=99s an intel > then pick the model ID > if that didn=E2=80=99t work > then do feature-based detection >=20 > Here you=E2=80=99re 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? >=20 > The AMD detection code would have to go before the generic fallback case > though. >=20 > WDYT? >=20 > Ludo=E2=80=99. in gcc-11 driver-i386.c is modified to use the 'vendor' to choose the 'processor', and then using the processor flag it runs through a list of if statements to check feature flags, so that's what I was following. --=20 Efraim Flashner =D7=A8=D7=A0=D7=A9=D7=9C=D7=A4 = =D7=9D=D7=99=D7=A8=D7=A4=D7=90 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --7HBfkYMFZGvymHTa Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmIDm0wACgkQQarn3Mo9 g1GWng/+KAjjyd0KGXjwIfX2lzesS/Js08dJet2TIwuK8T64qGiWPkZo+k2v6ByS oa2g1S8Ii+09x51dDEI5naU47eUJQbBFyNtSm3XHQ2N7bpHroFvnZCZhwf/6KWtq hbGT5/v9esSjMmvMjRC8PQizZmr/Xkipipj98ia5Y7/UWMh6KcUxJitkEUFQg7HS cxFnyHXMJrriAAPWTt4fsm50Pbp8+zCQ23zyfhF7STaSE3Rv34QW6iOjLw+wvFCJ EoL8ma74MEOXicW7OJnRZZYhNLe23gflFdvIet2YjDilWv2jeEyADmiCfDZONHAR ttUvn91G2qYgwLxNiQARe6cZqZSFNE4HWcjsc+W65BqmTqm7sRCvU+AW3anng5AB kshe2wvUDfbqmdCYaMHCVbvlIlk/RDW6bAvtXQzk58SYWrkOGjlxcdn8/fW7RJWb LQwOjEe+2exYPJN0ARKHy0JVBhnDupadBR6nT5MmYUjnJO2Lq65XPHqtTOF/NkpH nClD99Sd8TYVCbNE9qK2nsQBKTGQzlYAMS6LGHnqyeokBmkd9FPOWc6iRoTRTBP2 MrcsVAcZ44nIXBXRgypZCybUE55ArPO//YGgnzQaovO2VFQJ4KQfZkzfb82L+rSV Te2OV5SkKd15AL9tp/xZfSnqKPgjoK9p0m5BMJl2RkofEy1XgX0= =Dt6k -----END PGP SIGNATURE----- --7HBfkYMFZGvymHTa--