This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix missing __syncthreads.
AbandonedPublic

Authored by oToToT on Feb 4 2021, 9:05 PM.

Details

Summary

I think the symbol for syncthreads is missing. Therefore, I've added this into the clang_cuda_device_functions.h.

This also solve an issue on GitHub opened about half a year ago.
Ref: https://github.com/clangd/clangd/issues/404

Diff Detail

Event Timeline

oToToT created this revision.Feb 4 2021, 9:05 PM
oToToT requested review of this revision.Feb 4 2021, 9:05 PM
oToToT updated this revision to Diff 321652.Feb 4 2021, 9:08 PM

I guess __nvvm_bar_sync is the right instruction.

I doubt this compiles:

https://godbolt.org/z/c51v5d

even with adjusted type, this fails because __syncthreads is a builtin (right now):

https://godbolt.org/z/jP7e6h

(and __nvvm_bar_sync requires an argument).

oToToT abandoned this revision.Feb 5 2021, 10:36 AM

OK, I've found what's wrong with my fix here. I should check for the clangd compile mechanism with more detail to fix this problem.

Sorry for disturbance.

OK, I've found what's wrong with my fix here. I should check for the clangd compile mechanism with more detail to fix this problem.

Sorry for disturbance.

No worries. I'm not sure how clangd handles builtins, but I guess that is a general thing it should as this is not the only one people might want to use :)