Skip to content

Commit

Permalink
Merge pull request #1286 from IntelPython/update/fixme_comment
Browse files Browse the repository at this point in the history
Update FIXME comment in stride computation.
  • Loading branch information
Diptorup Deb authored Jan 22, 2024
2 parents d0d3e07 + 73eb979 commit c3dbf90
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions numba_dpex/core/runtime/_dpexrt_python.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,13 +866,14 @@ static int DPEXRT_sycl_usm_ndarray_from_python(PyObject *obj,
for (i = 0; i < ndim; ++i, ++p)
*p = shape[i];

// DPCTL returns a NULL pointer if the array is contiguous. dpctl stores
// strides as number of elements and Numba stores strides as bytes, for
// that reason we are multiplying stride by itemsize when unboxing the
// external array.

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

0 comments on commit c3dbf90

Please sign in to comment.