[PATCH] D63164: [HIP] Add option to force lambda nameing following ODR in HIP/CUDA.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 13 12:01:33 PDT 2019


hliao added a comment.

In D63164#1542361 <https://reviews.llvm.org/D63164#1542361>, @rsmith wrote:

> I think this is the wrong way to handle this issue. We need to give lambdas a mangling if they occur in functions for which there can be definitions in multiple translation units. In regular C++ code, that's inline functions and function template specializations, so that's what we're currently checking for. CUDA adds more cases (in particular, `__host__ __device__` functions, plus anything else that can be emitted for multiple targets), so we should additionally check for those cases when determining whether to number lambdas. I don't see any need for a flag to control this behavior.


I agree that this's a temporary solution to fix the issue. But, the real tricky part is that, once we found a `__device__` lambda, we need to ensure all the enclosing scopes should be named following ODR as well just as the case illustrated in the test case. In fact, it's not the outer lambda (not annotated with `__device__` nor within an inline function.) not being named in ODR. The tricky issue is that, so far, we don't maintain a context to add mangling back if we found an inner one needs to follow ODR. We have to add that before we could do that on-demand. I was working on that but it would take more efforts of review.
That's also the motivation why this change adds a option to guard this behavior.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63164





More information about the cfe-commits mailing list