aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2023-07-18 10:27:54 -0500
committerJoseph Huber <jhuber6@vols.utk.edu>2023-07-18 13:48:11 -0500
commitd2ac0069a21b79efdcd32ba4cc44dc7f08a25b8b (patch)
tree790ea4b30b7a9d11de1d08129b453f4680a333b5 /clang/lib/Driver/Driver.cpp
parentcf931d4fa56e38e0c806f5f628c5bab831a45991 (diff)
downloadllvm-d2ac0069a21b79efdcd32ba4cc44dc7f08a25b8b.zip
llvm-d2ac0069a21b79efdcd32ba4cc44dc7f08a25b8b.tar.gz
llvm-d2ac0069a21b79efdcd32ba4cc44dc7f08a25b8b.tar.bz2
[Clang] Only emit CUDA version warnings when creating the CUDA toolchain
This warning primarily applies to users of the CUDA langues as there may be new features we rely on. The other two users of the toolchain are OpenMP via `-fopenmp --offload-arch=sm_70` and a cross-compiled build via `--target=nvptx64-nvida-cuda -march=sm_70`. Both of these do not rely directly on things that would change significantly between CUDA versions, and the way they are built can sometims make this warning print many times. This patch changees the behaiour to only check for the version when building for CUDA offloading specifically, the other two will not have this check. Reviewed By: tra Differential Revision: https://reviews.llvm.org/D155606
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 211a65e..ce40df2 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -810,6 +810,12 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
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) {