summaryrefslogtreecommitdiff
path: root/sys-devel/llvm-roc
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-08-31 08:59:54 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-08-31 08:59:54 +0100
commit3b08f674e3f771b49370edb144dab0958c8cf721 (patch)
tree3673eb62859b2343bc70589f2f9d670c2eee5cc8 /sys-devel/llvm-roc
parentb1c81de4fadbd00897700a7321f03b390d952b2e (diff)
gentoo resync : 31.08.2021
Diffstat (limited to 'sys-devel/llvm-roc')
-rw-r--r--sys-devel/llvm-roc/Manifest3
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.3.0-hip-location.patch189
-rw-r--r--sys-devel/llvm-roc/llvm-roc-4.3.0-r1.ebuild (renamed from sys-devel/llvm-roc/llvm-roc-4.3.0.ebuild)1
3 files changed, 192 insertions, 1 deletions
diff --git a/sys-devel/llvm-roc/Manifest b/sys-devel/llvm-roc/Manifest
index d328fc6325f1..8e4fedf9a975 100644
--- a/sys-devel/llvm-roc/Manifest
+++ b/sys-devel/llvm-roc/Manifest
@@ -7,6 +7,7 @@ AUX llvm-roc-4.1.0-fix-missing-include.patch 665 BLAKE2B f1bf71ef746cb7bf2671e88
AUX llvm-roc-4.2.0-add_Object.patch 439 BLAKE2B c59ab50959d94ea04d63b734d580f1e91e6fc12bab5ff94b2322a28388ffb2e9e2bd26905dc3095bc75c57248b6e9a0e8913a1d02054b06c7e5e3e72a05add93 SHA512 ed2ffebd3c79f2dbcdb77cbacffc9a546b35e11a7c523d524ad74b6b69eab7fca91e0d22af09bac42284865da1a332292dbe8a3df968e4364baf55996ea05823
AUX llvm-roc-4.2.0-current_pos.patch 1217 BLAKE2B 693e79cb895918f5e1a56be8d6624c049e8aa5640c55c34fc3fe27f053b7642670310ece321548df58f23e73d145f00d5c95b1e462eee008070cf6a2fde1c66c SHA512 fa8f773ba230e01f83526e4ae644fb2e7aceae99720cb5219c1b22baaabc5008f9b0151aee4c44ba9a4415ef421a8bfeb268302ee70e8c56428bf56c08b15903
AUX llvm-roc-4.2.0-cyclades.patch 3703 BLAKE2B 3250b2da548ffe759155fb673f0f81cfba1a918a8337aac72c8190edde18c0d14610b9734ac47c9e47570c35c6c28a525045f48acb446f70e7b6aa0706daab72 SHA512 694c38775a6353eba3c5bdcc39e2884a913f72b7a35dd5285ceed0ddf89456c9ca89fa2f5d801b6f4aa44f1301e3ceeb65f1641cd92d5128a91ebce5f42a261e
+AUX llvm-roc-4.3.0-hip-location.patch 7128 BLAKE2B 6756bcad1c0bdef0729d3e7f2c6ea3468777623fb1493209956f436e9f234a1728e052c31ff064f8125c72d2a8cf68f425f76fb21cecf02680e999a6d5e7e41b SHA512 09f42ce7a37e072aa813036b78efd38cdaee54a1155fb347bf22f3f9f87441a6af83014fbc798f4d6d11966f40cf9c9fe6d3a8662b58be7859ab5b167eee37c2
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
@@ -27,5 +28,5 @@ EBUILD llvm-roc-4.0.1.ebuild 2344 BLAKE2B d195d63018e995832f513b50ad0f2ac7563492
EBUILD llvm-roc-4.1.0.ebuild 2353 BLAKE2B 0ad6a859369212effe46aa857af8902d2be4113ff00b7760c79c4372c31f4c08e217b928fa06938e9aa9f4859677c6dc7b6624fe19b42b1477c238ec31c2b0df SHA512 2075d70c1d396a7a09a570480dfe054236ec987bf2b95059a85a0011e2c82f9dbc0d0a66ec61a93b5954ecfd5a6061cf742b51edf574754e3876e92733d458be
EBUILD llvm-roc-4.1.1.ebuild 2392 BLAKE2B 6991a50a82746c051c1084f0e4794c31347fc792a7da6ba791cc09fe16de7394cdf70edc50da73db0db8db5e554c6d8cd41f087c47b9dec0d60bb9f8ac98f9fb SHA512 489431911aa16544645387b13a6296000b7171bd0910065bd778d87ef5b1db33f26d40ca4d6ea88998a7ed932603ceba41eea5c11b1ffb09890c5d530f64b644
EBUILD llvm-roc-4.2.0.ebuild 2366 BLAKE2B 91003a3a21fc407c8546b4984daf617414877b61b83bfa20ddad15f64582b3076e744d42040d896c3afec6ca9e9a06433035883775d72841914c48b6a60546b8 SHA512 c149083879e100e8db6125c9d5ce839e3cf15e932b49378be4351da1e5213369b18a428b681d7dd1fd53aa1e0c9ec24e6d8cc2c59a8fd748395764473b5bedd4
-EBUILD llvm-roc-4.3.0.ebuild 2394 BLAKE2B 082476642b71e1985d9993a9f031cd4bc05814ef070c174906ed2799874e735010f081b656fe54abe802e79cf8e06a73a39ffe1ac103c48b977eb19869ea950f SHA512 70ddf87455d9a96fb6a0b9045516a72041ebd0070a4b4d342226de3783aaf1efeb5e8f8addaf3a932448228e82610bf8a896bf9fbf2450a6935a91f2ebcc0ba8
+EBUILD llvm-roc-4.3.0-r1.ebuild 2447 BLAKE2B f8c8605942225d53517c373cc42e6f6ca73000a47415ad89fdf8a6095a05637715be1d7636b388a82f7040db5e256d9a2a0a206a6956de6ca4fa7b8884e9b637 SHA512 fe11f3b4a2ba24cdb068fc4ba8a0a0f0b8bb72a3d42fc0701d3d6fdf1cad9fb9f0d8f458da987a14601102a095eccb1ec7dac36a1863e19d58cdc2722325cc86
MISC metadata.xml 469 BLAKE2B a1e09f1367584ac91c7ff11e1960ea9bc9fb4cc91f6aba026c62bc8eda0d73c63d9cac2307c0acc45a0d6edad2c42dfe48b62ce7186e97eeaa431cd92e49efb9 SHA512 80825c579b65284d97c97ed7988330141c9c5587e3b95e22c28908b98cf010298b75dc04b5e2ccfe38cee22f6ef916c9226f7db4c604a4b4dde2b2ff6c755a37
diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.3.0-hip-location.patch b/sys-devel/llvm-roc/files/llvm-roc-4.3.0-hip-location.patch
new file mode 100644
index 000000000000..1fe93a33db36
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-4.3.0-hip-location.patch
@@ -0,0 +1,189 @@
+replace hardcoded hip finder with Gentoo paths.
+
+It is not necessary to check HIP runtime each time.
+
+Author: Benda Xu <heroxbd@gentoo.org>
+Author: Yiyang Wu <xgreenlandforwyy@gmail.com>
+
+--- orig/clang/lib/Driver/ToolChains/AMDGPU.cpp
++++ llvm-project-rocm-4.3.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+@@ -165,133 +165,8 @@ bool RocmInstallationDetector::parseHIPV
+ /// cached and populated only once.
+ const SmallVectorImpl<RocmInstallationDetector::Candidate> &
+ RocmInstallationDetector::getInstallationPathCandidates() {
+-
+- // Return the cached candidate list if it has already been populated.
+- if (!ROCmSearchDirs.empty())
+- return ROCmSearchDirs;
+-
+- auto DoPrintROCmSearchDirs = [&]() {
+- if (PrintROCmSearchDirs)
+- for (auto Cand : ROCmSearchDirs) {
+- llvm::errs() << "ROCm installation search path";
+- if (Cand.isSPACK())
+- llvm::errs() << " (Spack " << Cand.SPACKReleaseStr << ")";
+- llvm::errs() << ": " << Cand.Path << '\n';
+- }
+- };
+-
+- // For candidate specified by --rocm-path we do not do strict check, i.e.,
+- // checking existence of HIP version file and device library files.
+- if (!RocmPathArg.empty()) {
+- ROCmSearchDirs.emplace_back(RocmPathArg.str());
+- DoPrintROCmSearchDirs();
+- return ROCmSearchDirs;
+- } else if (const char *RocmPathEnv = ::getenv("ROCM_PATH")) {
+- if (!StringRef(RocmPathEnv).empty()) {
+- ROCmSearchDirs.emplace_back(RocmPathEnv);
+- DoPrintROCmSearchDirs();
+- return ROCmSearchDirs;
+- }
+- }
+-
+- // Try to find relative to the compiler binary.
+- const char *InstallDir = D.getInstalledDir();
+-
+- // 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.
+- auto DeduceROCmPath = [](StringRef ClangPath) {
+- // Strip off directory (usually bin)
+- StringRef ParentDir = llvm::sys::path::parent_path(ClangPath);
+- 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);
+- }
+-
+- // Detect ROCm packages built with SPACK.
+- // clang is installed at
+- // <rocm_root>/llvm-amdgpu-<rocm_release_string>-<hash>/bin directory.
+- // We only consider the parent directory of llvm-amdgpu package as ROCm
+- // installation candidate for SPACK.
+- if (ParentName.startswith("llvm-amdgpu-")) {
+- auto SPACKPostfix =
+- ParentName.drop_front(strlen("llvm-amdgpu-")).split('-');
+- auto SPACKReleaseStr = SPACKPostfix.first;
+- if (!SPACKReleaseStr.empty()) {
+- ParentDir = llvm::sys::path::parent_path(ParentDir);
+- return Candidate(ParentDir.str(), /*StrictChecking=*/true,
+- SPACKReleaseStr);
+- }
+- }
+-
+- // Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
+- // Some versions of the aomp package install to /opt/rocm/aomp/bin
+- if (ParentName == "llvm" || ParentName.startswith("aomp"))
+- ParentDir = llvm::sys::path::parent_path(ParentDir);
+-
+- return Candidate(ParentDir.str(), /*StrictChecking=*/true);
+- };
+-
+- // Deduce ROCm path by the path used to invoke clang. Do not resolve symbolic
+- // link of clang itself.
+- ROCmSearchDirs.emplace_back(DeduceROCmPath(InstallDir));
+-
+- // Deduce ROCm path by the real path of the invoked clang, resolving symbolic
+- // link of clang itself.
+- llvm::SmallString<256> RealClangPath;
+- llvm::sys::fs::real_path(D.getClangProgramPath(), RealClangPath);
+- auto ParentPath = llvm::sys::path::parent_path(RealClangPath);
+- if (ParentPath != InstallDir)
+- ROCmSearchDirs.emplace_back(DeduceROCmPath(ParentPath));
+-
+- // Device library may be installed in clang resource directory.
+- ROCmSearchDirs.emplace_back(D.ResourceDir,
+- /*StrictChecking=*/true);
+-
+- ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/rocm",
+- /*StrictChecking=*/true);
+-
+- // Find the latest /opt/rocm-{release} directory.
+- std::error_code EC;
+- std::string LatestROCm;
+- llvm::VersionTuple LatestVer;
+- // Get ROCm version from ROCm directory name.
+- auto GetROCmVersion = [](StringRef DirName) {
+- llvm::VersionTuple V;
+- std::string VerStr = DirName.drop_front(strlen("rocm-")).str();
+- // The ROCm directory name follows the format of
+- // rocm-{major}.{minor}.{subMinor}[-{build}]
+- std::replace(VerStr.begin(), VerStr.end(), '-', '.');
+- V.tryParse(VerStr);
+- return V;
+- };
+- for (llvm::vfs::directory_iterator
+- File = D.getVFS().dir_begin(D.SysRoot + "/opt", EC),
+- FileEnd;
+- File != FileEnd && !EC; File.increment(EC)) {
+- llvm::StringRef FileName = llvm::sys::path::filename(File->path());
+- if (!FileName.startswith("rocm-"))
+- continue;
+- if (LatestROCm.empty()) {
+- LatestROCm = FileName.str();
+- LatestVer = GetROCmVersion(LatestROCm);
+- continue;
+- }
+- auto Ver = GetROCmVersion(FileName);
+- if (LatestVer < Ver) {
+- LatestROCm = FileName.str();
+- LatestVer = Ver;
+- }
+- }
+- if (!LatestROCm.empty())
+- ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
+- /*StrictChecking=*/true);
+-
+- DoPrintROCmSearchDirs();
+- return ROCmSearchDirs;
++ ROCmSearchDirs.emplace_back(D.SysRoot + "/usr", /*StrictChecking=*/true);
++ return ROCmSearchDirs;
+ }
+
+ RocmInstallationDetector::RocmInstallationDetector(
+@@ -423,42 +298,7 @@ void RocmInstallationDetector::detectDev
+ }
+
+ void RocmInstallationDetector::detectHIPRuntime() {
+- SmallVector<Candidate, 4> HIPSearchDirs;
+- if (!HIPPathArg.empty())
+- HIPSearchDirs.emplace_back(HIPPathArg.str(), /*StrictChecking=*/true);
+- else
+- HIPSearchDirs.append(getInstallationPathCandidates());
+- auto &FS = D.getVFS();
+-
+- for (const auto &Candidate : HIPSearchDirs) {
+- InstallPath = Candidate.Path;
+- if (InstallPath.empty() || !FS.exists(InstallPath))
+- continue;
+- // HIP runtime built by SPACK is installed to
+- // <rocm_root>/hip-<rocm_release_string>-<hash> directory.
+- auto SPACKPath = findSPACKPackage(Candidate, "hip");
+- InstallPath = SPACKPath.empty() ? InstallPath : SPACKPath;
+-
+- BinPath = InstallPath;
+- llvm::sys::path::append(BinPath, "bin");
+- IncludePath = InstallPath;
+- llvm::sys::path::append(IncludePath, "include");
+- LibPath = InstallPath;
+- llvm::sys::path::append(LibPath, "lib");
+-
+- llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> VersionFile =
+- FS.getBufferForFile(BinPath + "/.hipVersion");
+- if (!VersionFile && Candidate.StrictChecking)
+- continue;
+-
+- if (HIPVersionArg.empty() && VersionFile)
+- if (parseHIPVersionFile((*VersionFile)->getBuffer()))
+- continue;
+-
+- HasHIPRuntime = true;
+- return;
+- }
+- HasHIPRuntime = false;
++ HasHIPRuntime = true;
+ }
+
+ void RocmInstallationDetector::print(raw_ostream &OS) const {
diff --git a/sys-devel/llvm-roc/llvm-roc-4.3.0.ebuild b/sys-devel/llvm-roc/llvm-roc-4.3.0-r1.ebuild
index f055da5b9391..34567ada1922 100644
--- a/sys-devel/llvm-roc/llvm-roc-4.3.0.ebuild
+++ b/sys-devel/llvm-roc/llvm-roc-4.3.0-r1.ebuild
@@ -33,6 +33,7 @@ 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.3.0-hip-location.patch"
eapply "${FILESDIR}/${PN}-4.2.0-cyclades.patch"
if [[ -n ${EPREFIX} ]]; then