diff options
author | Julien Roy <julien@jroy.ca> | 2021-12-10 10:29:37 -0500 |
---|---|---|
committer | Julien Roy <julien@jroy.ca> | 2021-12-10 10:29:37 -0500 |
commit | 5ab02820562429ed0ac7df8be555bc66063ce130 (patch) | |
tree | 65c79aaf2a21329b8c404c193897856ed5e5bc59 /sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch | |
parent | d97cecc0c33bbf233f295f304f7b31ce98861852 (diff) | |
download | MrRoy-Overlay-5ab02820562429ed0ac7df8be555bc66063ce130.tar.gz MrRoy-Overlay-5ab02820562429ed0ac7df8be555bc66063ce130.tar.bz2 MrRoy-Overlay-5ab02820562429ed0ac7df8be555bc66063ce130.zip |
Added patches for llvm-rom from gentoo tree
Diffstat (limited to 'sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch')
-rw-r--r-- | sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch | 84 |
1 files changed, 84 insertions, 0 deletions
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 0000000..225adc7 --- /dev/null +++ b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch @@ -0,0 +1,84 @@ +replace hardcoded hip finder with Gentoo paths. + +It is not necessary to check HIP runtime each time. + +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", /*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; + } + +@@ -273,33 +244,7 @@ void RocmInstallationDetector::detectDev + } + + void RocmInstallationDetector::detectHIPRuntime() { +- auto Candidates = getInstallationPathCandidates(); +- auto &FS = D.getVFS(); +- +- for (const auto &Candidate : Candidates) { +- InstallPath = Candidate.Path; +- if (InstallPath.empty() || !FS.exists(InstallPath)) +- continue; +- +- 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) +- ParseHIPVersionFile((*VersionFile)->getBuffer()); +- +- HasHIPRuntime = true; +- return; +- } +- HasHIPRuntime = false; ++ HasHIPRuntime = true; + } + + void RocmInstallationDetector::print(raw_ostream &OS) const { |