[PATCH] D89832: [CUDA] Extract CUDA version from cuda.h if version.txt is not found

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 10:15:00 PDT 2020


tra added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Cuda.cpp:76-77
+    return CudaVersion::CUDA_102;
+  if (raw_version < 11010)
+    return CudaVersion::CUDA_110;
+  return CudaVersion::LATEST;
----------------
emankov wrote:
> Please, add `CudaVersion::CUDA_111` declaration in `Cuda.h` and a corresponding `if` here. 
> Btw, `switch` is possible here. 
It does not serve any purpose here. 102/110 were added when clang was only accepting specific versions. Now that it will accept any newer version,  Arguably it's 102/101 that should be gone until we implement the new functionality. All of that would out of scope for this patch.

As for the switch, it would only work to match exact versions encoded in the CUDA headers, including updates, patches, special private builds etc. I do not have access to all of those versions, so I can not enumerate all of them. Range checking is more robust.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89832



More information about the cfe-commits mailing list