diff options
author | Fco Javier Felix <ffelix@inode64.com> | 2022-02-11 18:09:22 +0200 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2022-02-11 18:12:44 +0200 |
commit | d2a17410775f2c569c1e091decfe41467680deef (patch) | |
tree | 34a23b608ca4b791659cd655f3d898ede8973183 /sys-devel/llvm-roc/files | |
parent | dev-util/rocm-cmake: bump to 4.5.2 (diff) | |
download | gentoo-d2a17410775f2c569c1e091decfe41467680deef.tar.gz gentoo-d2a17410775f2c569c1e091decfe41467680deef.tar.bz2 gentoo-d2a17410775f2c569c1e091decfe41467680deef.zip |
sys-devel/llvm-roc: bump to 4.5.2
Closes: https://bugs.gentoo.org/802924
Package-Manager: Portage-3.0.28-r1, Repoman-3.0.3-r1
Signed-off-by: Fco. Javier Felix <ffelix@inode64.com>
Closes: https://github.com/gentoo/gentoo/pull/23343
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'sys-devel/llvm-roc/files')
-rw-r--r-- | sys-devel/llvm-roc/files/llvm-roc-4.5.2-add_libraries.patch | 11 | ||||
-rw-r--r-- | sys-devel/llvm-roc/files/llvm-roc-4.5.2-hip-location.patch | 188 |
2 files changed, 199 insertions, 0 deletions
diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.5.2-add_libraries.patch b/sys-devel/llvm-roc/files/llvm-roc-4.5.2-add_libraries.patch new file mode 100644 index 000000000000..e2fe9282d837 --- /dev/null +++ b/sys-devel/llvm-roc/files/llvm-roc-4.5.2-add_libraries.patch @@ -0,0 +1,11 @@ +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 --git a/sys-devel/llvm-roc/files/llvm-roc-4.5.2-hip-location.patch b/sys-devel/llvm-roc/files/llvm-roc-4.5.2-hip-location.patch new file mode 100644 index 000000000000..7b5714e610a7 --- /dev/null +++ b/sys-devel/llvm-roc/files/llvm-roc-4.5.2-hip-location.patch @@ -0,0 +1,188 @@ +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,7 @@ + /// 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); +- // Some versions of the aomp package install to /opt/rocm/aomp/bin +- // and it seems ParentDir is already pointing to correct place. +- 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(); ++ ROCmSearchDirs.emplace_back(D.SysRoot + "/usr", /*StrictChecking=*/true); + return ROCmSearchDirs; + } + +@@ -424,42 +298,7 @@ + } + + 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 { |