Skip to content

Commit 1a02fcd

Browse files
author
Diptorup Deb
committed
Update the comments around why we reverse dpex.Range index in kernel_launcher.py
1 parent 6b483fd commit 1a02fcd

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

numba_dpex/core/utils/kernel_launcher.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,21 @@ def _create_sycl_range(self, idx_range):
459459
for rext in idx_range
460460
]
461461

462-
# we reverse the global range to account for how sycl and opencl
463-
# range differs
462+
# Index inversion is done here as numba-dpex first compiles a native
463+
# kernel (OpenCL or Level Zero) and then generates a SYCL
464+
# interoperability kernel from it. The convention for unit stride
465+
# dimensions is opposite for OpenCL and SYCL
466+
# refer:
467+
# https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:opencl:kernel-conventions-sycl
468+
# For this reason, although numba-dpex follows SYCL like indexing in
469+
# the kernel front-end while launching the kernel the indexing is
470+
# reversed.
471+
#
472+
# TODO[1]: It needs to be investigated if we need the index reversal
473+
# if we use SYCL-like LLVM IR indexing intrinsic instead of
474+
# OpenCL-like LLVM IR intrinsic functions.
475+
#
476+
# TODO[2]: Do we need to do this when the backend is LevelZero
464477
int64_range.reverse()
465478

466479
return self._create_ll_from_py_list(types.uintp, int64_range)

0 commit comments

Comments
 (0)