[PATCH] D78655: [CUDA][HIP] Let lambda be host device by default

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 7 15:57:34 PDT 2020


tra added inline comments.


================
Comment at: clang/lib/Sema/SemaCUDA.cpp:757-759
+  // In host compilation, deferred diagnostics are only emitted for functions
+  // which are sure to be emitted on host side since there is no reliable
+  // way to check if a function is emitted on device side. Therefore in
----------------
I don't think this is completely correct. Postponed diags get emitted if we know we're attempoting to codegen wrong things.
E.g. during host compilation when HD function used by host code ends up attempting to call a device function.
It also works in the other direction -- it kicks in during device compilation when HD function calls a host function.
AFAICT it has nothing to do with what happens on the other side of the compilation, but rather what we're attempting to codegen during *this* compilation.

I don't think that we can reason that checks can be done on the host side only, based only on the argument you're making above (at least based on the way I understand it).

The point you're making below that a captured lambda created by device code can't ever be used by the host code is probably a better argument why the check may not be necessary.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78655/new/

https://reviews.llvm.org/D78655





More information about the cfe-commits mailing list