You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dpnp.ndarray.data.ptr always returns the base allocation pointer #2641
dpnp.ndarray.data.ptr always returns the base allocation pointer, not the view start pointer.
Expected: data.ptr should reflect the view’s actual first-element address (base + offset * itemsize), matching NumPy/CuPy semantics.
importdpnpasdpnao, ngrids=24, 4096elems_plane=nao*ngridsarena=dp.empty(4*elems_plane, dtype=dp.float64)
slice1=arena[elems_plane:] # non-zero offset view# Construct shaped array over the *view*:plane1=dp.ndarray((nao, ngrids), dtype=arena.dtype, buffer=slice1)
defptr(a):
returnint(a.data.ptr)
print("arena ptr :", hex(ptr(arena)))
print("slice1 ptr:", hex(ptr(slice1))) # expected start for plane1print("plane1 ptr:", hex(ptr(plane1))) # BUG: equals arena ptr (offset lost)# This should hold if buffer=view were respected:print("EXPECT plane1.ptr == slice1.ptr:", ptr(plane1) ==ptr(slice1))
One should expect slice1 and plane1 (since plane1 is constructed from slice1) share the same pointer but since the offset is lost plane1 points to the parent base memory pointer (i.e., arena)
It was agreed that the issue will be resolved in dpctl. @ndgrigorian could you please share if there is any progress on updating the logic in usm_ndarray constructor to mitigate the issue?
yes, the issue will be resolved in the development version of dpctl soon. The focus has been on the 0.21.1 release at the moment, but when that's completed, it will be fixed soon after
A PR is now open that accounts for the offset when a view is provided to the usm_ndarray constructor. This also means non-contiguous views are disallowed (works the same in NumPy): IntelPython/dpctl#2226
Activity
abagusetty commentedon Oct 28, 2025
With the cupy's equivalent results in: (
slice1&plane1are the same)With numpy:
With DPNP:
alvarovm commentedon Dec 5, 2025
Is there any update here?
antonwolfy commentedon Dec 13, 2025
It was agreed that the issue will be resolved in dpctl.
@ndgrigorian could you please share if there is any progress on updating the logic in
usm_ndarrayconstructor to mitigate the issue?ndgrigorian commentedon Dec 17, 2025
yes, the issue will be resolved in the development version of dpctl soon. The focus has been on the 0.21.1 release at the moment, but when that's completed, it will be fixed soon after
ndgrigorian commentedon Jan 7, 2026
A PR is now open that accounts for the offset when a view is provided to the
usm_ndarrayconstructor. This also means non-contiguous views are disallowed (works the same in NumPy):IntelPython/dpctl#2226
Merge branch 'master' into fix-gh-2641
Merge branch 'master' into fix-gh-2641
Merge branch 'master' into fix-gh-2641