Author: Matt Arsenault Date: 2020-05-23T13:28:24-04:00 New Revision: 1d96dca9491e3d75c11c3cd1acff5fcda8c2f613
URL: https://github.com/llvm/llvm-project/commit/1d96dca9491e3d75c11c3cd1acff5fcda8c2f613 DIFF: https://github.com/llvm/llvm-project/commit/1d96dca9491e3d75c11c3cd1acff5fcda8c2f613.diff LOG: HIP: Try to deal with more llvm package layouts The various HIP builds are all inconsistent. The default llvm install goes to ${INSTALL_PREFIX}/bin/clang, but the rocm packaging scripts move this under ${INSTALL_PREFIX}/llvm/bin/clang. Some other builds further pollute this with ${INSTALL_PREFIX}/bin/x86_64/clang. These should really be consolidated, but try to handle them for now. Added: Modified: clang/lib/Driver/ToolChains/AMDGPU.cpp Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp index 193ccad98f52..3e51bd00bae4 100644 --- a/clang/lib/Driver/ToolChains/AMDGPU.cpp +++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp @@ -107,11 +107,18 @@ RocmInstallationDetector::RocmInstallationDetector( // 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); - if (ParentDir == HostTriple.getArchName()) + 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); + } - if (ParentDir == "bin") { + if (ParentName == "llvm") { + // Some versions of the rocm llvm package install to /opt/rocm/llvm/bin Candidates.emplace_back(llvm::sys::path::parent_path(ParentDir).str(), /*StrictChecking=*/true); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits