Skip to content

Move _tensor_accumulation_impl extension and use it for dpnp#2791

Open
vlad-perevezentsev wants to merge 7 commits intomove_tensor_impl_linear_sequencefrom
move_tensor_accumulation_impl
Open

Move _tensor_accumulation_impl extension and use it for dpnp#2791
vlad-perevezentsev wants to merge 7 commits intomove_tensor_impl_linear_sequencefrom
move_tensor_accumulation_impl

Conversation

@vlad-perevezentsev
Copy link
Contributor

This PR completely moves _tensor_accumulation_impl pybind11 extension into dpctl_ext.tensor and extends dpctl_ext.tensor Python API with the functions cumulative_logsumexp, cumulative_prod and cumulative_sum reusing them in dpnp

  • 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?

@vlad-perevezentsev vlad-perevezentsev self-assigned this Mar 2, 2026
@vlad-perevezentsev vlad-perevezentsev changed the title Move _tensor_accumulation_impl extensions and use it for dpnp Move _tensor_accumulation_impl extension and use it for dpnp Mar 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Array API standard conformance tests for dpnp=0.20.0dev3=py313h509198e_122 ran successfully.
Passed: 1356
Failed: 1
Skipped: 16

#pragma once

#include <cstddef>
#include <cstdint>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#include <cstdint>

believe it's unused


#include <cstddef>
#include <cstdint>
#include <stdexcept>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include <stdexcept>
#include <exception>
#include <iterator>
#include <stdexcept>
#include <tuple>

//===----------------------------------------------------------------------===//

#pragma once

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include <algorithm>

int trailing_dims_to_accumulate,
const arrayT &dst, sycl::queue &exec_q,
const event_vecT &depends = {}) {
using dpctl::tensor::py_internal::py_accumulate_over_axis;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using dpctl::tensor::py_internal::py_accumulate_over_axis;

Comment on lines +329 to +330
using dpctl::tensor::py_internal::
py_accumulate_final_axis_include_initial;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using dpctl::tensor::py_internal::
py_accumulate_final_axis_include_initial;


auto cumlogsumexp_dtype_supported = [&](const py::dtype &input_dtype,
const py::dtype &output_dtype) {
using dpctl::tensor::py_internal::py_accumulate_dtype_supported;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using dpctl::tensor::py_internal::py_accumulate_dtype_supported;

Comment on lines +339 to +340
using dpctl::tensor::py_internal::
py_accumulate_final_axis_include_initial;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using dpctl::tensor::py_internal::
py_accumulate_final_axis_include_initial;


auto cumprod_dtype_supported = [&](const py::dtype &input_dtype,
const py::dtype &output_dtype) {
using dpctl::tensor::py_internal::py_accumulate_dtype_supported;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using dpctl::tensor::py_internal::py_accumulate_dtype_supported;

auto cumsum_pyapi = [&](const arrayT &src, int trailing_dims_to_accumulate,
const arrayT &dst, sycl::queue &exec_q,
const event_vecT &depends = {}) {
using dpctl::tensor::py_internal::py_accumulate_over_axis;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using dpctl::tensor::py_internal::py_accumulate_over_axis;

Comment on lines +337 to +338
using dpctl::tensor::py_internal::
py_accumulate_final_axis_include_initial;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using dpctl::tensor::py_internal::
py_accumulate_final_axis_include_initial;


auto cumsum_dtype_supported = [&](const py::dtype &input_dtype,
const py::dtype &output_dtype) {
using dpctl::tensor::py_internal::py_accumulate_dtype_supported;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using dpctl::tensor::py_internal::py_accumulate_dtype_supported;

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.

3 participants