summaryrefslogtreecommitdiff
path: root/sys-devel/llvm-roc
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/llvm-roc')
-rw-r--r--sys-devel/llvm-roc/Manifest5
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch47
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch29
-rw-r--r--sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild94
-rw-r--r--sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild4
5 files changed, 176 insertions, 3 deletions
diff --git a/sys-devel/llvm-roc/Manifest b/sys-devel/llvm-roc/Manifest
index 91d974138f33..670b5eaf1bd3 100644
--- a/sys-devel/llvm-roc/Manifest
+++ b/sys-devel/llvm-roc/Manifest
@@ -1,6 +1,8 @@
AUX llvm-roc-3.0.0-add_libraries.patch 648 BLAKE2B a201718b8afdc1ba18ae5d7e85a73fde7ca2bb163eecabab33d37c5815ac6ab8c4f8d960ab40f95ad6df95da626a439fbda1d20c25abb9558a37bcdf64a77e64 SHA512 7a1892c8781146830aa5bf69db20bbe7329634f469aeef0946232b15138b55d332491092ed00a4cf698033f19d8f279f4a5b34f13168d5b9ff7eba4a229e82a0
AUX llvm-roc-3.7.0-current_pos.patch 1292 BLAKE2B 8481497e3f9c46c142034ae4c5455f94e79d9c10cc806945af64252043d46c558a3ba08078239a673937705edfd21ba85f618d1d3a5bff652d45efe4e1e70877 SHA512 6cd41988e4eb654b7040c238bef8fc10d8f5922bac9c0ba112c5ba1b57c769472d0b9deaea6822f2d6bbbfda0a27bed2c1df2bba93a79cb4bf08f24185843981
AUX llvm-roc-3.9.0-tensorflow.patch 1901 BLAKE2B 2fc2d2d77987e8a85c14e1190645f0453f431a6d606336696549e518cf216a15818bc4117bec7c270161ef86f0e6770c63c9fda84e12f3c3334c9dd04fa5ffbf SHA512 151b2f0fc9fd7193fc0af0c088d70b2e36fda484228f3c911dbf1a6c6e836107a8e156a98585dd2ffb6faea0953a05d769e986d72def0f2f530bc3da5c5521d7
+AUX llvm-roc-4.0.0-hip-location.patch 1850 BLAKE2B 718472b6bf81c3727746bb6dfc166e3492f8f0f45f68f8b26e9f70711b20e64f0feef0e531aed9efbd4a36a2d63dc1b65668080541f842a499942e48edba2ad6 SHA512 61f2d9eebdb22bf693ce8d287f0d44393b9395a6fecf482cf30cb96d8612be679860453f07e045a689a45d7edc3cdcd5c0712fb700e67639b7e0e869ee64ed4d
+AUX llvm-roc-4.0.0-remove-isystem-usr-include.patch 1187 BLAKE2B ec9043f7358373822c3f6ce53d267192470dfbf03cf649a0964bd93b8b843db8e0a794fee8bbf292f882a6a908d0fa26a1303e4b13d92233d60b6b41c461ce9f SHA512 c3e9f96cb393f702cebe4da8a18495b492ae7cab7877576f3f2a4e6555f77c499dff6eded623305c6939ccd2cd00307e1b5ee28f2c34c9fd3128568dbe88c887
DIST llvm-rocm-ocl-3.10.0.tar.gz 123600166 BLAKE2B 9b69dab6c7d1a8dfe0d90c76b54446ec7f8ef6e59c74ad328208ac07dbf8836ae412dc5c32fdcbfc926a2488e81cd8afef71c3ebca6cd8ff745205028ab380d8 SHA512 3bb7dac13d89cadfb61a231564155f49021437b7c35eae8735b88ceae4a23b7950643f17e3bfebb0868621297202a04d41120d50ea52b6ad8980dabe9bc75509
DIST llvm-rocm-ocl-3.7.0.tar.gz 116973132 BLAKE2B c1cc8a3b95292d726626d3cb59ec1b96549682bfcbec16030e47cf1318c6ea01bc76f3349f012ce4f1e4d8b9fe192c51a025c2d08cf593622c61fe7c61969ba6 SHA512 0626075bedb3898c96c0bb0be7a2aba4662050a1c738115f661bedc03d744ace7a4581b55c6325060740c13a0e50e72e09272bb02c1186c2c4a40fc9b961dcbe
DIST llvm-rocm-ocl-3.8.0.tar.gz 117004300 BLAKE2B 13c3213f0fb951fb9d574e8f6d76bb6c632fecadfe93dbe68a9720baa22e35aa3269deef8b533c5a5ff50a2c1ee3dd7a1ea0fae4b8ab8573ec5bfc5ca5d04f4f SHA512 4eca387a132c9d1237ebec7c80319e99c80088766209d05a697d09890f4a82c56ba5f48a5c8c8749bb051c177bb5eab67e00405b04d3191681d0ac7cf1ae868c
@@ -10,5 +12,6 @@ EBUILD llvm-roc-3.10.0.ebuild 1536 BLAKE2B 60a1d393a5df2291d971e67f9bbd2675611f9
EBUILD llvm-roc-3.7.0-r1.ebuild 1397 BLAKE2B 08aec56b8ab26093f28a9118ca043adb35dcb84ae5899da5890cbeecb5d10f8d6b08e767a490272a5f35d1b3a5ee8d912a52b448ee57582cda9f99fce57ec8ec SHA512 745f2a9fa18bc3b9d76a324beb1e5165f9be8f720ef133b35e1509c08c08e48872ec4c7402e52d29a3b493e27729a43081fd0e90afe90d30b64d6da3f046e824
EBUILD llvm-roc-3.8.0.ebuild 1492 BLAKE2B 73fd9fd2c47a18b5de44222b84fead548f85b4e67c18838050c52917b6836debee77bc83db6aa0a378516b48a56e5daaac53dde84bdbe1dbefd02494b06498d8 SHA512 d45f0e60c2f12e9b98425310fe370aeeb5d29cd24bfa83b1b908bcbc25866a49e6e1fc7facb04e699bd897f1960a394f2e3a4c5a8308ad9af6177f735dc40631
EBUILD llvm-roc-3.9.0.ebuild 1529 BLAKE2B 07aac1728864214e61ed45cee3ca718c7830835502fe9e6c1e5ba5d6fc8303f3b644b0bb3476f8a1adcaabf09e961b3b55bfce34312b953e8ba855b7f36cdecb SHA512 5b9755c9c06ed465b58d8ca7c677211c04cb05eafaffee1e558b26d3d3bc033a1b8d6b1b3e69732441edd9f14cbf608da919f4eac3e283f5f4226dc332ffb68c
-EBUILD llvm-roc-4.0.0.ebuild 2211 BLAKE2B 85b023669ea3c5ca0f8838983a6ecc75abcf3031bdae2cb21674db3facbdf44319b10009cc5b63f4b772e4417cbd31ca8b624efff544761b9dba5852e711c5cf SHA512 0560eaa5858c2e94a88e59eb0ec3de8cdabe9f8e3e10fc76bba5f6e9110bad366df6c83623ce704fe7737191190426253be147310c6547a4f0e9e942d027f320
+EBUILD llvm-roc-4.0.0-r1.ebuild 2374 BLAKE2B 3944380f53d89d30e8d93314f37a191c37359095dc10c23ce9ad85cc8e9b25eaf86907fa48cd9bf2ae0adc2348d57733bc56b134fa106104e84cae34b2f6432d SHA512 2204600e6e06c08baab1fa655e1d818e0b8b8bbb057b5d8cd838e7206f47ad0af1302f38d4bbf1420c566d5d2bc1023727a695244bc7e0fccf56ec592ddbe5f9
+EBUILD llvm-roc-4.0.0.ebuild 2209 BLAKE2B 69cb35d21ea261977032b7ba780bee60d1feda3a3246e81bb16b33f21b5b08fb094fbe34b117aa68e00d1cd42551a44fb53dd64bb40a74254bf02ba872f4cc32 SHA512 34a7d3f9cfd920adad596fe7532a15c347f56ccbd3cc9f66eb02fa77efa7b512ef3ba119c5377a059471cd6e256424c4ae34fac49dd08620674e0b22375d8268
MISC metadata.xml 461 BLAKE2B 5a060c417f0bb9bf1fba8375292e7bff20b2c50c3a2ab490bd436f81a954dbd370d61ba59b305b8bdaad9887e9c6a872eb30fea31c566dc6d74d3493b40d0a26 SHA512 a82c2186fc0642dab37608155dcf0aafd20701cb7e2769c6eb3aae88d4df6690743769a75f47efdb36fd8a3d6771f0feecd3efd01c98460fe195394c16d95660
diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
new file mode 100644
index 000000000000..8342299f1139
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
@@ -0,0 +1,47 @@
+replace hardcoded hip finder with Gentoo paths.
+
+Author: Benda Xu <heroxbd@gentoo.org>
+
+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
+@@ -116,37 +116,8 @@ RocmInstallationDetector::getInstallatio
+ return Candidates;
+ }
+
+- // Try to find relative to the compiler binary.
+- const char *InstallDir = D.getInstalledDir();
++ Candidates.emplace_back(D.SysRoot + "/usr/lib/hip", /*StrictChecking=*/true);
+
+- // Check both a normal Unix prefix position of the clang binary, as well as
+- // the Windows-esque layout the ROCm packages use with the host architecture
+- // subdirectory of bin.
+-
+- // Strip off directory (usually bin)
+- StringRef ParentDir = llvm::sys::path::parent_path(InstallDir);
+- StringRef ParentName = llvm::sys::path::filename(ParentDir);
+-
+- // Some builds use bin/{host arch}, so go up again.
+- if (ParentName == "bin") {
+- ParentDir = llvm::sys::path::parent_path(ParentDir);
+- ParentName = llvm::sys::path::filename(ParentDir);
+- }
+-
+- // Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
+- if (ParentName == "llvm")
+- ParentDir = llvm::sys::path::parent_path(ParentDir);
+-
+- Candidates.emplace_back(ParentDir.str(), /*StrictChecking=*/true);
+-
+- // Device library may be installed in clang resource directory.
+- Candidates.emplace_back(D.ResourceDir, /*StrictChecking=*/true);
+-
+- Candidates.emplace_back(D.SysRoot + "/opt/rocm", /*StrictChecking=*/true);
+- if (ParentName.startswith("aomp")) {
+- // Some versions of the aomp package install to /opt/rocm/aomp/bin
+- Candidates.emplace_back(ParentDir.str());
+- }
+ return Candidates;
+ }
+
diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch
new file mode 100644
index 000000000000..f14ec4ac0db2
--- /dev/null
+++ b/sys-devel/llvm-roc/files/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/sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild b/sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild
new file mode 100644
index 000000000000..5714ae9b7198
--- /dev/null
+++ b/sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+DESCRIPTION="Radeon Open Compute llvm,lld,clang"
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm/"
+SRC_URI="https://github.com/RadeonOpenCompute/llvm-project/archive/rocm-${PV}.tar.gz -> llvm-rocm-ocl-${PV}.tar.gz"
+
+LICENSE="UoI-NCSA rc BSD public-domain"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="debug +runtime"
+
+RDEPEND="virtual/cblas
+ dev-libs/libxml2
+ sys-libs/zlib
+ sys-libs/ncurses:="
+DEPEND="${RDEPEND}"
+PDEPEND="dev-libs/rocr-runtime"
+
+S="${WORKDIR}/llvm-project-rocm-${PV}/llvm"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-3.7.0-current_pos.patch"
+ "${FILESDIR}/${PN}-3.9.0-tensorflow.patch"
+)
+
+CMAKE_BUILD_TYPE=RelWithDebInfo
+
+src_prepare() {
+ cd "${WORKDIR}/llvm-project-rocm-${PV}" || die
+ eapply "${FILESDIR}/${PN}-3.0.0-add_libraries.patch"
+ eapply "${FILESDIR}/${PN}-4.0.0-remove-isystem-usr-include.patch"
+ eapply "${FILESDIR}/${PN}-4.0.0-hip-location.patch"
+
+ if [[ -n ${EPREFIX} ]]; then
+ pushd "${S}"/../clang >/dev/null || die
+ sed -i -e "s@DEFAULT_SYSROOT \"\"@DEFAULT_SYSROOT \"${EPREFIX}\"@" CMakeLists.txt
+ eend $?
+ ebegin "Use ${EPREFIX} as default sysroot"
+ cd lib/Driver/ToolChains >/dev/null || die
+ ebegin "Use dynamic linker from ${EPREFIX}"
+ sed -i -e "/LibDir.*Loader/s@return \"\/\"@return \"${EPREFIX}/\"@" Linux.cpp
+ eend $?
+
+ ebegin "Remove --sysroot call on ld for native toolchain"
+ sed -i -e "$(grep -n -B1 sysroot= Gnu.cpp | sed -ne '{1s/-.*//;1p}'),+1 d" Gnu.cpp
+ eend $?
+ popd >/dev/null || die
+ fi
+
+ # handled by sysroot, don't prefixify here.
+ sed -e 's:/opt/rocm:/usr/lib/hip:' \
+ -i "${S}"/../clang/lib/Driver/ToolChains/AMDGPU.cpp
+
+ eapply_user
+ cmake_src_prepare
+}
+
+src_configure() {
+ PROJECTS="clang;lld"
+
+ if usex runtime; then
+ PROJECTS+=";compiler-rt"
+ fi
+
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/roc"
+ -DLLVM_ENABLE_PROJECTS="${PROJECTS}"
+ -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86"
+ -DLLVM_BUILD_DOCS=NO
+ -DLLVM_ENABLE_OCAMLDOC=OFF
+ -DLLVM_ENABLE_SPHINX=NO
+ -DLLVM_ENABLE_DOXYGEN=OFF
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_VERSION_SUFFIX=roc
+ -DOCAMLFIND=NO
+ )
+
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ cat > "99${PN}" <<-EOF
+ LDPATH="${EROOT}/usr/lib/llvm/roc/lib"
+ EOF
+ doenvd "99${PN}"
+}
diff --git a/sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild b/sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild
index 64b2abf582b3..046488f4cf2a 100644
--- a/sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild
+++ b/sys-devel/llvm-roc/llvm-roc-4.0.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -42,7 +42,7 @@ src_prepare() {
ebegin "Use ${EPREFIX} as default sysroot"
cd lib/Driver/ToolChains >/dev/null || die
ebegin "Use dynamic linker from ${EPREFIX}"
- sed -i -e "/LibDir.*Loader/s@return \"\/\"@return \"${EPREFIX%/}/\"@" Linux.cpp
+ sed -i -e "/LibDir.*Loader/s@return \"\/\"@return \"${EPREFIX}/\"@" Linux.cpp
eend $?
ebegin "Remove --sysroot call on ld for native toolchain"