[PATCH] D76620: [SYCL] Implement __builtin_unique_stable_name.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 09:43:35 PDT 2020


rjmccall added a comment.

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.


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