Skip to content

Convert .pxi include files to .pxd/.pyx in dpnp/tensor#2913

Open
vlad-perevezentsev wants to merge 14 commits into
masterfrom
update_tensor_cython_pxi
Open

Convert .pxi include files to .pxd/.pyx in dpnp/tensor#2913
vlad-perevezentsev wants to merge 14 commits into
masterfrom
update_tensor_cython_pxi

Conversation

@vlad-perevezentsev
Copy link
Copy Markdown
Contributor

This PR proposes to replace Cython textual includes with proper module imports in dpnp/tensor
.pxi files are converted into corresponding .pxd and .pyx modules for _slicing.pxi, _stride_utils.pxi and _types.pxi`

This change replaces the include .pxi pattern with standard Cython cimport statements and improving modularity

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 12, 2026

Coverage Status

coverage: 78.154% (-0.09%) from 78.242% — update_tensor_cython_pxi into master

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

Array API standard conformance tests for dpnp=0.21.0dev0=py313h509198e_62 ran successfully.
Passed: 1356
Failed: 4
Skipped: 16

@github-actions
Copy link
Copy Markdown
Contributor

View rendered docs @ https://intelpython.github.io/dpnp/pull/2913/index.html

Comment thread dpnp/tensor/_usmarray.pyx Outdated
Comment thread CHANGELOG.md Outdated
Comment thread dpnp/tensor/_slicing.pyx
from cpython.buffer cimport PyObject_CheckBuffer
from numpy import ndarray

from ._usmarray cimport usm_ndarray
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not that produce a circular dependency? (_usmarray ↔ _slicing)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_slicing.pxd itself does not depend on _usmarray;
It is only needed for isinstance() checks in .pyx implementation so this circular cimport is safe

Comment thread dpnp/tensor/_usmarray.pyx Outdated
Comment thread dpnp/tests/tensor/elementwise/test_expm1.py Outdated
Comment thread dpnp/backend/include/dpnp4pybind11.hpp
Comment thread dpnp/tensor/_types.pyx
Comment on lines +35 to +51
cdef int UAR_BOOL = UAR_BOOL_VALUE
cdef int UAR_BYTE = UAR_BYTE_VALUE
cdef int UAR_UBYTE = UAR_UBYTE_VALUE
cdef int UAR_SHORT = UAR_SHORT_VALUE
cdef int UAR_USHORT = UAR_USHORT_VALUE
cdef int UAR_INT = UAR_INT_VALUE
cdef int UAR_UINT = UAR_UINT_VALUE
cdef int UAR_LONG = UAR_LONG_VALUE
cdef int UAR_ULONG = UAR_ULONG_VALUE
cdef int UAR_LONGLONG = UAR_LONGLONG_VALUE
cdef int UAR_ULONGLONG = UAR_ULONGLONG_VALUE
cdef int UAR_FLOAT = UAR_FLOAT_VALUE
cdef int UAR_DOUBLE = UAR_DOUBLE_VALUE
cdef int UAR_CFLOAT = UAR_CFLOAT_VALUE
cdef int UAR_CDOUBLE = UAR_CDOUBLE_VALUE
cdef int UAR_TYPE_SENTINEL = UAR_TYPE_SENTINEL_VALUE
cdef int UAR_HALF = UAR_HALF_VALUE
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems redundant to cdef them here and in usmarray.pyx, is there a way to do it in something common?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants