================ @@ -14794,9 +14803,36 @@ void ASTContext::getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap, } } -static SYCLKernelInfo BuildSYCLKernelInfo(CanQualType KernelNameType, +static SYCLKernelInfo BuildSYCLKernelInfo(ASTContext &Context, + CanQualType KernelNameType, const FunctionDecl *FD) { - return {KernelNameType, FD}; + // Host and device compilation may use different ABIs and different ABIs + // may allocate name mangling discriminators differently. A discriminator + // override is used to ensure consistent discriminator allocation across + // host and device compilation. + auto DeviceDiscriminatorOverrider = + [](ASTContext &Ctx, const NamedDecl *ND) -> std::optional<unsigned> { + if (const auto *RD = dyn_cast<CXXRecordDecl>(ND)) + if (RD->isLambda()) ---------------- erichkeane wrote:
>Why do you believe that device mangling numbers are assigned differently for >non-generic lambdas vs generic lambdas? I don't see any reason that they would >be treated differently. Can you point to relevant code? The device mangling >number applies to the (single) closure type produced by a (generic) lambda. Just my memory of it when I was implementing `SYCLUniqueStableNameExpr` (or actually, bugs found after and not fixed). I don't really recall where it ended up though, so it seems worthy of investigation. >Can you elaborate? I don't know what you're referring to. This code is nearly >identical to SYCLUniqueStableNameExpr::ComputeName(). I mean in `TransfromLambdaExpr` and its descendants. So it would be there. https://github.com/llvm/llvm-project/pull/133030 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits