[PATCH] D114326: Update the list of CUDA versions up to 11.5

Mojca Miklavec via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 20 13:55:51 PST 2021


mojca created this revision.
mojca added a reviewer: carlosgalvezp.
mojca added a project: clang.
Herald added subscribers: usaxena95, kadircet, yaxunl.
mojca requested review of this revision.
Herald added subscribers: cfe-commits, ilya-biryukov.

I've been trying to address the following issue in `clangd` for Visual Studio Code trying to access CUDA:
https://github.com/clangd/clangd/issues/793

This patch alone is not yet sufficient for a fully functional clangd, but it gets rid of the error message saying

  Cannot find CUDA installation. Provide its path via --cuda-path, or pass -nocudainc to build without CUDA includes.

in case clangd and the code is located on the `C:` drive.

In my case I had both `clangd` (which I needed for debugging purposes) and the source code on `D:`. At this point:

  c++
  Candidates.emplace_back(D.SysRoot + "/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v" + Ver);

the `D.SysRoot` seems to be empty. Then, during the call to

  c++
   if (InstallPath.empty() || !FS.exists(InstallPath))

after `sys::fs::make_absolute(WD->Resolved, Storage);` (in `VirtualFileSystem.cpp`) the `Storage` expands to `D:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.4` which isn't found either.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114326

Files:
  clang/lib/Driver/ToolChains/Cuda.cpp


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -127,7 +127,9 @@
   SmallVector<Candidate, 4> Candidates;
 
   // In decreasing order so we prefer newer versions to older versions.
-  std::initializer_list<const char *> Versions = {"8.0", "7.5", "7.0"};
+  std::initializer_list<const char *> Versions = {
+      "11.5", "11.4", "11.3", "11.2", "11.1", "11.0", "10.2", "10.1",
+      "10.0", "9.2",  "9.1",  "9.0",  "8.0",  "7.5",  "7.0"};
   auto &FS = D.getVFS();
 
   if (Args.hasArg(clang::driver::options::OPT_cuda_path_EQ)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114326.388730.patch
Type: text/x-patch
Size: 681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211120/1fbbd3c3/attachment.bin>


More information about the cfe-commits mailing list