Skip to content

Commit c3dbf90

Browse files
author
Diptorup Deb
authored
Merge pull request #1286 from IntelPython/update/fixme_comment
Update FIXME comment in stride computation.
2 parents d0d3e07 + 73eb979 commit c3dbf90

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

numba_dpex/core/runtime/_dpexrt_python.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -866,13 +866,14 @@ static int DPEXRT_sycl_usm_ndarray_from_python(PyObject *obj,
866866
for (i = 0; i < ndim; ++i, ++p)
867867
*p = shape[i];
868868

869-
// DPCTL returns a NULL pointer if the array is contiguous. dpctl stores
870-
// strides as number of elements and Numba stores strides as bytes, for
871-
// that reason we are multiplying stride by itemsize when unboxing the
872-
// external array.
873-
874-
// FIXME: Stride computation should check order and adjust how strides are
875-
// calculated. Right now strides are assuming that order is C contigous.
869+
// dpctl returns a NULL pointer for the stride vector if the array has a
870+
// C-contiguous layout. For all other cases, including strided views and
871+
// F contiguous layouts, the actual stride values are returned. Also, dpctl
872+
// stores strides as number of elements and Numba follows NumPy and stores
873+
// strides as number of bytes. For that reason, we multiply strides by
874+
// itemsize when unboxing an usm_ndarray if dpctl returned a popualted
875+
// stride vector. For the default C contiguous case, strides are
876+
// calculated directly as number of bytes based on itemsize.
876877
if (strides) {
877878
for (i = 0; i < ndim; ++i, ++p) {
878879
*p = strides[i] << exp;

0 commit comments

Comments
 (0)