[PATCH] D47804: [CUDA] Replace 'nv_weak' attributes in CUDA headers with 'weak'.
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 5 16:51:26 PDT 2018
tra created this revision.
tra added reviewers: Hahnfeld, aaron.ballman, jlebar.
Herald added subscribers: bixia, sanjoy.
An alternative to implementing nv_weak attribute (https://reviews.llvm.org/D47201).
The patch should make runtime sub functions to have .weak attribute in PTX and that should avoid GPU-side linking errors.
https://reviews.llvm.org/D47804
Files:
clang/lib/Headers/__clang_cuda_runtime_wrapper.h
Index: clang/lib/Headers/__clang_cuda_runtime_wrapper.h
===================================================================
--- clang/lib/Headers/__clang_cuda_runtime_wrapper.h
+++ clang/lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -100,11 +100,17 @@
#include "host_config.h"
#include "host_defines.h"
+// Temporarily replace "nv_weak" with weak, so __attribute__((nv_weak)) in
+// cuda_device_runtime_api.h ends up being __attribute__((weak)) which is the
+// functional equivalent of what we need.
+#pragma push_macro("nv_weak")
+#define nv_weak weak
#undef __CUDABE__
#undef __CUDA_LIBDEVICE__
#define __CUDACC__
#include "cuda_runtime.h"
+#pragma pop_macro("nv_weak")
#undef __CUDACC__
#define __CUDABE__
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47804.150055.patch
Type: text/x-patch
Size: 724 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180605/5b25f3ac/attachment.bin>
More information about the cfe-commits
mailing list