hliao added a comment.

In D63164#1538968 <https://reviews.llvm.org/D63164#1538968>, @tra wrote:

> So, in short, what you're saying is that lambda type may leak into the 
> mangled name of a `__global__` function and ne need to ensure that the 
> mangled name is identical for both host and device, hence the need for 
> consistent naming of lambdas.
>
> If that's the case, shouldn't it be enabled for CUDA/HIP by default? While 
> it's not frequently used ATM, it is something we do want to work correctly 
> all the time. The failure to do so results in weird runtime failures that 
> would be hard to debug for end-users.
>
> @rsmith -- are there any downsides having this enabled all the time?


yeah, we should ensure consistent naming by default. But, I want to hear more 
suggestion and comment before making that option by default. To more specific, 
as that option forces all naming of lambda to follow ODR rule. For 
non-`__device__` lambda, even though there is no code quality change, we do add 
overhead for the compiler itself, as the additional records, though that should 
be negligible.  A potential solution is to record the ODR context for parent 
lambdas and re-number them if the inner lambda is found as `__device__` one.
However, I do like the straight-forward and extremely simple solution of this 
patch to force all lambda naming following ODR, there is no code quality change 
and, potentially slight, FE overhead. What's your thought?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63164



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

Reply via email to