From patchwork Thu Dec 16 17:58:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 501 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 6115327BBEA; Thu, 16 Dec 2021 17:59:10 +0000 (GMT) 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,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, 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 E498527BBE9 for ; Thu, 16 Dec 2021 17:59:09 +0000 (GMT) Received: from localhost ([::1]:41668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxv25-0007dq-46 for patchwork@mira.cbaines.net; Thu, 16 Dec 2021 12:59:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxv1y-0007cH-Gq for guix-patches@gnu.org; Thu, 16 Dec 2021 12:59:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:53377) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mxv1y-0007y7-8g for guix-patches@gnu.org; Thu, 16 Dec 2021 12:59:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mxv1x-0006k7-Ts for guix-patches@gnu.org; Thu, 16 Dec 2021 12:59:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52283] [PATCH v2 00/12] Tuning packages for CPU micro-architectures Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 Dec 2021 17:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52283 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52283@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 52283-submit@debbugs.gnu.org id=B52283.163967752925809 (code B ref 52283); Thu, 16 Dec 2021 17:59:01 +0000 Received: (at 52283) by debbugs.gnu.org; 16 Dec 2021 17:58:49 +0000 Received: from localhost ([127.0.0.1]:36660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxv1k-0006i6-UU for submit@debbugs.gnu.org; Thu, 16 Dec 2021 12:58:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53182) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxv1j-0006hf-69 for 52283@debbugs.gnu.org; Thu, 16 Dec 2021 12:58:48 -0500 Received: from [2001:470:142:3::e] (port=44350 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxv1d-0007rp-20; Thu, 16 Dec 2021 12:58:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=+Enig7YkUOe/RQxkhEBZFtYE9IRiqkyyIJ8hADpvy94=; b=LC59kdbzoEqttCML0bPM ytxtYdnL95BYnWI7GvLKtP/fYNNbwngZWYT7fN/smdxNGCn1zAuABB/hIoO5fqiYrH3XwJP4Xk09r RustTPZcbJD5AKfhgiUfnAXukOii1XHJmNwAfnNnAQb2gzg6D7AlMfLLQtFf8WC46h0oHSvUl9zeb ynJMd0160LUMwdSrpz6TVZA542qHhq4mRAb7YF6U5QKZw//oNAHqIyM+JE0ZQts/F6bXPjg1TnNKo 11XspplJWardIex7+AFCwZjs9BVFFfQeZ0mSmVy9yT80cVsyB0e+dxAAnOGmStxOm/MgTKWdP/cRL q+LCJlXNZVtVHg==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42202 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mxv1Y-0000YX-Ju; Thu, 16 Dec 2021 12:58:41 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 16 Dec 2021 18:58:15 +0100 Message-Id: <20211216175827.2077-1-ludo@gnu.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <87lf0wkcam.fsf@gnu.org> References: <87lf0wkcam.fsf@gnu.org> 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" X-getmail-retrieved-from-mailbox: Patches Hello! Here is v2 of the patch set implementing the ‘--tune’ package transformation option. Changes since v1: • Compiler packages (gcc, clang, gcc-toolchain, clang-toolchain) now declare in a package property the supported CPU names; ‘--tune’ verifies, when the package a lowered to a bag, whether the target CPU is supported by the compiler and errors out if not. In theory, ‘--tune’ (with no argument) could detect a CPU that the compiler does not support, though that’s unlikely since (guix cpu) currently corresponds to what GCC 10 supports. I considered doing something fancy that would somehow fall back to a less accurate but supported CPU name, but gave up out of laziness and fear of complexity. • Guix now prints which package is being tuned, like so: $ ./pre-inst-env guix shell --tune inspekt3d -- Studio guix shell: tuning libfive@0-4.8ca1b86 for CPU skylake • Documentation reworded as suggested by Josselin. It also clarifies that a compiler wrapper is used and that tests are skipped. • Inputs of the new packages were simplified. \o/ Something left as future work is AMD processor identification in (guix cpu). Those interested in compiler optimizations can use it to compare the job made by different compilers: guix shell --with-c-toolchain=xtensor-benchmark=clang-toolchain \ --tune xtensor-benchmark -- benchmark_xtensor Fun fact: guix shell --tune eigen-benchmarks -- benchBlasGemm 240 240 240 now gives me 45 Gflops/s on my CORE i7 (skylake), when pre-merge it would give 36 Gflops/s. Same result with: --with-c-toolchain=eigen-benchmarks=gcc-toolchain@7 Go figure! I re-pushed the ‘wip-cpu-tuning’ branch so people can give it a try: guix time-machine --branch=wip-cpu-tuning -- \ shell eigen-benchmarks --tune -- \ benchBlasGemm 240 240 240 Thoughts? Ludo’. Ludovic Courtès (12): Add (guix cpu). gnu: gcc: Add 'compiler-cpu-architectures' property. gnu: clang: Add 'compiler-cpu-architectures' property. transformations: Add '--tune'. ci: Add extra jobs for tunable packages. gnu: Add eigen-benchmarks. gnu: Add xsimd-benchmark. gnu: Add xtensor-benchmark. gnu: ceres-solver: Mark as tunable. gnu: Add ceres-solver-benchmarks. gnu: libfive: Mark as tunable. gnu: prusa-slicer: Mark as tunable. Makefile.am | 1 + doc/guix.texi | 61 ++++++++++ gnu/ci.scm | 43 +++++-- gnu/packages/algebra.scm | 77 +++++++++++++ gnu/packages/commencement.scm | 1 + gnu/packages/cpp.scm | 23 ++++ gnu/packages/engineering.scm | 10 +- gnu/packages/gcc.scm | 31 +++++- gnu/packages/llvm.scm | 71 +++++++++++- gnu/packages/maths.scm | 48 +++++++- guix/cpu.scm | 143 ++++++++++++++++++++++++ guix/transformations.scm | 204 ++++++++++++++++++++++++++++++++++ tests/transformations.scm | 35 ++++++ 13 files changed, 733 insertions(+), 15 deletions(-) create mode 100644 guix/cpu.scm base-commit: e642378df3b0d218e463397883e7bf331f528c6a