hliao requested changes to this revision.
hliao added a comment.
This revision now requires changes to proceed.

In D78655#1997491 <https://reviews.llvm.org/D78655#1997491>, @tra wrote:

> Summoning @rsmith as I'm sure that there are interesting corner cases in 
> lambda handling that we didn't consider.
>
> Making lambdas implicitly HD will make it easier to write the code which 
> can't be instantiated on one side of the compilation. That's probably 
> observable via SFINAE, but I can't tell whether that matters.
>  By default I'd rather err on handling lambdas the same way as we do regular 
> user-authored functions.


Marking lambda `__device__`/`__device__ __host__` should be

In D78655#1997491 <https://reviews.llvm.org/D78655#1997491>, @tra wrote:

> Summoning @rsmith as I'm sure that there are interesting corner cases in 
> lambda handling that we didn't consider.
>
> Making lambdas implicitly HD will make it easier to write the code which 
> can't be instantiated on one side of the compilation. That's probably 
> observable via SFINAE, but I can't tell whether that matters.
>  By default I'd rather err on handling lambdas the same way as we do regular 
> user-authored functions.


Marking lambda with proper attributes helps check the potential harmful 
captures.

In D78655#1997491 <https://reviews.llvm.org/D78655#1997491>, @tra wrote:

> Summoning @rsmith as I'm sure that there are interesting corner cases in 
> lambda handling that we didn't consider.
>
> Making lambdas implicitly HD will make it easier to write the code which 
> can't be instantiated on one side of the compilation. That's probably 
> observable via SFINAE, but I can't tell whether that matters.
>  By default I'd rather err on handling lambdas the same way as we do regular 
> user-authored functions.


I though the goal of adding HD/D attributes for lambda is to make the static 
check easier as lambda used in device code or device lambda is sensitive to 
captures. Invalid capture may render error accidentally without static check, 
says we capture host variable reference in a device lambda. That makes the 
final code invalid. Allowing regular lambda to be used in global or device 
function is considering harmful.


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

https://reviews.llvm.org/D78655



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to