[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!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 8736 bytes
Desc: not available
More information about the cfe-commits