Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6ad1c5f
Support `kDLCPU` devices via DLPack protocol
ndgrigorian Aug 2, 2024
a250506
Refactor _dlpack.pyx functions
ndgrigorian Aug 2, 2024
d326314
Fix Cython warning caused by cimporting from Numpy
ndgrigorian Aug 2, 2024
1ec9a76
Handle Numpy deprecated API without touching CMake
ndgrigorian Aug 3, 2024
7b6a651
Introduce _is_host_cpu utility predicate used in __dlpack__
oleksandr-pavlyk Aug 5, 2024
d393950
Merge pull request #1784 from IntelPython/factor-out-dl-device-check
oleksandr-pavlyk Aug 5, 2024
c3655ed
Fixes a typo when making NumPy array interface from a boolean array i…
ndgrigorian Aug 5, 2024
cb80f55
Adds validation for `dl_device` argument in `__dlpack__`
ndgrigorian Aug 5, 2024
3c35c3b
Chane per PR review by @oleksandr-pavlyk and pass NULL strides to dl_…
ndgrigorian Aug 5, 2024
f781400
Adds tests for DLPack using `kDLCPU` dl_device
ndgrigorian Aug 5, 2024
1544e9b
Clean up errors in `__dlpack__`
ndgrigorian Aug 6, 2024
70c6772
Re-order conditional strides assignment
ndgrigorian Aug 6, 2024
fe71e99
Prevent losing reference of DLPack holder when returning NumPy array
ndgrigorian Aug 6, 2024
85d417f
Expose `DLDeviceType` in `dpctl.tensor`
ndgrigorian Aug 8, 2024
5ae872a
Docstring for DLDeviceType listing the valid enumerators
ndgrigorian Aug 8, 2024
353be0d
Add documentation for constants and `DLDeviceType` enums
ndgrigorian Aug 8, 2024
2bd92df
Merge pull request #1793 from IntelPython/document-dldevicetype-const…
oleksandr-pavlyk Aug 8, 2024
a30b573
Merge branch 'master' into feature/dlpack-kdlcpu-support
oleksandr-pavlyk Aug 8, 2024
4c360d3
Add _is_kdlcpu_device utility to _dlpack.pyx
ndgrigorian Aug 9, 2024
dd4c0c0
Minor change to `_is_kdlcpu_device`
ndgrigorian Aug 9, 2024
2661f51
Support copy-via-host in from_dlpack
oleksandr-pavlyk Aug 7, 2024
9a17afc
Merge pull request #1789 from IntelPython/enhance-from_dlpack
oleksandr-pavlyk Aug 13, 2024
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
7 changes: 6 additions & 1 deletion dpctl/tensor/_dlpack.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,11 @@ class _numpy_array_interface_wrapper:
self._memory_owner = memory_owner


cdef bint _is_kdlcpu_device(DLDevice *dev):
"Check if DLTensor.DLDevice denotes (kDLCPU, 0)"
return (dev.device_type == kDLCPU) and (dev.device_id == 0)


cpdef object from_dlpack_capsule(object py_caps):
"""
from_dlpack_capsule(py_caps)
Expand Down Expand Up @@ -915,7 +920,7 @@ cpdef object from_dlpack_capsule(object py_caps):
if readonly:
res_ary.flags_ = (res_ary.flags_ & ~USM_ARRAY_WRITABLE)
return res_ary
elif dl_tensor.device.device_type == kDLCPU:
elif _is_kdlcpu_device(&dl_tensor.device):
ary_iface = _numpy_array_interface_from_dl_tensor(dl_tensor, readonly)
if not versioned:
dlm_holder = _DLManagedTensorOwner._create(dlm_tensor)
Expand Down
Loading