Skip to content

Commit 1d96dca

Browse files
committed
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.
1 parent 76e3dd0 commit 1d96dca

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

clang/lib/Driver/ToolChains/AMDGPU.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,18 @@ RocmInstallationDetector::RocmInstallationDetector(
107107
// the Windows-esque layout the ROCm packages use with the host architecture
108108
// subdirectory of bin.
109109

110+
// Strip off directory (usually bin)
110111
StringRef ParentDir = llvm::sys::path::parent_path(InstallDir);
111-
if (ParentDir == HostTriple.getArchName())
112+
StringRef ParentName = llvm::sys::path::filename(ParentDir);
113+
114+
// Some builds use bin/{host arch}, so go up again.
115+
if (ParentName == "bin") {
112116
ParentDir = llvm::sys::path::parent_path(ParentDir);
117+
ParentName = llvm::sys::path::filename(ParentDir);
118+
}
113119

114-
if (ParentDir == "bin") {
120+
if (ParentName == "llvm") {
121+
// Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
115122
Candidates.emplace_back(llvm::sys::path::parent_path(ParentDir).str(),
116123
/*StrictChecking=*/true);
117124
}

0 commit comments

Comments
 (0)