Resolve an issue with .data.ptr ignoring USM offset on array views#2812
Merged
antonwolfy merged 9 commits intomasterfrom Mar 18, 2026
Merged
Resolve an issue with .data.ptr ignoring USM offset on array views#2812antonwolfy merged 9 commits intomasterfrom
.data.ptr ignoring USM offset on array views#2812antonwolfy merged 9 commits intomasterfrom
Conversation
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/2812/index.html |
Contributor
|
Array API standard conformance tests for dpnp=0.20.0dev4=py313h509198e_18 ran successfully. |
Collaborator
vlad-perevezentsev
approved these changes
Mar 17, 2026
Contributor
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
No more comments from me. Great job @antonwolfy
LGTM
github-actions bot
added a commit
that referenced
this pull request
Mar 18, 2026
…2812) The `create_data()` function had an early return when `usm_data` was already a dpnp memory class instance, which skipped setting the `ptr` attribute. This caused all array views to report the same base pointer, making `arr[0].data.ptr == arr[1].data.ptr` even though they point to different memory locations. The PR proposes a fix ensuring `ptr` is always set to `x._pointer`, which points to the start of the array's data (including any offset for views), rather than `usm_data._pointer` which points to the base buffer. Additionally, always create a new memory wrapper instance to avoid shared state when the same `usm_data` is used for multiple views. This PR closes #2781. - [x] Have you provided a meaningful PR description? - [x] Have you added a test, reproducer or referred to an issue with a reproducer? - [x] Have you tested your changes locally for CPU and GPU devices? - [x] 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? - [x] Have you added your changes to the changelog? 54d2109
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
create_data()function had an early return whenusm_datawas already a dpnp memory class instance, which skipped setting theptrattribute. This caused all array views to report the same base pointer, makingarr[0].data.ptr == arr[1].data.ptreven though they point to different memory locations.The PR proposes a fix ensuring
ptris always set tox._pointer, which points to the start of the array's data (including any offset for views), rather thanusm_data._pointerwhich points to the base buffer.Additionally, always create a new memory wrapper instance to avoid shared state when the same
usm_datais used for multiple views.This PR closes #2781.