arsenm created this revision.
arsenm added reviewers: yaxunl, scchan.
Herald added subscribers: kerbowa, nhaehnle, wdng, jvesely.

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.


https://reviews.llvm.org/D80461

Files:
  clang/lib/Driver/ToolChains/AMDGPU.cpp


Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -107,11 +107,18 @@
     // 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);
     }


Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -107,11 +107,18 @@
     // 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

Reply via email to