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

Eli Bendersky eliben at google.com
Wed Apr 15 13:08:55 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),
----------------
tra wrote:
> 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.
> 
> 
> Do we expect an error further down in the pipeline if/when we get to generate the code for the call?

Yes, that sums it up, pretty much. This flag, as far as I'm concerned, exists for the purpose of source-rewriting tools. There's no codegen involved, and no IR being emitted. In our current CUDA pipeline, real problems in user code will fail in subsequents steps of the pipeline.

http://reviews.llvm.org/D9036

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






More information about the cfe-commits mailing list