95 lines
4.9 KiB
Diff
95 lines
4.9 KiB
Diff
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
|
|
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
|
|
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
|
|
@@ -58,19 +58,16 @@
|
|
llvm::sys::path::append(PackagePath, SubDirs[0]);
|
|
return PackagePath;
|
|
}
|
|
- if (SubDirs.size() == 0) {
|
|
- unsigned DiagID = D.getDiags().getCustomDiagID(
|
|
- DiagnosticsEngine::Error,
|
|
- "Expecting SPACK package %0 at %1 but not found");
|
|
- D.Diag(DiagID) << Prefix << Cand.Path;
|
|
+ if (SubDirs.size() == 0 && Verbose) {
|
|
+ llvm::errs() << "SPACK package " << Prefix << " not found at " << Cand.Path
|
|
+ << '\n';
|
|
return {};
|
|
}
|
|
|
|
- assert(SubDirs.size() > 1);
|
|
- unsigned DiagID = D.getDiags().getCustomDiagID(
|
|
- DiagnosticsEngine::Error,
|
|
- "Expecting one SPACK package %0 at %1 but found more");
|
|
- D.Diag(DiagID) << Prefix << Cand.Path;
|
|
+ if (SubDirs.size() > 1 && Verbose) {
|
|
+ llvm::errs() << "Cannot use SPACK package " << Prefix << " at " << Cand.Path
|
|
+ << " due to multiple installations for the same version\n";
|
|
+ }
|
|
return {};
|
|
}
|
|
|
|
@@ -305,6 +302,7 @@
|
|
const Driver &D, const llvm::Triple &HostTriple,
|
|
const llvm::opt::ArgList &Args, bool DetectHIPRuntime, bool DetectDeviceLib)
|
|
: D(D) {
|
|
+ Verbose = Args.hasArg(options::OPT_v);
|
|
RocmPathArg = Args.getLastArgValue(clang::driver::options::OPT_rocm_path_EQ);
|
|
PrintROCmSearchDirs =
|
|
Args.hasArg(clang::driver::options::OPT_print_rocm_search_dirs);
|
|
diff --git a/clang/lib/Driver/ToolChains/ROCm.h b/clang/lib/Driver/ToolChains/ROCm.h
|
|
--- a/clang/lib/Driver/ToolChains/ROCm.h
|
|
+++ b/clang/lib/Driver/ToolChains/ROCm.h
|
|
@@ -110,6 +110,7 @@
|
|
// Cache ROCm installation search paths.
|
|
SmallVector<Candidate, 4> ROCmSearchDirs;
|
|
bool PrintROCmSearchDirs;
|
|
+ bool Verbose;
|
|
|
|
bool allGenericLibsValid() const {
|
|
return !OCML.empty() && !OCKL.empty() && !OpenCL.empty() && !HIP.empty() &&
|
|
diff --git a/clang/test/Driver/rocm-detect.hip b/clang/test/Driver/rocm-detect.hip
|
|
--- a/clang/test/Driver/rocm-detect.hip
|
|
+++ b/clang/test/Driver/rocm-detect.hip
|
|
@@ -61,12 +61,15 @@
|
|
// RUN: %s 2>&1 | FileCheck -check-prefixes=SPACK-SET %s
|
|
|
|
// Test invalid SPACK ROCm installation missing hip and rocm-device-libs packages.
|
|
+// The message about SPACK is emitted only if -v is specified.
|
|
|
|
// RUN: rm -rf %T/rocm-spack/hip-*
|
|
// RUN: rm -rf %T/rocm-spack/rocm-device-libs-*
|
|
// RUN: %T/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin/clang -### -v \
|
|
// RUN: -target x86_64-linux-gnu --cuda-gpu-arch=gfx900 %s 2>&1 \
|
|
// RUN: | FileCheck -check-prefixes=SPACK-MISS %s
|
|
+// RUN: %T/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin/clang --version 2>&1 \
|
|
+// RUN: | FileCheck -check-prefixes=SPACK-MISS-SILENT %s
|
|
|
|
// GFX902-DEFAULTLIBS: error: cannot find ROCm device library for gfx902. Provide its path via --rocm-path or --rocm-device-lib-path, or pass -nogpulib to build without ROCm device library
|
|
|
|
@@ -90,8 +93,8 @@
|
|
// SPACK-SAME: "-internal-isystem" "[[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5/include"
|
|
|
|
// SPACK-MULT: InstalledDir: [[DIR:.*]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin
|
|
-// SPACK-MULT-DAG: Expecting one SPACK package hip-4.0.0 at [[DIR]] but found more
|
|
-// SPACK-MULT-DAG: Expecting one SPACK package rocm-device-libs-4.0.0 at [[DIR]] but found more
|
|
+// SPACK-MULT-DAG: Cannot use SPACK package hip-4.0.0 at [[DIR]] due to multiple installations for the same version
|
|
+// SPACK-MULT-DAG: Cannot use SPACK package rocm-device-libs-4.0.0 at [[DIR]] due to multiple installations for the same version
|
|
// SPACK-MULT-NOT: Found HIP installation: [[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5, version 4.0.20214-a2917cd
|
|
// SPACK-MULT-NOT: "-mlink-builtin-bitcode" "[[DIR]]/rocm-device-libs-4.0.0-6wnyzz4hgl3hr7uswasnagt7j2adctbs/amdgcn/bitcode/hip.bc"
|
|
// SPACK-MULT-NOT: "-internal-isystem" "[[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5/include"
|
|
@@ -103,8 +106,12 @@
|
|
// SPACK-SET-SAME: "-internal-isystem" "[[DIR]]/hip-4.0.0-abcd/include"
|
|
|
|
// SPACK-MISS: InstalledDir: [[DIR:.*]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin
|
|
-// SPACK-MISS-DAG: Expecting SPACK package hip-4.0.0 at [[DIR]] but not found
|
|
-// SPACK-MISS-DAG: Expecting SPACK package rocm-device-libs-4.0.0 at [[DIR]] but not found
|
|
+// SPACK-MISS-DAG: SPACK package hip-4.0.0 not found at [[DIR]]
|
|
+// SPACK-MISS-DAG: SPACK package rocm-device-libs-4.0.0 not found at [[DIR]]
|
|
// SPACK-MISS-NOT: Found HIP installation: [[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5, version 4.0.20214-a2917cd
|
|
// SPACK-MISS-NOT: "-mlink-builtin-bitcode" "[[DIR]]/rocm-device-libs-4.0.0-6wnyzz4hgl3hr7uswasnagt7j2adctbs/amdgcn/bitcode/hip.bc"
|
|
// SPACK-MISS-NOT: "-internal-isystem" "[[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5/include"
|
|
+
|
|
+// SPACK-MISS-SILENT-NOT: SPACK package hip-{{.*}} not found at
|
|
+// SPACK-MISS-SILENT-NOT: SPACK package rocm-device-libs-{{.*}} not found at
|
|
+// SPACK-MISS-SILENT-NOT: Found HIP installation
|