From patchwork Tue Mar 12 22:51:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Elsing X-Patchwork-Id: 61741 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 6A16327BBEA; Tue, 12 Mar 2024 22:55:40 +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,SPF_HELO_PASS,URIBL_BLOCKED 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 E08AA27BBE2 for ; Tue, 12 Mar 2024 22:55:39 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rkB12-00017A-N0; Tue, 12 Mar 2024 18:54:36 -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 1rkB06-0000Bw-4O for guix-patches@gnu.org; Tue, 12 Mar 2024 18:53:40 -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 1rkB04-0000Lo-Nm for guix-patches@gnu.org; Tue, 12 Mar 2024 18:53:37 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rkB0c-0001ni-BJ for guix-patches@gnu.org; Tue, 12 Mar 2024 18:54:10 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69591] [PATCH v2 20/31] gnu: Add qnnpack. Resent-From: David Elsing Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 12 Mar 2024 22:54:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69591 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69591@debbugs.gnu.org Cc: David Elsing Received: via spool by 69591-submit@debbugs.gnu.org id=B69591.17102840216677 (code B ref 69591); Tue, 12 Mar 2024 22:54:10 +0000 Received: (at 69591) by debbugs.gnu.org; 12 Mar 2024 22:53:41 +0000 Received: from localhost ([127.0.0.1]:44095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkB08-0001jX-QZ for submit@debbugs.gnu.org; Tue, 12 Mar 2024 18:53:41 -0400 Received: from mout02.posteo.de ([185.67.36.66]:51477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkAzj-0001ep-MN for 69591@debbugs.gnu.org; Tue, 12 Mar 2024 18:53:16 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 5672B240103 for <69591@debbugs.gnu.org>; Tue, 12 Mar 2024 23:52:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1710283955; bh=rYxZm6PMHMNiHkYNllCyJK+BLRy+cDMfyH6qJNdSvt8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=edDvMbgu88GOcBXYmp4goWJJDXAN98cRE0+5WXOtT2guQSxOPyxJW0DFbvXupN5px Kc6CttZE2x9JSBwz2DpYvGh4TwKqXBIS3GRUOkPU43Vw0k4ksSk0etPt3R0ROrd+wY mIHpz4noGHlTecozhVEl0KIXW1VIvlX9z617b/3+DDKk6Knvl/V2FF/uymKlrrT1bG P7rtlgW7PyJFRUINR0+4ebIPV09llsiGQdFDKBK4p7vgYsbrpcputI3TxPM1VpbPvY RVSRe3lY/luZrTmAd6fKIjLKlNJt9MZMjbhxJ5DtDu0awoZ8SWn8l18rKBkcAjTO9K 5RmlN8Qc4SphA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TvTS26t2Gz6tvr; Tue, 12 Mar 2024 23:52:34 +0100 (CET) From: David Elsing Date: Tue, 12 Mar 2024 22:51:48 +0000 Message-ID: <20240312225211.16427-20-david.elsing@posteo.net> In-Reply-To: <20240312224712.15578-1-david.elsing@posteo.net> References: <20240312224712.15578-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 (qnnpack): New variable. --- gnu/packages/machine-learning.scm | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 72b11cca5f..bc1aa308a9 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -4025,6 +4025,55 @@ (define-public nnpack (supported-systems '("x86_64-linux" "armhf-linux" "aarch64-linux")) (license license:bsd-2)))) +(define-public qnnpack + (let ((commit "7d2a4e9931a82adc3814275b6219a03e24e36b4c") + (revision "0")) + (package + (name "qnnpack") + (version (git-version "0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/pytorch/qnnpack") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1dgzriiaz9arsrfwhx42y4l74wbzn6xvdmllfb66v4pmvi5gpxc5")) + (modules '((guix build utils))) + (snippet + '(delete-file-recursively "deps")))) + (build-system cmake-build-system) + (arguments + (list + ;; The shared library build fails with linker errors, so we build the + ;; static library with -fPIC as in the bundled PyTorch version. + #:configure-flags + ''("-DQNNPACK_LIBRARY_TYPE=static" + "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-cmake + (lambda _ + (substitute* "CMakeLists.txt" + (("IF.*SOURCE_DIR.*") + "IF(FALSE)\n") + (("IF\\(NOT TARGET.*") + "IF(FALSE)\n") + (("TARGET_LINK_LIBRARIES.*(fxdiv|psimd|fp16)\\).*") + "") + (("(TARGET_LINK_LIBRARIES.*) fp16 (.*)" _ before after) + (string-append before " " after)))))))) + (inputs (list clog cpuinfo fp16 fxdiv psimd pthreadpool)) + (native-inputs (list googletest googlebenchmark)) + (home-page "https://github.com/pytorch/qnnpack") + (synopsis "Quantized Neural Network PACKage") + (description "QNNPACK is a library for low-precision neural network +inference. It contains the implementation of common neural network operators +on quantized 8-bit tensors.") + (license license:bsd-3)))) + (define-public xnnpack ;; There's currently no tag on this repo. (let ((version "0.0")