[clang] [SYCL] AST support for SYCL kernel entry point functions. (PR #122379)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 22:11:30 PST 2025


================
@@ -480,6 +480,7 @@ following requirements.
 * Is not a C variadic function.
 * Is not a coroutine.
 * Is not defined as deleted or as defaulted.
+* Is not defined with a function try block.
----------------
tahonermann wrote:

The SYCL specification isn't relevant here as `sycl_kernel_entry_point` attributed functions are implementation detail. This doesn't preclude a SYCL kernel having a call operator with a _function-try-block_. The SYCL 2020 specification doesn't implicitly or explicitly acknowledge the existence of such things; all it has to say is "Exception-handling cannot be used inside a device function" ([section 5.4, "Language restrictions for device functions"](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:language.restrictions.kernels)). I find it unclear whether that means that exceptions can't be thrown (on pain of UB?) or whether try-blocks and throw expressions are syntactically prohibited. I opened an issue regarding this against the SYCL specification last year (https://github.com/KhronosGroup/SYCL-Docs/issues/543), but, again, it isn't relevant for this.

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


More information about the cfe-commits mailing list