summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/llvm-roc/files')
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-3.0.0-add_libraries.patch20
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-3.7.0-current_pos.patch32
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-3.9.0-tensorflow.patch35
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch84
-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/files/llvm-roc-4.1.0-fix-missing-include.patch21
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.2.0-add_Object.patch11
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.2.0-current_pos.patch28
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.2.0-cyclades.patch86
-rw-r--r--sys-devel/llvm-roc/files/llvm-roc-4.3.0-hip-location.patch189
10 files changed, 0 insertions, 535 deletions
diff --git a/sys-devel/llvm-roc/files/llvm-roc-3.0.0-add_libraries.patch b/sys-devel/llvm-roc/files/llvm-roc-3.0.0-add_libraries.patch
deleted file mode 100644
index 120ab819f5b4..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-3.0.0-add_libraries.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-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
- )
diff --git a/sys-devel/llvm-roc/files/llvm-roc-3.7.0-current_pos.patch b/sys-devel/llvm-roc/files/llvm-roc-3.7.0-current_pos.patch
deleted file mode 100644
index a0d3c1df6d99..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-3.7.0-current_pos.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-https://bugs.llvm.org/show_bug.cgi?id=43235
-
-diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
-index 705f1790b1d..a0314b2c46a 100644
---- a/include/llvm/Support/raw_ostream.h
-+++ b/include/llvm/Support/raw_ostream.h
-@@ -507,9 +507,7 @@ class raw_string_ostream : public raw_ostream {
- /// See raw_ostream::write_impl.
- void write_impl(const char *Ptr, size_t Size) override;
-
-- /// Return the current position within the stream, not counting the bytes
-- /// currently in the buffer.
-- uint64_t current_pos() const override { return OS.size(); }
-+ uint64_t current_pos() const override;
-
- public:
- explicit raw_string_ostream(std::string &O) : OS(O) {}
-diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
-index 4bb315f824a..742e2aced39 100644
---- a/lib/Support/raw_ostream.cpp
-+++ b/lib/Support/raw_ostream.cpp
-@@ -895,6 +895,10 @@ raw_ostream &llvm::nulls() {
- // raw_string_ostream
- //===----------------------------------------------------------------------===//
-
-+/// Return the current position within the stream, not counting the bytes
-+/// currently in the buffer.
-+uint64_t raw_string_ostream::current_pos() const { return OS.size(); }
-+
- raw_string_ostream::~raw_string_ostream() {
- flush();
- }
diff --git a/sys-devel/llvm-roc/files/llvm-roc-3.9.0-tensorflow.patch b/sys-devel/llvm-roc/files/llvm-roc-3.9.0-tensorflow.patch
deleted file mode 100644
index 3e1124457ad3..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-3.9.0-tensorflow.patch
+++ /dev/null
@@ -1,35 +0,0 @@
---- llvm-project-rocm-3.9.0.orig/CMakeLists.txt 2020-11-12 22:03:09.902293395 +0100
-+++ llvm-project-rocm-3.9.0/CMakeLists.txt 2020-11-12 22:07:28.185294853 +0100
-@@ -824,6 +824,11 @@
- ${LLVM_INCLUDE_DIR}/llvm/Config/Targets.def
- )
-
-+# They are not referenced. See set_output_directory().
-+set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin )
-+set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
-+set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
-+
- # For up-to-date instructions for installing the Tensorflow dependency, refer to
- # the bot setup script: https://github.com/google/ml-compiler-opt/blob/master/buildbot/buildbot_init.sh
- # In this case, the latest C API library is available for download from
-@@ -832,18 +837,13 @@
- # LLVM_HAVE_TF_API, through llvm-config.h, so that a user of the LLVM library may
- # also leverage the dependency.
- set(TENSORFLOW_C_LIB_PATH "" CACHE PATH "Path to TensorFlow C library install")
--find_library(tensorflow_c_api tensorflow PATHS ${TENSORFLOW_C_LIB_PATH}/lib)
-
--if (tensorflow_c_api)
-+if (TENSORFLOW_C_LIB_PATH)
-+ find_library(tensorflow_c_api tensorflow PATHS ${TENSORFLOW_C_LIB_PATH}/lib NO_DEFAULT_PATH REQUIRED)
- set(LLVM_HAVE_TF_API "ON" CACHE BOOL "Full Tensorflow API available")
- include_directories(${TENSORFLOW_C_LIB_PATH}/include)
- endif()
-
--# They are not referenced. See set_output_directory().
--set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin )
--set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
--set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
--
- # For up-to-date instructions for installing the Tensorflow dependency, refer to
- # the bot setup script: https://github.com/google/ml-compiler-opt/blob/master/buildbot/buildbot_init.sh
- # Specifically, assuming python3 is installed:
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
deleted file mode 100644
index 225adc709666..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-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 {
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
deleted file mode 100644
index f14ec4ac0db2..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-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/files/llvm-roc-4.1.0-fix-missing-include.patch b/sys-devel/llvm-roc/files/llvm-roc-4.1.0-fix-missing-include.patch
deleted file mode 100644
index 4914ba2e7f98..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-4.1.0-fix-missing-include.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From b498303066a63a203d24f739b2d2e0e56dca70d1 Mon Sep 17 00:00:00 2001
-From: serge-sans-paille <sguelton@redhat.com>
-Date: Tue, 10 Nov 2020 14:55:25 +0100
-Subject: [PATCH] [nfc] Fix missing include
-
----
- llvm/utils/benchmark/src/benchmark_register.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/utils/benchmark/src/benchmark_register.h b/llvm/utils/benchmark/src/benchmark_register.h
-index 0705e219f2fa2..4caa5ad4da079 100644
---- a/utils/benchmark/src/benchmark_register.h
-+++ b/utils/benchmark/src/benchmark_register.h
-@@ -1,6 +1,7 @@
- #ifndef BENCHMARK_REGISTER_H
- #define BENCHMARK_REGISTER_H
-
-+#include <limits>
- #include <vector>
-
- #include "check.h"
diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.2.0-add_Object.patch b/sys-devel/llvm-roc/files/llvm-roc-4.2.0-add_Object.patch
deleted file mode 100644
index da21ab2fc85a..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-4.2.0-add_Object.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff --color -uprN orig/lib/Target/AMDGPU/Disassembler/CMakeLists.txt llvm/lib/Target/AMDGPU/Disassembler/CMakeLists.txt
---- orig/lib/Target/AMDGPU/Disassembler/CMakeLists.txt 2021-06-14 11:57:54.222796911 +0800
-+++ 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
diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.2.0-current_pos.patch b/sys-devel/llvm-roc/files/llvm-roc-4.2.0-current_pos.patch
deleted file mode 100644
index 0f3398951b07..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-4.2.0-current_pos.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -Naur a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h
---- a/include/llvm/Support/raw_ostream.h 2021-05-22 19:56:44.779955686 +0200
-+++ b/include/llvm/Support/raw_ostream.h 2021-05-22 20:00:49.449954752 +0200
-@@ -610,9 +610,7 @@
- /// See raw_ostream::write_impl.
- void write_impl(const char *Ptr, size_t Size) override;
-
-- /// Return the current position within the stream, not counting the bytes
-- /// currently in the buffer.
-- uint64_t current_pos() const override { return OS.size(); }
-+ uint64_t current_pos() const override;
-
- public:
- explicit raw_string_ostream(std::string &O) : OS(O) {
-diff -Naur a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
---- a/lib/Support/raw_ostream.cpp 2021-05-22 19:59:05.651955148 +0200
-+++ b/lib/Support/raw_ostream.cpp 2021-05-22 20:01:22.929954625 +0200
-@@ -938,6 +938,10 @@
- // raw_string_ostream
- //===----------------------------------------------------------------------===//
-
-+/// Return the current position within the stream, not counting the bytes
-+/// currently in the buffer.
-+uint64_t raw_string_ostream::current_pos() const { return OS.size(); }
-+
- raw_string_ostream::~raw_string_ostream() {
- flush();
- }
diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.2.0-cyclades.patch b/sys-devel/llvm-roc/files/llvm-roc-4.2.0-cyclades.patch
deleted file mode 100644
index 629ede5bbc76..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-4.2.0-cyclades.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-https://github.com/RadeonOpenCompute/llvm-project/commit/68d5235cb58f988c71b403334cd9482d663841ab.patch
-https://bugs.gentoo.org/800695
-Differential Revision: https://reviews.llvm.org/D102059
-
-From 68d5235cb58f988c71b403334cd9482d663841ab Mon Sep 17 00:00:00 2001
-From: Tamar Christina <tamar.christina@arm.com>
-Date: Thu, 20 May 2021 18:55:11 +0100
-Subject: [PATCH] libsanitizer: Remove cyclades inclusion in sanitizer
---- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
-@@ -370,15 +370,6 @@ static void ioctl_table_fill() {
-
- #if SANITIZER_GLIBC
- // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
-- _(CYGETDEFTHRESH, WRITE, sizeof(int));
-- _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
-- _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
-- _(CYGETTHRESH, WRITE, sizeof(int));
-- _(CYGETTIMEOUT, WRITE, sizeof(int));
-- _(CYSETDEFTHRESH, NONE, 0);
-- _(CYSETDEFTIMEOUT, NONE, 0);
-- _(CYSETTHRESH, NONE, 0);
-- _(CYSETTIMEOUT, NONE, 0);
- _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
- _(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
- _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
-@@ -143,7 +143,6 @@ typedef struct user_fpregs elf_fpregset_t;
- # include <sys/procfs.h>
- #endif
- #include <sys/user.h>
--#include <linux/cyclades.h>
- #include <linux/if_eql.h>
- #include <linux/if_plip.h>
- #include <linux/lp.h>
-@@ -460,7 +459,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-
- #if SANITIZER_GLIBC
- unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
-- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
- #if EV_VERSION > (0x010000)
- unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
- #else
-@@ -824,15 +822,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
- #endif // SANITIZER_LINUX
-
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
-- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
-- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
-- unsigned IOCTL_CYGETMON = CYGETMON;
-- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
-- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
-- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
-- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
-- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
-- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
- unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
- unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
- unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
-+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
-@@ -983,7 +983,6 @@ extern unsigned struct_vt_mode_sz;
-
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
- extern unsigned struct_ax25_parms_struct_sz;
--extern unsigned struct_cyclades_monitor_sz;
- extern unsigned struct_input_keymap_entry_sz;
- extern unsigned struct_ipx_config_data_sz;
- extern unsigned struct_kbdiacrs_sz;
-@@ -1328,15 +1327,6 @@ extern unsigned IOCTL_VT_WAITACTIVE;
- #endif // SANITIZER_LINUX
-
- #if SANITIZER_LINUX && !SANITIZER_ANDROID
--extern unsigned IOCTL_CYGETDEFTHRESH;
--extern unsigned IOCTL_CYGETDEFTIMEOUT;
--extern unsigned IOCTL_CYGETMON;
--extern unsigned IOCTL_CYGETTHRESH;
--extern unsigned IOCTL_CYGETTIMEOUT;
--extern unsigned IOCTL_CYSETDEFTHRESH;
--extern unsigned IOCTL_CYSETDEFTIMEOUT;
--extern unsigned IOCTL_CYSETTHRESH;
--extern unsigned IOCTL_CYSETTIMEOUT;
- extern unsigned IOCTL_EQL_EMANCIPATE;
- extern unsigned IOCTL_EQL_ENSLAVE;
- extern unsigned IOCTL_EQL_GETMASTRCFG;
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
deleted file mode 100644
index 1fe93a33db36..000000000000
--- a/sys-devel/llvm-roc/files/llvm-roc-4.3.0-hip-location.patch
+++ /dev/null
@@ -1,189 +0,0 @@
-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 {