[clangd-dev] Clangd CUDA support

Haojian Wu via clangd-dev clangd-dev at lists.llvm.org
Wed Mar 27 09:14:35 PDT 2019


We have made a new release of the vscode-clangd. The new version v0.0.12
should support .cu files, but note that the extension is not enabled by
vscode if you just open a .cu file, you'd need to run the activation
command to activate the extension (on Linux, press "Ctrl+P" to open the
"Quick Open" file list, type "> activate clangd", and select the item it
suggested).


On Mon, Mar 25, 2019 at 12:03 PM Ilya Biryukov via clangd-dev <
clangd-dev at lists.llvm.org> wrote:

> Ah, we don't have clangd enabled for .cu files,
> https://reviews.llvm.org/D59759 would should do the trick clangd.
> However, I'm not 100% certain it's a good idea since compilation db seems
> to be broken for CUDA files by default. OTOH, clangd is already enabled on
> CUDA headers, so it's not like we were handling this use-case properly
> anyway.
>
> On Sat, Mar 23, 2019 at 8:29 PM Jacek Ciesielski <trupwszafie at o2.pl>
> wrote:
>
>> Hi Ilya,
>>
>> Thank you for replying!
>>
>> Today, I did some more extensive testing. I've managed to run YCM with
>> clangd support successfully. I still fail with libclang. I guess that's a
>> whole different story.
>>
>> It turns out, I've been using compile_commands.json generated by cmake,
>> which doesn't support clang as cuda compiler. After correcting the flags
>> manually, I was able to get completion for a .cu file. Like you said, it
>> doesn't recognize cuda specific code, e.g. __syncthreads(); but I reckon
>> those are fixable by some quick macros and include hacks.
>>
>> However, my setup of VSCode fails completely when it comes to .cu files.
>> I am attaching screen showing a simple cpp-only completion test. I expected
>> it would know a list of vector's method.
>> Setup:
>> Arch linux 5.0.3
>> VSCode 1.32.3, vscode-clangd 0.0.11
>> clangd 7.0.1
>>
>> My project is closed source. I need some CUDA 9 and 10 features so I am
>> kinda forced to use nvcc.
>>
>> I suppose the next position on my wish list is generating commands for
>> clang by cmake or accepting nvcc flags by clang. Even with script replacing
>> flags, needing to run it each time I regenerate flags is dull.
>>
>> Best regards,
>> Jacek
>> On 3/22/19 3:36 PM, Ilya Biryukov wrote:
>>
>> Hi Jacek,
>>
>> We haven't put any effort into supporting CUDA so far.
>> However, clang supports CUDA, so basic features should work on CUDA code,
>> e.g. non-CUDA-specific completions, resolve, etc.
>>
>> The difficulty is obtaining a compilation database that specifies proper
>> CUDA-specific flags.
>>
>> Could you describe the setup with YCM or VSCode that you tried and that
>> didn't work for you? What's the project (if it's open-source) you tried
>> running on? What's your OS and what kind of toolchain do you use for the
>> build (nvcc, clang)?
>>
>> On Fri, Mar 22, 2019 at 2:26 PM Jacek Ciesielski via clangd-dev <
>> clangd-dev at lists.llvm.org> wrote:
>>
>>> Hi guys,
>>>
>>> I couldn't find any reliable info whether clangd supports CUDA
>>> completion.
>>>
>>> Docs mention only C++. Yet, I tried using it with some CUDA code. I
>>> didn't succeed trying with YCM nor VS Code. Is it possible at all? How
>>> much effort would that possibly take to develop support for CUDA?
>>>
>>> Best regards,
>>> Jacek
>>>
>>> _______________________________________________
>>> clangd-dev mailing list
>>> clangd-dev at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev
>>>
>>
>>
>> --
>> Regards,
>> Ilya Biryukov
>>
>>
>
> --
> Regards,
> Ilya Biryukov
> _______________________________________________
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20190327/10859f66/attachment.html>


More information about the clangd-dev mailing list