[PATCH] D108247: [CUDA] Improve CUDA version detection and diagnostics.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 27 10:26:23 PDT 2021


tra added a comment.

So, what's the current state of affairs regarding CUDA SDK layout in debian?
Clang does rely on very particular ordering of includes, so having CUDA headers in a location clang does not expect will lead to issues sooner or later.
If the headers are not available where --cuda-path points clang to, I'm not sure what clang is supposed to do. Second-guessing explicit user input is not a good idea in general.

CUDA SDK no longer ships version.txt, so cuda.h is the only reliable mechanism for detecting CUDA version and clang does need to know it.

In case the version has not been found we also can not choose an arbitrary old version as the default.

So, one workaround would be to install CUDA-11.4. AFAICT, we do find the headers and ptxas, but misdetect CUDA version.
Another workaround would be to place a fake /usr/lib/cuda/include/cuda.h with something like this:

  #pragma push_macro("CUDA_VERSION")
  #define CUDA_VERSION 11030
  #pragma pop_macro("CUDA_VERSION")
  #include_next <cuda.h>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108247



More information about the cfe-commits mailing list