From: Artem Belevich Date: Wed, 27 Sep 2017 19:07:15 +0000 (+0000) Subject: [CUDA] Work around conflicting function definitions in CUDA-9 headers. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=31a16c4f5bc89d8e9ca6c0a52a34b98c18058b6b;p=clang [CUDA] Work around conflicting function definitions in CUDA-9 headers. Differential Revision: https://reviews.llvm.org/D38326 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314334 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Headers/__clang_cuda_runtime_wrapper.h b/lib/Headers/__clang_cuda_runtime_wrapper.h index e4fc5860b5..b8ffc2ce9f 100644 --- a/lib/Headers/__clang_cuda_runtime_wrapper.h +++ b/lib/Headers/__clang_cuda_runtime_wrapper.h @@ -173,7 +173,18 @@ inline __host__ double __signbitd(double x) { // __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