[llvm-branch-commits] [llvm] [libsycl] Add parallel_for feature (PR #189068)
Sergey Semenov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 24 06:25:48 PDT 2026
================
@@ -220,26 +356,55 @@ class _LIBSYCL_EXPORT queue {
sizeof(FirstArg));
}
+ /// 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();
}
+
+ /// 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) {
+ KernelFunc(detail::Builder::getElement(detail::declptr<ElementType>()));
+ }
#undef _LIBSYCL_ENTRY_POINT_ATTR__
- event getLastEvent();
- void submitKernelImpl(detail::DeviceKernelInfo &KernelInfo, void *ArgData,
- size_t ArgSize);
+ /// 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 KernelInfo a name of the kernel being invoked.
+ /// \param ArgData a pointer to kernel argument.
+ /// \param ArgSize a size of kernel argument.
----------------
sergey-semenov wrote:
```suggestion
/// \param KernelInfo the information for the kernel being invoked.
/// \param ArgData a pointer to the kernel argument.
/// \param ArgSize the size of the kernel argument.
```
https://github.com/llvm/llvm-project/pull/189068
More information about the llvm-branch-commits
mailing list