Skip to content

Conversation

@vlad-perevezentsev
Copy link
Collaborator

Previously C-contiguous arrays with ndim > 0 were exported with NULL strides while F-contiguous strides were computed explicitly.
In #2193 NULL strides are no longer allowed due to DLPack v 1.2 and missing strides started to be
computed using only F-order logic so C-contiguous arrays were exported with incorrect strides

import dpctl.tensor as dpt

a = dpt.asarray([[1,2,3],[4,5,6]])
a.strides
# (3, 1)
b = dpt.from_dlpack(a)
b.strides
# (1, 2)

This PR adds stride computation for C-contiguous layouts and resolves #2213

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

@github-actions
Copy link

github-actions bot commented Dec 15, 2025

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

@github-actions
Copy link

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_77 ran successfully.
Passed: 1116
Failed: 42
Skipped: 82

@coveralls
Copy link
Collaborator

coveralls commented Dec 15, 2025

Coverage Status

coverage: 86.25% (-0.02%) from 86.269%
when pulling 8090e95 on resolve_gh_2213
into b8d0890 on master.

ndgrigorian
ndgrigorian previously approved these changes Dec 17, 2025
Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those are the only comments from me, everything else LGTM

@github-actions
Copy link

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_94 ran successfully.
Passed: 1115
Failed: 43
Skipped: 82

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you @vlad-perevezentsev

@ndgrigorian ndgrigorian merged commit 2e67f59 into master Dec 17, 2025
100 of 116 checks passed
@ndgrigorian ndgrigorian deleted the resolve_gh_2213 branch December 17, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dpt.from_dlpack changes content of usm_ndarray

3 participants