r264205 - [CUDA] Don't define __NVCC__.

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 24 08:30:23 PDT 2016


On Wed, Mar 23, 2016 at 3:42 PM, Justin Lebar via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: jlebar
> Date: Wed Mar 23 17:42:27 2016
> New Revision: 264205
>
> URL: http://llvm.org/viewvc/llvm-project?rev=264205&view=rev
> Log:
> [CUDA] Don't define __NVCC__.
>
> Summary:
> We decided this makes life too difficult for code authors.  For example,
> people may want to detect NVCC and disable variadic templates, which
> NVCC does not support, but which we do.
>

This seems like a different tradeoff from the one Clang made for GCC
compatibility (we define all the GCC macros, but then also define others so
people can detect Clang). If people were just disabling features that NVCC
didn't support, that seems fairly harmless - what sort of
problems/difficulties did this create?


>
> Since people are going to have to change compiler flags *anyway* in
> order to compile with clang, if they really want the old behavior, they
> can pass -D__NVCC__.
>
> Tested with tensorflow and thrust, no apparent problems.
>
> Reviewers: tra
>
> Subscribers: cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D18417
>
> Modified:
>     cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
>
> Modified: cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h?rev=264205&r1=264204&r2=264205&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h (original)
> +++ cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h Wed Mar 23
> 17:42:27 2016
> @@ -199,7 +199,6 @@ static inline __device__ void __brkpt(in
>  // Set up compiler macros expected to be seen during compilation.
>  #undef __CUDABE__
>  #define __CUDACC__
> -#define __NVCC__
>
>  #if defined(__CUDA_ARCH__)
>  // We need to emit IR declaration for non-existing __nvvm_reflect() to
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160324/4910bf63/attachment.html>


More information about the cfe-commits mailing list