[PATCH] D47201: [CUDA] Implement nv_weak attribute for functions
Jonas Hahnfeld via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 22 08:54:29 PDT 2018
Hahnfeld created this revision.
Hahnfeld added a reviewer: tra.
Herald added a subscriber: cfe-commits.
This is needed for relocatable device code with CUDA 9 and later.
Before this patch, linking two or more object files resulted in
"Multiple definition" errors for a group of functions from
cuda_device_runtime_api.h which are annoted with "nv_weak".
CUDA headers already used this attribute in earlier releases, but
until CUDA 8.0 the only definitions in cuda_device_runtime_api.h
were conditional under `defined(__CUDABE__)` which is explicitly
undefined in Clang's wrapper. However since CUDA 9.0 this has
changed to `!defined(__CUDACC_RTC__)`. Trying to add that define
resulted in errors that nvrtc_device_runtime.h could not be found.
Reported by Andrea Bocci!
Repository:
rC Clang
https://reviews.llvm.org/D47201
Files:
include/clang/Basic/Attr.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/CodeGen/CodeGenModule.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclAttr.cpp
test/CodeGenCUDA/nv_weak.cu
test/SemaCUDA/attr-declspec.cu
test/SemaCUDA/attr-nv_weak.cu
test/SemaCUDA/attributes-on-non-cuda.cu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47201.148022.patch
Type: text/x-patch
Size: 8736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180522/a621d11d/attachment.bin>
More information about the cfe-commits
mailing list