[clang] Compiler messages on HIP SDK for Windows (PR #97668)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 20:36:26 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: David Salinas (david-salinas)

<details>
<summary>Changes</summary>

      When target triple indicates we are on Windows, do not add linux
      paths to search path in ROCm Installation Detection.

Change-Id: I18effb8c20252de3d84ea37ef562124695c5a570

---
Full diff: https://github.com/llvm/llvm-project/pull/97668.diff


2 Files Affected:

- (modified) clang/lib/Driver/ToolChains/AMDGPU.cpp (+10-8) 
- (modified) clang/lib/Driver/ToolChains/ROCm.h (+5) 


``````````diff
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 453daed7cc7d5..e05b9202599c7 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -306,14 +306,16 @@ RocmInstallationDetector::getInstallationPathCandidates() {
       LatestVer = Ver;
     }
   }
-  if (!LatestROCm.empty())
-    ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
-                                /*StrictChecking=*/true);
+  if (!isWindows()) {
+    if (!LatestROCm.empty())
+      ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
+                                  /*StrictChecking=*/true);
 
-  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;
@@ -322,7 +324,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
 RocmInstallationDetector::RocmInstallationDetector(
     const Driver &D, const llvm::Triple &HostTriple,
     const llvm::opt::ArgList &Args, bool DetectHIPRuntime, bool DetectDeviceLib)
-    : D(D) {
+    : D(D), hostTriple(HostTriple) {
   Verbose = Args.hasArg(options::OPT_v);
   RocmPathArg = Args.getLastArgValue(clang::driver::options::OPT_rocm_path_EQ);
   PrintROCmSearchDirs =
diff --git a/clang/lib/Driver/ToolChains/ROCm.h b/clang/lib/Driver/ToolChains/ROCm.h
index dceb0ab036693..e2492b1630238 100644
--- a/clang/lib/Driver/ToolChains/ROCm.h
+++ b/clang/lib/Driver/ToolChains/ROCm.h
@@ -111,6 +111,8 @@ class RocmInstallationDetector {
   // Wheter -nogpulib is specified.
   bool NoBuiltinLibs = false;
 
+  llvm::Triple hostTriple;
+
   // Paths
   SmallString<0> InstallPath;
   SmallString<0> BinPath;
@@ -193,6 +195,9 @@ class RocmInstallationDetector {
   /// Check whether we detected a valid HIP STDPAR Acceleration library.
   bool hasHIPStdParLibrary() const { return HasHIPStdParLibrary; }
 
+  /// Check whether the target triple is for Windows.
+  bool isWindows() const { return hostTriple.isOSWindows();}
+
   /// Print information about the detected ROCm installation.
   void print(raw_ostream &OS) const;
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/97668


More information about the cfe-commits mailing list