[PATCH] D96102: [clangd] Fix missing __syncthreads.

Tommy Chiang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 4 21:05:11 PST 2021


oToToT created this revision.
oToToT added reviewers: tra, chandlerc, jdoerfert, gtbercea, emankov, JDevlieghere.
Herald added subscribers: usaxena95, kadircet, arphaman.
oToToT requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96102

Files:
  clang/lib/Headers/__clang_cuda_device_functions.h


Index: clang/lib/Headers/__clang_cuda_device_functions.h
===================================================================
--- clang/lib/Headers/__clang_cuda_device_functions.h
+++ clang/lib/Headers/__clang_cuda_device_functions.h
@@ -519,6 +519,7 @@
   return __nv_fast_sincosf(__a, __s, __c);
 }
 __DEVICE__ float __sinf(float __a) { return __nv_fast_sinf(__a); }
+__DEVICE__ int __syncthreads() { return __nvvm_bar(); }
 __DEVICE__ int __syncthreads_and(int __a) { return __nvvm_bar0_and(__a); }
 __DEVICE__ int __syncthreads_count(int __a) { return __nvvm_bar0_popc(__a); }
 __DEVICE__ int __syncthreads_or(int __a) { return __nvvm_bar0_or(__a); }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96102.321649.patch
Type: text/x-patch
Size: 654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210205/694ea7bb/attachment-0001.bin>


More information about the cfe-commits mailing list