[PATCH] D80461: HIP: Try to deal with more llvm package layouts

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 22 17:10:07 PDT 2020


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);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80461.265816.patch
Type: text/x-patch
Size: 1063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200523/e1094851/attachment-0001.bin>


More information about the cfe-commits mailing list