Intellisense error in brand new CUDA project in VS2019


I just started learning about CUDA development. I downloaded the latest CUDA SDK and installed it. I have VS2019 Community. I created a new CUDA project in VS and compiled it with no issues. However, the Error list shows an E0029 Expected an expression error on the third ‘<’ character in the following statement

addKernel<<<1,size>>>(dev_c, dev_a, dev_b);

This is an Intellisense error, not a compile error, so it ultimately has no effect on the outcome of the code, but I have come to rely on Intellisense pointing out mistakes I make before I compile, and so this kind of error grates on my sensibilities. Is there a way to make Intellisense learn of this CUDA-specific construct and not report it as an error?

Can you confirm you’ve installed the Nsight plugin for VS?

Yes, it is listed under the Extensions menu.

Intellisense will never look for a third beyond the second angle bracket, because it isn’t valid C/C++. For the same reason it will never appear on the Intellisense team’s list of known defects, because it isn’t. Jen-Hsun needs to pick up the phone and talk directly to Bill Gates, explaining how CUDA can help save the world - only then can we hope to get support for color coded CUDA kernel launches in VS

Calling Bill Gates won’t do any good, I am afraid. I assume you meant Satya Nadella.

Nadella it is, same angle:

  • We have a responsibility to ensure that our actions and the products we build benefit everyone on the planet – and the planet itself. That’s why today we are making new commitments to address climate change.

Arguably things were more fun back in the days when “Weird Al” Yankovic could rhyme, in his 1999 parody “It’s All About the Pentiums”:

One option is to use a macro for kernel declarations. Here is one set I found :

#ifndef __INTELLISENSE__
#define KERNEL_ARGS2(grid, block)                 <<< grid, block >>>
#define KERNEL_ARGS3(grid, block, sh_mem)         <<< grid, block, sh_mem >>>
#define KERNEL_ARGS4(grid, block, sh_mem, stream) <<< grid, block, sh_mem, stream >>>
#define KERNEL_ARGS2(grid, block)
#define KERNEL_ARGS3(grid, block, sh_mem)
#define KERNEL_ARGS4(grid, block, sh_mem, stream)

Usage example :

//kernel <<<grid, 1 >>> (dev_bitmap);
kernel KERNEL_ARGS2(grid, 1) (dev_bitmap);
1 Like

I assume that when compiling with nvcc INTELISENSE won’t be defined. This will work. Thank you @ryork.