From patchwork Mon Jun 26 12:38:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51351 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9959227BBEA; Mon, 26 Jun 2023 13:43:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2B7BC27BBE2 for ; Mon, 26 Jun 2023 13:43:25 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDlVw-0008M7-Hp; Mon, 26 Jun 2023 08:40:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDlVj-0008Ei-K9 for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDlVj-0005ke-48 for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDlVi-0004IC-Po for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH v2 1/7] gnu: %gcc-11-x86_64-micro-architectures: Add psabi entries. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 12:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64188 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64188@debbugs.gnu.org Cc: Efraim Flashner Received: via spool by 64188-submit@debbugs.gnu.org id=B64188.168778314616324 (code B ref 64188); Mon, 26 Jun 2023 12:40:02 +0000 Received: (at 64188) by debbugs.gnu.org; 26 Jun 2023 12:39:06 +0000 Received: from localhost ([127.0.0.1]:44755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUo-0004F8-0n for submit@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:06 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]:54387) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUl-0004ES-Rw for 64188@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:04 -0400 Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3112f5ab0b1so2798277f8f.0 for <64188@debbugs.gnu.org>; Mon, 26 Jun 2023 05:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687783138; x=1690375138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=y0/9ENgcoLtQLw34XxIld3+BcmNNGwYVTxELI04+qo8=; b=F7YFeo4QUyH8YjhcwPDZ0uB1nUwUdjliKPx7vAu7sVHqTUJGfjQi5sRs4tVcJho/AY JOKSOuQBl7eu3v1FkHnNOS0Z0kvOrr8yH+ZaLxNw4nE+Zs1qwYi/5AdYJVWGm+LyzSie 18GZWTV4D7F2ThHpFByUSJL0MgUuCkUWKkUFx4sBq2LWO5onaLHe740dASYzrTqPB1xx Wjn//kMDQCxNR9QVhh5Ln8rfafjzQsCfRc9uPcWLEnVTY2g78neOC4QFrJHkfKAqBwE9 d9AsBIW7NQT6WTXhyj6K1+6WNBidC6FvgJxVeT7xSLU54cs9Q3brcyzU/T1P5Ruxetwn Sc5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687783138; x=1690375138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=y0/9ENgcoLtQLw34XxIld3+BcmNNGwYVTxELI04+qo8=; b=WcOqoWcd7ctsZW0jSjDq9Ft1b+9/DKALSxyHvfBEcb/0yam8mB/i2Ap88MrDkwBh7s RArmll3qKaYat1z807tZlnlqM/o61TTLxqpjmZ1Je85Ug2bF4TfmDyFAq2dNxcM5XfwP /42YVuFycis3NMkhn8eyZK9+3m76oaUUa/d2MRXVeRLVfE3zaQkWIdaUt4ecN1izNopM yLVmSUBTiBs1mrhiXWA8wBHaUyWgJMChlvgbvRB7da5eCEn5+kIOwWkq//kisTpC5uZk EfUCaBEJYAFo+wQi0zwHVDo3FCv+Z2/Q1kxjNWHyVtkFgVeofTW6T9fw3nDJeeOQzD2N BJGA== X-Gm-Message-State: AC+VfDyYtt9hUnM4kPUtf6OHVfEKhV2eIcMV977dI2hxZahZkq8cqgYw bBl/mxTgq38ck2C0SHeqvBwYTrmFMVgoBg== X-Google-Smtp-Source: ACHHUZ6O98vbb4S1E8ayHFEDV2puhs0MMiY67qm/zJxRedcV773A7oysSO0/2wvFDG7s0OTNqNv2Gw== X-Received: by 2002:a5d:608f:0:b0:313:f157:7d56 with SMTP id w15-20020a5d608f000000b00313f1577d56mr1623437wrt.30.1687783137933; Mon, 26 Jun 2023 05:38:57 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id u15-20020a5d6acf000000b003111fd2e33dsm7243909wrw.30.2023.06.26.05.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 05:38:57 -0700 (PDT) From: Efraim Flashner Date: Mon, 26 Jun 2023 15:38:37 +0300 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/gcc.scm (%gcc-11-x86_64-micro-architectures): Add entries for x86_64-v{1,2,3,4}. --- gnu/packages/gcc.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 1b444c2b02..862fdd79c3 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -614,7 +614,10 @@ (define %gcc-11-x86_64-micro-architectures (append %gcc-10-x86_64-micro-architectures '("sapphirerapids" "alterlake" "rocketlake" ;Intel - "btver1" "btver2"))) ;AMD + "btver1" "btver2" ;AMD + + ;; psABI micro-architecture levels + "x86_64-v1" "x86_64-v2" "x86_64-v3" "x86_64-v4"))) ;; Suitable '-march' values for GCC 12. (define %gcc-12-aarch64-micro-architectures From patchwork Mon Jun 26 12:38:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51349 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8B0F827BBE9; Mon, 26 Jun 2023 13:42:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E794A27BBE2 for ; Mon, 26 Jun 2023 13:42:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDlWJ-0000Bp-Tv; Mon, 26 Jun 2023 08:40:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDlVq-0008J4-P5 for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDlVl-0005wV-Lb; Mon, 26 Jun 2023 08:40:09 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDlVj-0004IJ-6t; Mon, 26 Jun 2023 08:40:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH v2 2/7] guix: cpu: Add generalized CPU matching. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 12:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64188 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64188@debbugs.gnu.org Cc: Efraim Flashner , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 64188-submit@debbugs.gnu.org id=B64188.168778315216362 (code B ref 64188); Mon, 26 Jun 2023 12:40:03 +0000 Received: (at 64188) by debbugs.gnu.org; 26 Jun 2023 12:39:12 +0000 Received: from localhost ([127.0.0.1]:44760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUu-0004Fn-DN for submit@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:12 -0400 Received: from mail-lf1-f50.google.com ([209.85.167.50]:48247) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUn-0004EV-Ph for 64188@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:06 -0400 Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-4f86dbce369so4158064e87.0 for <64188@debbugs.gnu.org>; Mon, 26 Jun 2023 05:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687783140; x=1690375140; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=CXBRcMEcNe1ySkaWYCr/u8mNOd3kmsx59TQ9m6l9814=; b=W5/SMplaOd6C7EBlEIMyTTIFOZHwM7+AaAkm1RbzPjicxmdiHFaGAX+xvdjkjxa4zv NQ1ZxKPv1pL6LFwTpU5dQsO+eO46siXqkDbMIL2d87rOwnKIP5gFN5cVVDL+L72UxOON 2410RdSuq9uIiuSW7exjl7NeQTcw6dGgHo0WYPT5fIQQCx+Em9E+CnstUICrREx+H+ml NkObDCeyP2CQO3/FkDin5xhas91f7BfPYNxcehB2N3XjxtUnzHox0p8NdAJYvW+wTJJs lZo0S25H2abndtce/3T41oYJdyRbjvoIeUummWVBZd4lmatzzFFwLQYc+DYFUAnylPQx 0QHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687783140; x=1690375140; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CXBRcMEcNe1ySkaWYCr/u8mNOd3kmsx59TQ9m6l9814=; b=b9/1yNv+UxbDuC8kN8I7D6HbdvO6WUtIKkW3oUzLFItM/Mxr8d140Dq0Xm0AnMYjCz 62JYSt00KiWk4u+jfGpoOFRPHS9fWWcNJneSYAB/u8v32vJ6PqJe8GZ3zbVYryUcv/yi j3YD+wd7CdcoFpZNPOVdIupkDWW/JBFDarz6bfiWMgFCWyMQZFUOdzvtTlCrLCD4gQ0D 2f6nE0tRYSgtKBOZhO0jEezXS4dHUikNgLKajkfmu4VgSvVJJVf4YffA2eYolKv7a74y /YsLsPMz95Oe4rOxab9DCavN2M6dxyZhgUMiQh0wg+Mmovjxp4Me83ADAToJcXv05luy tJgw== X-Gm-Message-State: AC+VfDxb4ciI4cWdUbDaVawMu+yNbhRNauxO+nJ+dxkNoCbNgLtTiZND 8Y0+AOw3/Ztk3j/b9qcktvMyQLnOhUSu1w== X-Google-Smtp-Source: ACHHUZ6/lx9TjRlfrj9Kh9axDestorK5vIJoWpJ9qek15aLt3SpK2tAUNC5QfWC1H/lyh/P4OM1xZQ== X-Received: by 2002:a19:7b06:0:b0:4f3:a051:58df with SMTP id w6-20020a197b06000000b004f3a05158dfmr16387854lfc.59.1687783139781; Mon, 26 Jun 2023 05:38:59 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id y17-20020a1c4b11000000b003f90a604885sm7598171wma.34.2023.06.26.05.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 05:38:59 -0700 (PDT) From: Efraim Flashner Date: Mon, 26 Jun 2023 15:38:38 +0300 Message-Id: <7bd5d1f49f921827954ff0373121a52c0cbc0ad6.1687781377.git.efraim@flashner.co.il> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/cpu.scm (cpu->micro-architecture-level): New variable. --- guix/cpu.scm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/guix/cpu.scm b/guix/cpu.scm index 45e1abeed7..3fc12327ed 100644 --- a/guix/cpu.scm +++ b/guix/cpu.scm @@ -285,3 +285,36 @@ (define (cpu->gcc-architecture cpu) (architecture ;; TODO: More architectures architecture))) + +(define (cpu->micro-architecture-level cpu) + "Return a micro-architecture name, suitable for generalized optimizations that +correspond roughly to CPU, a record as returned by 'current-cpu'." + (match (cpu-architecture cpu) + ("x86_64" + (or (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 + ;; https://gitlab.com/x86-psABIs/x86-64-ABI/-/blob/master/x86-64-ABI/low-level-sys-info.tex + ;; v4: AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL + ;; v3: AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, OSXSAVE + ;; v2: CMPXCHG16B, LAHF, SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3 + ("avx512f" "avx512bw" "abx512cd" "abx512dq" "avx512vl" + "avx" "avx2" "bmi1" "bmi2" "f16c" "fma" "movbe" + "popcnt" "sse3" "sse4_1" "sse4_2" "ssse3" => "x86_64-v4") + ("avx" "avx2" "bmi1" "bmi2" "f16c" "fma" "movbe" + "popcnt" "sse3" "sse4_1" "sse4_2" "ssse3" => "x86_64-v3") + ("popcnt" "sse3" "sse4_1" "sse4_2" "ssse3" => "x86_64-v2") + (_ => "x86_64-v1"))) + "x86_64-v1")) + (architecture + ;; TODO: More architectures + architecture))) From patchwork Mon Jun 26 12:38:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51355 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1E59727BBE9; Mon, 26 Jun 2023 13:47:00 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D1B5027BBE2 for ; Mon, 26 Jun 2023 13:46:59 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDlWK-0000F3-Mc; Mon, 26 Jun 2023 08:40:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDlVq-0008K6-Vq for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDlVo-0005xt-DK; Mon, 26 Jun 2023 08:40:09 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDlVj-0004IR-Le; Mon, 26 Jun 2023 08:40:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH v2 3/7] guix: cpu: Rewrite fallback for x86_64 cpu->gcc-architecture. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 12:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64188 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64188@debbugs.gnu.org Cc: Efraim Flashner , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 64188-submit@debbugs.gnu.org id=B64188.168778315316369 (code B ref 64188); Mon, 26 Jun 2023 12:40:03 +0000 Received: (at 64188) by debbugs.gnu.org; 26 Jun 2023 12:39:13 +0000 Received: from localhost ([127.0.0.1]:44762 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUu-0004Fr-QI for submit@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:13 -0400 Received: from mail-lf1-f44.google.com ([209.85.167.44]:46162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUp-0004Eo-KO for 64188@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:08 -0400 Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-4f957a45b10so3990141e87.0 for <64188@debbugs.gnu.org>; Mon, 26 Jun 2023 05:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687783142; x=1690375142; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=Q3SrNB3/9BknWXrVXQY1Lo9YB8E8g/DrbnvvbG6ob7w=; b=l+Xq46yrqW1kFcI2yxrg6goPt5HxGJusMUJYK+fYwDdjtk3xrY9zb7Tel72gVKJxDh O8MP92BthQjFgkPoegtPE1ZHmB8QFzOuEls5732Mak/jjZ0bpJPjxHX361TukoGPeoNb hOP/Z4D0+7mfhHBEzglJZHR83Davtivw2jRe/vLsXSdnekrdJBdsqr65G4IftDQz7qIU cAVqm62eCeDPed1yOx5/E20LohodDgRM5eA66/wyxXFeXnzEBTBcXOqQhsWuwp5Mlzow EV5qRhlYju+5HqNATqeEr4cBll7+IsHslKfWo8XgatSdYFYOAUVlfNrDgetIZbYG1zKT PFAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687783142; x=1690375142; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Q3SrNB3/9BknWXrVXQY1Lo9YB8E8g/DrbnvvbG6ob7w=; b=lPNkg8dQs22qEpPJw9fx9S/Jf2CsI2xV1TQ7ONLDZZbbUN0at3Tet/IOj6r45texvb JRpjT4hhZyrk+ADGtpbNCelagHu3GBBQ64ufWsE4tTh8LhEiJBm0zeXlBIksRlIMZLKB F0/q35LviWFLyszzc7Rrx7eoWVQOdgnEwWc4UYNOEnd/ssdmeq9IjPnzJifW7yXBZqRO jyV+RSU56EqU5FqogbdtNdLP4D/pSzMLmiQHzYY0TTe6WddKYnaqNnJh/zIHsP1ZIldc Kw1W27tar/7q3fqkfFBOPrF6urvUOp2efOkLItFPz8txI2gFntIOdjTNq2lSQkSGJedc KRcw== X-Gm-Message-State: AC+VfDw5Nrcxtrph0OjnP3C45I18vnKy+lMBn8ZsV6MtleMu0TuViC4O Eb98I6VqY/UJXy7AQYumT1cJKfZOmTmRrA== X-Google-Smtp-Source: ACHHUZ6dN7rxn4nRHGKrbLaCdqr7ZzbAcdorsG2oeLpiOCa4Vr99JWJ/imABCTdOffzIz+aEPJBm3A== X-Received: by 2002:a05:6512:2314:b0:4fa:21d4:b3ca with SMTP id o20-20020a056512231400b004fa21d4b3camr2744761lfu.2.1687783141645; Mon, 26 Jun 2023 05:39:01 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id y17-20020a1c4b11000000b003f9b24cf881sm10515134wma.16.2023.06.26.05.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 05:39:01 -0700 (PDT) From: Efraim Flashner Date: Mon, 26 Jun 2023 15:38:39 +0300 Message-Id: <4a54a8434bd741fb7bf2d3067fd8dcec106b3ece.1687781377.git.efraim@flashner.co.il> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/cpu.scm (cpu->gcc-architecture): Adjust the fallback case to use cpu->micro-architecture-level. --- guix/cpu.scm | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/guix/cpu.scm b/guix/cpu.scm index 3fc12327ed..1a75b8ac62 100644 --- a/guix/cpu.scm +++ b/guix/cpu.scm @@ -209,21 +209,7 @@ (define (cpu->gcc-architecture cpu) (if (and (= 7 (cpu-family cpu)) (= #x3b (cpu-model cpu))) "lujiazui" - (if-flags ("avx512" => "knl") - ("adx" => "broadwell") - ("avx2" => "haswell") - ;; TODO: tigerlake, cooperlake, etc. - ("avx" => "sandybridge") - ("sse4_2" "gfni" => "tremont") - ("sse4_2" "sgx" => "goldmont-plus") - ("sse4_2" "xsave" => "goldmont") - ("sse4_2" "movbe" => "silvermont") - ("sse4_2" => "nehalem") - ("ssse3" "movbe" => "bonnell") - ("ssse3" "sse3" "longmode" => "nocona") - ("ssse3" "sse3" "lm" => "nocona") - ("ssse3" "sse3" => "prescott") - ("ssse3" => "core2")))) + (cpu->micro-architecture-level cpu)) ;; TODO: Recognize CENTAUR/CYRIX/NSC? From patchwork Mon Jun 26 12:38:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51350 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4DF3627BBE9; Mon, 26 Jun 2023 13:42:37 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id BA03A27BBE2 for ; Mon, 26 Jun 2023 13:42:36 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDlWJ-0000B8-Pc; Mon, 26 Jun 2023 08:40:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDlVl-0008FY-3K for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDlVk-0005rK-8O; Mon, 26 Jun 2023 08:40:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDlVk-0004Id-36; Mon, 26 Jun 2023 08:40:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH v2 4/7] guix: cpu: Refactor cpu->gcc-architecture. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 12:40:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64188 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64188@debbugs.gnu.org Cc: Efraim Flashner , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 64188-submit@debbugs.gnu.org id=B64188.168778315416382 (code B ref 64188); Mon, 26 Jun 2023 12:40:04 +0000 Received: (at 64188) by debbugs.gnu.org; 26 Jun 2023 12:39:14 +0000 Received: from localhost ([127.0.0.1]:44765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUv-0004Fy-8f for submit@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:13 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:42052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUr-0004Ew-5D for 64188@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:09 -0400 Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-31297125334so2742760f8f.0 for <64188@debbugs.gnu.org>; Mon, 26 Jun 2023 05:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687783143; x=1690375143; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=E2lA4qQUapcvjg38AXDXp4wACqRJI5uJ52nAKM4GHYo=; b=X1Hf++xP5IdxGMgIv6bXE31WLq+hsRcaBYcvIfA8EK5wWRDz9qCXmbxufUHTykSpRS 6EY2Y+Tz8OASnoO/ubB5zRBW61Qpm+2ZLtmqBK8+NOm7FrX5L5E5xVfoGkLGZrY32Eps jwmpv1GyYfnJHqzy2AlnJL7/XsYkXGS5L2QkzxuxmHV9xNyogo2SNhHRwITkx4g+KoFQ kBa5drTqtdzp9ITGdsDyWJmP31T9ytTT7uAL9ov5C4SpkoR5tmK6CiZrW1HHvPjkbP8k QD1cWDu1pq6qR/mYNFiYpjFOkx+VxWRX0dYrHX7PL1rXQGBGBKgP0PfFKTIuGyS0LGNm 6fIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687783143; x=1690375143; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=E2lA4qQUapcvjg38AXDXp4wACqRJI5uJ52nAKM4GHYo=; b=ie+4b9lKIvmhRoOVJEDlHU0Tu6J6PPX9y0NoQw0WsKJrFqV61uVn/y0xeWhbo6KqCh +PBis+G4xGhg207D2Yt406dmargpIkZruRVZFIyHrlWjRjcillRJv0rox+TZMgcDjDVr lKXrNE/sesQdY5QXP/1+/gJwoMSD1IM0DTFW+Najp8aW+3e0UZFeZNFUUPLVfSp5jFFI bZfv/Agl6CcdBBiGgsdXeC7qM3vA7lPkc2EQR1X0u1srUp/q1cjmroQFF8GPssKsxcoe Njlp4V5nhuUO1w+xphdmo2MNWE5cIJxIiWZTw3IO3Oy7D41mCGGDbzA9S4UNOpa+PQCa 8iEg== X-Gm-Message-State: AC+VfDzU95jPNzYUjrztxn1p2+FgnNSJRJWcY4qsd3mERJSsFABP6mp3 hwOKLzjtgD2MF5J5Th5rqiq5FlHBGCVGvw== X-Google-Smtp-Source: ACHHUZ4GKPNrmGJLk3rxSAfYA6W1e98LV9dYoRtv09kiY4D2R5C7UUMyEMW0l4GpYdsl0Pj+l3aaLw== X-Received: by 2002:a5d:480c:0:b0:311:5b9:9d58 with SMTP id l12-20020a5d480c000000b0031105b99d58mr25387590wrq.16.1687783143507; Mon, 26 Jun 2023 05:39:03 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id e10-20020a056000194a00b0031134bcdacdsm7297974wry.42.2023.06.26.05.39.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 05:39:03 -0700 (PDT) From: Efraim Flashner Date: Mon, 26 Jun 2023 15:38:40 +0300 Message-Id: <0e756812e63220f9f5bc17169713b80281806dbe.1687781377.git.efraim@flashner.co.il> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/cpu.scm (cpu->gcc-architecture): Refactor to wrap all the x86_64 options inside a common letrec-syntax. --- guix/cpu.scm | 57 +++++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/guix/cpu.scm b/guix/cpu.scm index 1a75b8ac62..30cd860a19 100644 --- a/guix/cpu.scm +++ b/guix/cpu.scm @@ -114,19 +114,19 @@ (define (cpu->gcc-architecture cpu) (match (cpu-architecture cpu) ("x86_64" ;; Transcribed from GCC's 'host_detect_local_cpu' in driver-i386.cc. - (or (and (equal? "GenuineIntel" (cpu-vendor cpu)) - (= 6 (cpu-family cpu)) ;the "Pentium Pro" family - (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 ...)))))) + (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 ...)))))) + (or (and (equal? "GenuineIntel" (cpu-vendor cpu)) + (= 6 (cpu-family cpu)) ;the "Pentium Pro" family (if-flags ("avx" "raoint" => "grandridge") ("avx" "amx_fp16" => "graniterapids") ("avx" "avxvnniint8" => "sierraforest") @@ -152,20 +152,9 @@ (define (cpu->gcc-architecture cpu) ("ssse3" "movbe" => "bonnell") ("ssse3" => "core2") ("longmode" => "x86-64") - ("lm" => "x86-64")))) - - (and (equal? "AuthenticAMD" (cpu-vendor cpu)) - (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 ...)))))) + ("lm" => "x86-64"))) + (and (equal? "AuthenticAMD" (cpu-vendor cpu)) (or (and (= 22 (cpu-family cpu)) (if-flags ("movbe" => "btver2"))) (and (= 6 (cpu-family cpu)) @@ -192,20 +181,10 @@ (define (cpu->gcc-architecture cpu) ("lm" => "k8") ("mmx" "3dnow" => "k6-3") ("mmx" => "k6") - (_ => "pentium"))))) + (_ => "pentium")))) - ;; Fallback case for non-Intel processors or for Intel processors not - ;; recognized above. - (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 ...)))))) + ;; Fallback case for non-Intel processors or for processors not + ;; recognized above. (if (and (= 7 (cpu-family cpu)) (= #x3b (cpu-model cpu))) "lujiazui" @@ -213,7 +192,7 @@ (define (cpu->gcc-architecture cpu) ;; TODO: Recognize CENTAUR/CYRIX/NSC? - "x86_64")) + "x86_64"))) ("aarch64" ;; Transcribed from GCC's list of aarch64 processors in aarch64-cores.def ;; What to do with big.LITTLE cores? From patchwork Mon Jun 26 12:38:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51354 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1C8A027BBE2; Mon, 26 Jun 2023 13:46:30 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8515C27BBE2 for ; Mon, 26 Jun 2023 13:46:29 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDlWH-0008SR-18; Mon, 26 Jun 2023 08:40:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDlVr-0008K9-74 for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDlVm-0005x3-FR; Mon, 26 Jun 2023 08:40:09 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDlVk-0004Im-Hp; Mon, 26 Jun 2023 08:40:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH v2 5/7] guix: cpu: Add gcc-architecture->micro-architecture-level mapping. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 12:40:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64188 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64188@debbugs.gnu.org Cc: Efraim Flashner , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 64188-submit@debbugs.gnu.org id=B64188.168778315416388 (code B ref 64188); Mon, 26 Jun 2023 12:40:04 +0000 Received: (at 64188) by debbugs.gnu.org; 26 Jun 2023 12:39:14 +0000 Received: from localhost ([127.0.0.1]:44767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUv-0004GB-VA for submit@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:14 -0400 Received: from mail-wr1-f51.google.com ([209.85.221.51]:46163) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUt-0004F5-6J for 64188@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:11 -0400 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-313f2a24cb6so896793f8f.0 for <64188@debbugs.gnu.org>; Mon, 26 Jun 2023 05:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687783145; x=1690375145; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=fDr2gQ4E0M+2kBmCgFw/Ozk3Cr9PTk5B2N5KSuSzAAs=; b=l5JvDbqlsAgTkrP4uH6jficHibHWMLKr4HwwKT5WMYfNnvj8y9dq0HjaekVyiNvTWq x0OXj0t+qTL6H2NQhrfNKbajtmEdbM6nsGhUQdZkBLJjTaPoSdhQ/H9xEQShiLpQawYd IfKYSO/Z7Hz+MvhRViZO4P83Jm7XLRnthqy1ZmoMKBTLcBquHzEm5Cgk8PVbrgmCUShd pG18karc4cAbMaoj4sI1lloMvU3neXGnAi1zv7i6/0m5KzipB+ZuRz5sgeL5kgCKZZDm etU93QsEvaao6coyTS94wonIOqHpIx39XiinhQf1T9vfrSE0JKJpKNQXEi1iGLSVoMwC HCTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687783145; x=1690375145; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=fDr2gQ4E0M+2kBmCgFw/Ozk3Cr9PTk5B2N5KSuSzAAs=; b=KEIMbNX4TIe+NajDvoCQX63vqihlckL6fFQN0MmYVEqbSMnBqdz+zypC/htEDoA3kS kilt6RFA6/eTFQb4ulddtvMvuZKR5E0Npr/y3Fod1GY1TdNf5fypdZjIT8dhOddeFoQl go4r4mtvSurK0Gl41RRUJKk3anSOGJu+BubBwcoTbOSwmGMs17ESBGIAFd3Rpb0dg/Cf vjF5IoXVRLkVebrsGfU9wz0QJEyAGQc6HUCdKcQqduaQzzaHEpAh8Fg/r+09kZGyYu5H gQdwvaF5A5ryHwPbkmu3d2+kiADQ8sjtGZTXB5nRFyPqMohG+HkypQ4b/6cQgU02tugb +hZA== X-Gm-Message-State: AC+VfDz4GRbYpHSsOgzSt/Z2jmNC+VK9ySV6FNuGLVn75fgRreG/Z3tY N709nuYXEGvpLl4RwmSr9m4Um+KvokmwnA== X-Google-Smtp-Source: ACHHUZ5gEG+u4pjgU3HnQu+beeHC7W8GDrfwNiaO/ORnooU/bKTIRM2B4iKcYneMIzgRM9caQvuTCQ== X-Received: by 2002:a5d:42d1:0:b0:30f:c1c3:8173 with SMTP id t17-20020a5d42d1000000b0030fc1c38173mr25524873wrr.26.1687783145297; Mon, 26 Jun 2023 05:39:05 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id e15-20020adfe7cf000000b0030aed4223e0sm7233471wrn.105.2023.06.26.05.39.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 05:39:04 -0700 (PDT) From: Efraim Flashner Date: Mon, 26 Jun 2023 15:38:41 +0300 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/cpu.scm (gcc-architecture->micro-architecture-level): New variable. --- guix/cpu.scm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/guix/cpu.scm b/guix/cpu.scm index 30cd860a19..29ad883584 100644 --- a/guix/cpu.scm +++ b/guix/cpu.scm @@ -32,7 +32,8 @@ (define-module (guix cpu) cpu-model cpu-flags - cpu->gcc-architecture)) + cpu->gcc-architecture + gcc-architecture->micro-architecture-level)) ;;; Commentary: ;;; @@ -283,3 +284,24 @@ (define (cpu->micro-architecture-level cpu) (architecture ;; TODO: More architectures architecture))) + +(define (gcc-architecture->micro-architecture-level gcc-architecture) + "Return a matching psABI micro-architecture, allowing optimizations for x86_64 +CPUs for compilers which don't allow for more focused optimizing." + ;; Matching gcc-architectures isn't an easy task, with the rule-of-thumb being + ;; 'Haswell and higher' qualify for x86_64-v3. + ;; https://gitlab.com/x86-psABIs/x86-64-ABI/-/blob/master/x86-64-ABI/low-level-sys-info.tex + (match gcc-architecture + ((or "grandridge" "graniterapids" "sierraforest" "tigerlake" + "sapphirerapids" "cooperlake" "icelake-server" "icelake-client" + "cannonlake" "knm" "knl" "skylake-avx512" "alderlake" "skylake" + "broadwell" "haswell" + "znver4" "znver3" "znver2" "znver1" "bdver4") + "x86_64-v3") + ((or "sandybridge" "tremont" "goldmont-plus" "goldmont" "silvermont" + "nehalem" "bonnell" "core2" + "btver2" "athalon" "k8-sse3" "k8" "bdver3" "bdver2" "bdver1" "btver1" + "amdfam10" + "lujiazui" "x86-64") + "x86_64-v1") + (_ gcc-architecture))) From patchwork Mon Jun 26 12:38:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51353 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9357427BBE9; Mon, 26 Jun 2023 13:46:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 83F6C27BBE2 for ; Mon, 26 Jun 2023 13:46:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDlWG-0008P2-TG; Mon, 26 Jun 2023 08:40:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDlVl-0008Gb-Hs for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDlVl-0005wJ-5K for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDlVk-0004Ix-Uu for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH v2 6/7] gnu: go: Add CPU tuning targets. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 12:40:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64188 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64188@debbugs.gnu.org Cc: Efraim Flashner Received: via spool by 64188-submit@debbugs.gnu.org id=B64188.168778316416411 (code B ref 64188); Mon, 26 Jun 2023 12:40:04 +0000 Received: (at 64188) by debbugs.gnu.org; 26 Jun 2023 12:39:24 +0000 Received: from localhost ([127.0.0.1]:44770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlV5-0004Gb-E2 for submit@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:23 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:56495) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUu-0004FR-NN for 64188@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:13 -0400 Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-311099fac92so4490400f8f.0 for <64188@debbugs.gnu.org>; Mon, 26 Jun 2023 05:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687783147; x=1690375147; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=QArB61ZaBlsKH9o7v20L+XAb6dBHB5LI03AapNzQ+Kw=; b=ToHq65mWgJJlNsX6Dp8yBVAG0yBp2EQzexoy6ut3qLzd0UeZN63A6d4R6Pvf6ndPQJ H7zB0krQ3R9PXN8CcWPWwyBHjzbxcKcVHoIazLhpPiLpuLRP/UXyS+f9O8wLnDlqfgGs UhBkoqTBp6QmGKpA+rjVTwNuC7PYllPRt9rGniqzRL5KENpwaEvPoqjSH370PraUDMvU k+4UjHtnT9IFqtn7+8FpC7dunKltnyCKk1JlKqJIhaugP8PhtgEgPK9RRf31Z5R67ioQ iBqprIkCn15UAuSOnchXDQ52v5jUuYxQINzu1NAbElU0Jgi/7xHW7vRbszS13bGbhjht 2XJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687783147; x=1690375147; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QArB61ZaBlsKH9o7v20L+XAb6dBHB5LI03AapNzQ+Kw=; b=Y9lqmF07X1FKgeEp0nk5SndyU3L6HbIJEQ2weDOd3y22KMk99/YYcTG95mWArMfMKk rwsQ4yd8JkDSYH57dkI+NxirVVzPc6XW6dOtegdhFoPSiW8/N2N+ZY769Si4ogP8Rox8 WKZ4lIx9oMUD041JhwywRx22EnX9jHcvDHNYjL7v72wb1Rc20ftuAZKFMmTWAP126dR6 1wGrE1R3D+fvRWF8ncnU2vwRcfgkYfcFR4IxnKjDMfyKyYkYXodxbGk7rxZKW5UFfZ+l v+tMERef7gzH++hEmddZDmbO5mKju1bexv/ljvkPpVep/fLlr9SiFuDajvCwc/yfW2Qj O6Tg== X-Gm-Message-State: AC+VfDz9q1ead3YIkgU27VmoivAJYyVeRpTgsYXa+S40dxcMiVHhtLz+ yw4FoRrHwRdrzRWi/VhMje4yPMsrYGq0lg== X-Google-Smtp-Source: ACHHUZ7KDpfWdCj7VXWMU91lMs4qmAYILT3yOjTNmrG6jLT1xRCDlYegeoagNIGb+lC7/3Vr//Hiaw== X-Received: by 2002:adf:df82:0:b0:313:e20c:b8e0 with SMTP id z2-20020adfdf82000000b00313e20cb8e0mr6084280wrl.23.1687783147122; Mon, 26 Jun 2023 05:39:07 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id u14-20020adfdb8e000000b003112ab916cdsm7380079wri.73.2023.06.26.05.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 05:39:06 -0700 (PDT) From: Efraim Flashner Date: Mon, 26 Jun 2023 15:38:42 +0300 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/golang.scm (go-1.17)[properties]: New field. (%go-1.17-arm-micro-architectures, %go-1.17-powerpc64le-micro-architectures, %go-1.18-x86_64-micro-architectures): New variables. (go-1.18)[properties]: New field. --- gnu/packages/golang.scm | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index e4c4cb299b..55cc40dda5 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -628,6 +628,13 @@ (define-public go-1.16 `(("go-fix-script-tests.patch" ,(search-patch "go-fix-script-tests.patch")) ,@(package-native-inputs go-1.14))))) +;; https://github.com/golang/go/wiki/MinimumRequirements#microarchitecture-support +(define %go-1.17-arm-micro-architectures + (list "armv5" "armv6" "armv7")) + +(define %go-1.17-powerpc64le-micro-architectures + (list "power8" "power9")) + (define-public go-1.17 (package (inherit go-1.16) @@ -844,7 +851,14 @@ (define-public go-1.17 "README.md" "SECURITY.md")))))))) (inputs (if (not (or (target-arm?) (target-ppc64le?))) (alist-delete "gcc:lib" (package-inputs go-1.16)) - (package-inputs go-1.16))))) + (package-inputs go-1.16))) + (properties + `((compiler-cpu-architectures + ("armhf" ,@%go-1.17-arm-micro-architectures) + ("powerpc64le" ,@%go-1.17-powerpc64le-micro-architectures)))))) + +(define %go-1.18-x86_64-micro-architectures + (list "x86_64-v1" "x86_64-v2" "x86_64-v3" "x86_64-v4")) (define-public go-1.18 (package @@ -887,7 +901,12 @@ (define-public go-1.18 "ldflags, err := setextld(ldflags, compiler)\n" "ldflags = append(ldflags, \"-r\")\n" "ldflags = append(ldflags, \"" gcclib "\")\n"))))))) - '()))))))) + '()))))) + (properties + `((compiler-cpu-architectures + ("armhf" ,@%go-1.17-arm-micro-architectures) + ("powerpc64le" ,@%go-1.17-powerpc64le-micro-architectures) + ("x86_64" ,@%go-1.18-x86_64-micro-architectures)))))) (define-public go-1.19 (package From patchwork Mon Jun 26 12:38:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51352 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1660E27BBE9; Mon, 26 Jun 2023 13:43:37 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7C3E727BBE2 for ; Mon, 26 Jun 2023 13:43:36 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDlWI-00006o-Jg; Mon, 26 Jun 2023 08:40:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDlVr-0008K8-6Z for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDlVo-0005y5-LO; Mon, 26 Jun 2023 08:40:09 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDlVl-0004J5-C4; Mon, 26 Jun 2023 08:40:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH v2 7/7] transformations: Allow tuning go packages. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 12:40:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64188 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64188@debbugs.gnu.org Cc: Efraim Flashner , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 64188-submit@debbugs.gnu.org id=B64188.168778316416418 (code B ref 64188); Mon, 26 Jun 2023 12:40:05 +0000 Received: (at 64188) by debbugs.gnu.org; 26 Jun 2023 12:39:24 +0000 Received: from localhost ([127.0.0.1]:44772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlV6-0004Gf-0v for submit@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:24 -0400 Received: from mail-wm1-f41.google.com ([209.85.128.41]:44404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUw-0004FZ-WB for 64188@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:16 -0400 Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-3f9c88ac077so41425995e9.1 for <64188@debbugs.gnu.org>; Mon, 26 Jun 2023 05:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687783149; x=1690375149; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=LwwwmFpvBIVIQtMswvyyZ/l54M3FmQmhCc8uvh4HwKQ=; b=cNqi6EQ+EjpT7nfyvz6SJvbVomnel9zomIW7We+5DbC2C0N/sWn4f+RtCJ5rbQnWsM RWzx1hH2kJVe3nrL2QGAgJ5Fo3QNrUiKFYQzJtVQlbPBXhw0axXpkuo295iriUcCzzKT YSpNcfW9EDISkIB4/wx5OdBSb1i3Rpqhfo9PcN5oMOAIhIpoEAS60Uzn7en6jtVjCsk9 /fG6G/g51OVx8yd8zbwI7mEo9i59MUDZf9nf8SBNgWk6ecZhYIPS8fn1IuacSPisLR6G 83NVzRD8jYrsA30wkDzFTb2jD14jlA988y5a6p9v7+VMc4WkdUQ6s7BFRI/3bPy2q/AM LnKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687783149; x=1690375149; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=LwwwmFpvBIVIQtMswvyyZ/l54M3FmQmhCc8uvh4HwKQ=; b=jDjbOyxwwuBw8HKgYGwDm6MoxrcaBJlja02icgi5sK5miBIg79b+Ozx4Lez1Oqyb0a qiLIC/Ewydz2UCAJH3a3KlmmYEWXA3jpBRj5wfoMvOA11Ku02MT8MPpjHqiF/TX2fiel gi6NUgo1G14+iClSvF9PzUYI4822L1rcjh1mIANYA6YxX2v+BG4nemcAl3CS9VZecisC N04wx5XPv8oO7wrFZEzaLjRik9NpM3OSkJHjt4SuEPq1hIcTAexGFtLE6NemothLwhWI JQLoP7X7jCJxENSX3c+L/x1iRBAGfhQkpwR46Uv5l+Nw3+g1YCBsfTr9DPnhhlt7NY/t 0pow== X-Gm-Message-State: AC+VfDxV7Um/lXmjoYN0PkYbUktR0+LMLX5qmswnMcH1zcp6HmPyVboh cPeaQdypOFpBL5aA/QlQduIpAKgo031PFg== X-Google-Smtp-Source: ACHHUZ6ZwC4qkP/idR54wraMKv6S+lEzBbNFztc0utt8snU6QFGiYZqmfvmADYh0yAEj5TN1jdE2ZQ== X-Received: by 2002:a05:600c:231a:b0:3f9:b430:199b with SMTP id 26-20020a05600c231a00b003f9b430199bmr16149326wmo.15.1687783149085; Mon, 26 Jun 2023 05:39:09 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id j9-20020a5d4649000000b0030aefa3a957sm7284253wrs.28.2023.06.26.05.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 05:39:08 -0700 (PDT) From: Efraim Flashner Date: Mon, 26 Jun 2023 15:38:43 +0300 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/transformations.scm (build-system-with-tuning-compiler): When checking if a microarchitecture is supported by the compiler, also check if it is a go compiler which supports that psabi. Add a phase after 'setup-go-environment to set the go microarchitecture. --- guix/transformations.scm | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/guix/transformations.scm b/guix/transformations.scm index a289f81219..92d9c89c0e 100644 --- a/guix/transformations.scm +++ b/guix/transformations.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2016-2023 Ludovic Courtès ;;; Copyright © 2021 Marius Bakke ;;; Copyright © 2023 Sarthak Shah +;;; Copyright © 2023 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -32,7 +33,9 @@ (define-module (guix transformations) #:autoload (guix upstream) (package-latest-release upstream-source-version upstream-source-signature-urls) - #:autoload (guix cpu) (current-cpu cpu->gcc-architecture) + #:autoload (guix cpu) (current-cpu + cpu->gcc-architecture + gcc-architecture->micro-architecture-level) #:use-module (guix utils) #:use-module (guix memoization) #:use-module (guix gexp) @@ -516,7 +519,9 @@ (define (build-system-with-tuning-compiler bs micro-architecture) 'compiler-cpu-architectures) p)) (_ #f)) - (bag-build-inputs lowered)))) + (bag-build-inputs lowered))) + (psabi (gcc-architecture->micro-architecture-level + micro-architecture))) (unless compiler (raise (formatted-message (G_ "failed to determine which compiler is used")))) @@ -528,8 +533,11 @@ (define (build-system-with-tuning-compiler bs micro-architecture) (G_ "failed to determine whether ~a supports ~a") (package-full-name compiler) micro-architecture))) - (unless (member micro-architecture - (or (assoc-ref lst architecture) '())) + (unless (or (member micro-architecture + (or (assoc-ref lst architecture) '())) + (and (string=? (package-name compiler) "go") + (member psabi + (or (assoc-ref lst architecture) '())))) (raise (make-compound-condition (formatted-message @@ -556,6 +564,27 @@ (define (build-system-with-tuning-compiler bs micro-architecture) (bag (inherit lowered) + (arguments + (substitute-keyword-arguments (bag-arguments lowered) + ;; We add the tuning parameter after the default GO flags are set. + ((#:phases phases '%standard-phases) + #~(modify-phases #$phases + (add-after 'setup-go-environment 'set-microarchitecture + (lambda _ + (cond + ((string-prefix? "arm" #$psabi) + (setenv "GOARM" (string-take-right #$psabi 1)) + (format #t "Setting GOARM to ~s." + (getenv "GOARM"))) + ((string-prefix? "powerpc" #$psabi) + (setenv "GOPPC64" #$psabi) + (format #t "Setting GOPPC64 to ~s." + (getenv "GOPPC64"))) + ((string-prefix? "x86_64" #$psabi) + (setenv "GOAMD" (string-take-right #$psabi 2)) + (format #t "Setting GOAMD to ~s.\n" + (getenv "GOAMD"))) + (else #t)))))))) (build-inputs ;; Arrange so that the compiler wrapper comes first in $PATH. `(("tuning-compiler" ,(tuning-compiler micro-architecture))