mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-19 22:16:32 +01:00
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.
This commit is contained in:
parent
df90cb1d5c
commit
c5ee2cf72a
5 changed files with 102 additions and 0 deletions
|
@ -1416,6 +1416,9 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/llvm-9-fix-bitcast-miscompilation.patch \
|
%D%/packages/patches/llvm-9-fix-bitcast-miscompilation.patch \
|
||||||
%D%/packages/patches/llvm-9-fix-lpad-miscompilation.patch \
|
%D%/packages/patches/llvm-9-fix-lpad-miscompilation.patch \
|
||||||
%D%/packages/patches/llvm-9-fix-scev-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/lm-sensors-hwmon-attrs.patch \
|
||||||
%D%/packages/patches/lrcalc-includes.patch \
|
%D%/packages/patches/lrcalc-includes.patch \
|
||||||
%D%/packages/patches/lsh-fix-x11-forwarding.patch \
|
%D%/packages/patches/lsh-fix-x11-forwarding.patch \
|
||||||
|
|
22
gnu/packages/patches/llvm-roc-3.0.0-add_libraries.patch
Normal file
22
gnu/packages/patches/llvm-roc-3.0.0-add_libraries.patch
Normal file
|
@ -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
|
||||||
|
)
|
|
@ -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"});
|
||||||
|
}
|
13
gnu/packages/patches/llvm-roc-4.2.0-add_Object.patch
Normal file
13
gnu/packages/patches/llvm-roc-4.2.0-add_Object.patch
Normal file
|
@ -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
|
|
@ -55,3 +55,38 @@ (define-public rocm-cmake
|
||||||
(description "ROCm cmake modules provides cmake modules for common build
|
(description "ROCm cmake modules provides cmake modules for common build
|
||||||
tasks needed for the ROCM software stack.")
|
tasks needed for the ROCM software stack.")
|
||||||
(license license:ncsa)))
|
(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=")))))))
|
||||||
|
|
Loading…
Reference in a new issue