[CUDA] Improve CUDA version detection and diagnostics.
authorArtem Belevich <tra@google.com>
Tue, 17 Aug 2021 19:32:05 +0000 (12:32 -0700)
committerArtem Belevich <tra@google.com>
Mon, 23 Aug 2021 20:24:48 +0000 (13:24 -0700)
commit3db8e486e560183f064e31a228aada52fdeac5d6
tree848bd92d4bda0e5b87846f789160437a65ff662c
parent49d982d8cbbbb6e01b6f8e4f173ed6325beab08b
[CUDA] Improve CUDA version detection and diagnostics.

Always use cuda.h to detect CUDA version. It's a more universal approach
compared to version.txt which is no longer present in recent CUDA versions.

Split the 'unknown CUDA version' warning in two:

* when detected CUDA version is partially supported by clang. It's expected to
work in general, at the feature parity with the latest supported CUDA
version. and may be missing support for the new features/instructions/GPU
variants. Clang will issue a warning.

* when detected version is new. Recent CUDA versions have been working with
clang reasonably well, and will likely to work similarly to the partially
supported ones above. Or it may not work at all. Clang will issue a warning and
proceed as if the latest known CUDA version was detected.

Differential Revision: https://reviews.llvm.org/D108247
16 files changed:
clang/include/clang/Basic/Cuda.h
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Basic/Cuda.cpp
clang/lib/Driver/ToolChains/Cuda.cpp
clang/lib/Driver/ToolChains/Cuda.h
clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/bin/.keep [new file with mode: 0644]
clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/include/.keep [new file with mode: 0644]
clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/include/cuda.h [new file with mode: 0644]
clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/lib/.keep [new file with mode: 0644]
clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/lib64/.keep [new file with mode: 0644]
clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/nvvm/libdevice/libdevice.10.bc [new file with mode: 0644]
clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt [deleted file]
clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/include/cuda.h [new file with mode: 0644]
clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/version.txt [deleted file]
clang/test/Driver/Inputs/CUDA_90/usr/local/cuda/include/cuda.h [new file with mode: 0644]
clang/test/Driver/cuda-version-check.cu