[PATCH] D38326: [CUDA] Work around conflicting function definitions in CUDA-9 headers.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 12:08:53 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL314334: [CUDA] Work around conflicting function definitions in CUDA-9 headers. (authored by tra).

Changed prior to commit:
  https://reviews.llvm.org/D38326?vs=116856&id=116858#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38326

Files:
  cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h


Index: cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
===================================================================
--- cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
+++ cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -173,7 +173,18 @@
 // __device__.
 #pragma push_macro("__forceinline__")
 #define __forceinline__ __device__ __inline__ __attribute__((always_inline))
+
+#pragma push_macro("__float2half_rn")
+#if CUDA_VERSION >= 9000
+// CUDA-9 has conflicting prototypes for __float2half_rn(float f) in
+// cuda_fp16.h[pp] and device_functions.hpp. We need to get the one in
+// device_functions.hpp out of the way.
+#define __float2half_rn  __float2half_rn_disabled
+#endif
+
 #include "device_functions.hpp"
+#pragma pop_macro("__float2half_rn")
+
 
 // math_function.hpp uses the __USE_FAST_MATH__ macro to determine whether we
 // get the slow-but-accurate or fast-but-inaccurate versions of functions like


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38326.116858.patch
Type: text/x-patch
Size: 941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170927/85937071/attachment.bin>


More information about the cfe-commits mailing list