From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id zHmJAdPgDGFxEwEAgWs5BA (envelope-from ) for ; Fri, 06 Aug 2021 09:12:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4JQWONLgDGGQAwAAbx9fmQ (envelope-from ) for ; Fri, 06 Aug 2021 07:12:18 +0000 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 B9D34174FB for ; Fri, 6 Aug 2021 09:12:17 +0200 (CEST) Received: from localhost ([::1]:32946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBu1f-000490-Aq for larch@yhetil.org; Fri, 06 Aug 2021 03:12:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBu1T-00047s-P6 for guix-patches@gnu.org; Fri, 06 Aug 2021 03:12:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37429) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mBu1S-0006np-E6 for guix-patches@gnu.org; Fri, 06 Aug 2021 03:12:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mBu1S-0007su-9L for guix-patches@gnu.org; Fri, 06 Aug 2021 03:12:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49907] Acknowledgement ([PATCH 00/11] AMD ROCm OpenCL runtime) Resent-From: Lars-Dominik Braun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 06 Aug 2021 07:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49907 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49907@debbugs.gnu.org Received: via spool by 49907-submit@debbugs.gnu.org id=B49907.162823388730269 (code B ref 49907); Fri, 06 Aug 2021 07:12:02 +0000 Received: (at 49907) by debbugs.gnu.org; 6 Aug 2021 07:11:27 +0000 Received: from localhost ([127.0.0.1]:48975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mBu0n-0007s3-Ja for submit@debbugs.gnu.org; Fri, 06 Aug 2021 03:11:27 -0400 Received: from mout-p-101.mailbox.org ([80.241.56.151]:20218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mBu0k-0007rp-Ed for 49907@debbugs.gnu.org; Fri, 06 Aug 2021 03:11:20 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4GgxTr4FgnzQk9Z for <49907@debbugs.gnu.org>; Fri, 6 Aug 2021 09:11:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6xq.net; s=MBO0001; t=1628233870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zUAmL1/1nBOaqgguDa8ebHrhk9vQpvy2xminhEFcNkM=; b=LjIVoQsEBOHmzYCV7QFLNb9/UBxSZOYiVXOM+ExHcLAuGGwveXniefRpz6gIx+ZmxVbbC3 J4yz+lQYbvMlUcXdTLoiV8ux/pigGWqQXRvz/BoMX28y5Z5jzhGYP2Vhr5zWmQI9MiZqQc WytIX85cyIVlSM+dMQ7HbgG2dHm7wwBatklcFP23lEDZpAlTeXeaccS+KQA8iU/7bb8Xgt PBm+xmP9P2/DzrFEKtwmfhSDCyAxRUcT659dC9uROlFsIK73DP75u+jR5dwbMIuGIMAnMf EkkdPszlBA9oRtsovhL4p2lA5ZbFhWCvdeuMAkw/3R4c/Bbq03zRdF+hJp03Xg== Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter05.heinlein-hosting.de (spamfilter05.heinlein-hosting.de [80.241.56.123]) (amavisd-new, port 10030) with ESMTP id cIYCIIoRerIR for <49907@debbugs.gnu.org>; Fri, 6 Aug 2021 09:11:07 +0200 (CEST) Date: Fri, 6 Aug 2021 09:11:06 +0200 From: Lars-Dominik Braun Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MkAhou5kCvVy2ruM" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 3ABA9182F X-Rspamd-UID: da8d30 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1628233938; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=zUAmL1/1nBOaqgguDa8ebHrhk9vQpvy2xminhEFcNkM=; b=GgbYQ2Ih4IfdMjN0AxALq0VsW9yBrWrx/NYwpvH8cN+L977F9Fqz24Ysbleq9ZYymvM93a xYTpCFOKWJN9ahOyiQWDpfUWibprgV3zhtdWCaov+kdKC3VLHe7ofiTi+3K4UeZIPzQ6lU IvEuhNXwZrQRXnUO9L/hdA66Rzfq8TZ+ST8rO96R6LI3bTSK3WrSTkXqYnB6kBn4Sei2Qk nIwpHBnxFmbt6sB23s0MYS0s2HJlxP7H1Yk/7x+Q8kxjO1Ouwht+Je/wwrPpcbX4DG0q3I IKKCSR7RdYz2G5Qw5JFn44cWzGL39Sy6fPO4gXfp8sdmWCSPR9ZeciYdWOettw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628233938; a=rsa-sha256; cv=none; b=MrjvbTJWC9AbxK6hl5TN8wCcJqc1YU91Lv7eIfp1bv3RvxBLoECDYSLXYxTZyzej9rGsDp Vr8WArbmU2iRLx0rBWHqy1Trc9t6HsY7A1dGbHWDAvkxFKqUmT0nN494bJN/jOAk+ApQn2 y0j+3612A/EWS6x4AUcCLKvpBwWPoWUBVj355I2gTCtP1UxSbQ74ldM+uLTMRIvuN1gn2f 2sXBKOtPKW826s5/hbNPyPmSGX7w3+TeCh/3kwUqgQA7yGCHBdx/SbR/af7nHdcvBv819q Jr5q3fkZFIhWVRuTB2yHL4hRkEePo+D9C1sJxakv8y9VaSYC8pE+i2RWSQaBKA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=LjIVoQsE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=LjIVoQsE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: B9D34174FB X-Spam-Score: -1.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5s/NibkmKZCV --MkAhou5kCvVy2ruM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Forgot to attach the actual patches, sorry. --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=iso-8859-1 Content-Disposition: attachment; filename="0001-gnu-Add-rocm-cmake.patch" Content-Transfer-Encoding: 8bit >From 4e4ca903ff7b94fceba9ba85c85f6d267baf71fc Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Thu, 5 Aug 2021 15:33:47 +0200 Subject: [PATCH 01/11] gnu: Add rocm-cmake. * gnu/packages/rocm.scm (%rocm-version, rocm-cmake): New variables. --- gnu/packages/rocm.scm | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 gnu/packages/rocm.scm diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm new file mode 100644 index 0000000000..b04eb8050e --- /dev/null +++ b/gnu/packages/rocm.scm @@ -0,0 +1,57 @@ +;;; +;;; Copyright © 2021 Lars-Dominik Braun +;;; +;;; This program is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + +(define-module (gnu packages rocm) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix utils) + #:use-module (guix git-download) + #:use-module (guix build-system cmake) + #:use-module (gnu packages) + #:use-module (gnu packages elf) + #:use-module (gnu packages gl) + #:use-module (gnu packages linux) + #:use-module (gnu packages llvm) + #:use-module (gnu packages opencl) + #:use-module (gnu packages version-control) + #:use-module (gnu packages vim)) + +;; The components are tightly integrated and can only be upgraded as a unit. If +;; you want to upgrade ROCm, bump this version number and update hashes below. +(define %rocm-version "4.3.0") + +(define-public rocm-cmake + (package + (name "rocm-cmake") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/rocm-cmake.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0sic2zxmzl2pb2865vvq55mbpcr8pby8v19pjdlm08pypqw5h6h6")))) + (build-system cmake-build-system) + (arguments `(#:tests? #f)) ; Tests try to use git commit + (native-inputs `(("git" ,git))) + (home-page "https://github.com/RadeonOpenCompute/rocm-cmake") + (synopsis "ROCm cmake modules") + (description "ROCm cmake modules provides cmake modules for common build +tasks needed for the ROCM software stack.") + (license license:ncsa))) -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-gnu-Add-llvm-for-rocm.patch" >From e42d64d84a5901ab9177aab6d4dd02256fb95f63 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:18:26 +0200 Subject: [PATCH 02/11] gnu: Add llvm-for-rocm. * gnu/packages/rocm.scm (llvm-for-rocm): New variable. * gnu/packages/patches/llvm-roc-3.0.0-add_libraries.patch, gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch, gnu/packages/patches/llvm-roc-4.2.0-add_Object.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. --- gnu/local.mk | 3 ++ .../llvm-roc-3.0.0-add_libraries.patch | 22 ++++++++++++ ...roc-4.0.0-remove-isystem-usr-include.patch | 29 +++++++++++++++ .../patches/llvm-roc-4.2.0-add_Object.patch | 13 +++++++ gnu/packages/rocm.scm | 35 +++++++++++++++++++ 5 files changed, 102 insertions(+) create mode 100644 gnu/packages/patches/llvm-roc-3.0.0-add_libraries.patch create mode 100644 gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch create mode 100644 gnu/packages/patches/llvm-roc-4.2.0-add_Object.patch diff --git a/gnu/local.mk b/gnu/local.mk index e8494806fd..ac9f1d6154 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1414,6 +1414,9 @@ dist_patch_DATA = \ %D%/packages/patches/llvm-9-fix-bitcast-miscompilation.patch \ %D%/packages/patches/llvm-9-fix-lpad-miscompilation.patch \ %D%/packages/patches/llvm-9-fix-scev-miscompilation.patch \ + %D%/packages/patches/llvm-roc-3.0.0-add_libraries.patch \ + %D%/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch \ + %D%/packages/patches/llvm-roc-4.2.0-add_Object.patch \ %D%/packages/patches/lm-sensors-hwmon-attrs.patch \ %D%/packages/patches/lrcalc-includes.patch \ %D%/packages/patches/lsh-fix-x11-forwarding.patch \ diff --git a/gnu/packages/patches/llvm-roc-3.0.0-add_libraries.patch b/gnu/packages/patches/llvm-roc-3.0.0-add_libraries.patch new file mode 100644 index 0000000000..f6bc639f33 --- /dev/null +++ b/gnu/packages/patches/llvm-roc-3.0.0-add_libraries.patch @@ -0,0 +1,22 @@ +Taken from https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-devel/llvm-roc/files + +diff -Naur a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt +--- a/clang/lib/Basic/CMakeLists.txt 2019-12-28 07:42:49.119055933 +0100 ++++ b/clang/lib/Basic/CMakeLists.txt 2019-12-28 07:42:13.265056070 +0100 +@@ -2,6 +2,7 @@ + Core + MC + Support ++ Option + ) + + find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc) +diff -Naur a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt +--- a/clang/lib/Driver/CMakeLists.txt 2019-12-28 07:41:39.521056199 +0100 ++++ b/clang/lib/Driver/CMakeLists.txt 2019-12-28 07:40:23.998056487 +0100 +@@ -79,4 +79,5 @@ + LINK_LIBS + clangBasic + ${system_libs} ++ pthread + ) diff --git a/gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch b/gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch new file mode 100644 index 0000000000..f14ec4ac0d --- /dev/null +++ b/gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch @@ -0,0 +1,29 @@ +Author: Wilfried (justxi) Holzke + +Adopted from https://github.com/justxi/rocm/blob/master/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch + +Index: llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp +=================================================================== +--- llvm-project-rocm-4.0.0.orig/clang/lib/Driver/ToolChains/AMDGPU.cpp ++++ llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp +@@ -326,11 +326,6 @@ void RocmInstallationDetector::AddHIPInc + // + // ROCm 3.5 does not fully support the wrapper headers. Therefore it needs + // a workaround. +- SmallString<128> P(D.ResourceDir); +- if (UsesRuntimeWrapper) +- llvm::sys::path::append(P, "include", "cuda_wrappers"); +- CC1Args.push_back("-internal-isystem"); +- CC1Args.push_back(DriverArgs.MakeArgString(P)); + } + + if (DriverArgs.hasArg(options::OPT_nogpuinc)) +@@ -341,8 +336,6 @@ void RocmInstallationDetector::AddHIPInc + return; + } + +- CC1Args.push_back("-internal-isystem"); +- CC1Args.push_back(DriverArgs.MakeArgString(getIncludePath())); + if (UsesRuntimeWrapper) + CC1Args.append({"-include", "__clang_hip_runtime_wrapper.h"}); + } diff --git a/gnu/packages/patches/llvm-roc-4.2.0-add_Object.patch b/gnu/packages/patches/llvm-roc-4.2.0-add_Object.patch new file mode 100644 index 0000000000..f1762a558b --- /dev/null +++ b/gnu/packages/patches/llvm-roc-4.2.0-add_Object.patch @@ -0,0 +1,13 @@ +Taken from https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-devel/llvm-roc/files + +diff --color -uprN orig/lib/Target/AMDGPU/Disassembler/CMakeLists.txt llvm/lib/Target/AMDGPU/Disassembler/CMakeLists.txt +--- a/llvm/lib/Target/AMDGPU/Disassembler/CMakeLists.txt 2021-06-14 11:57:54.222796911 +0800 ++++ b/llvm/lib/Target/AMDGPU/Disassembler/CMakeLists.txt 2021-06-14 11:58:35.206796875 +0800 +@@ -11,6 +11,7 @@ add_llvm_component_library(LLVMAMDGPUDis + MC + MCDisassembler + Support ++ Object + + ADD_TO_COMPONENT + AMDGPU diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index b04eb8050e..473fbe21d0 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -55,3 +55,38 @@ (description "ROCm cmake modules provides cmake modules for common build tasks needed for the ROCM software stack.") (license license:ncsa))) + +(define-public llvm-for-rocm + (hidden-package + (package + ;; Actually based on LLVM 13 as of v4.3, but llvm-12 works just fine. + (inherit llvm-12) + (name "llvm-for-rocm") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/llvm-project.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0p75nr1qpmy6crymdax5hm40wkimman4lnglz4x5cnbiqindya7s")) + (patches + (search-patches "llvm-roc-4.2.0-add_Object.patch" + "llvm-roc-3.0.0-add_libraries.patch" + "llvm-roc-4.0.0-remove-isystem-usr-include.patch")))) + (arguments + (substitute-keyword-arguments (package-arguments llvm-12) + ((#:phases phases '%standard-phases) + `(modify-phases ,phases + (add-after 'unpack 'chdir + (lambda _ + (chdir "llvm"))))) + ((#:configure-flags flags) + ''("-DLLVM_ENABLE_PROJECTS=llvm;clang;lld" + "-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86" + "-DCMAKE_SKIP_BUILD_RPATH=FALSE" + "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" + "-DBUILD_SHARED_LIBS:BOOL=TRUE" + "-DLLVM_VERSION_SUFFIX="))))))) -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0003-gnu-Add-rocm-device-libs.patch" >From 2dc8ac256a1994e3072b884c616d4aeb5bbdfa28 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:19:34 +0200 Subject: [PATCH 03/11] gnu: Add rocm-device-libs. * gnu/packages/rocm.scm (rocm-device-libs): New variable. --- gnu/packages/rocm.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index 473fbe21d0..14eaed9007 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -90,3 +90,28 @@ tasks needed for the ROCM software stack.") "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" "-DBUILD_SHARED_LIBS:BOOL=TRUE" "-DLLVM_VERSION_SUFFIX="))))))) + +(define-public rocm-device-libs + (package + (name "rocm-device-libs") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/ROCm-Device-Libs.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1f8xsylfajpxqjk6ayjnrry53y8b0a6lh9d72pd41nffxfyzvw3w")))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags + (list "-DCMAKE_SKIP_BUILD_RPATH=FALSE" + "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"))) + (inputs `(("llvm" ,llvm-for-rocm))) + (home-page "https://github.com/RadeonOpenCompute/ROCm-Device-Libs") + (synopsis "ROCm Device libraries") + (description "AMD-specific device-side language runtime libraries, namely +oclc, ocml, ockl, opencl, hip and hc.") + (license license:ncsa))) -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0004-gnu-Add-rocm-comgr.patch" >From 588e8c6636fe6e9dad2845ff7ffa6a88cfe3bd07 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:21:20 +0200 Subject: [PATCH 04/11] gnu: Add rocm-comgr. * gnu/packages/rocm.scm (rocm-comgr): New variable. * gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + .../rocm-comgr-3.1.0-dependencies.patch | 52 +++++++++++++++++++ gnu/packages/rocm.scm | 33 ++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch diff --git a/gnu/local.mk b/gnu/local.mk index ac9f1d6154..db1f8e499d 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1698,6 +1698,7 @@ dist_patch_DATA = \ %D%/packages/patches/rnp-add-version.cmake.patch \ %D%/packages/patches/rnp-disable-ruby-rnp-tests.patch \ %D%/packages/patches/rnp-unbundle-googletest.patch \ + %D%/packages/patches/rocm-comgr-3.1.0-dependencies.patch \ %D%/packages/patches/ruby-sanitize-system-libxml.patch \ %D%/packages/patches/rust-1.19-mrustc.patch \ %D%/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch \ diff --git a/gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch b/gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch new file mode 100644 index 0000000000..c91d273f92 --- /dev/null +++ b/gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch @@ -0,0 +1,52 @@ +https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/pull/25 + +From c65cba2e73f9118e128b9ab7e655ee0f8a7798e7 Mon Sep 17 00:00:00 2001 +From: Craig Andrews +Date: Sun, 1 Mar 2020 19:24:22 -0500 +Subject: [PATCH] Link additional required LLVM libraries + +Without these additional required dependencies, linking fails with errors such as: +`undefined reference to llvm::errs()'` +--- + CMakeLists.txt | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1794a07..c7b852a 100644 +--- a/lib/comgr/CMakeLists.txt ++++ b/lib/comgr/CMakeLists.txt +@@ -207,7 +207,11 @@ install(FILES + DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}") + + set(CLANG_LIBS +- clangFrontendTool) ++ clangFrontendTool ++ clangFrontend ++ clangBasic ++ clangDriver ++ clangSerialization) + + set(LLD_LIBS + lldELF +@@ -218,8 +222,20 @@ if (LLVM_LINK_LLVM_DYLIB) + else() + llvm_map_components_to_libnames(LLVM_LIBS + ${LLVM_TARGETS_TO_BUILD} ++ Option + DebugInfoDWARF +- Symbolize) ++ Symbolize ++ Support ++ Object ++ BitWriter ++ MC ++ MCParser ++ MCDisassembler ++ Core ++ IRReader ++ CodeGen ++ Linker ++ BinaryFormat) + endif() + + target_link_libraries(amd_comgr diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index 14eaed9007..92530b5d83 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -115,3 +115,36 @@ tasks needed for the ROCM software stack.") (description "AMD-specific device-side language runtime libraries, namely oclc, ocml, ockl, opencl, hip and hc.") (license license:ncsa))) + +(define-public rocm-comgr + (package + (name "rocm-comgr") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0bakbm7shr0l67lph44b5cnc9psd6rivg1mp79qizaawkn380x60")) + (patches + (search-patches "rocm-comgr-3.1.0-dependencies.patch")))) + (build-system cmake-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda* (#:key inputs native-inputs #:allow-other-keys) + (chdir "lib/comgr") + #t))))) + (inputs + `(("rocm-device-libs" ,rocm-device-libs) + ("llvm" ,llvm-for-rocm) + ("lld" ,lld))) + (home-page "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport") + (synopsis "ROCm Code Object Manager") + (description "The Comgr library provides APIs for compiling and inspecting +AMDGPU code objects.") + (license license:ncsa))) -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0005-gnu-Add-roct-thunk-interface.patch" >From a2f768e7d53a58d3d94a072fc87f5516b8c84c86 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:23:53 +0200 Subject: [PATCH 05/11] gnu: Add roct-thunk-interface. * gnu/packages/rocm.scm (roct-thunk-interface): New variable. --- gnu/packages/rocm.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index 92530b5d83..21b7e43d2b 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -148,3 +148,25 @@ oclc, ocml, ockl, opencl, hip and hc.") (description "The Comgr library provides APIs for compiling and inspecting AMDGPU code objects.") (license license:ncsa))) + +(define-public roct-thunk-interface + (package + (name "roct-thunk-interface") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0ffqhrrscmcydfqf61dk58d7nnxk6n2k68jhqfj7a4hvhlphb74f")))) + (build-system cmake-build-system) + (arguments `(#:tests? #f)) ; Not sure how to run tests. + (inputs `(("numactl" ,numactl))) + (home-page "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface") + (synopsis "Radeon Open Compute Thunk Interface") + (description "User-mode API interfaces used to interact with the ROCk +driver.") + (license license:ncsa))) -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0006-gnu-Add-rocr-runtime.patch" >From d0537f8c11f59a0b0793f8763f913a9b88fe46df Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:24:44 +0200 Subject: [PATCH 06/11] gnu: Add rocr-runtime. * gnu/packages/rocm.scm (rocr-runtime): New variable. --- gnu/packages/rocm.scm | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index 21b7e43d2b..86b113ce42 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -170,3 +170,43 @@ AMDGPU code objects.") (description "User-mode API interfaces used to interact with the ROCk driver.") (license license:ncsa))) + +(define-public rocr-runtime + (package + (name "rocr-runtime") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/ROCR-Runtime.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0jqfqf5ymwlbpac065bhigmkgsk7mbyimdgvca7ymn38wpf80ka7")))) + (build-system cmake-build-system) + (arguments + `(#:configure-flags + `(,(string-append + "-DBITCODE_DIR=" + (assoc-ref %build-inputs "rocm-device-libs") + "/amdgcn/bitcode/")) + #:tests? #f ; No tests. + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda* (#:key inputs native-inputs #:allow-other-keys) + (chdir "src") + #t))))) + (inputs + `(("libelf" ,libelf) + ("numactl" ,numactl) + ("llvm" ,llvm-for-rocm) + ("roct-thunk-interface" ,roct-thunk-interface) + ("rocm-device-libs" ,rocm-device-libs))) ; For bitcode. + (native-inputs `(("xxd" ,xxd))) + (home-page "https://github.com/RadeonOpenCompute/ROCR-Runtime") + (synopsis "ROCm Platform Runtime") + (description "User-mode API interfaces and libraries necessary for host +applications to launch compute kernels to available HSA ROCm kernel agents.") + (license license:ncsa))) -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0007-gnu-Add-rocclr.patch" >From 0b0b8ef438d2adf5900e0e4e7be4da032a502821 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:25:38 +0200 Subject: [PATCH 07/11] gnu: Add rocclr. * gnu/packages/rocm.scm (rocclr): New variable. --- gnu/packages/rocm.scm | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index 86b113ce42..3538208577 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -210,3 +210,48 @@ driver.") (description "User-mode API interfaces and libraries necessary for host applications to launch compute kernels to available HSA ROCm kernel agents.") (license license:ncsa))) + +(define-public rocclr + (package + (name "rocclr") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ROCm-Developer-Tools/ROCclr.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1pm1y020zriz7zmi95w0rcpka0jrsc7wwh81sssnysi8wxk3nnfy")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; No tests. + #:configure-flags + `(,(string-append + "-DOPENCL_DIR=" + (assoc-ref %build-inputs "rocm-opencl-runtime-src"))))) + (inputs + `(("mesa" ,mesa) + ("rocm-comgr" ,rocm-comgr) + ("llvm" ,llvm-for-rocm) + ("rocm-device-libs" ,rocm-device-libs) + ("rocr-runtime" ,rocr-runtime) + ("rocm-cmake" ,rocm-cmake) + ;; rocclr depends on a few headers provided by rocm-opencl-runtime. + ("rocm-opencl-runtime-src" + ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1cglpiaj3ny1z74ssmy6j63vj92sfy4q38ix6qsga0mg3b2wvqz3")))))) + (home-page "https://github.com/ROCm-Developer-Tools/ROCclr") + (synopsis "Radeon Open Compute Common Language Runtime") + (description "ROCclr is a virtual device interface that compute runtimes +interact with to different backends such as ROCr or PAL. This abstraction +allows runtimes to work on Windows as well as on Linux without much effort.") + (license license:ncsa))) -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0008-gnu-Add-rocm-opencl-runtime.patch" >From 179b4c74f80a6155a7f5d439acee60bc10585c74 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:27:32 +0200 Subject: [PATCH 08/11] gnu: Add rocm-opencl-runtime. * gnu/packages/rocm.scm (rocm-opencl-runtime): New variable. * gnu/packages/patches/rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch, gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch, gnu/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch, gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. --- gnu/local.mk | 4 ++ ....10.0-add-rocclr-include-directories.patch | 14 +++++ .../rocm-opencl-runtime-4.3-noclinfo.patch | 28 +++++++++ .../rocm-opencl-runtime-4.3-nocltrace.patch | 25 ++++++++ .../rocm-opencl-runtime-4.3-noopencl.patch | 63 +++++++++++++++++++ gnu/packages/rocm.scm | 51 +++++++++++++++ 6 files changed, 185 insertions(+) create mode 100644 gnu/packages/patches/rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch create mode 100644 gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch create mode 100644 gnu/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch create mode 100644 gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch diff --git a/gnu/local.mk b/gnu/local.mk index db1f8e499d..6c73e02dd8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1699,6 +1699,10 @@ dist_patch_DATA = \ %D%/packages/patches/rnp-disable-ruby-rnp-tests.patch \ %D%/packages/patches/rnp-unbundle-googletest.patch \ %D%/packages/patches/rocm-comgr-3.1.0-dependencies.patch \ + %D%/packages/patches/rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch + %D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch + %D%/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch + %D%/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch %D%/packages/patches/ruby-sanitize-system-libxml.patch \ %D%/packages/patches/rust-1.19-mrustc.patch \ %D%/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch \ diff --git a/gnu/packages/patches/rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch b/gnu/packages/patches/rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch new file mode 100644 index 0000000000..d81bb0747f --- /dev/null +++ b/gnu/packages/patches/rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch @@ -0,0 +1,14 @@ +Add missing include dirs for ROCclr. + +--- a/amdocl/CMakeLists.txt 2020-12-05 22:05:55.838529158 +0100 ++++ b/amdocl/CMakeLists.txt 2020-12-05 22:07:35.677524507 +0100 +@@ -23,6 +23,9 @@ + include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos) + include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos/headers) + include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos/headers/opencl2.2) ++include_directories(${ROCclr_DIR}/../../../include) ++include_directories(${ROCclr_DIR}/../../../include/compiler/lib/include/) ++include_directories(${ROCclr_DIR}/../../../include/elf/) + + if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR + (CMAKE_${COMPILER}_COMPILER_ID MATCHES "Clang")) diff --git a/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch b/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch new file mode 100644 index 0000000000..5709e0d19a --- /dev/null +++ b/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch @@ -0,0 +1,28 @@ +Do not build and install clinfo. + +diff --git a/CMakeLists.txt.orig b/CMakeLists.txt +index 76847d3..3f62bfe 100644 +--- a/CMakeLists.txt.orig ++++ b/CMakeLists.txt +@@ -72,7 +72,7 @@ find_package(ROCclr REQUIRED CONFIG + + add_subdirectory(khronos/icd) + add_subdirectory(amdocl) +-add_subdirectory(tools/clinfo) ++#add_subdirectory(tools/clinfo) + add_subdirectory(tools/cltrace) + if(BUILD_TESTS) + add_subdirectory(tests/ocltst) +@@ -108,9 +108,9 @@ endif() + ###--- Packaging ------------------------------------------------------------### + + # MAIN package +-install(PROGRAMS $ +- DESTINATION bin +- COMPONENT MAIN) ++#install(PROGRAMS $ ++# DESTINATION bin ++# COMPONENT MAIN) + install(PROGRAMS $ + DESTINATION lib + COMPONENT MAIN) diff --git a/gnu/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch b/gnu/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch new file mode 100644 index 0000000000..e0328d7734 --- /dev/null +++ b/gnu/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch @@ -0,0 +1,25 @@ +Do not build and install cltrace. + +diff --git a/CMakeLists.txt.orig b/CMakeLists.txt +index c449db4..9cff673 100644 +--- a/CMakeLists.txt.orig ++++ b/CMakeLists.txt +@@ -73,7 +73,7 @@ find_package(ROCclr REQUIRED CONFIG + #add_subdirectory(khronos/icd) + add_subdirectory(amdocl) + #add_subdirectory(tools/clinfo) +-add_subdirectory(tools/cltrace) ++#add_subdirectory(tools/cltrace) + if(BUILD_TESTS) + add_subdirectory(tests/ocltst) + endif() +@@ -108,9 +108,6 @@ endif() + #install(PROGRAMS $ + # DESTINATION bin + # COMPONENT MAIN) +-install(PROGRAMS $ +- DESTINATION lib +- COMPONENT MAIN) + install(PROGRAMS $ + DESTINATION lib + COMPONENT MAIN) diff --git a/gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch b/gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch new file mode 100644 index 0000000000..ed20f02503 --- /dev/null +++ b/gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch @@ -0,0 +1,63 @@ +Do not build and install libOpenCL. + +--- b/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -70,7 +70,7 @@ + ${ROCclr_DIR} + ${LIBROCclr_STATIC_DIR}) + +-add_subdirectory(khronos/icd) ++#add_subdirectory(khronos/icd) + add_subdirectory(amdocl) + #add_subdirectory(tools/clinfo) + add_subdirectory(tools/cltrace) +@@ -93,9 +93,6 @@ + OUTPUT_VARIABLE OPENCL_VERSION_GITDATE + OUTPUT_STRIP_TRAILING_WHITESPACE) + +-get_target_property(OPENCL_LIB_VERSION_MAJOR OpenCL SOVERSION) +-get_target_property(OPENCL_LIB_VERSION_STRING OpenCL VERSION) +- + find_package(ROCM QUIET CONFIG PATHS /opt/rocm) + + if(ROCM_FOUND) +@@ -117,25 +114,6 @@ + install(PROGRAMS $ + DESTINATION lib + COMPONENT MAIN) +-install(PROGRAMS $ +- DESTINATION lib +- COMPONENT MAIN) +-install(PROGRAMS $ +- DESTINATION lib +- COMPONENT MAIN) +- +-# DEV package +-install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL" +- DESTINATION include +- COMPONENT DEV +- USE_SOURCE_PERMISSIONS +- PATTERN cl_d3d10.h EXCLUDE +- PATTERN cl_d3d11.h EXCLUDE +- PATTERN cl_dx9_media_sharing.h EXCLUDE +- PATTERN cl_egl.h EXCLUDE) +-install(PROGRAMS $ +- DESTINATION lib +- COMPONENT DEV) + + ############################# + # Packaging steps +--- a/khronos/icd/CMakeLists.txt 2020-06-07 16:05:32.425022904 +0200 ++++ b/khronos/icd/CMakeLists.txt 2020-06-07 16:06:03.273022786 +0200 +@@ -132,7 +132,7 @@ + add_subdirectory (test) + endif() + +-install (TARGETS OpenCL +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++#install (TARGETS OpenCL ++# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index 3538208577..8cc0eff9e3 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -255,3 +255,54 @@ applications to launch compute kernels to available HSA ROCm kernel agents.") interact with to different backends such as ROCr or PAL. This abstraction allows runtimes to work on Windows as well as on Linux without much effort.") (license license:ncsa))) + +(define-public rocm-opencl-runtime + (package + (name "rocm-opencl-runtime") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1cglpiaj3ny1z74ssmy6j63vj92sfy4q38ix6qsga0mg3b2wvqz3")) + (patches + (search-patches + "rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch" + ;; Do not install libOpenCL, which ocl-icd provides. + "rocm-opencl-runtime-4.3-noopencl.patch" + ;; Guix includes a program clinfo already. + "rocm-opencl-runtime-4.3-noclinfo.patch" + ;; cltrace linking fails, remove it. + "rocm-opencl-runtime-4.3-nocltrace.patch")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; Not sure how to run them. + #:phases + (modify-phases %standard-phases + (add-after 'install 'create-icd + ;; Manually install ICD, which simply consists of dumping + ;; the path of the .so into the correct file. + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (vendors (string-append out "/etc/OpenCL/vendors")) + (sopath (string-append out "/lib/libamdocl64.so"))) + (mkdir-p vendors) + (with-output-to-file (string-append vendors "/amdocl64.icd") + (lambda _ (display sopath))))))))) + (inputs + `(("mesa" ,mesa) + ("rocm-comgr" ,rocm-comgr) + ("rocr-runtime" ,rocr-runtime) + ("rocclr" ,rocclr) + ("ocl-icd" ,ocl-icd) + ("glew" ,glew))) + (native-inputs `()) + (home-page "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime") + (synopsis "ROCm OpenCL Runtime") + (description "OpenCL 2.0 compatible language runtime, supporting offline +and in-process/in-memory compilation.") + (license license:ncsa))) -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0009-gnu-Add-rocminfo.patch" >From cdfbc09ae5ceb21357aeaaece3676afbcf3442b4 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:29:12 +0200 Subject: [PATCH 09/11] gnu: Add rocminfo. * gnu/packages/rocm.scm (rocminfo): New variable. --- gnu/packages/rocm.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index 8cc0eff9e3..95b586c640 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -306,3 +306,24 @@ allows runtimes to work on Windows as well as on Linux without much effort.") (description "OpenCL 2.0 compatible language runtime, supporting offline and in-process/in-memory compilation.") (license license:ncsa))) + +(define-public rocminfo + (package + (name "rocminfo") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/rocminfo.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0pcm308vwkjrwnrk507iya20mkil8j0vx699w9jk2gas4n4jvkcz")))) + (build-system cmake-build-system) + (arguments `(#:tests? #f)) ; No tests. + (inputs `(("rocr-runtime" ,rocr-runtime))) + (home-page "https://github.com/RadeonOpenCompute/rocminfo") + (synopsis "ROCm Application for Reporting System Info") + (description #f) + (license license:ncsa))) -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0010-gnu-Add-rocm-bandwidth-test.patch" >From 79680d7d55c98212e6f397c133e74d52996e31a6 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:29:39 +0200 Subject: [PATCH 10/11] gnu: Add rocm-bandwidth-test. * gnu/packages/rocm.scm (rocm-bandwidth-test): New variable. --- gnu/packages/rocm.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index 95b586c640..eeea66526d 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -327,3 +327,29 @@ and in-process/in-memory compilation.") (synopsis "ROCm Application for Reporting System Info") (description #f) (license license:ncsa))) + +(define-public rocm-bandwidth-test + (package + (name "rocm-bandwidth-test") + (version %rocm-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/RadeonOpenCompute/rocm_bandwidth_test.git") + (commit (string-append "rocm-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0a14kwkjpiyljgzxblh031qibn6xgbxp6m12zdy1pmwb2c44jjmm")))) + (build-system cmake-build-system) + (arguments `(#:tests? #f)) ; No tests. + (inputs `(("rocr-runtime" ,rocr-runtime))) + (home-page "https://github.com/RadeonOpenCompute/rocm_bandwidth_test") + (synopsis "Bandwidth test for ROCm") + (description "RocBandwidthTest is designed to capture the performance +characteristics of buffer copying and kernel read/write operations. The help +screen of the benchmark shows various options one can use in initiating +cop/read/writer operations. In addition one can also query the topology of the +system in terms of memory pools and their agents.") + (license license:ncsa))) + -- 2.31.1 --MkAhou5kCvVy2ruM Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0011-gnu-darktable-Add-compatibility-for-ROCm.patch" >From 164a786fe3bc322bdba549c6f3b8b49e7435d0f1 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 6 Aug 2021 08:30:13 +0200 Subject: [PATCH 11/11] gnu: darktable: Add compatibility for ROCm. darktable has a few tools, which can use OpenCL, not just the main binary. Instead of wrapping it, patch the search path. ROCm also fails to build OpenCL kernels with just the inline keyword. Apply upstream fix. * gnu/packages/photo.scm (darktable) [#:phases]: Add new phases, remove LD_LIBRARY_PATH from wrap-binary. --- gnu/packages/photo.scm | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/gnu/packages/photo.scm b/gnu/packages/photo.scm index 3ef0fbf7f5..bf51e6885f 100644 --- a/gnu/packages/photo.scm +++ b/gnu/packages/photo.scm @@ -486,6 +486,24 @@ photographic equipment.") "-DBUILD_TESTING=On") #:phases (modify-phases %standard-phases + (add-after 'unpack 'libOpenCL-path + (lambda* (#:key inputs #:allow-other-keys) + ;; Statically link to libOpenCL. + (substitute* "./src/common/dlopencl.c" + (("\"libOpenCL\"") + (string-append "\"" (assoc-ref inputs "ocl-icd") "/lib/libOpenCL.so\""))) + #t)) + ;; The use of inline is wrong and darktable cannot compile its kernels + ;; with ROCm. See upstream commit + ;; https://github.com/darktable-org/darktable/commit/f0d8710f5ef34eb7e33b4064e022ebf3057b9e53 + (add-after 'unpack 'opencl-inline + (lambda* (#:key inputs #:allow-other-keys) + ;; This is a feature of OpenCL 1.2 and later. + (substitute* "data/kernels/CMakeLists.txt" + (("CL1\\.1") "CL1.2")) + (substitute* (find-files "data/kernels" "\\.(cl|h)$") + (("inline") "static inline")) + #t)) (add-before 'configure 'prepare-build-environment (lambda* (#:key inputs #:allow-other-keys) ;; Rawspeed fails to build with GCC due to OpenMP error: @@ -516,11 +534,7 @@ photographic equipment.") ;; For GtkFileChooserDialog. `("GSETTINGS_SCHEMA_DIR" = (,(string-append (assoc-ref inputs "gtk+") - "/share/glib-2.0/schemas"))) - ;; For libOpenCL.so. - `("LD_LIBRARY_PATH" = - (,(string-append (assoc-ref inputs "ocl-icd") - "/lib")))) + "/share/glib-2.0/schemas")))) #t))))) (native-inputs `(("clang" ,clang-11) -- 2.31.1 --MkAhou5kCvVy2ruM--