[llvm-branch-commits] [llvm] [libsycl] Add parallel_for feature (PR #189068)
Yury Plyakhin via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 3 15:05:14 PDT 2026
================
@@ -221,25 +351,56 @@ class _LIBSYCL_EXPORT queue {
submitKernelImpl(KernelName, TypelessArgs);
}
+ /// The sycl_kernel_entry_point attribute facilitates the generation of an
+ /// offload kernel entry point function with parameters corresponding to the
+ /// (potentially decomposed) kernel arguments and a body that (potentially
+ /// reconstructs the arguments and) executes the kernel.
#ifdef SYCL_LANGUAGE_VERSION
# define _LIBSYCL_ENTRY_POINT_ATTR__(KernelName) \
[[clang::sycl_kernel_entry_point(KernelName)]]
#else
# define _LIBSYCL_ENTRY_POINT_ATTR__(KernelName)
#endif // SYCL_LANGUAGE_VERSION
+ /// Specifies the parameters and body of the generated offload kernel entry
+ /// point for single_task invocations. On host compiler generates call to
+ /// sycl_kernel_launch instead of KernelFunc invocation.
template <typename KernelName, typename KernelType>
_LIBSYCL_ENTRY_POINT_ATTR__(KernelName)
void submitSingleTask(const KernelType KernelFunc) {
KernelFunc();
}
- event getLastEvent();
- void submitKernelImpl(const char *KernelName,
- detail::ArgCollection &TypelessArgs);
+ /// Specifies the parameters and body of the generated offload kernel entry
+ /// point for parallel_for invocations. On host compiler generates call to
+ /// sycl_kernel_launch instead of KernelFunc invocation.
+ template <typename KernelName, typename ElementType, typename KernelType>
+ _LIBSYCL_ENTRY_POINT_ATTR__(KernelName)
+ void submitParallelFor(const KernelType KernelFunc) {
+#ifdef __SYCL_DEVICE_ONLY__
+ KernelFunc(detail::Builder::getElement(detail::declptr<ElementType>()));
+#endif
+ (void)KernelFunc;
+ }
+
+ /// Passes kernel parameters to runtime.
+ /// \param Events a collection of events representing dependencies of the
+ /// kernel to submit.
+ /// \param Range a unified view of range for kernel execution.
void setKernelParameters(const std::vector<event> &Events,
const detail::UnifiedRangeView &Range = {});
+ /// Passes kernel arguments to runtime.
+ /// If all dependencies are met and kernel can be submitted to backend - it is
+ /// done in this call.
+ /// \param KernelName a name of the kernel being invoked.
+ /// \param TypelessArgs a unified arguments collection.
+ void submitKernelImpl(const char *KernelName,
----------------
YuriPlyakhin wrote:
```suggestion
void submitKernelImpl(std::string_view KernelName,
```
https://github.com/llvm/llvm-project/pull/189068
More information about the llvm-branch-commits
mailing list