Skip to content
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

Data members renamed, accessors added #435

Merged
merged 2 commits into from
May 7, 2021
Merged
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
5 changes: 5 additions & 0 deletions dpctl/tensor/_slicing.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ import numbers
cdef object _basic_slice_meta(object ind, tuple shape,
tuple strides, Py_ssize_t offset):
"""
Give basic slicing index `ind` and array layout information produce
a tuple (resulting_shape, resulting_strides, resultin_offset)
used to contruct a view into underlying array.

Raises IndexError for invalid index `ind`, and NotImplementedError
if `ind` is an array.
"""
if ind is Ellipsis:
return (shape, strides, offset)
Expand Down
31 changes: 24 additions & 7 deletions dpctl/tensor/_usmarray.pxd
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
# distutils: language = c++
# cython: language_level=3

cimport dpctl


cdef public int USM_ARRAY_C_CONTIGUOUS
cdef public int USM_ARRAY_F_CONTIGUOUS
cdef public int USM_ARRAY_WRITEABLE


cdef public class usm_ndarray [object PyUSMArrayObject, type PyUSMArrayType]:
cdef char* data
cdef int nd
cdef Py_ssize_t *shape
cdef Py_ssize_t *strides
cdef int typenum
cdef int flags
cdef object base
# data fields
cdef char* data_
cdef readonly int nd_
cdef Py_ssize_t *shape_
cdef Py_ssize_t *strides_
cdef readonly int typenum_
cdef readonly int flags_
cdef readonly object base_
# make usm_ndarray weak-referenceable
cdef object __weakref__

cdef void _reset(usm_ndarray self)
cdef void _cleanup(usm_ndarray self)
cdef usm_ndarray _clone(usm_ndarray self)
cdef Py_ssize_t get_offset(usm_ndarray self) except *

cdef char* get_data(self)
cdef int get_ndim(self)
cdef Py_ssize_t * get_shape(self)
cdef Py_ssize_t * get_strides(self)
cdef int get_typenum(self)
cdef int get_itemsize(self)
cdef int get_flags(self)
cdef object get_base(self)
cdef dpctl.DPCTLSyclQueueRef get_queue_ref(self) except *
cdef dpctl.SyclQueue get_sycl_queue(self)

cdef __cythonbufferdefaults__ = {"mode": "strided"}
Loading