if (!CudaTC) {
CudaTC = std::make_unique<toolchains::CudaToolChain>(
*this, *CudaTriple, *HostTC, C.getInputArgs());
+
+ // Emit a warning if the detected CUDA version is too new.
+ CudaInstallationDetector &CudaInstallation =
+ static_cast<toolchains::CudaToolChain &>(*CudaTC).CudaInstallation;
+ if (CudaInstallation.isValid())
+ CudaInstallation.WarnIfUnsupportedVersion();
}
C.addOffloadDeviceToolChain(CudaTC.get(), OFK);
} else if (IsHIP) {
const ArgList &Args, bool Freestanding = false)
: ToolChain(D, Triple, Args), CudaInstallation(D, HostTriple, Args),
Freestanding(Freestanding) {
- if (CudaInstallation.isValid()) {
- CudaInstallation.WarnIfUnsupportedVersion();
+ if (CudaInstallation.isValid())
getProgramPaths().push_back(std::string(CudaInstallation.getBinPath()));
- }
// Lookup binaries into the driver directory, this is used to
// discover the 'nvptx-arch' executable.
getProgramPaths().push_back(getDriver().Dir);
// UNKNOWN_VERSION: CUDA version is newer than the latest{{.*}} supported version
// UNKNOWN_VERSION_CXX-NOT: unknown CUDA version
+
+// Check to make sure we do not emit these warnings for OpenMP or cross-compilation.
+// RUN: %clang --target=x86_64-linux -v -### -fopenmp -nogpulib --offload-arch=sm_60 --cuda-path=%S/Inputs/CUDA-new/usr/local/cuda 2>&1 -x c %s | \
+// RUN: FileCheck %s --check-prefix=VERSION
+// RUN: %clang --target=nvptx64-nvidia-cuda -v -### -nogpulib -march=sm_60 --cuda-path=%S/Inputs/CUDA-new/usr/local/cuda 2>&1 -x c %s | \
+// RUN: FileCheck %s --check-prefix=VERSION
+// VERSION-NOT: CUDA version is newer than the latest{{.*}} supported version
+