From patchwork Sun Aug 4 22:15:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Elsing X-Patchwork-Id: 66730 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 7932C27BBEC; Sun, 4 Aug 2024 23:18:40 +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=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,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 EE10927BBE2 for ; Sun, 4 Aug 2024 23:18:36 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sajXv-0007ZS-Aa; Sun, 04 Aug 2024 18:17:47 -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 1sajXr-0007YF-Sl for guix-patches@gnu.org; Sun, 04 Aug 2024 18:17:44 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sajXr-0000sH-Hu for guix-patches@gnu.org; Sun, 04 Aug 2024 18:17:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=bbbtusPINZSF3oz1sBON4FytxvNc+tJ69vN4xPipTLI=; b=NH0IPFfbCy54bMxUt7nzLLo+7JdCuaPmu/PTS7RKv3UOewJlJMe+vXf1z2aTw6uSADKzdl+kbQNRhMrEQonoiTx3jKNlaXq88lMuKjxZCR2IuPJsoPMMHWMG3t6VR3L4VACF9NU0/s8pv5CLcCiLDOZNv+jil2aEqYiYCN+TirnXPKHTXPI4Anfh333ncYynmtpDnaqIJ9uPtQdSW0qw96C8p0ich41T3aLGHqWv0/AnaqdJh7Fs/T05fhm3839PK6AcuJhgHDB9/uRkz5o+JcP5XzsYNNSwTCuW66HdxyX6cthmtKsWxwM1x3KGM1KSmAB+03sTLCBXuDL6ZgqPSw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sajYD-0004Se-1g for guix-patches@gnu.org; Sun, 04 Aug 2024 18:18:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72471] [PATCH 11/24] gnu: Add xnnpack-for-r-torch. Resent-From: David Elsing Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 04 Aug 2024 22:18:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72471 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72471@debbugs.gnu.org Cc: David Elsing Received: via spool by 72471-submit@debbugs.gnu.org id=B72471.172280986016888 (code B ref 72471); Sun, 04 Aug 2024 22:18:05 +0000 Received: (at 72471) by debbugs.gnu.org; 4 Aug 2024 22:17:40 +0000 Received: from localhost ([127.0.0.1]:57499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sajXg-0004NU-Vp for submit@debbugs.gnu.org; Sun, 04 Aug 2024 18:17:39 -0400 Received: from mout01.posteo.de ([185.67.36.65]:38433) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sajXZ-0004KE-0C for 72471@debbugs.gnu.org; Sun, 04 Aug 2024 18:17:26 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id CBEEF240027 for <72471@debbugs.gnu.org>; Mon, 5 Aug 2024 00:16:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1722809817; bh=kpSFbD+vDKoqTbbB1oMtUH8W0T6wyzLKHrQAq7kp5Wo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=qaOKHnCn08/9rBzwAr6MwRVNMNGg8ECT2aoUsFsfiIEg29QDNyZDI55td9T2MFnVc 23diuTAoHE0VN/71M2NyqvrAHOVfHiRRmVL0zR84txwSrSKiA3zm5UTYECCA1JB6UU Vz5BGiW67o+5pK9Qs6tQYe71F8hqo++hyR+fTGwJngoKoYRqXw1sLfOWxItCyE24M7 XJFBRpClZ9XaDuz6NqjxZC3GPzdxKKJP82mzbkB5M0ad3vukBZmOXMpnPWjVIxQyD0 pWOlZPfo5VBpPEKjF6tWI2jLYDiw1wE4c/3D4/CuL3FLoJLqGyTeYnjMp9Xj/t3ddN 4/gykshV1A9BA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WcYp13Xr6z6tlh; Mon, 5 Aug 2024 00:16:57 +0200 (CEST) From: David Elsing Date: Sun, 4 Aug 2024 22:15:49 +0000 Message-ID: <20240804221635.3805-11-david.elsing@posteo.net> In-Reply-To: <20240804220847.15842-1-david.elsing@posteo.net> References: <20240804220847.15842-1-david.elsing@posteo.net> 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/machine-learning.scm (xnnpack-for-r-torch): New variable. (xnnpack)[inputs]: Use xnnpack-for-r-torch instead of xnnpack. --- gnu/packages/machine-learning.scm | 71 ++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 6fcfc1d167..71683c4df6 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -4251,6 +4251,74 @@ (define target-deps "") "i686-linux" "x86_64-linux")) (license license:bsd-3)))) +(define-public xnnpack-for-r-torch + (let ((version "0.0") + (commit "51a987591a6fc9f0fc0707077f53d763ac132cbf") + (revision "2")) + (package + (inherit xnnpack) + (version (git-version version revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference (url (package-home-page xnnpack)) (commit commit))) + (file-name (git-file-name (package-name xnnpack) version)) + (sha256 + (base32 + "1rzby82xq8d0rl1d148yz88jh9cpsw5c8b2yw7yg39mi7qmr55rm")) + (modules '((guix build utils) + (ice-9 ftw) + (ice-9 textual-ports) + (srfi srfi-26))) + (snippet + '(begin + ;; Remove autogenerated files + (for-each + (lambda (dir) + (let ((gendir (string-append "src/" dir "/gen"))) + (when (file-exists? gendir) + (delete-file-recursively gendir) + ;; Needed for the scripts generating the files + (mkdir gendir)))) + (scandir "src" (negate (cut member <> '("." ".."))))) + (delete-file-recursively "google3") + (delete-file "cmake/microkernels.cmake") + ;; Additional autogenerated files which contain the string + ;; "Auto-generated file" + (for-each + (lambda (dir) + (for-each + (lambda (name) + (let ((path (string-append dir "/" name))) + (when (call-with-input-file path + (lambda (port) + (string-contains + (get-string-all port) + "Auto-generated file"))) + (delete-file path)))) + (scandir dir (negate (cut member <> '("." "..")))))) + '("test" "bench" "eval" "models" "src/enums" "src/xnnpack")))))) + (arguments + (substitute-keyword-arguments (package-arguments xnnpack) + ((#:phases phases) + #~(modify-phases #$phases + (replace 'generate-files + (lambda _ + (for-each + (lambda (name) + (when (and (string-prefix? "generate" name) + (string-suffix? ".sh" name) + (not (equal? "generate-amalgamation.sh" name))) + (display (string-append name "\n")) + (invoke "bash" (string-append "scripts/" name)))) + (scandir "scripts")) + ;; These need to run after the above scripts + (display "Remaining files\n") + (invoke "python3" "tools/update-microkernels.py") + (substitute* "tools/amalgamate-microkernels.py" + (("BUILD") "BUILD.bazel")) + (invoke "bash" "scripts/generate-amalgamation.sh")))))))))) + ;; Warning: This package requires AVX2 or AVX-512 instructions. (define-public fbgemm (package @@ -4851,7 +4919,8 @@ (define-public python-pytorch-for-r-torch (inputs (modify-inputs (package-inputs python-pytorch) (replace "qnnpack-pytorch" qnnpack-pytorch-for-r-torch) - (replace "oneapi-dnnl" oneapi-dnnl-for-r-torch))) + (replace "oneapi-dnnl" oneapi-dnnl-for-r-torch) + (replace "xnnpack" xnnpack-for-r-torch))) (propagated-inputs (modify-inputs (package-propagated-inputs python-pytorch) (append python-filelock