[clang] [SYCL] The sycl_kernel_entry_point attribute. (PR #111389)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 12 21:24:01 PDT 2024


================
@@ -455,6 +455,64 @@ The SYCL kernel in the previous code sample meets these expectations.
   }];
 }
 
+def SYCLKernelEntryPointDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+The ``sycl_kernel_entry_point`` attribute specifies that a function definition
+defines a pattern for an offload kernel entry point function to be emitted when
+the source code is compiled with ``-fsycl`` for a device target. Such functions
+serve as the execution entry point for a SYCL run-time library to invoke a SYCL
+kernel on a device. The function's parameters define the parameters to the
+offload kernel.
+
+The attribute requires a single type argument that specifies a class type that
+meets the requirements for a SYCL kernel name as described in section 5.2,
+"Naming of kernels", of the SYCL 2020 specification. A unique kernel name type
+is required for each function declared with the attribute. The attribute may
+not first appear on a declaration that follows a definition of the function.
+
+The attribute appertains only to non-member functions and static member
+functions that meet the following requirements:
+
+- Has a ``void`` return type.
+- Is not a variadic function.
+- Is not a coroutine.
+- Is not defined as deleted or as defaulted.
----------------
tahonermann wrote:

I haven't been able to imagine such a use case. Can you explain further how you envision this being useful? I'm inclined toward prohibiting use with defaulted functions for now; we can always relax support later if a use case emerges.

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


More information about the cfe-commits mailing list