Skip to content

Commit 970b1e6

Browse files
author
David Salinas
committed
Compiler messages on HIP SDK for Windows
When target triple indicates we are on Windows, do not add linux paths to search path in ROCm Installation Detection. Change-Id: I18effb8c20252de3d84ea37ef562124695c5a570
1 parent 845dee3 commit 970b1e6

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

clang/lib/Driver/ToolChains/AMDGPU.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,16 @@ RocmInstallationDetector::getInstallationPathCandidates() {
306306
LatestVer = Ver;
307307
}
308308
}
309-
if (!LatestROCm.empty())
310-
ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
311-
/*StrictChecking=*/true);
309+
if (!isWindows()) {
310+
if (!LatestROCm.empty())
311+
ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
312+
/*StrictChecking=*/true);
312313

313-
ROCmSearchDirs.emplace_back(D.SysRoot + "/usr/local",
314-
/*StrictChecking=*/true);
315-
ROCmSearchDirs.emplace_back(D.SysRoot + "/usr",
316-
/*StrictChecking=*/true);
314+
ROCmSearchDirs.emplace_back(D.SysRoot + "/usr/local",
315+
/*StrictChecking=*/true);
316+
ROCmSearchDirs.emplace_back(D.SysRoot + "/usr",
317+
/*StrictChecking=*/true);
318+
}
317319

318320
DoPrintROCmSearchDirs();
319321
return ROCmSearchDirs;
@@ -322,7 +324,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
322324
RocmInstallationDetector::RocmInstallationDetector(
323325
const Driver &D, const llvm::Triple &HostTriple,
324326
const llvm::opt::ArgList &Args, bool DetectHIPRuntime, bool DetectDeviceLib)
325-
: D(D) {
327+
: D(D), hostTriple(HostTriple) {
326328
Verbose = Args.hasArg(options::OPT_v);
327329
RocmPathArg = Args.getLastArgValue(clang::driver::options::OPT_rocm_path_EQ);
328330
PrintROCmSearchDirs =

clang/lib/Driver/ToolChains/ROCm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ class RocmInstallationDetector {
111111
// Wheter -nogpulib is specified.
112112
bool NoBuiltinLibs = false;
113113

114+
llvm::Triple hostTriple;
115+
114116
// Paths
115117
SmallString<0> InstallPath;
116118
SmallString<0> BinPath;
@@ -193,6 +195,9 @@ class RocmInstallationDetector {
193195
/// Check whether we detected a valid HIP STDPAR Acceleration library.
194196
bool hasHIPStdParLibrary() const { return HasHIPStdParLibrary; }
195197

198+
/// Check whether the target triple is for Windows.
199+
bool isWindows() const { return hostTriple.isOSWindows(); }
200+
196201
/// Print information about the detected ROCm installation.
197202
void print(raw_ostream &OS) const;
198203

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// UNSUPPORTED: system-linux
2+
3+
// RUN: %clang -### -nogpulib -nogpuinc \
4+
// RUN: --print-rocm-search-dirs %s 2>&1 \
5+
// RUN: | FileCheck %s
6+
7+
// CHECK-NOT: ROCm installation search path: [[ROCM_PATH:.*/usr$]]

0 commit comments

Comments
 (0)