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))