[PATCH] D78655: [HIP] Add -fhip-lambda-host-device

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 11:16:00 PDT 2020


tra accepted this revision.
tra added a comment.

LGTM. Thank you for adding the checks for capturing lambdas and for putting this behind the flag.
I've asked @rsmith  to chime in in case there's anything else about the lambdas we need to deal with. Please wait a day or two before landing the patch to give him a chance to reply.



================
Comment at: clang/test/SemaCUDA/lambda.cu:25-35
+  kernel<<<1,1>>>([&](){ hd(); });
+  // expected-note at -1 {{in instantiation of function template specialization 'kernel<(lambda at}}
+  // expected-note at -2 {{candidate function not viable: call to __host__ function from __global__ function}}
+
+  kernel<<<1,1>>>([=, &b](){ hd(); });
+  // expected-note at -1 {{in instantiation of function template specialization 'kernel<(lambda at}}
+  // expected-note at -2 {{candidate function not viable: call to __host__ function from __global__ function}}
----------------
We may need a better diagnostic for this. Here we've correctly rejected captured lambdas, but the diagnostic is a generic 'can't use that'.
If would be helpful to let user know that we can't use that because of the capturing lambdas.


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

https://reviews.llvm.org/D78655





More information about the cfe-commits mailing list