[PATCH] CUDA host device code with two code paths

Jacques Pienaar jpienaar at google.com
Sun Nov 30 09:46:08 PST 2014


Hi pcc, eliben,

Allow CUDA host device functions with two code paths using __CUDA_ARCH__ to differentiate between code path being compiled.

For example,
__host__ __device__ void host_device_function(void) {
#ifdef __CUDA_ARCH__
  device_only_function();
#else
  host_only_function();
#endif
}

http://reviews.llvm.org/D6457

Files:
  lib/Sema/SemaCUDA.cpp
  test/SemaCUDA/function-target.cu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6457.16752.patch
Type: text/x-patch
Size: 2642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141130/282c7faa/attachment.bin>


More information about the cfe-commits mailing list