[clang] [SYCL] Basic code generation for SYCL kernel caller offload entry point functions. (PR #133030)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 14 14:02:28 PDT 2025


================
@@ -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())
----------------
tahonermann wrote:

Sorry, but I need a more concrete description of the concern to know what I'm looking for. I audited uses of `isGenericLambda()` that I thought might be relevant and I didn't find anything that suggested relevance for device mangling context. Can we postpone this until the upcoming PR that revises the name mangling approach? That PR will come with tests and I can ensure that generic lambdas are exercised.

https://github.com/llvm/llvm-project/pull/133030


More information about the cfe-commits mailing list