Skip to content

Refactor libtensor and backend into libtensor - #3131

Merged
antonwolfy merged 7 commits into
masterfrom
feature/refactor-dpnp-backend-to-libtensor
Nov 3, 2026
Merged

antonwolfy merged 7 commits into
masterfrom
feature/refactor-dpnp-backend-to-libtensor

Conversation

@ndgrigorian

@ndgrigorian ndgrigorian commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

This PR proposes a refactor merging the dpnp backend pybind11 extensions into libtensor, moving libtensor to the dpnp directory (out from dpnp/tensor) and merging kernels from the dpnp backend into libtensor

This makes libtensor the sole home of all kernels and Python bindings, such that users of the libtensor library have access to the full suite of functionality from Python or C++

Slips in some small additional changes:

  • vm: the 2-D binary contig dispatch check now looks up both type ids (the row lookup could never be nullptr; the check still can't fire, since the earlier checks already guarantee a match) and fixes the fmax/fmin docstrings copied from fmod
  • lapack: cast the syevd eigenvalue output to RealT (a no-op for the supported T == RealT types); fix the "outpuy" typo and the gesvd error message naming gesv()
  • fix the "c-contiguos" typo (visible in the dpnp.interp error for non-contiguous input)
  • remove unused helpers: DispatchTable2 getters, local-memory-size overloads, and FourZeroOffsets_Indexer, FixedDimStridedIndexer and ThreeOffsets_FixedDimStridedIndexer from utils/offset_utils.hpp
  • CMake: remove dead branches and options, unused targets and variables, and no-op properties
  • coverage: the dpnp sources are listed first in the merged modules so coverage builds keep their instrumented copies of shared inline functions, and the shared static library is instrumented too
  • Fixes unnecessary copies of dependent event vectors
  • 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?

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Array API standard conformance tests for dpnp=0.22.0dev0=np2py314h8d9cdd5_19 ran successfully.
Passed: 1491
Failed: 0
Skipped: 6

ndgrigorian added a commit that referenced this pull request Oct 29, 2026
@coveralls

coveralls commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Status

No base build to compare — feature/refactor-dpnp-backend-to-libtensor into master

@antonwolfy antonwolfy added this to the 0.22.0 release milestone Oct 29, 2026
ndgrigorian added a commit that referenced this pull request Oct 30, 2026
@ndgrigorian
ndgrigorian force-pushed the feature/refactor-dpnp-backend-to-libtensor branch from d6424db to 56d8d97 Compare October 30, 2026 07:55
@ndgrigorian
ndgrigorian marked this pull request as ready for review October 30, 2026 08:39
ndgrigorian added a commit that referenced this pull request Oct 31, 2026
@ndgrigorian
ndgrigorian force-pushed the feature/refactor-dpnp-backend-to-libtensor branch from 56d8d97 to c8c00ac Compare October 31, 2026 08:59
Base automatically changed from feature/implement-radix-select-topk to master October 31, 2026 11:31
ndgrigorian added a commit that referenced this pull request Oct 31, 2026
@ndgrigorian
ndgrigorian force-pushed the feature/refactor-dpnp-backend-to-libtensor branch from c8c00ac to ff6221b Compare October 31, 2026 19:42
@antonwolfy
antonwolfy requested a balanced review from Copilot November 1, 2026 17:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Changing dpnp.get_include() leaves retained backend headers inaccessible through its returned path, causing existing extensions that rely on it to fail compilation.

1 open issue
What changed in this PR

This PR consolidates native kernels and pybind11 bindings under dpnp/libtensor, while keeping the Python tensor API in dpnp.tensor and retaining the legacy C backend.

Changes:

  • Redirects Python interfaces and tests to the consolidated native extensions.
  • Unifies kernel namespaces, shared elementwise helpers, and extension build configuration.
  • Updates header packaging and discovery, fixes VM dispatch lookup and LAPACK output casting, and refreshes diagnostics and changelog entries.

This pull request requires changes. The unresolved moderate issue at dpnp/dpnp_iface.py:441 (2 votes) breaks legacy header discovery: dpnp.get_include() no longer exposes the retained dpnp_iface.hpp and dpnp_iface_fptr.hpp headers. Preserve the existing lookup until deprecation, or expose those headers through the new include directory.

File Description
setup.py Packages relocated libtensor headers.
dpnp/​tests/​test_umath.py Updates VM extension import.
dpnp/​tests/​test_scipy_sparse_linalg.py Updates sparse extension import.
dpnp/​tests/​test_array_api_info.py Updates device-type helper import.
dpnp/​tests/​tensor/​test_usm_ndarray_reductions.py Updates index-type helper import.
dpnp/​tests/​tensor/​test_usm_ndarray_manipulation.py Updates tensor extension import.
dpnp/​tests/​tensor/​test_usm_ndarray_indexing.py Updates tensor extension import.
dpnp/​tests/​tensor/​test_tensor_statistical_functions.py Updates floating-type helper import.
dpnp/​tests/​tensor/​test_tensor_array_api_inspection.py Updates device-type helper imports.
dpnp/​tests/​tensor/​elementwise/​test_divide.py Updates scalar-division binding import.
dpnp/​tensor/​_utility_functions.py Redirects tensor and reduction imports.
dpnp/​tensor/​_usmarray.pyx Redirects default dtype helper import.
dpnp/​tensor/​_type_utils.py Redirects tensor extension import.
dpnp/​tensor/​_statistical_functions.py Redirects statistical kernel imports.
dpnp/​tensor/​_sorting.py Redirects sorting binding imports.
dpnp/​tensor/​_set_functions.py Redirects set-operation kernel imports.
dpnp/​tensor/​_searchsorted.py Redirects search, indexing, and copy imports.
dpnp/​tensor/​_search_functions.py Redirects tensor extension import.
dpnp/​tensor/​_reshape.py Redirects reshape binding imports.
dpnp/​tensor/​_reduction.py Redirects reduction binding imports.
dpnp/​tensor/​_print.py Redirects tensor extension import.
dpnp/​tensor/​_manipulation_functions.py Redirects manipulation kernel imports.
dpnp/​tensor/​_linear_algebra_functions.py Redirects linear-algebra kernel imports.
dpnp/​tensor/​_indexing_functions.py Redirects indexing kernel imports.
dpnp/​tensor/​_elementwise_funcs.py Redirects elementwise binding imports.
dpnp/​tensor/​_elementwise_common.py Redirects shared tensor imports.
dpnp/​tensor/​_data_types.py Redirects device dtype queries.
dpnp/​tensor/​_ctors.py Redirects constructor binding imports.
dpnp/​tensor/​_copy_utils.py Redirects copy binding imports.
dpnp/​tensor/​_clip.py Redirects clipping kernel imports.
dpnp/​tensor/​_array_api.py Redirects Array API dtype queries.
dpnp/​tensor/​_accumulation.py Redirects accumulation binding imports.
dpnp/​scipy/​sparse/​linalg/​_iterative.py Redirects BLAS extension import.
dpnp/​scipy/​sparse/​_csr.py Redirects sparse import and source-path comment.
dpnp/​scipy/​linalg/​_utils.py Redirects LAPACK and tensor imports.
dpnp/​linalg/​dpnp_utils_linalg.py Redirects LAPACK and tensor imports.
dpnp/​linalg/​dpnp_iface_linalg.py Redirects native exception import.
dpnp/​libtensor/​source/​zeros_ctor.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​zeros_ctor.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​window/​kaiser.cpp Uses consolidated Kaiser kernel namespace.
dpnp/​libtensor/​source/​triul_ctor.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​triul_ctor.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​tensor_sorting.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​tensor_reductions.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​tensor_linalg.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​tensor_elementwise.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​tensor_accumulation.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​statistics/​statistics_py.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​statistics/​sliding_window1d.hpp Uses consolidated sliding-window kernel namespaces.
dpnp/​libtensor/​source/​statistics/​histogram_common.hpp Uses consolidated histogram kernel namespace.
dpnp/​libtensor/​source/​sorting/​topk.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​topk.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​searchsorted.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​searchsorted.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​radix_sort.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​radix_sort.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​radix_sort_support.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​radix_argsort.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​radix_argsort.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​py_sort_common.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​py_argsort_common.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​merge_sort.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​merge_sort.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​merge_argsort.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​merge_argsort.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​isin.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​sorting/​isin.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​simplify_iteration_space.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​simplify_iteration_space.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​repeat.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​repeat.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​sum.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​sum.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​reduction_over_axis.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​reduction_common.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​reduction_common.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​reduction_atomic_support.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​reduce_hypot.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​reduce_hypot.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​prod.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​prod.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​min.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​min.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​max.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​max.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​logsumexp.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​logsumexp.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​argmin.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​argmin.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​argmax.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​argmax.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​any.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​any.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​all.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​reductions/​all.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​putmask.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​linear_sequences.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​linear_sequences.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​linalg_functions/​dot.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​linalg_functions/​dot.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​linalg_functions/​dot_dispatch.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​linalg_functions/​dot_atomic_support.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​full_ctor.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​full_ctor.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​eye_ctor.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​eye_ctor.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​trunc.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​trunc.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​true_divide.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​true_divide.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​tanh.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​tanh.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​tan.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​tan.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​subtract.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​subtract.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​square.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​square.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​sqrt.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​sqrt.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​spacing.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​sinh.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​sinh.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​sinc.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​sin.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​sin.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​signbit.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​signbit.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​sign.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​sign.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​rsqrt.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​rsqrt.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​round.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​round.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​remainder.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​remainder.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​reciprocal.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​reciprocal.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​real.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​real.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​radians.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​proj.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​proj.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​pow.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​pow.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​positive.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​positive.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​not_equal.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​not_equal.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​nextafter.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​nextafter.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​negative.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​negative.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​nan_to_num.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​multiply.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​multiply.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​modf.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​minimum.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​minimum.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​maximum.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​maximum.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logical_xor.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logical_xor.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logical_or.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logical_or.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logical_not.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logical_not.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logical_and.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logical_and.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logaddexp2.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​logaddexp.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​logaddexp.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​log2.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​log2.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​log1p.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​log1p.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​log10.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​log10.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​log.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​log.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​less.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​less.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​less_equal.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​less_equal.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​ldexp.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​lcm.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​isnan.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​isnan.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​isinf.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​isinf.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​isfinite.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​isfinite.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​isclose.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​interpolate.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​interpolate.cpp Consolidates binding and kernel namespaces.
dpnp/​libtensor/​source/​elementwise_functions/​imag.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​imag.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​i0.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​hypot.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​hypot.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​heaviside.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​greater.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​greater.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​greater_equal.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​greater_equal.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​gcd.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​frexp.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​fmod.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​fmin.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​fmax.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​floor.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​floor.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​floor_divide.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​floor_divide.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​float_power.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​float_power.cpp Reuses shared elementwise type helper.
dpnp/​libtensor/​source/​elementwise_functions/​fabs.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​expm1.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​expm1.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​exp2.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​exp2.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​exp.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​exp.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​erf_funcs.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​equal.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​equal.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​elementwise_functions_type_utils.hpp Declares two-output type lookup support.
dpnp/​libtensor/​source/​elementwise_functions/​elementwise_functions_type_utils.cpp Implements two-output type lookup support.
dpnp/​libtensor/​source/​elementwise_functions/​elementwise_common.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​divmod.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​degrees.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​cosh.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​cosh.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​cos.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​cos.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​copysign.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​copysign.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​conj.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​conj.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​ceil.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​ceil.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​cbrt.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​cbrt.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_xor.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_xor.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_right_shift.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_right_shift.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_or.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_or.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_left_shift.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_left_shift.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_invert.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_invert.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_count.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_and.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​bitwise_and.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​atanh.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​atanh.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​atan2.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​atan2.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​atan.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​atan.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​asinh.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​asinh.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​asin.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​asin.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​angle.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​angle.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​add.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​add.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​acosh.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​acosh.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​acos.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​acos.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​abs.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​elementwise_functions/​abs.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​device_support_queries.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​device_support_queries.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​copy_numpy_ndarray_into_usm_ndarray.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​copy_numpy_ndarray_into_usm_ndarray.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​copy_for_roll.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​copy_for_roll.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​copy_for_reshape.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​copy_for_reshape.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​copy_as_contig.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​copy_and_cast_usm_to_usm.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​copy_and_cast_usm_to_usm.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​choose.hpp Moves declaration into tensor binding namespace.
dpnp/​libtensor/​source/​boolean_advanced_indexing.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators/​cumulative_sum.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators/​cumulative_sum.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators/​cumulative_prod.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators/​cumulative_prod.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators/​cumulative_logsumexp.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators/​cumulative_logsumexp.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators/​accumulators_common.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators/​accumulators_common.cpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators/​accumulate_over_axis.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators.hpp Updates binding-reference comment.
dpnp/​libtensor/​source/​accumulators.cpp Updates binding-reference comment.
dpnp/​libtensor/​include/​utils/​rich_comparisons.hpp Updates binding-reference comment.
dpnp/​libtensor/​include/​kernels/​window/​kaiser.hpp Consolidates Kaiser and Bessel namespaces.
dpnp/​libtensor/​include/​kernels/​window/​hanning.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​window/​hamming.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​window/​blackman.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​window/​bartlett.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​statistics/​sliding_window1d.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​statistics/​histogram.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​sorting/​sort_impl_fn_ptr_t.hpp Updates binding-reference comment.
dpnp/​libtensor/​include/​kernels/​sorting/​radix_sort.hpp Updates binding-reference comment.
dpnp/​libtensor/​include/​kernels/​putmask.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​spacing.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​sinc.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​radians.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​nan_to_num.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​modf.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​logaddexp2.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​ldexp.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​lcm.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​isclose.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​interpolate.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​i0.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​heaviside.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​gcd.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​frexp.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​fmod.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​fmin.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​fmax.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​fabs.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​erfinv.hpp Consolidates error-function namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​erfcx.hpp Consolidates error-function namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​erf.hpp Consolidates error-function namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​divmod.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​degrees.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​elementwise_functions/​bitwise_count.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​kernels/​dpnp_tensor_types.hpp Updates binding-reference comment.
dpnp/​libtensor/​include/​kernels/​choose.hpp Consolidates kernel namespace.
dpnp/​libtensor/​include/​ext/​dispatch_table.hpp Removes individual supported-type accessors.
dpnp/​libtensor/​include/​ext/​details/​validation_utils_internal.hpp Corrects contiguity diagnostic spelling.
dpnp/​libtensor/​extensions/​vm/​vm_py.cpp Updates binding-reference comment.
dpnp/​libtensor/​extensions/​vm/​trunc.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​tanh.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​tan.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​sub.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​sqrt.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​sqr.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​sinh.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​sin.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​rint.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​pow.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​nextafter.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​mul.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​log2.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​log1p.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​log10.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​ln.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​inv.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​i0.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​hypot.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​fmod.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​fmin.cpp Reuses helpers and corrects binding description.
dpnp/​libtensor/​extensions/​vm/​fmax.cpp Reuses helpers and corrects binding description.
dpnp/​libtensor/​extensions/​vm/​floor.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​expm1.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​exp2.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​exp.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​erf_funcs.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​div.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​cosh.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​cos.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​copysign.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​conj.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​common.hpp Corrects binary dispatch-table indexing.
dpnp/​libtensor/​extensions/​vm/​CMakeLists.txt Builds against shared sources and iteration-space helpers.
dpnp/​libtensor/​extensions/​vm/​ceil.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​cbrt.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​atanh.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​atan2.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​atan.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​asinh.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​asin.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​arg.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​add.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​acosh.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​acos.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​vm/​abs.cpp Reuses shared elementwise helpers.
dpnp/​libtensor/​extensions/​sparse/​CMakeLists.txt Uses centralized extension installation and includes.
dpnp/​libtensor/​extensions/​lapack/​syevd.cpp Corrects eigenvalue output-pointer cast.
dpnp/​libtensor/​extensions/​lapack/​lapack_py.cpp Updates binding-reference comment.
dpnp/​libtensor/​extensions/​lapack/​gesvd_common_utils.hpp Corrects SVD diagnostics.
dpnp/​libtensor/​extensions/​lapack/​CMakeLists.txt Uses centralized extension installation and includes.
dpnp/​libtensor/​extensions/​fft/​fft_py.cpp Updates binding-reference comment.
dpnp/​libtensor/​extensions/​fft/​CMakeLists.txt Uses centralized extension installation.
dpnp/​libtensor/​extensions/​blas/​CMakeLists.txt Uses centralized extension installation and includes.
dpnp/​libtensor/​extensions/​blas/​blas_py.cpp Updates binding-reference comment.
dpnp/​fft/​dpnp_utils_fft.py Redirects FFT and tensor imports.
dpnp/​dpnp_utils/​dpnp_utils_linearalgebra.py Redirects BLAS and tensor imports.
dpnp/​dpnp_iface.py Redirects tensor import and changes public header discovery.
dpnp/​dpnp_iface_window.py Redirects window extension import.
dpnp/​dpnp_iface_statistics.py Redirects statistics and elementwise imports.
dpnp/​dpnp_iface_searching.py Redirects tensor extension import.
dpnp/​dpnp_iface_logic.py Uses consolidated scalar-tolerance comparison binding.
dpnp/​dpnp_iface_indexing.py Uses consolidated choose and putmask bindings.
dpnp/​dpnp_iface_histograms.py Redirects statistics extension import.
dpnp/​dpnp_iface_bitwise.py Uses consolidated bitwise-count bindings.
dpnp/​dpnp_algo/​dpnp_fill.py Redirects fill binding imports.
dpnp/​dpnp_algo/​dpnp_elementwise_common.py Redirects tensor and VM imports.
dpnp/​__main__.py Reports relocated tensor include directory.
cmake/​dpnp-config.cmake Finds relocated libtensor headers.
CHANGELOG.md Records kernel and extension consolidation.

Review effort: Balanced

Comment thread dpnp/dpnp_iface.py Resolved
@antonwolfy

Copy link
Copy Markdown
Contributor

Build time and memory: master vs this PR

Measured on a Panther Lake H Linux box (8 cores, 14 GB RAM, Xe3 iGPU) with icpx 2026.2: python scripts/build_locally.py --clean, CMAKE_BUILD_PARALLEL_LEVEL=6. The PR head and its master base were built in place in two separate trees.

master PR Δ
Clean build, wall time 978.7 s 1035.0 s +56 s (+5.8%)
Clean build, CPU time (user+sys) 3264 s 3253 s −0.3%
Peak RSS of the largest process (ld.lld of _tensor_impl) 3216 MiB 3479 MiB +263 MiB (+8%)
Peak RSS of all build processes (1 s sampling) 4271 MiB 5704 MiB +1433 MiB (+34%)
Rebuild _tensor_impl (+ _indexing_impl on master) 577 s 636 s +58.5 s (+10%)
Rebuild _tensor_elementwise_impl (+ _ufunc_impl on master) 505 s 575 s +70.5 s (+14%)
Rebuild _statistics_impl + _window_impl 46.5 s 46.5 s 0
Installed .so total 192.70 MB 192.16 MB −0.28%
Device images in the .so files 98.96 MB 98.97 MB +0.01%
Shipped headers 114 files, 1.83 MB 153 files, 2.11 MB +39 files
RSS after import dpnp 400.3 MiB 403.7 MiB +0.9%
RSS after 12 calls on the L0 GPU 632.8 MiB 637.6 MiB +0.8%
GPU memory (drm-total-gtt) after the same calls 118.2 MiB 106.7 MiB −11.5 MiB
  • Method: clean builds are one run per side. Each rebuild deleted the modules' objects and .so and ran ninja -j6 four times, in the order master, PR, PR, master; repeats agree within 1 s. The runtime rows are medians of at least 10 fresh processes per side, run interleaved.
  • The slowdown is all link time: compile time is the same on both sides (object total 2643 s vs 2625 s). The six large SYCL links start only after all compile jobs are done, and the _tensor_impl link is the last to finish on both sides. choose.cpp and putmask.cpp make that link 58 s longer, which accounts for the whole delta. Merging _ufunc_impl makes the _tensor_elementwise_impl link 70 s longer than the two separate links running in parallel, but that link doesn't finish last.
  • The +1.4 GiB total peak depends on timing: the longer elementwise link now ends at the same time as the _tensor_reductions_impl link, so their two ld.lld processes (2.5 and 2.9 GiB) overlap. Whether that happens depends on core count and job count. The +263 MiB of the largest process happens regardless.
  • No runtime cost: import time and first-call (JIT) latency of the moved functions are unchanged within noise.

Comment thread dpnp/libtensor/source/CMakeLists.txt Resolved
Comment thread dpnp/dpnp_iface.py Resolved
Comment thread CHANGELOG.md Resolved
Comment thread dpnp/CMakeLists.txt Resolved
Comment thread dpnp/__main__.py Resolved
Comment thread dpnp/libtensor/source/CMakeLists.txt Resolved
Comment thread dpnp/libtensor/source/CMakeLists.txt Resolved
Comment thread dpnp/libtensor/extensions/vm/common.hpp Resolved
ndgrigorian added a commit that referenced this pull request Nov 2, 2026
@ndgrigorian
ndgrigorian force-pushed the feature/refactor-dpnp-backend-to-libtensor branch from e24ca7b to 2df1e76 Compare November 2, 2026 15:06
@antonwolfy
antonwolfy requested a balanced review from Copilot November 2, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Cross-module SYCL/C++ consolidation changes linking, initialization, and installed-package layout, requiring human review and runtime validation of imports and CPU/GPU kernels that source inspection alone cannot provide.

1 open issue

Review effort: Balanced

ndgrigorian added a commit that referenced this pull request Nov 2, 2026
@ndgrigorian
ndgrigorian force-pushed the feature/refactor-dpnp-backend-to-libtensor branch from 2df1e76 to 186068e Compare November 2, 2026 20:19
- vm: check the 2-D binary contig dispatch table with both type ids,
  the row lookup could never be nullptr
- vm: fix fmax/fmin docstrings copied from fmod
- lapack: cast syevd eigenvalues output to RealT, fix gesvd typo and
  error message naming gesv
- ext: fix "c-contiguos" typo, drop unused DispatchTable2 getters and
  unused queue/reserve overloads of the local memory size helpers
- offset_utils: drop unused FourZeroOffsets_Indexer,
  FixedDimStridedIndexer and ThreeOffsets_FixedDimStridedIndexer
- cmake: drop the dead BUILD_DPNP_EXT_SYCL branch, unused variables,
  unused *_headers interface targets, a no-op PIC property, the empty
  COMPILE_DEFINITIONS loop and commented-out include dirs; stop adding
  -fno-fast-math twice to elementwise_functions_type_utils.cpp
- Move the C++ guide to dpnp/libtensor/AGENTS.md and update the layout,
  ufunc steps and paths in the other AGENTS.md files
- Add changelog entries for the moved headers, dpnp.get_include and the
  removed indexers; fix the get_include docstring and test it
- Keep the dpnp sources first in the merged modules and instrument the
  shared helpers so coverage builds measure them; note the mixed FP flags
- Drop the dead SYCL option of build_dpnp_tensor_ext and the no-op
  CMAKE_POSITION_INDEPENDENT_CODE property of dpnp_backend_c
simplify_iteration_space and elementwise_functions_type_utils.cpp are
compiled with -fsycl in Coverage builds. Instrumenting their device code
too made sycl-link fail with "Appending variables with different address
spaces need to be linked!" for every module that links them.
@ndgrigorian
ndgrigorian force-pushed the feature/refactor-dpnp-backend-to-libtensor branch from 236c2e1 to 43ca63d Compare November 2, 2026 21:41

@antonwolfy antonwolfy left a comment •

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.

Thanks for addressing all the comments. LGTM.

The build files changed after my build-cost measurements only in coverage builds (plus source order and dead code), so those numbers still stand: +56 s clean build (+5.8%) and +263 MiB peak ld.lld RSS. Both come from the _tensor_impl link, which got longer with choose/putmask and is the critical path of the build.

Possible follow-up (not for this PR): research ways to reduce the build time. Each item needs measuring (clean build time, peak link memory, .so size, first-call JIT time) before changing anything:

  1. Parallel device link: try -fsycl-max-parallel-link-jobs=<N> on the big modules. With -fsycl-device-code-split=per_kernel, most of the link is spent in the per-kernel device images, which are processed one after another by default.
  2. Device code split mode: compare per_kernel with per_source/auto for link time against runtime JIT and memory.
  3. --offload-compress cost: measure how much of the link time it takes and whether a lower compression level helps.
  4. Link scheduling: the big links start only after all compiles finish. Find out what serializes them, and try a CMake JOB_POOL_LINK so the heavy lld runs overlap with compiles without raising peak memory.
  5. Module granularity: splitting the largest modules (e.g. _tensor_impl) into smaller ones would let their links run in parallel instead of in one long critical-path link, at the cost of more modules.
  6. CI caching: look into ccache/sccache for the compile step in GitHub Actions and Jenkins.

@ndgrigorian

Copy link
Copy Markdown
Collaborator Author

@antonwolfy
I can't merge for some reason ("failing merge requirements") so please merge when you have a chance

@antonwolfy
antonwolfy merged commit bc5d6ed into master Nov 3, 2026
105 of 109 checks passed
@antonwolfy
antonwolfy deleted the feature/refactor-dpnp-backend-to-libtensor branch November 3, 2026 16:31
github-actions Bot added a commit that referenced this pull request Nov 3, 2026
This PR proposes a refactor merging the dpnp backend pybind11 extensions
into libtensor, moving libtensor to the dpnp directory (out from
dpnp/tensor) and merging kernels from the dpnp backend into libtensor

This makes libtensor the sole home of all kernels and Python bindings,
such that users of the libtensor library have access to the full suite
of functionality from Python or C++

Slips in some small additional changes:
* vm: the 2-D binary contig dispatch check now looks up both type ids
(the row lookup could never be `nullptr`; the check still can't fire,
since the earlier checks already guarantee a match) and fixes the
`fmax`/`fmin` docstrings copied from `fmod`
* lapack: cast the `syevd` eigenvalue output to `RealT` (a no-op for the
supported `T == RealT` types); fix the "outpuy" typo and the gesvd error
message naming `gesv()`
* fix the "c-contiguos" typo (visible in the `dpnp.interp` error for
non-contiguous input)
* remove unused helpers: `DispatchTable2` getters, local-memory-size
overloads, and `FourZeroOffsets_Indexer`, `FixedDimStridedIndexer` and
`ThreeOffsets_FixedDimStridedIndexer` from `utils/offset_utils.hpp`
* CMake: remove dead branches and options, unused targets and variables,
and no-op properties
* coverage: the dpnp sources are listed first in the merged modules so
coverage builds keep their instrumented copies of shared inline
functions, and the shared static library is instrumented too
* Fixes unnecessary copies of dependent event vectors bc5d6ed
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