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
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

Coverage Status

coverage: 86.25% (-0.02%) from 86.269%
when pulling da72671 on resolve_gh_2213
into 2b3f1ec on master.

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

2 participants