From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id gFyXEMdakWSMTgEASxT56A (envelope-from ) for ; Tue, 20 Jun 2023 09:52:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id gPyqD8dakWRsjwAA9RJhRA (envelope-from ) for ; Tue, 20 Jun 2023 09:52:39 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E3A55131BF for ; Tue, 20 Jun 2023 09:52:38 +0200 (CEST) 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1687247559; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=uliwPgGofx32KubgtxjpIsl6lux11rtd1cYIDTx20SE=; b=esNpQEilMuQNP/ZW6osAhf1UnwYqG4y1vKu8c0hMOxyC848+eyRu5JItArKXWDA+XOCtLd Kpkv8kT9N3/TGXAMKVRkMbw2MujFxMQOvlv2CH4xFLMaCy0uTS4ZV0iNgPi8CIS6xsvYQ5 x6C6EHA6ctrMnIQw4znzYt5+sX4H5sgewYQP3GuqbX0ORyR11CCuZIsSYEnjetlipebSzy FW5zP1XQsXZUxt2Iz7WXFcYooAlHATp5xS4KzwGtgo+1ftOHCTwBGSvmxJTkKJS0EbElp2 ftjf3hsDD2vunuOmkTTJLimYgLJY/V8hE0edeYjjgOgjF1/OlLPKu6wjDlbzbg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=FOhxoa+x; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1687247559; a=rsa-sha256; cv=none; b=fj5mHKYfY4/I230Np3KzM6Lho+UqBSV82dJYsOjLMvy7qm77LNvXSnma/2f1oT2jBk9W8z MTFTCqX1DE12DJR8KSOUWBqJhQzILweQYyOA+eIGh+OV5orl541ppWiIW9tVbB8K+EjCAO XriOZLqOA2x+pA4M5UY+avOCyr2U03Pbrr2738y4fdxWvHXl414uFBH1Z88SMUPjewKjEQ byYXCMptZJKWA/3zAdQHlubs1QXz+bIdIXvD2ffQofHFvlb5NNPEbKryNPnTf4zSCTyEKt MSl9kbqXg0PImiLl8GzNt4gNa34I+A3hod0rfh9VP0e9rGgJDQHRirQVPeb3Qg== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: 1.76 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=FOhxoa+x; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: E3A55131BF X-Spam-Score: 1.76 X-TUID: +YDb9KILyKYX * 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 -- Efraim Flashner רנשלפ םירפא GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted