Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Maintenance

* Updated examples to remove use of `dpctl.tensor`, opting to simplify the examples and rely on `dpctl.memory` objects which wrap USM allocations [gh-2245](https://github.com/IntelPython/dpctl/pull/2245)
* Removed deprecated property syntax from Cython files [gh-2277](https://github.com/IntelPython/dpctl/pull/2277)

## [0.21.1] - Nov. 29, 2025

Expand Down
12 changes: 6 additions & 6 deletions dpctl/_sycl_queue.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1747,12 +1747,12 @@ cdef class WorkGroupMemory:
def is_available():
return DPCTLWorkGroupMemory_Available()

property _ref:
@property
def _ref(self):
"""Returns the address of the C API ``DPCTLWorkGroupMemoryRef``
pointer as a ``size_t``.
"""
def __get__(self):
return <size_t>self._mem_ref
return <size_t>self._mem_ref


cdef class _RawKernelArg:
Expand Down Expand Up @@ -1842,9 +1842,9 @@ cdef class RawKernelArg:
def is_available():
return DPCTLRawKernelArg_Available()

property _ref:
@property
def _ref(self):
"""Returns the address of the C API ``DPCTLRawKernelArgRef`` pointer
as a ``size_t``.
"""
def __get__(self):
return <size_t>self._arg_ref
return <size_t>self._arg_ref
78 changes: 39 additions & 39 deletions dpctl/memory/_memory.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -290,63 +290,63 @@ cdef class _Memory:
buffer.strides = &buffer.itemsize
buffer.suboffsets = NULL # for pointer arrays only

property nbytes:
@property
def nbytes(self):
"""Extent of this USM buffer in bytes."""
def __get__(self):
return self.nbytes
return self.nbytes

property size:
@property
def size(self):
"""Extent of this USM buffer in bytes."""
def __get__(self):
return self.nbytes
return self.nbytes

property _pointer:
@property
def _pointer(self):
"""
USM pointer at the start of this buffer
represented as Python integer.
"""
def __get__(self):
return <size_t>(self._memory_ptr)
return <size_t>(self._memory_ptr)

property _context:
@property
def _context(self):
""":class:`dpctl.SyclContext` the USM pointer is bound to. """
def __get__(self):
return self.queue.get_sycl_context()
return self.queue.get_sycl_context()

property _queue:
@property
def _queue(self):
"""
:class:`dpctl.SyclQueue` with :class:`dpctl.SyclContext` the
USM allocation is bound to and :class:`dpctl.SyclDevice` it was
allocated on.
"""
def __get__(self):
return self.queue
return self.queue

property reference_obj:
@property
def reference_obj(self):
"""
Reference to the Python object owning this USM buffer.
"""
def __get__(self):
return self.refobj
return self.refobj

property sycl_context:
@property
def sycl_context(self):
""":class:`dpctl.SyclContext` the USM pointer is bound to."""
def __get__(self):
return self.queue.get_sycl_context()
return self.queue.get_sycl_context()

property sycl_device:
@property
def sycl_device(self):
""":class:`dpctl.SyclDevice` the USM pointer is bound to."""
def __get__(self):
return self.queue.get_sycl_device()
return self.queue.get_sycl_device()

property sycl_queue:
@property
def sycl_queue(self):
"""
:class:`dpctl.SyclQueue` with :class:`dpctl.SyclContext` the
USM allocation is bound to and :class:`dpctl.SyclDevice` it was
allocated on.
"""
def __get__(self):
return self.queue
return self.queue

def __repr__(self):
return (
Expand All @@ -370,7 +370,8 @@ cdef class _Memory:
def __reduce__(self):
return _to_memory, (self.copy_to_host(), self.get_usm_type())

property __sycl_usm_array_interface__:
@property
def __sycl_usm_array_interface__(self):
"""
Dictionary encoding information about USM allocation.

Expand All @@ -396,17 +397,16 @@ cdef class _Memory:
Queue associated with this class instance.

"""
def __get__(self):
cdef dict iface = {
"data": (<size_t>(<void *>self._memory_ptr),
True), # bool(self.writable)),
"shape": (self.nbytes,),
"strides": None,
"typestr": "|u1",
"version": 1,
"syclobj": self.queue
}
return iface
cdef dict iface = {
"data": (<size_t>(<void *>self._memory_ptr),
True), # bool(self.writable)),
"shape": (self.nbytes,),
"strides": None,
"typestr": "|u1",
"version": 1,
"syclobj": self.queue,
}
return iface

def get_usm_type(self, syclobj=None):
"""
Expand Down
Loading