[PATCH] Create a frontend flag to disable CUDA cross-target call checks

Artem Belevich tra at google.com
Wed Apr 15 12:48:06 PDT 2015


================
Comment at: lib/Sema/SemaCUDA.cpp:63-69
@@ -62,4 +62,9 @@
 
 bool Sema::CheckCUDATarget(const FunctionDecl *Caller,
                            const FunctionDecl *Callee) {
+  // The CUDADisableTargetCallChecks short-circuits this check: we assume all
+  // cross-target calls are valid.
+  if (getLangOpts().CUDADisableTargetCallChecks)
+    return false;
+
   CUDAFunctionTarget CallerTarget = IdentifyCUDATarget(Caller),
----------------
Do we really need to disable the check completely?
Can it be limited to calls from host-device functions only?
What's expected to happen if we do let host->device or device->host call through?
Do we expect an error further down in the pipeline if/when we get to generate the code for the call?
Or will we generate valid code which would cause runtime error if the call were to happen?
In either case this seems to need a test case to make sure we do a sensible thing for the call that is not expected to work.

http://reviews.llvm.org/D9036

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list