-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get CUDA intellisense to work with compile_commands.json #8091
Comments
CUDA IntelliSense works in general with compile commands (i.e. our automated test for that is working), but there might be something special about the arguments used that could be causing it to fail. If you set your C_Cpp.loggingLevel to "Debug" and look for the C/C++ output (not the Diagnostics output) after "Invoking nvcc with command line:" it may show more info on what is going wrong. You might double-check if the "-I", "/usr/local/cuda/include" argument isn't causing the failure (i.e. if the path exists), but I don't see that include being added to your includePath. It's also possible the "-o", "vectorAdd.o" might be causing the issue. Otherwise, @Colengms might be investigate more next week. |
It seems
which would give the error message
|
Okay, that helps -- looks like it's caused by a typo of "--o instead of "-o". We should have a fix for 1.7.0-insiders. |
We've made a fix for 1.6.0-insiders -- if it's not fixed in that release, we'll need to investigate more. |
The fix is available with https://github.com/microsoft/vscode-cpptools/releases/tag/1.7.0-insiders2 |
Sorry for my not able to test this on my linux machine now(because I'm on vacation). On Windows the error persists. My
and the error message says
The command outputs the following result for me:
Besides, everything goes well without the |
This is caused by spaces in the flags |
Hi @xq114 . That issue would seem to be due to cpptools assuming arguments in the We could change this to instead assume that the |
I escaped the argument and everything finally works fine! Thanks a lot. I do agree that the LLVM specification should be more concise. |
I find that for c++ files the spaces in the arguments field is correctly recognized:
the flag gives the following result:
It seems a flag with whitespace is acceptable. How does the case differ from what happened in CUDA flag processing? In other words, why can't the include flags be recognized first and automatically handled? |
Hi @xq114 . The difference is that the CUDA scenario involves invoking an executable (nvcc). We are invoking nvcc using an OS API that evaluates the command line as the shell would (on Windows). The shell parses the command line to discern the arguments, which requires quoting if the arguments have spaces or quotes embedded within them. Depending on how compiler arguments are provided, they may or may not already have shell quoting/escaping present. If specified via a "command line", that form implies shell quoting/escaping is present. If arguments are provided in a list (such as the There are shell features people are accustomed to being able to use in arguments, that require shell parsing. For example, use of backticks in a bash command line (to invoke another process and use its output) are shell-processed. And, use of quotes mid-argument (such as Internally, we may need to process the contents of arguments (such as |
Bug type: Language Service
Describe the bug
When I try to provide compile commands for cuda source files, I found it fail to provide a correct intellisense for these files in vscode. Indicators like
__global__
and variables likeblockDim
are not recognized by vscode. I've made a minimal example to reproduce it.Steps to reproduce
Expected behavior
Intellisense work with cuda source files and compile_commands.json
Code sample and logs
c_cpp_properties.json
C/C++: Log Diagnostics
from the VS Code command paletteScreenshots
Intellisense work without compile_commands.json
Intellisense do not work with compile_commands.json
Additional context
The text was updated successfully, but these errors were encountered: