Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-22 Thread Justin Lebar via cfe-commits
jlebar abandoned this revision. jlebar marked 7 inline comments as done. jlebar added a comment. Okay, after much discussion, we've decided to go with --relaxed-constexpr instead of this. I have a patch for that which seems to mostly work, will send it out soon. http://reviews.llvm.org/D18328

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Richard Smith via cfe-commits
rsmith added inline comments. Comment at: lib/Sema/SemaCUDA.cpp:464-465 @@ +463,4 @@ +// without passing -fcuda-allow-std-complex. +// TODO: Output a nvcc-compat warning if you try to use a non-constexpr function +// from -- nvcc only lets you use constexpr functions. +bool Sem

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Richard Smith via cfe-commits
rsmith added inline comments. Comment at: lib/Sema/SemaCUDA.cpp:479-481 @@ +478,5 @@ +return false; + StringRef Filename = FE->getName(); + if (Filename != "complex" && !Filename.endswith("/complex")) +return false; + jlebar wrote: > rsmith wrote: > > I

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Justin Lebar via cfe-commits
jlebar added inline comments. Comment at: include/clang/Driver/Options.td:383-384 @@ -382,2 +382,4 @@ HelpText<"Enable device-side debug info generation. Disables ptxas optimizations.">; +def cuda_allow_std_complex : Flag<["--"], "cuda-allow-std-complex">, + HelpText<"Allow C

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Richard Smith via cfe-commits
rsmith added inline comments. Comment at: include/clang/Driver/Options.td:383-384 @@ -382,2 +382,4 @@ HelpText<"Enable device-side debug info generation. Disables ptxas optimizations.">; +def cuda_allow_std_complex : Flag<["--"], "cuda-allow-std-complex">, + HelpText<"Allow C

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Justin Lebar via cfe-commits
jlebar added inline comments. Comment at: include/clang/Driver/Options.td:383-384 @@ -382,2 +382,4 @@ HelpText<"Enable device-side debug info generation. Disables ptxas optimizations.">; +def cuda_allow_std_complex : Flag<["--"], "cuda-allow-std-complex">, + HelpText<"Allow C

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Justin Lebar via cfe-commits
jlebar added inline comments. Comment at: include/clang/Driver/Options.td:383-384 @@ -382,2 +382,4 @@ HelpText<"Enable device-side debug info generation. Disables ptxas optimizations.">; +def cuda_allow_std_complex : Flag<["--"], "cuda-allow-std-complex">, + HelpText<"Allow C

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Reid Kleckner via cfe-commits
rnk added a comment. In http://reviews.llvm.org/D18328#379824, @rsmith wrote: > I would much prefer for us to, say, provide a header that wraps the > system one and does something like > > // > #pragma clang cuda_implicit_host_device { > #include_next > #pragma clang cuda_implicit_hos

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Justin Lebar via cfe-commits
jlebar added a comment. Here are two other approaches we considered and rejected, for the record: 1. Copy-paste a implementation from e.g. libc++ into __clang_cuda_runtime_wrapper.h, and edit it appropriately. Then #define the real 's include guards. Main problem with this is the obvious o

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Artem Belevich via cfe-commits
tra added a comment. In http://reviews.llvm.org/D18328#379824, @rsmith wrote: > I would much prefer for us to, say, provide a header that wraps the > system one and does something like > > // > #pragma clang cuda_implicit_host_device { > #include_next > #pragma clang cuda_implicit_hos

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Justin Lebar via cfe-commits
jlebar added a comment. Thanks for the suggestions, Richard. I'm not sure any of them will work, but I don't defend this patch as anything other than a hack, so if we can come up with something that works for what we need to accomplish and is cleaner, that's great. In http://reviews.llvm.org/

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Reid Kleckner via cfe-commits
rnk added inline comments. Comment at: lib/Sema/SemaCUDA.cpp:474 @@ +473,3 @@ + SourceLocation Loc = FD.getLocation(); + if (!SM.isInSystemHeader(Loc)) +return false; jlebar wrote: > tra wrote: > > Can C++ library headers ever be non-system? I.e. can someone

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith. rsmith added a comment. I would much prefer for us to, say, provide a header that wraps the system one and does something like // #pragma clang cuda_implicit_host_device { #include_next #pragma clang cuda_implicit_host_device } or to provide an expl

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Justin Lebar via cfe-commits
jlebar added inline comments. Comment at: lib/Sema/SemaCUDA.cpp:474 @@ +473,3 @@ + SourceLocation Loc = FD.getLocation(); + if (!SM.isInSystemHeader(Loc)) +return false; tra wrote: > Can C++ library headers ever be non-system? I.e. can someone use libc++ via

Re: [PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Artem Belevich via cfe-commits
tra accepted this revision. tra added a comment. This revision is now accepted and ready to land. One minor question, LGTM otherwise. Comment at: lib/Sema/SemaCUDA.cpp:474 @@ +473,3 @@ + SourceLocation Loc = FD.getLocation(); + if (!SM.isInSystemHeader(Loc)) +return false;

[PATCH] D18328: [CUDA] Add option to mark most functions inside as host+device.

2016-03-21 Thread Justin Lebar via cfe-commits
jlebar created this revision. jlebar added reviewers: tra, rnk. jlebar added subscribers: cfe-commits, jhen. clang --cuda-allow-std-complex translates into cc1 -fcuda-allow-std-complex. With this flag, we will mark all functions inside within namespace std as host+device, other than operator>> a