Reimplement __builtin_unique_stable_name-The original version of this was reverted, and @rjmcall provided someadvice to architect a new solution. This is that solution.This implements a builtin
Reimplement __builtin_unique_stable_name-The original version of this was reverted, and @rjmcall provided someadvice to architect a new solution. This is that solution.This implements a builtin to provide a unique name that is stable acrosscompilations of this TU for the purposes of implementing the librarycomponent of the unnamed kernel feature of SYCL. It does this byrunning the Itanium mangler with a few modifications.Because it is somewhat common to wrap non-kernel-related lambdas inmacros that aren't present on the device (such as for logging), thisuniquely generates an ID for all lambdas involved in the naming of akernel. It uses the lambda-mangling number to do this, except replacesthis with its own number (starting at 10000 for readabililty reasons)for lambdas used to name a kernel.Additionally, this implements itself as constexpr with a slight catch:if a name would be invalidated by the use of this lambda in a laterkernel invocation, it is diagnosed as an error (see the Sema tests).Differential Revision: https://reviews.llvm.org/D103112
show more ...
Revert "[SYCL] Implement __builtin_unique_stable_name."This reverts commit b5a034e771d0e4d7d8e71fc545b230d98e5a1f42.This feature was added without following the proper process.
[SYCL] Implement __builtin_unique_stable_name.In order to support non-user-named kernels, SYCL needs some way in theintegration headers to name the kernel object themselves. Initially, thedesign
[SYCL] Implement __builtin_unique_stable_name.In order to support non-user-named kernels, SYCL needs some way in theintegration headers to name the kernel object themselves. Initially, thedesign considered just RTTI naming of the lambdas, this results in aquite unstable situation in light of some device/host macros.Additionally, this ends up needing to use RTTI, which is a burden on theimplementation and typically unsupported.Instead, we've introduced a builtin, __builtin_unique_stable_name, whichtakes a type or expression, and results in a constexpr constantcharacter array that uniquely represents the type (or type of theexpression) being passed to it.The implementation accomplishes that simply by using a slightly modifiedversion of the Itanium Mangling. The one exception is when manglinglambdas, instead of appending the index of the lambda in the function,it appends the macro-expansion back-trace of the lambda itself in theform LINE->COL[~LINE->COL...].Differential Revision: https://reviews.llvm.org/D76620