Skip to content

Move _tensor_elementwise_impl (unary) extension and use it for dpnp#2795

Open
vlad-perevezentsev wants to merge 160 commits intoinclude-dpctl-tensorfrom
move_tensor_elementwise_impl_unary
Open

Move _tensor_elementwise_impl (unary) extension and use it for dpnp#2795
vlad-perevezentsev wants to merge 160 commits intoinclude-dpctl-tensorfrom
move_tensor_elementwise_impl_unary

Conversation

@vlad-perevezentsev
Copy link
Contributor

@vlad-perevezentsev vlad-perevezentsev commented Mar 3, 2026

This PR initializes _tensor_elementwise_impl pybind11 extension in dpctl_ext.tensor and extends dpctl_ext.tensor Python API with the part of unary functions :

abs
acos
acosh
angle
atan
atanh
bitwise_invert
ceil
conj

This is the first part of the work on migrating _tensor_elementwise_impl (unary)_

  • 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 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

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


namespace py = pybind11;

namespace py = pybind11;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
namespace py = pybind11;


#pragma once

#include <algorithm>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need that include?

Comment on lines +35 to +36
#pragma once
#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.

Dublicate pragma

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

#pragma once
#include <cstddef>
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing include <complex>

/// This file defines kernels for elementwise evaluation of ANGLE(x) function.
//===---------------------------------------------------------------------===//

#include <cmath>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need <cmath> include?


#include <sycl/sycl.hpp>

#include "dpnp4pybind11.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to include that?

#include "kernels/dpctl_tensor_types.hpp"
#include "kernels/elementwise_functions/common.hpp"

#include "utils/offset_utils.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems never used (the same in other headers)


} // namespace impl

void init_acos(py::module_ m)
Copy link
Contributor

Choose a reason for hiding this comment

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

missing namespace py = pybind11;

#include "kernels/elementwise_functions/atanh.hpp"
#include "kernels/elementwise_functions/common.hpp"

namespace py = pybind11;
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate

int nd = src_nd;
const py::ssize_t *shape = src_shape;

dpctl::tensor::py_internal::simplify_iteration_space(
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to use the namespace name to access the function (here in other places)

return py::cast<py::object>(res);
}
else {
using dpctl::tensor::py_internal::type_utils::_dtype_from_typenum;
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::type_utils::_dtype_from_typenum;
using type_utils::_dtype_from_typenum;

Base automatically changed from move_tensor_reductions_impl_ext to include-dpctl-tensor March 10, 2026 15:45
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.

2 participants