[PATCH] CUDA: Add option to allow host device functions to call host functions
Jacques Pienaar
jpienaar at google.com
Tue Feb 24 12:41:11 PST 2015
================
Comment at: test/CodeGenCUDA/host-device-calls-host.cu:21
@@ +20,3 @@
+extern "C"
+__host__ __device__ void hd_function() {
+ host_function();
----------------
rnk wrote:
> I think this is a more interesting test case:
> extern "C" {
> void host_function() {}
> __host__ __device__ void hd_function(bool b) { if (b) host_function(); }
> __device__ void device_function() { hd_function(false); }
> }
>
> It actually tests emission of the bogus call, even though it can never occur in practice. What should clang do for that?
Both nvcc and clang (with this patch) accepts this and the resulting code executes without errors. clang should still warn that this can cause a runtime failure as there is no call-site analysis performed.
http://reviews.llvm.org/D7841
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list