[llvm] [libsycl] add initial sycl::handler impl (PR #216754)
Kseniya Tikhomirova via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 07:26:42 PDT 2026
================
@@ -104,5 +107,49 @@ ol_alloc_type_t getOlAllocType(usm::alloc USMKind) {
}
}
+ol_kernel_launch_size_args_t convertToOlRange(const UnifiedRangeView &Range) {
+ assert(Range.MDims < 4 && "Invalid dimensions.");
+
+ uint32_t GlobalSize[3] = {1, 1, 1};
+ if (Range.MGlobalSize) {
+ for (size_t I = 0; I < Range.MDims; ++I) {
+ assert(Range.MGlobalSize[I] <= std::numeric_limits<uint32_t>::max());
+ GlobalSize[I] = static_cast<uint32_t>(Range.MGlobalSize[I]);
+ }
+ }
+
+ uint32_t GroupSize[3] = {1, 1, 1};
+ if (Range.MLocalSize) {
+ for (size_t I = 0; I < Range.MDims; ++I) {
+ assert(Range.MLocalSize[I] <= std::numeric_limits<uint32_t>::max() &&
+ Range.MLocalSize[I] != 0);
+ GroupSize[I] = static_cast<uint32_t>(Range.MLocalSize[I]);
+ }
+ }
+
+ // We have the following mapping between dimensions with SPIR-V builtins:
+ // 1D: id[0] -> x
+ // 2D: id[0] -> y, id[1] -> x
+ // 3D: id[0] -> z, id[1] -> y, id[2] -> x
+ // So in order to ensure the correctness we update all the kernel
+ // parameters accordingly.
+ if (Range.MDims > 1) {
+ // TODO: Offset is not supported in liboffload so just ignore it for now.
----------------
KseniyaTikhomirova wrote:
@lplewa, @pbalcer is there any plans to support offset in liboffload? I see that offset was present in UR kernel submission https://github.com/intel/llvm/blob/sycl/sycl/source/detail/scheduler/commands.cpp#L2587.
https://github.com/llvm/llvm-project/pull/216754
More information about the llvm-commits
mailing list