[llvm] [libsycl] add single_task (PR #192499)

Alexey Bader via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 19 22:03:41 PDT 2026


================
@@ -10,11 +10,41 @@
 
 #include <detail/device_impl.hpp>
 #include <detail/event_impl.hpp>
+#include <detail/program_manager.hpp>
+
+#include <algorithm>
 
 _LIBSYCL_BEGIN_NAMESPACE_SYCL
 
 namespace detail {
 
+static void setKernelLaunchArgs(const detail::UnifiedRangeView &Range,
+                                ol_kernel_launch_size_args_t &ArgsToSet) {
+  assert(Range.MDims < 4 && "Invalid dimensions.");
+  uint32_t GlobalSize[3] = {1, 1, 1};
+  if (Range.MGlobalSize) {
+    for (auto I = 0; I < Range.MDims; I++) {
+      GlobalSize[I] = static_cast<uint32_t>(Range.MGlobalSize[I]);
+    }
+  }
+
+  uint32_t GroupSize[3] = {1, 1, 1};
+  if (Range.MLocalSize) {
+    for (auto I = 0; I < Range.MDims; I++) {
+      GroupSize[I] = static_cast<uint32_t>(Range.MLocalSize[I]);
----------------
bader wrote:

```suggestion
      assert(Range.MLocalSize[I] <= std::numeric_limits<uint32_t>::max() && Range.MLocalSize[I] != 0);
      GroupSize[I] = static_cast<uint32_t>(Range.MLocalSize[I]);
```
We also need to validate that local size != 0 to avoid division by zero below.

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


More information about the llvm-commits mailing list