[PATCH] D89752: [CUDA] Improve clang's ability to detect recent CUDA versions.

Evgeny Mankov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 05:10:04 PDT 2020


emankov added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Cuda.cpp:158
     if (!VersionFile) {
-      // CUDA 7.0 doesn't have a version.txt, so guess that's our version if
-      // version.txt isn't present.
-      Version = CudaVersion::CUDA_70;
+      // CUDA 7.0 and CUDA 11.1+ do not have version.txt file.
+      // Use libdevice file to distinguish 7.0 from the new versions.
----------------
CUDA 11.0+, actually


================
Comment at: clang/lib/Driver/ToolChains/Cuda.cpp:161
+      if (FS.exists(LibDevicePath + "/libdevice.10.bc")) {
+        Version = CudaVersion::LATEST;
+        DetectedVersionIsNotSupported = Version > CudaVersion::LATEST_SUPPORTED;
----------------
Do we have any other mechanism besides version.txt for determining an exact CUDA version? Setting the latest version in case of absence of version.txt doesn't suit all the needs: sometimes the exact version is taken into account, for instance in [[ https://github.com/ROCm-Developer-Tools/HIPIFY#clang | hipify-clang ]].


================
Comment at: clang/test/Driver/cuda-version-check.cu:13
 // RUN:    FileCheck %s --check-prefix=UNKNOWN_VERSION
+// CUDA-11.1 does not carry version.txt file. Make sure we still detect it as a
+// new version and handle it the same as we handle other new CUDA versions.
----------------
CUDA-11.0 Update 1 doesn't carry version.txt as well.


================
Comment at: clang/test/Driver/cuda-version-check.cu:72
 
-// UNKNOWN_VERSION: Unknown CUDA version 999.999. Assuming the latest supported version
+// UNKNOWN_VERSION: Unknown CUDA version{{.*}}. Assuming the latest supported version
 // UNKNOWN_VERSION_CXX-NOT: Unknown CUDA version
----------------
missing space before {{


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89752/new/

https://reviews.llvm.org/D89752



More information about the cfe-commits mailing list