[PATCH] D91034: [Frontend] Treat CUDA header files as CUDA source files

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 13:00:01 PST 2020


tra added a comment.

In general, I'm still not quite convinced that adding CUDA detection to header extensions is all that useful.

The problem is that CUDA compilation relies on the external SDK and that essentially means that user must at least provide the path to CUDA SDK. 
Just guessing that it's a CUDA header is not sufficient for correct compilation results. 
It may work if clang finds a CUDA SDK via driver's autodetection machinery (I'm not sure it kicks in when used by tooling), 
but it may not necessarily be the SDK used by the compilation of CUDA sources. That may lead to subtle 
differences  between the data you get when the header is processed by itself vs when it's included from a CUDA source.

I'm reluctant to add something that "mostly works".



================
Comment at: lib/Frontend/FrontendOptions.cpp:32
       .Case("cl", Language::OpenCL)
-      .Case("cu", Language::CUDA)
+      .Cases("cu", "cuh", Language::CUDA)
       .Cases("ll", "bc", Language::LLVM_IR)
----------------
tra wrote:
> I'd add `.cu.h` and `.cu.cc` to the list.
It would need to be moved above the `cc` checks so it takes precedence over C++.



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

https://reviews.llvm.org/D91034



More information about the llvm-commits mailing list