Skip to content

Fixed tests from_dlpack and _from_dlpack_strided for USM-host allocations #1338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions dpctl/tests/test_usm_ndarray_dlpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ def test_from_dlpack(shape, typestr, usm_type):
Y = dpt.from_dlpack(X)
assert X.shape == Y.shape
assert X.dtype == Y.dtype
assert X.sycl_device == Y.sycl_device
assert X.usm_type == Y.usm_type
assert X._pointer == Y._pointer
# we can only expect device to round-trip for USM-device and
# USM-shared allocations, which are made for specific device
assert (Y.usm_type == "host") or (X.sycl_device == Y.sycl_device)
if Y.ndim:
V = Y[::-1]
W = dpt.from_dlpack(V)
Expand All @@ -149,9 +151,11 @@ def test_from_dlpack_strides(mod, typestr, usm_type):
Y = dpt.from_dlpack(X)
assert X.shape == Y.shape
assert X.dtype == Y.dtype
assert X.sycl_device == Y.sycl_device
assert X.usm_type == Y.usm_type
assert X._pointer == Y._pointer
# we can only expect device to round-trip for USM-device and
# USM-shared allocations, which are made for specific device
assert (Y.usm_type == "host") or (X.sycl_device == Y.sycl_device)
if Y.ndim:
V = Y[::-1]
W = dpt.from_dlpack(V)
Expand Down