Fznamznon wrote: > @Fznamznon @tahonermann Do we have any plans to for a non-macro way to > declare device-only code?
That would be an extension to SYCL, I think. In SYCL marking device code is not that obvious and mostly implicit. A function becomes device code if it is called from a kernel invoking API, i.e. `parallel_for` library call. We will use attribute [[clang::sycl_kernel_entry_point]] for marking these APIs in the SYCL library. A function marked with `[[clang::sycl_kernel_entry_point]]` will accept a callable object or a lambda and everything called from it recursively becomes device code. Additionally, there is SYCL_EXTERNAL macro which we will define via [[clang::sycl_external]] attribute. It simply forces code generation of a function for the device, even when it is not called from a callable object passed to `[[clang::sycl_kernel_entry_point]]` attributed function. The thing is, both these ways are forcing compilation for device meaning the host code will also have definitions for these functions. There is no way to define device-only function in SYCL except framing it with __SYCL_DEVICE_ONLY__ macro. It is the way SYCL 2020 is. https://github.com/llvm/llvm-project/pull/168438 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
