[PATCH] D149110: [HIP] Detect HIP for Ubuntu, Mint, Gentoo, etc.

Cory Bloor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 17:36:35 PDT 2023


cgmb created this revision.
cgmb added reviewers: scchan, tra, yaxunl.
Herald added subscribers: kosarev, kerbowa, jvesely.
Herald added a project: All.
cgmb published this revision for review.
cgmb added a comment.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

Ubuntu Lunar (23.04) has released, which is the first version of Ubuntu with ROCm support in the universe repos. With respect to ROCm, it is basically a snapshot of Debian Sid. However, since LLVM detects HIP package differently on Ubuntu than on Debian, there are additional flags required on Ubuntu that are not needed on Debian. This patch removes the differences in behaviour between distros. An alternative approach would be just to add `|| Dist.IsGentoo() || Dist.IsUbuntu()` to the existing check, but that may still fail on Ubuntu-derived distros such as Linux Mint.


HIP may be installed into /usr or /usr/local on a variety of Linux
operating systems. It may become unwieldy to list them all.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149110

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
@@ -11,7 +11,6 @@
 #include "clang/Basic/TargetID.h"
 #include "clang/Config/config.h"
 #include "clang/Driver/Compilation.h"
-#include "clang/Driver/Distro.h"
 #include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Driver/InputInfo.h"
 #include "clang/Driver/Options.h"
@@ -309,13 +308,10 @@
     ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
                                 /*StrictChecking=*/true);
 
-  Distro Dist(D.getVFS(), llvm::Triple(llvm::sys::getProcessTriple()));
-  if (Dist.IsDebian() || Dist.IsRedhat()) {
-    ROCmSearchDirs.emplace_back(D.SysRoot + "/usr/local",
-                                /*StrictChecking=*/true);
-    ROCmSearchDirs.emplace_back(D.SysRoot + "/usr",
-                                /*StrictChecking=*/true);
-  }
+  ROCmSearchDirs.emplace_back(D.SysRoot + "/usr/local",
+                              /*StrictChecking=*/true);
+  ROCmSearchDirs.emplace_back(D.SysRoot + "/usr",
+                              /*StrictChecking=*/true);
 
   DoPrintROCmSearchDirs();
   return ROCmSearchDirs;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149110.516578.patch
Type: text/x-patch
Size: 1257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230425/3a68f122/attachment-0001.bin>


More information about the cfe-commits mailing list