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

Paul Fultz II via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 30 10:41:14 PDT 2020


pfultz2 added a comment.

> Not only the capture is an issue, like a regular function, lambda could also access non-local variables/functions.

In practice this is not an issue. Hcc will implictly treat anything inlinable as host device, and user's are not confused or surprised when they use non-local variables/reference that are on the host.

> From the other perspective, a lambda is just another function and should have consistent rule for its usage, resolution, and etc.

But its not like another function. It has internal linkage(even when using global variables declared with `inline`). Lambdas are also implicitly `constexpr` whereas a function need to explicitly declare `constexpr`. Making lambdas implicitly HD whereas function need to be explicit seems to be consistent with how lambdas work with `constexpr`.


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

https://reviews.llvm.org/D78655





More information about the cfe-commits mailing list