[PATCH] D76620: [SYCL] Implement __builtin_unique_stable_name.

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 09:49:16 PDT 2020


erichkeane added a comment.

In D76620#2327976 <https://reviews.llvm.org/D76620#2327976>, @rjmccall wrote:

> In D76620#2327910 <https://reviews.llvm.org/D76620#2327910>, @erichkeane wrote:
>
>> In D76620#2327901 <https://reviews.llvm.org/D76620#2327901>, @rjmccall wrote:
>>
>>> You know on both sides that a lambda is used as a kernel, yes?  Why not simply introduce that into the mangling of lambdas, so that the subset of lambdas used as kernels form a stable sequence?
>>
>> Coming up with said stable sequence is somewhat difficult as well.  A strict integer ordering didn't end up being stable, as some of the kernel handling can cause instantiations to happen in a slightly different ordering, which messed that up, as would use of the builtin. We wanted to find a way that was dependent on the source code alone.  The "Quick and Dirty" solution was line/column numbers, though we considered a hash of that same information to at least make it shorter.
>
> Certainly you wouldn't want a *global* sequence ID.  However, lambdas can't just occur globally, they're always part of some declaration that they can be scoped to, so that you have e.g. "the third kernel lambda within function X".  I fail to see how that wouldn't address the concern about instantiation order, and it's still source-directed.

Hmm... I'll have to consider that.  That is an interesting thought. Presumably we could just copy the 'getLambdaManglingNumber' stuff in that case, and place the value in the same location in the mangling, with some sort of discriminator (to avoid conflicting manglings).  The only other concern I have is WHEN we know that a lambda is used in a kernel, which we don't until it is called (and can cause confusion when it is a template parameter and called later).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76620



More information about the cfe-commits mailing list