[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 7 11:09:29 PDT 2025


================
@@ -12816,6 +12816,15 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
     if (!FD->doesThisDeclarationHaveABody())
       return FD->doesDeclarationForceExternallyVisibleDefinition();
 
+    // Function definitions with the sycl_kernel_entry_point attribute are
+    // required during device compilation so that SYCL kernel caller offload
+    // entry points are emitted.
+    if (LangOpts.SYCLIsDevice && FD->hasAttr<SYCLKernelEntryPointAttr>())
+      return true;
+
+    // FIXME: Functions declared with SYCL_EXTERNAL are required during
----------------
tahonermann wrote:

Such a test will have to wait. Filtering to prevent symbols from being emitted is not yet in place and there are a few existing tests that are dependent on such symbols being emitted during device compilation; presumably unintentionally. One of the next two PRs will add such filtering and remove/fix such tests. Additionally, an attribute to support `SYCL_EXTERNAL` does not yet exist upstream, so there is no syntax that can currently be used to write such a test.

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


More information about the cfe-commits mailing list