From patchwork Tue Jun 20 07:51:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51095 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 849DD27BBEA; Tue, 20 Jun 2023 08:52:42 +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 08C6727BBE2 for ; Tue, 20 Jun 2023 08:52:42 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBW9j-0003lh-3x; Tue, 20 Jun 2023 03:52:03 -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 1qBW9i-0003lX-Dh for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:02 -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 1qBW9i-0006ML-57 for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBW9i-00055s-1C for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH 1/8] gnu: %gcc-11-x86_64-micro-architectures: Add generic options. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 20 Jun 2023 07:52:01 +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.168724747319429 (code B ref 64188); Tue, 20 Jun 2023 07:52:01 +0000 Received: (at 64188) by debbugs.gnu.org; 20 Jun 2023 07:51:13 +0000 Received: from localhost ([127.0.0.1]:57946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW8u-00053I-NC for submit@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:12 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:56483) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW8s-00052z-NM for 64188@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:11 -0400 Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-311099fac92so5119604f8f.0 for <64188@debbugs.gnu.org>; Tue, 20 Jun 2023 00:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687247465; x=1689839465; 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=W15okNRfKglCI26HtE3HaYTr+lHOJ+mzzo9xrD7Cwz4=; b=f/3neW87PYv9tjEFbvqu4cxov+S9cxkoYcuoYOItclwSR1BaXDrgPjuRa6Ujny4B8p ddsIQ3SnveSLQqYl3arfrnzxfQYJ7Kn6sIqklT/t4ZV1c69cL5PqZddPkmEM/HXNOjto Jk3jIYfht4aZyueVdCZl+ucfsP98kwlWNk+HzBoq7TyKrdFvzrU4LZ7BTxsMnEz98sqr HT9/QjymvCjHg9dC9KFrB6QFw9xwUvyJkDJ0bSm7SELtf6K1h2JbAKwtly/rgByC2psD 81vYCXIUM5Rh73jOMk+I11gzfAggtuWzUJZFLUWpfyazcRJwvZng4p8AZJky9SOBsOeE eiaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247465; x=1689839465; 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=W15okNRfKglCI26HtE3HaYTr+lHOJ+mzzo9xrD7Cwz4=; b=D3UXhRRkWtwk8EA/H/JAQd/lY/Pey+MeRwy+pU9l1ZbRNaHEkSTFAy1VDUPT9734xB xxpmB+N8EHD3TJ2Na7fSnUvp5Gc+aM2N1usHmrGj5W9CppXwNu4zbkz7Qb/zQ8TwKyIc kGVrVYDNslr82HGHewWTI7M5anoPlPbGRDLcD6orfMWKw4uM+CaCwvrobhA/Au4w2BOm sDYOQKXhKI8o5CgLvg/ZrsOzZIPe+ERnP+F988G8ab4i9uGvTq4JblMxAnH1NO93XRgq AmxXWCW4NQhjOyyz9UqiPPEKJ4uQRjBeuwtiBOgoQnknmGTYvB7wFU2Klx93yaWO/bPz qVBg== X-Gm-Message-State: AC+VfDwF3aru6wq/bCmZJPOj0jBh7h196y30PHYRFmX8b0NY/OQ3YLAx iE2YDaJxYzdDc0RpOagehTUHTg5CQjS0Fc5e X-Google-Smtp-Source: ACHHUZ6YrJx/x/164ovUtpQT/0jT5mXrncK3ELJeCbCjw6cDeiIQiK0TjOj5hT5jwcuNKLpIJFIUPQ== X-Received: by 2002:a5d:5960:0:b0:30e:19a8:4b0a with SMTP id e32-20020a5d5960000000b0030e19a84b0amr10889891wri.2.1687247464471; Tue, 20 Jun 2023 00:51:04 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id m15-20020a056000008f00b0030e5bd253aasm1352437wrx.39.2023.06.20.00.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:51:04 -0700 (PDT) From: Efraim Flashner Date: Tue, 20 Jun 2023 10:51:02 +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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 1b444c2b02..f5736de993 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -614,7 +614,9 @@ (define %gcc-11-x86_64-micro-architectures (append %gcc-10-x86_64-micro-architectures '("sapphirerapids" "alterlake" "rocketlake" ;Intel - "btver1" "btver2"))) ;AMD + "btver1" "btver2" ;AMD + + "x86_64-v1" "x86_64-v2" "x86_64-v3" "x86_64-v4"))) ; Generic ;; Suitable '-march' values for GCC 12. (define %gcc-12-aarch64-micro-architectures From patchwork Tue Jun 20 07:51:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51099 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 4F63927BBE9; Tue, 20 Jun 2023 08:52:51 +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 A853327BBE2 for ; Tue, 20 Jun 2023 08:52:50 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBW9n-0003nI-MS; Tue, 20 Jun 2023 03:52:07 -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 1qBW9l-0003mA-CZ for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:06 -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 1qBW9l-0006NY-36; Tue, 20 Jun 2023 03:52:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBW9i-00055z-EO; Tue, 20 Jun 2023 03:52:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH 2/8] guix: cpu: Add inexact 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: Tue, 20 Jun 2023 07:52: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 , 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.168724747619446 (code B ref 64188); Tue, 20 Jun 2023 07:52:02 +0000 Received: (at 64188) by debbugs.gnu.org; 20 Jun 2023 07:51:16 +0000 Received: from localhost ([127.0.0.1]:57949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW8y-00053Z-0h for submit@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:16 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:52732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW8w-000535-7h for 64188@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:14 -0400 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-30e3caa6aa7so4364724f8f.1 for <64188@debbugs.gnu.org>; Tue, 20 Jun 2023 00:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687247468; x=1689839468; 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=GvOp7dpftE/82t5oSPr/dcYhFChSum/lRb9TF6+vQPg=; b=CxfdHX97rzieiMXWSLZTg69dic0Z6Kr52ywrCTC9OzKgfGL1sG4z7n/xYEGmk4X9A8 pMyoYXRpctz4Cta95fXIYz74CMx9fAPSaKvd1DMNnLEQ5jIkPvivOJWDgY5R2dzHFSMx wmVfYWb1iBbZ7jhXFw29gCVeyM5H9npYpQAk09upZ5ADw5XfD6HSK4qZri/S2dkbkqR5 +zA+FWLNLVIPb1gx/4nWHnK9kbRWSSp+wzzluIt0XR2roaZnQHqdABup0RsfcyG6swwa f8iOgQKFojoQYOU1NwRgxGZGskSuBCaJBT5vZjIJJ7WeG7BwK1hKyVMsRvTb+18PRIV5 1cvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247468; x=1689839468; 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=GvOp7dpftE/82t5oSPr/dcYhFChSum/lRb9TF6+vQPg=; b=k3C7iD5CLWb73qk8ap6AXj7OPxAVMdBoCow48PEvajQ6T6jNVbm8aZi8OSFgPsz+ab VWL933kVGvG/LQnwGj+KkfEILHSlLc69p5FxmfJbrLCEHP9oLzZ1mM4HLcj6umt5pnLD KnIIVroyTyvTeEyYw/bP8k6RJ4mh06lFG1jhsrRvAS+CvDmUbh7w3dyvO0FOV8aCnHsP oi5aVFeuiTUHq6vUVfmpt9M/E5IaawZwZ3Uj+66ACV5TzxuKKOijmYnD0v08YJNKGkJH x0eBiDoULAq3j1ppAZQV/+ZlY7I74DSD3p6U65V7TcVknA/Xe2L9OkUBjEH4ar3OxVMS mFyQ== X-Gm-Message-State: AC+VfDwkPiFGy/HtSR+HuC+jS5X3Fwjxf8BIgSISBf5lgyqvpnzjPCj2 wDP2UzInIfLs5tjqeuUXf2kImYVJi4g9ITYC X-Google-Smtp-Source: ACHHUZ61+iLhFnmOjFejYMjKzL4IbtbO7Zu08eEoaCNFBm0NzY7vDysKXP898Zs7gxk0i3p2Uz+mPg== X-Received: by 2002:a05:6000:1370:b0:311:1a45:3606 with SMTP id q16-20020a056000137000b003111a453606mr9216934wrz.30.1687247468514; Tue, 20 Jun 2023 00:51:08 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id y14-20020a5d470e000000b0030647449730sm1356830wrq.74.2023.06.20.00.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:51:08 -0700 (PDT) From: Efraim Flashner Date: Tue, 20 Jun 2023 10:51:03 +0300 Message-Id: <6ecddc871328fcb3b494f3e6c1aafc6ad1d20830.1687247150.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->generic-architecture): New variable. --- guix/cpu.scm | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/guix/cpu.scm b/guix/cpu.scm index 45e1abeed7..e6102e3d14 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 + cpu->generic-architecture)) ;;; Commentary: ;;; @@ -285,3 +286,36 @@ (define (cpu->gcc-architecture cpu) (architecture ;; TODO: More architectures architecture))) + +(define (cpu->generic-architecture cpu) + "Return the architecture name, suitable for inexact architecture optimizations, +that corresponds 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 Tue Jun 20 07:51:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51097 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 DA73D27BBE9; Tue, 20 Jun 2023 08:52:44 +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 6273227BBE2 for ; Tue, 20 Jun 2023 08:52:44 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBW9o-0003nK-27; Tue, 20 Jun 2023 03:52:08 -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 1qBW9l-0003mB-EU for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:06 -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 1qBW9k-0006NS-R4; Tue, 20 Jun 2023 03:52:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBW9i-000565-Po; Tue, 20 Jun 2023 03:52:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH 3/8] 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: Tue, 20 Jun 2023 07:52: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 , 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.168724747919468 (code B ref 64188); Tue, 20 Jun 2023 07:52:02 +0000 Received: (at 64188) by debbugs.gnu.org; 20 Jun 2023 07:51:19 +0000 Received: from localhost ([127.0.0.1]:57953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW91-00053v-DA for submit@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:19 -0400 Received: from mail-wm1-f45.google.com ([209.85.128.45]:53375) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW8y-000538-50 for 64188@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:16 -0400 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-3f8c65020dfso47319465e9.2 for <64188@debbugs.gnu.org>; Tue, 20 Jun 2023 00:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687247470; x=1689839470; 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=6rB6+88bEE0VUXQmBy2pUIf2SRFPVhTx0NwrBSxwUb0=; b=pi0sMtgr8ymlFJJzA53Ri1lpehR+RlnH77/MLaiR3LhGEGCmu2s6S5O6xE4xLeIFMW CFIjcbGVL92DGtt5EmPLNNjwPNgaWUkul0VUEUPIVyTXUJP5vzOKDq5gqM9gpz9vu3zs 0q6Ivq1MYKj2DRqY5sijiWDr41/DGNjM55z67eYHTrgmyyBQfNmwnMRLwHN+xe5Jp2Ob OAEVzZxeKPpxh8jdCUAwR0ObiIxhCeQ2DIRpDp9LUdwqQjQsPeRWZWMYmlfFuluB7Ahl CyjpBdyk2yDudDbblLgrArG3aYm+Ds9C2Nhnwc+gI9x8FVBrlwb+C997hmnMX88jXcqk 7BDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247470; x=1689839470; 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=6rB6+88bEE0VUXQmBy2pUIf2SRFPVhTx0NwrBSxwUb0=; b=LPjXOa8UBlz8897V5PGtkhVxNc9y6C7I3pZHEOE68TGpqjuQzDEQHlMdh1CVsAWUsK W8HchZgwNV/VB7N3T6kC1XouRYYdYk7fOna3Df479vqa6r9k5NQFBTxszeR7r7/2z3w2 BXWHdSHPrRh9QCQaRlrzQ7TSb/RTsYG45yWvxc1Gph+0+iuQchjlWbWi6B4ZlxzXxwC2 t7m5vBx8sxIis3icVUR84fb/aMqwWAWg8c9TuHkf7x0TqgPXEdE1mqK8AgWuuupI42NE 1+JrwSK30c1qoZxWM87c/x2YtIULB0G6tP/Us60Jj6/9c/Hcf0Ci1HTjdP3r1DlX1OrQ n+Eg== X-Gm-Message-State: AC+VfDxVCg/gI0BbGc7CwgGQJ/k/efEY0DhNubVBIkkUQV/flD7PJlrv zjxtP745AK5qdb8jInwWlkOHUTfBcxZkrHVe X-Google-Smtp-Source: ACHHUZ6PqHuGA3lAc2Hhys5vxLK7Bgg/2JoAXDTTd4M+AqeCGsvYLlRmKbPD+GS2d0vClicdtIWyRw== X-Received: by 2002:a05:600c:22d8:b0:3f8:f884:ebec with SMTP id 24-20020a05600c22d800b003f8f884ebecmr9197668wmg.17.1687247470358; Tue, 20 Jun 2023 00:51:10 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id f20-20020a1c6a14000000b003f8f884ebe5sm1686468wmc.2.2023.06.20.00.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:51:10 -0700 (PDT) From: Efraim Flashner Date: Tue, 20 Jun 2023 10:51:04 +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 (cpu->gcc-architecture): Adjust the fallback case to use cpu->generic-architecture. --- guix/cpu.scm | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/guix/cpu.scm b/guix/cpu.scm index e6102e3d14..e500664503 100644 --- a/guix/cpu.scm +++ b/guix/cpu.scm @@ -210,21 +210,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->generic-architecture cpu))) ;; TODO: Recognize CENTAUR/CYRIX/NSC? From patchwork Tue Jun 20 07:51:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51100 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 155FA27BBE9; Tue, 20 Jun 2023 08:52:52 +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 8689427BBE2 for ; Tue, 20 Jun 2023 08:52:51 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBW9n-0003my-Cr; Tue, 20 Jun 2023 03:52:07 -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 1qBW9m-0003mJ-9E for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:06 -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 1qBW9l-0006Nl-G3; Tue, 20 Jun 2023 03:52:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBW9j-00056H-5C; Tue, 20 Jun 2023 03:52:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH 4/8] 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: Tue, 20 Jun 2023 07:52: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.168724748019475 (code B ref 64188); Tue, 20 Jun 2023 07:52:03 +0000 Received: (at 64188) by debbugs.gnu.org; 20 Jun 2023 07:51:20 +0000 Received: from localhost ([127.0.0.1]:57955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW91-000542-Qm for submit@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:20 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:44089) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW8z-00053H-Pe for 64188@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:18 -0400 Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-311183ef595so4158801f8f.0 for <64188@debbugs.gnu.org>; Tue, 20 Jun 2023 00:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687247472; x=1689839472; 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=e3Ue99nDYZ4Z89xMaS87vUllvGH8q1VmDDTQRWV3pDE=; b=ClZZ7Wgy5Puo20ozW1C+KuM+B6sEwEODsJnWkGpQ/QOaOG2bGuaz6G2yCu9J8dbJgU TaFFqRruD3YnxkLrxNQf92BbLAbx+Vy0P7O1/LBKBy8Kqeqy36NDbdt3au4KvkxdKhli K4EOJqEHx88rAl6MUGtUYKLSAKPiq23zV2AJPG9joViGDClOoMsZgAfKYwgFlLxWQ5Zh 30vb2kpNUxVKEyQ4qWIJUjgKs+dR+hdsQcSB7tUl6chjGQ5TOGrnRvhzKHR9k1jIjdU/ bTy70KvZc9SKuBm3daXxr5mQ3GLydYM+Il7vE/SlKOiNdDrKr2rKphMYZdrJ8BdIUsHj Nvkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247472; x=1689839472; 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=e3Ue99nDYZ4Z89xMaS87vUllvGH8q1VmDDTQRWV3pDE=; b=eluAw55wkdIA0W8matjEZgWN3qZItySi3cZ+MAwAoZIu/oO4ipNxRT0U59+9jhWXZJ e29XIeCe5Mgcq5RB/6f8N+FdgNNoKeUdCKhFRMGGbam/SdxuiCNxdBlwROL4UXbG7RQN fu4OMu7r2TpoSBp7NweLDEUWVMkVEjgU8lfDyxdm33QuqPUm7wNnal7Ydw9N27QtnxRY 8lN4hAm6pCbpkKj9RTfDwEqSFXGzAPLUzRYTGchItGvkEq6gFJFO6mxjBKCHSFYTeyWs 3icGteHuETLrdaHH3mT4ZJUEjgUJP8Tvd8U8qAV5i7meCrfnc4Qlp+vHBP570SZhbt4W /Peg== X-Gm-Message-State: AC+VfDz3Rw57abgQ2w/VhM+41yLsenW+drK5ESyV0DkwFJyzm6mA5BqV vleYifDsvWVCuPPPtNtZvHhEnd9THzu9mmVB X-Google-Smtp-Source: ACHHUZ7q30IXsrJqzMLqtk809m86xaZ/CUrr9VWno7K9eZT0AX5NZS1aoIFCAgUDG8dFCl29UobcMw== X-Received: by 2002:a5d:46c5:0:b0:30f:ce77:434c with SMTP id g5-20020a5d46c5000000b0030fce77434cmr9103293wrs.62.1687247472177; Tue, 20 Jun 2023 00:51:12 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id i15-20020a5d55cf000000b0030633152664sm1329284wrw.87.2023.06.20.00.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:51:11 -0700 (PDT) From: Efraim Flashner Date: Tue, 20 Jun 2023 10:51:05 +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 (cpu->gcc-architecture): Refactor to wrap all the x86_64 options inside a common letrec-syntax. --- guix/cpu.scm | 59 +++++++++++++++++----------------------------------- 1 file changed, 19 insertions(+), 40 deletions(-) diff --git a/guix/cpu.scm b/guix/cpu.scm index e500664503..ddfa4f20bb 100644 --- a/guix/cpu.scm +++ b/guix/cpu.scm @@ -115,19 +115,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") @@ -153,20 +153,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)) @@ -193,28 +182,18 @@ (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" - (cpu->generic-architecture cpu))) + (cpu->generic-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 Tue Jun 20 07:51:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51093 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 6A22927BBE9; Tue, 20 Jun 2023 08:52:32 +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 7298427BBE2 for ; Tue, 20 Jun 2023 08:52:30 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBW9k-0003m6-Vo; Tue, 20 Jun 2023 03:52:05 -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 1qBW9k-0003lw-A4 for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52: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 1qBW9j-0006N6-LG for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBW9j-00056P-H2 for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH 5/8] gnu: go: Add CPU tuning targets. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 20 Jun 2023 07:52: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 Received: via spool by 64188-submit@debbugs.gnu.org id=B64188.168724748419504 (code B ref 64188); Tue, 20 Jun 2023 07:52:03 +0000 Received: (at 64188) by debbugs.gnu.org; 20 Jun 2023 07:51:24 +0000 Received: from localhost ([127.0.0.1]:57960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW96-00054R-8M for submit@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:24 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:45481) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW91-00053T-UF for 64188@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:20 -0400 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-30fcda210cfso4150483f8f.3 for <64188@debbugs.gnu.org>; Tue, 20 Jun 2023 00:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687247474; x=1689839474; 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=I4dZXYdhtEg2FuatYsIxG7WVf/4ArICeDFNWrU3kbwY=; b=BjkdOoqK7iO4ot7TxylJCuJbNnEv8zWrzGkclNDgiXvI2GA1akpxucP4uxDmz+MT1r kzm6PE9apxC4ePJz1C3N3NbGThAoLxMb9HQkmpn7aHsqCAIRuur9m6kDHQP6wT8r7U9j qFwNBMYllnkxwk/IRhSDktqFaRYscPxUNocQMQ9JoThW8oeVKPHCv9zr3b0JxkssXFDG dFD7JYkg99VdxMz2wJWgqA4NB3T0C+xZIOSfVbf00h+IJozzIFHQaMkG62wVBbzIxP8E FyIHKkntizc3y4Wk4uHhYYgH+Xfn8pFsecWjJuLX6Zr1pT+TnzolcoGxZosB2Ej5Re83 Ce1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247474; x=1689839474; 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=I4dZXYdhtEg2FuatYsIxG7WVf/4ArICeDFNWrU3kbwY=; b=eSnAUItnW4ODJyQ8R45Ue5223dhToMc2njgNgf1iI0vAbVNXvnYqgVg9ItUT5ekW8B WMwkr5qxp1xuKS86Av0qpnfw13P16vDOkbXhRilywurFnxMGzj2qwgQ2tbHBo0PJ4i4v 5VtTXPreocSvP12cbvBl1V9YwBAQdCqPsThl5XXpXv8r1kXiRP+084KiXdb4ptuitmwp sJHksJ5RWcqLf+aNoGQoRCqlNrEjr6Uqr5P/0iIr+Oa4RLcNCjGllRHQSHbxmnaXUouf D5d+PjYuBP852hXG9HTcWBGxwTYUJ3DcS24yFNQfVJs1GoQA2DnWEdZV97Z5q9tWaauv laEg== X-Gm-Message-State: AC+VfDyn501EyaABQhYMQ8oSQaJ2nrMMWsyMaoAttP3XhPZlLDiCkHwy 7AuWp/L9oy+dw+awsF5Af3yRBOclsOO80WqG X-Google-Smtp-Source: ACHHUZ4qZ/kZu64VP7EGmyi8rPP+fAO/4vFIZ81JH8hCf8IZvpOZY5KRjQzSM0mKobu/Kq+WdZqdWw== X-Received: by 2002:a5d:654a:0:b0:30f:bd48:6828 with SMTP id z10-20020a5d654a000000b0030fbd486828mr8118366wrv.31.1687247474335; Tue, 20 Jun 2023 00:51:14 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id w8-20020adfcd08000000b00301a351a8d6sm1356318wrm.84.2023.06.20.00.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:51:13 -0700 (PDT) From: Efraim Flashner Date: Tue, 20 Jun 2023 10:51:06 +0300 Message-Id: <2c8bd624a47e6902bdfc25b8322aa03b31b8291f.1687247150.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 * 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 d51c023808..c3ea30becc 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 Tue Jun 20 07:51:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51098 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 A8CDC27BBE9; Tue, 20 Jun 2023 08:52:48 +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 24B9227BBE2 for ; Tue, 20 Jun 2023 08:52:48 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBW9o-0003nR-KK; Tue, 20 Jun 2023 03:52:08 -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 1qBW9n-0003ms-2U for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:07 -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 1qBW9m-0006OA-Oc; Tue, 20 Jun 2023 03:52:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBW9j-00056Z-V7; Tue, 20 Jun 2023 03:52:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH 6/8] 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: Tue, 20 Jun 2023 07:52: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.168724748819521 (code B ref 64188); Tue, 20 Jun 2023 07:52:03 +0000 Received: (at 64188) by debbugs.gnu.org; 20 Jun 2023 07:51:28 +0000 Received: from localhost ([127.0.0.1]:57963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW99-00054m-QT for submit@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:28 -0400 Received: from mail-lf1-f54.google.com ([209.85.167.54]:56569) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW94-00053m-Nk for 64188@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:23 -0400 Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-4f866a3d8e4so3734167e87.0 for <64188@debbugs.gnu.org>; Tue, 20 Jun 2023 00:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687247476; x=1689839476; 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=s+4t5DdUHTaWV4XSXAE8le0FxTs+pztfyGUuJdYMBZg=; b=L/z/P9IhBdAo/NNNY2RPrbUoOuZwZdjDpM3j6ilDXWRwxodVVJqge5mPdeN3dFpqg4 3MmM8cnYYh73VjhLqHYatrw+ysCthf4+kHo/VNPA8+N4l8DpUWmh1wslFwLgqRyw3jJi 4ZLik51RpzzbaqD0N5AinIjSmHtVDLdQLgf6Wy9FKY0Ct/4x69tWCNwa4B3b7LXETR58 7I94arlCKFvZnFuWdE1zLMwGBehh/AQm4MoTaVqadoqiLQ2coHIov/+6Oy8s4HrQZl1Q FaRakOlVYgVOxzcM5QJoEn58Zf0ecrPzXk1YNW5o4YJt6Mec1Mj+ZVqarOUXzwibookl lOpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247476; x=1689839476; 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=s+4t5DdUHTaWV4XSXAE8le0FxTs+pztfyGUuJdYMBZg=; b=Bhmf8wQ891FDSmnmum9uSWmcVGYfbvRXiD840u4lo52Un4rM5DW0EtMrP4i3b0pYo+ GwOfjgD+v/tPb0W3mJ++mF+oJOHpScbKZacb0m+crhG5W1KoC8bb8xUbY1slOWLXnPju jttgBQrEf48oXx53FtaTAK/t3CysX1v+1IFi9m1HY2wzdQtYcc5UJM3ntPbDV25n2Yje 84jASI3Nggc4p9tVG9FVWld7q6ygDqqd1yPFqkMhZLafpWQmiD2K/mKTBWV2WWg0TME9 zTTwOi7UoQ2l/w1jqDNqzuhgrJC7fhkdzJ2kxchAcn3mwClbRCmhWJJN/bHugVOccn3n XdyA== X-Gm-Message-State: AC+VfDzfHMQYckpGa9XwhswLaBmYaQ+dEg5Fndsqf6uEmA7gebKsGIpS SN52oGDtrofrBuvbBpih2iTaG//TR0qrJbcb X-Google-Smtp-Source: ACHHUZ7qNWXgwzdo2afU1oj63AQWDR7tU4vaz8ZfDMob3EiGJgTj9pXYztbrxqPyQb6dWvrXi2kKcQ== X-Received: by 2002:a19:4409:0:b0:4f8:7556:23e6 with SMTP id r9-20020a194409000000b004f8755623e6mr2029931lfa.54.1687247476231; Tue, 20 Jun 2023 00:51:16 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id x11-20020adff0cb000000b003112d12a1ecsm1312246wro.98.2023.06.20.00.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:51:15 -0700 (PDT) From: Efraim Flashner Date: Tue, 20 Jun 2023 10:51:07 +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 (tuned-package)[build-system]: Don't replace the build-system if inheriting from the go-build-system. [arguments]: If using the go-build-system add a phase to set the micro-architecture for Go. --- guix/transformations.scm | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/guix/transformations.scm b/guix/transformations.scm index a289f81219..47eb4b0515 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. ;;; @@ -570,14 +571,42 @@ (define (tuned-package p micro-architecture) (package (inherit p) (build-system - (build-system-with-tuning-compiler (package-build-system p) - micro-architecture)) + ;; The go compiler doesn't need to be wrapped. + ;; XXX: This is where we check for supported micro-architectures. + (if (eq? (build-system-name (package-build-system p)) + 'go) + (package-build-system p) + (build-system-with-tuning-compiler (package-build-system p) + micro-architecture))) (arguments ;; The machine building this package may or may not be able to run code ;; for MICRO-ARCHITECTURE. Because of that, skip tests; they are run for ;; the "baseline" variant anyway. (substitute-keyword-arguments (package-arguments p) - ((#:tests? _ #f) #f))) + ((#:tests? _ #f) #f) + ;; We add the tuning parameter after the default GO flags are set. + ((#:phases phases '%standard-phases) + (if (eq? (build-system-name (package-build-system p)) + 'go) + #~(modify-phases #$phases + (add-after 'setup-go-environment 'set-microarchitecture + (lambda _ + (let ((microarch #$micro-architecture)) + (cond + ((string-prefix? "arm" microarch) + (setenv "GOARM" (string-take-right microarch 1)) + (format #t "Setting GOARM to ~s." + (getenv "GOARM"))) + ((string-prefix? "powerpc" microarch) + (setenv "GOPPC64" microarch) + (format #t "Setting GOPPC64 to ~s." + (getenv "GOPPC64"))) + ((string-prefix? "x86_64" microarch) + (setenv "GOAMD" (string-take-right microarch 2)) + (format #t "Setting GOAMD to ~s.\n" + (getenv "GOAMD"))) + (else #t)))))) + phases)))) (properties `((cpu-tuning . ,micro-architecture) From patchwork Tue Jun 20 07:51:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51096 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 D974F27BBEA; Tue, 20 Jun 2023 08:52:42 +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 9A80127BBE2 for ; Tue, 20 Jun 2023 08:52:42 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBW9p-0003nh-1S; Tue, 20 Jun 2023 03:52:09 -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 1qBW9n-0003mt-3W for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:07 -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 1qBW9m-0006O9-Nu; Tue, 20 Jun 2023 03:52:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBW9k-00056j-Fs; Tue, 20 Jun 2023 03:52:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH 7/8] guix: cpu: Add gcc-architecture->generic-architecture 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: Tue, 20 Jun 2023 07:52: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.168724748819528 (code B ref 64188); Tue, 20 Jun 2023 07:52:04 +0000 Received: (at 64188) by debbugs.gnu.org; 20 Jun 2023 07:51:28 +0000 Received: from localhost ([127.0.0.1]:57965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW9A-00054o-6x for submit@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:28 -0400 Received: from mail-wm1-f53.google.com ([209.85.128.53]:44348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW95-00053u-UI for 64188@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:24 -0400 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f8fa2cf847so41801115e9.1 for <64188@debbugs.gnu.org>; Tue, 20 Jun 2023 00:51:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687247478; x=1689839478; 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=rPluJ7odc7AC6rHWh4OctnBPj2llW0xVIDr/xBgkVyI=; b=X/uih4B7MPKgLDRI8x3ng7kAryL4dYIjyaEfA3HNopq71zGa6BD32dVDQX2Gez4ZOc 7rGJy592hMiO2zwl+eyKmfkrS2NIhdNEc4O3kpccyTDZi0458s4EqTcaMUfUOMLUVgPV Lx103zhEll8cJp2vxdtZ0xjJbDM5QYZC79mV9+DVgcKkDkKHpIuSCKoeXdTa2W5GogW/ xjae7NWH9pbAxSJ1yhAy9YuJIRumh3H48IH7XSOQTnTa0f9Spkmq8lFNDIYG1X72Q3FK hvahnTcvAE+36qHiRvq7VAUdQXEL4nrpb9hihqpc9dqvhXe0AySi95tMrjv3uuAGx2D5 Hr3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247478; x=1689839478; 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=rPluJ7odc7AC6rHWh4OctnBPj2llW0xVIDr/xBgkVyI=; b=Tx6SOLayutRb+Dv4kQAorFytPQ9oM/MTPvd6w+jbrTQQCShF+8BgPv+yO1lJBhPt2o dx7V/HPqDX2jBa1/TmAGCJbQyHVQCaNGXjgQcX+8DmVfggUN/6S0l32tyMIK8PnRZIck vMvRgVGK/BUZpkMFoZPbTNN4AH175Z19eTHppyuDCMiqgjPEIvIji6C7vOt4X0gYGNBP Vkd5Naygg+vDiXCY4VTRlkENlSYmKxMbr0nwsgx756okOXu/LvWd6BBYWMZ8UtsRnegu BcYDfvqslTl8MUe0q/G3Dqirj83fwNbktTWz5ULrIWUzD1+R8BK2jsA90H46OM/BFy6e mtow== X-Gm-Message-State: AC+VfDxjTKY0Jhv+6/JV17Xnaj7LsB2p//nY2Gwjr8GwM9+lFmih6tjG 5cAhwVt6qya0ZFHPEXWj29Hnwc9NkKnPtbkG X-Google-Smtp-Source: ACHHUZ5sFRICEXIpDdAO1hOyWNtnMYZYnIV4WHyMQTIYfV+XqPwNxkm9E/NuEu+tmSzS8ipTuS0P0g== X-Received: by 2002:a1c:7211:0:b0:3f9:206:c3a6 with SMTP id n17-20020a1c7211000000b003f90206c3a6mr7315291wmc.20.1687247478054; Tue, 20 Jun 2023 00:51:18 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id t20-20020a1c7714000000b003f900678815sm1603581wmi.39.2023.06.20.00.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:51:17 -0700 (PDT) From: Efraim Flashner Date: Tue, 20 Jun 2023 10:51:08 +0300 Message-Id: <12026d29411b4ef0597d2f40d874ad2fcc49a087.1687247150.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 (gcc-architecture->generic-architecture): New variable. --- guix/cpu.scm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/guix/cpu.scm b/guix/cpu.scm index ddfa4f20bb..af26e2280b 100644 --- a/guix/cpu.scm +++ b/guix/cpu.scm @@ -33,7 +33,8 @@ (define-module (guix cpu) cpu-flags cpu->gcc-architecture - cpu->generic-architecture)) + cpu->generic-architecture + gcc-architecture->generic-architecture)) ;;; Commentary: ;;; @@ -284,3 +285,21 @@ (define (cpu->generic-architecture cpu) (architecture ;; TODO: More architectures architecture))) + +(define (gcc-architecture->generic-architecture gcc-architecture) + "Return a generalized micro-architecture, using an inexact matching to provide +'good enough' optimizations." + (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 Tue Jun 20 07:51:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 51094 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 79A5D27BBE9; Tue, 20 Jun 2023 08:52:39 +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 DDC5527BBE2 for ; Tue, 20 Jun 2023 08:52:38 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBW9q-0003pz-Gq; Tue, 20 Jun 2023 03:52:10 -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 1qBW9n-0003n1-Dz for guix-patches@gnu.org; Tue, 20 Jun 2023 03:52:07 -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 1qBW9n-0006OO-3G; Tue, 20 Jun 2023 03:52:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBW9l-00056w-1E; Tue, 20 Jun 2023 03:52:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH 8/8] transformations: Allow autotuning for 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: Tue, 20 Jun 2023 07:52: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.168724749319541 (code B ref 64188); Tue, 20 Jun 2023 07:52:04 +0000 Received: (at 64188) by debbugs.gnu.org; 20 Jun 2023 07:51:33 +0000 Received: from localhost ([127.0.0.1]:57967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW9E-000554-Iz for submit@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:33 -0400 Received: from mail-lf1-f54.google.com ([209.85.167.54]:57567) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBW98-00054G-K2 for 64188@debbugs.gnu.org; Tue, 20 Jun 2023 03:51:27 -0400 Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-4f86a7a5499so3305481e87.2 for <64188@debbugs.gnu.org>; Tue, 20 Jun 2023 00:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687247481; x=1689839481; 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=uliwPgGofx32KubgtxjpIsl6lux11rtd1cYIDTx20SE=; b=FOhxoa+xsYgrjtRf6zby6K7SBaaLK5iOcRCOkQCJJwFQFq+SthhhzuOF4Cv6v9XA0o k6Lgn+dmCp/Ze/5Bq/Tga2vo5iYIEwuY+j1OLl2jgAoh2VMs9DcKnqmUt1f0LzvVg7EV Vg3hY647PI8Gpdq8pkUAhkAGgDdhWVeVQqpUm83M+HEKE7WSb0pge9iC4UviE5HF4nd5 hNN/aaoUW+1S7OXEtdcKAEQpyhBB6lOuyA5GyqnHsCLafNnJmarzaBxk+xf4RbGXH6+2 XJbmnCU8B0ZEuliMmxvl5uc0OIj/rI/UTUJL63W3jP6WDA9QnanpjQRmXfrOSgdXd1KT 6fBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247481; x=1689839481; 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=uliwPgGofx32KubgtxjpIsl6lux11rtd1cYIDTx20SE=; b=FNM7lSG614ZqinhdEyQQ20GmgPDa02l126UQJ0cM2jyk6cqD5DXUMrcIuyG4HVweVF 0SPGpupBESg+iJpQS2GHWIxYKs4EqBNz1V6Y112E//RqpN2sB69PXPb21TPbkFg3m/Ua jsZrUdzgfU611VHCvDYAioOKhgn7wAu72XdaRxQk4JGGZAU5KMsM2kJ2wj16jF2xB+xz 0GjPfpa8GL2OloXh07poMK41Bf8z+zZMVTdOJlPAwaG2Oh9J2SAFca+t6IzBrJxlTjTm +0NCl5iSiqqo945Kc/zR/RminD7ierGCUhuYb8q2OSKaN/tevLVAw5uLBIuTgXW/yqgt 6Gow== X-Gm-Message-State: AC+VfDxbs8fEKxYUZy86v0uqnQWDcShzdq+6UWizW6UeRQ73JewXXaih vO2PoYix4HiHqz0goCAofxVPYkCYyfhZcKEh X-Google-Smtp-Source: ACHHUZ4sUQ4hpWvrvsNYBcEXJ9jI5/RdGot5P56iBFxpk8UepSvKgzxQOlWVC2uOQVHM3m8vWIGBLA== X-Received: by 2002:ac2:5f99:0:b0:4f8:6cad:aae7 with SMTP id r25-20020ac25f99000000b004f86cadaae7mr3399159lfe.61.1687247480681; Tue, 20 Jun 2023 00:51:20 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id p19-20020a05600c469300b003f7f475c3bcsm22345002wmo.1.2023.06.20.00.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:51:19 -0700 (PDT) From: Efraim Flashner Date: Tue, 20 Jun 2023 10:51:09 +0300 Message-Id: <08188fe179fbbbe815ad75d39b14c6c8f6cca678.1687247150.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/transformations.scm (tuned-package)[build-system]: When the inherited package uses the go-build-system, use a generic micro-architecture. [arguments]: Adjust the 'set-microarchitecture phase for changes in the code. --- guix/transformations.scm | 50 ++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/guix/transformations.scm b/guix/transformations.scm index 47eb4b0515..122b0e74aa 100644 --- a/guix/transformations.scm +++ b/guix/transformations.scm @@ -33,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->generic-architecture) #:use-module (guix utils) #:use-module (guix memoization) #:use-module (guix gexp) @@ -568,16 +570,19 @@ (define (build-system-with-tuning-compiler bs micro-architecture) (define (tuned-package p micro-architecture) "Return package P tuned for MICRO-ARCHITECTURE." + (let ((generic-micro-arch (gcc-architecture->generic-architecture + micro-architecture))) (package (inherit p) (build-system - ;; The go compiler doesn't need to be wrapped. - ;; XXX: This is where we check for supported micro-architectures. - (if (eq? (build-system-name (package-build-system p)) - 'go) + ;; The go compiler doesn't need to be wrapped but we want the error + ;; checking to make sure we're targeting a recognized optimization target. + (build-system-with-tuning-compiler (package-build-system p) - (build-system-with-tuning-compiler (package-build-system p) - micro-architecture))) + (if (eq? (build-system-name (package-build-system p)) + 'go) + generic-micro-arch + micro-architecture))) (arguments ;; The machine building this package may or may not be able to run code ;; for MICRO-ARCHITECTURE. Because of that, skip tests; they are run for @@ -591,21 +596,20 @@ (define (tuned-package p micro-architecture) #~(modify-phases #$phases (add-after 'setup-go-environment 'set-microarchitecture (lambda _ - (let ((microarch #$micro-architecture)) - (cond - ((string-prefix? "arm" microarch) - (setenv "GOARM" (string-take-right microarch 1)) - (format #t "Setting GOARM to ~s." - (getenv "GOARM"))) - ((string-prefix? "powerpc" microarch) - (setenv "GOPPC64" microarch) - (format #t "Setting GOPPC64 to ~s." - (getenv "GOPPC64"))) - ((string-prefix? "x86_64" microarch) - (setenv "GOAMD" (string-take-right microarch 2)) - (format #t "Setting GOAMD to ~s.\n" - (getenv "GOAMD"))) - (else #t)))))) + (cond + ((string-prefix? "arm" #$generic-micro-arch) + (setenv "GOARM" (string-take-right #$generic-micro-arch 1)) + (format #t "Setting GOARM to ~s." + (getenv "GOARM"))) + ((string-prefix? "powerpc" #$generic-micro-arch) + (setenv "GOPPC64" #$generic-micro-arch) + (format #t "Setting GOPPC64 to ~s." + (getenv "GOPPC64"))) + ((string-prefix? "x86_64" #$generic-micro-arch) + (setenv "GOAMD" (string-take-right #$generic-micro-arch 2)) + (format #t "Setting GOAMD to ~s.\n" + (getenv "GOAMD"))) + (else #t))))) phases)))) (properties @@ -613,7 +617,7 @@ (define (tuned-package p micro-architecture) ;; Remove the 'tunable?' property so that 'package-tuning' does not ;; call 'tuned-package' again on this one. - ,@(alist-delete 'tunable? (package-properties p)))))) + ,@(alist-delete 'tunable? (package-properties p))))))) (define (tunable-package? package) "Return true if package PACKAGE is \"tunable\"--i.e., if tuning it for the