Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
//===----------------------------------------------------------------------===//

#pragma once

#include <array>
#include <complex>
#include <cstddef>
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@
#pragma once

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <type_traits>
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include "vec_size_util.hpp"

#include "utils/math_utils.hpp"
#include "utils/offset_utils.hpp"
#include "utils/type_dispatch_building.hpp"
#include "utils/type_utils.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "vec_size_util.hpp"

#include "utils/math_utils.hpp"
#include "utils/offset_utils.hpp"
#include "utils/type_dispatch_building.hpp"
#include "utils/type_utils.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "vec_size_util.hpp"

#include "utils/math_utils.hpp"
#include "utils/offset_utils.hpp"
#include "utils/type_dispatch_building.hpp"
#include "utils/type_utils.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
//===----------------------------------------------------------------------===//

#pragma once
#include <complex>

#include <cstddef>
#include <type_traits>
#include <vector>
Expand Down
13 changes: 7 additions & 6 deletions dpctl_ext/tensor/libtensor/source/accumulators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@
/// This file defines functions of dpctl.tensor._tensor_impl extensions
//===----------------------------------------------------------------------===//

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <stdexcept>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#include <sycl/sycl.hpp>

#include "dpnp4pybind11.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include "kernels/accumulators.hpp"
#include "simplify_iteration_space.hpp"
Expand Down Expand Up @@ -196,8 +197,8 @@ std::size_t py_mask_positions(const dpctl::tensor::usm_ndarray &mask,
int mask_nd = mask.get_ndim();
int nd = mask_nd;

dpctl::tensor::py_internal::compact_iteration_space(
nd, shape, strides_vector, compact_shape, compact_strides);
compact_iteration_space(nd, shape, strides_vector, compact_shape,
compact_strides);

// Strided implementation
auto strided_fn =
Expand Down Expand Up @@ -351,8 +352,8 @@ std::size_t py_cumsum_1d(const dpctl::tensor::usm_ndarray &src,
int src_nd = src.get_ndim();
int nd = src_nd;

dpctl::tensor::py_internal::compact_iteration_space(
nd, shape, strides_vector, compact_shape, compact_strides);
compact_iteration_space(nd, shape, strides_vector, compact_shape,
compact_strides);

// Strided implementation
auto strided_fn = cumsum_1d_strided_dispatch_vector[src_typeid];
Expand Down
1 change: 0 additions & 1 deletion dpctl_ext/tensor/libtensor/source/accumulators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <sycl/sycl.hpp>

#include "dpnp4pybind11.hpp"
#include <pybind11/pybind11.h>

namespace dpctl::tensor::py_internal
{
Expand Down
40 changes: 18 additions & 22 deletions dpctl_ext/tensor/libtensor/source/boolean_advanced_indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,21 +336,19 @@ std::pair<sycl::event, sycl::event>
shT masked_src_shape;
shT ortho_src_strides;
shT masked_src_strides;
dpctl::tensor::py_internal::split_iteration_space(
src_shape_vec, src_strides_vec, axis_start, axis_end,
ortho_src_shape,
masked_src_shape, // 4 vectors modified
ortho_src_strides, masked_src_strides);
split_iteration_space(src_shape_vec, src_strides_vec, axis_start,
axis_end, ortho_src_shape,
masked_src_shape, // 4 vectors modified
ortho_src_strides, masked_src_strides);

shT ortho_dst_shape;
shT masked_dst_shape;
shT ortho_dst_strides;
shT masked_dst_strides;
dpctl::tensor::py_internal::split_iteration_space(
dst_shape_vec, dst_strides_vec, axis_start, axis_start + 1,
ortho_dst_shape,
masked_dst_shape, // 4 vectors modified
ortho_dst_strides, masked_dst_strides);
split_iteration_space(dst_shape_vec, dst_strides_vec, axis_start,
axis_start + 1, ortho_dst_shape,
masked_dst_shape, // 4 vectors modified
ortho_dst_strides, masked_dst_strides);

assert(ortho_src_shape.size() == static_cast<std::size_t>(ortho_nd));
assert(ortho_dst_shape.size() == static_cast<std::size_t>(ortho_nd));
Expand All @@ -366,7 +364,7 @@ std::pair<sycl::event, sycl::event>
py::ssize_t ortho_src_offset(0);
py::ssize_t ortho_dst_offset(0);

dpctl::tensor::py_internal::simplify_iteration_space(
simplify_iteration_space(
ortho_nd, _shape, ortho_src_strides, ortho_dst_strides,
// output
simplified_ortho_shape, simplified_ortho_src_strides,
Expand Down Expand Up @@ -646,21 +644,19 @@ std::pair<sycl::event, sycl::event>
shT masked_dst_shape;
shT ortho_dst_strides;
shT masked_dst_strides;
dpctl::tensor::py_internal::split_iteration_space(
dst_shape_vec, dst_strides_vec, axis_start, axis_end,
ortho_dst_shape,
masked_dst_shape, // 4 vectors modified
ortho_dst_strides, masked_dst_strides);
split_iteration_space(dst_shape_vec, dst_strides_vec, axis_start,
axis_end, ortho_dst_shape,
masked_dst_shape, // 4 vectors modified
ortho_dst_strides, masked_dst_strides);

shT ortho_rhs_shape;
shT masked_rhs_shape;
shT ortho_rhs_strides;
shT masked_rhs_strides;
dpctl::tensor::py_internal::split_iteration_space(
rhs_shape_vec, rhs_strides_vec, axis_start, axis_start + 1,
ortho_rhs_shape,
masked_rhs_shape, // 4 vectors modified
ortho_rhs_strides, masked_rhs_strides);
split_iteration_space(rhs_shape_vec, rhs_strides_vec, axis_start,
axis_start + 1, ortho_rhs_shape,
masked_rhs_shape, // 4 vectors modified
ortho_rhs_strides, masked_rhs_strides);

assert(ortho_dst_shape.size() == static_cast<std::size_t>(ortho_nd));
assert(ortho_rhs_shape.size() == static_cast<std::size_t>(ortho_nd));
Expand All @@ -676,7 +672,7 @@ std::pair<sycl::event, sycl::event>
py::ssize_t ortho_dst_offset(0);
py::ssize_t ortho_rhs_offset(0);

dpctl::tensor::py_internal::simplify_iteration_space(
simplify_iteration_space(
ortho_nd, _shape, ortho_dst_strides, ortho_rhs_strides,
simplified_ortho_shape, simplified_ortho_dst_strides,
simplified_ortho_rhs_strides, ortho_dst_offset, ortho_rhs_offset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,10 @@ std::pair<sycl::event, sycl::event> copy_usm_ndarray_into_usm_ndarray(
const py::ssize_t *shape = src_shape;

// nd, simplified_* and *_offset are modified by reference
dpctl::tensor::py_internal::simplify_iteration_space(
nd, shape, src_strides, dst_strides,
// output
simplified_shape, simplified_src_strides, simplified_dst_strides,
src_offset, dst_offset);
simplify_iteration_space(nd, shape, src_strides, dst_strides,
// output
simplified_shape, simplified_src_strides,
simplified_dst_strides, src_offset, dst_offset);

if (nd < 2) {
if (nd == 1) {
Expand Down
42 changes: 20 additions & 22 deletions dpctl_ext/tensor/libtensor/source/copy_as_contig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ std::pair<sycl::event, sycl::event>
int nd = src_nd;

// nd, simplified_* and *_offset are modified by reference
dpctl::tensor::py_internal::simplify_iteration_space(
nd, src_shape_vec.data(), src_strides_vec, dst.get_strides_vector(),
// output
simplified_shape, simplified_src_strides, simplified_dst_strides,
src_offset, dst_offset);
simplify_iteration_space(nd, src_shape_vec.data(), src_strides_vec,
dst.get_strides_vector(),
// output
simplified_shape, simplified_src_strides,
simplified_dst_strides, src_offset, dst_offset);

if (!((0 == src_offset) && (0 == dst_offset))) {
throw std::runtime_error(
Expand Down Expand Up @@ -359,11 +359,11 @@ std::pair<sycl::event, sycl::event>
int nd = src_nd;

// nd, simplified_* and *_offset are modified by reference
dpctl::tensor::py_internal::simplify_iteration_space(
nd, src_shape_vec.data(), src_strides_vec, dst.get_strides_vector(),
// output
simplified_shape, simplified_src_strides, simplified_dst_strides,
src_offset, dst_offset);
simplify_iteration_space(nd, src_shape_vec.data(), src_strides_vec,
dst.get_strides_vector(),
// output
simplified_shape, simplified_src_strides,
simplified_dst_strides, src_offset, dst_offset);

if (!((0 == src_offset) && (0 == dst_offset))) {
throw std::runtime_error(
Expand Down Expand Up @@ -521,12 +521,11 @@ std::pair<sycl::event, sycl::event>
int nd = static_cast<int>(batch_shape_vec.size());

// nd, simplified_* and *_offset are modified by reference
dpctl::tensor::py_internal::simplify_iteration_space(
nd, batch_shape_vec.data(), src_batch_strides_vec,
dst_batch_strides_vec,
// output
simplified_shape, simplified_src_strides, simplified_dst_strides,
src_offset, dst_offset);
simplify_iteration_space(nd, batch_shape_vec.data(), src_batch_strides_vec,
dst_batch_strides_vec,
// output
simplified_shape, simplified_src_strides,
simplified_dst_strides, src_offset, dst_offset);

if (!((0 == src_offset) && (0 == dst_offset))) {
throw std::runtime_error(
Expand Down Expand Up @@ -714,12 +713,11 @@ std::pair<sycl::event, sycl::event>
int nd = static_cast<int>(batch_shape_vec.size());

// nd, simplified_* and *_offset are modified by reference
dpctl::tensor::py_internal::simplify_iteration_space(
nd, batch_shape_vec.data(), src_batch_strides_vec,
dst_batch_strides_vec,
// output
simplified_shape, simplified_src_strides, simplified_dst_strides,
src_offset, dst_offset);
simplify_iteration_space(nd, batch_shape_vec.data(), src_batch_strides_vec,
dst_batch_strides_vec,
// output
simplified_shape, simplified_src_strides,
simplified_dst_strides, src_offset, dst_offset);

if (!((0 == src_offset) && (0 == dst_offset))) {
throw std::runtime_error(
Expand Down
9 changes: 4 additions & 5 deletions dpctl_ext/tensor/libtensor/source/copy_for_roll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,10 @@ std::pair<sycl::event, sycl::event>
const py::ssize_t *shape = src_shape_ptr;

// nd, simplified_* and *_offset are modified by reference
dpctl::tensor::py_internal::simplify_iteration_space(
nd, shape, src_strides, dst_strides,
// output
simplified_shape, simplified_src_strides, simplified_dst_strides,
src_offset, dst_offset);
simplify_iteration_space(nd, shape, src_strides, dst_strides,
// output
simplified_shape, simplified_src_strides,
simplified_dst_strides, src_offset, dst_offset);

if (nd == 1 && simplified_src_strides[0] == 1 &&
simplified_dst_strides[0] == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#include "dpnp4pybind11.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include <sycl/sycl.hpp>

namespace dpctl::tensor::py_internal
Expand Down
5 changes: 3 additions & 2 deletions dpctl_ext/tensor/libtensor/source/full_ctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
/// This file defines functions of dpctl.tensor._tensor_impl extensions
//===--------------------------------------------------------------------===//

#include <complex>
#include <cstddef>
#include <cstdint>
#include <tuple>
Expand All @@ -42,11 +41,13 @@
#include <sycl/sycl.hpp>

#include "dpnp4pybind11.hpp"
#include <pybind11/complex.h>
#include <pybind11/complex.h> // py::cast<std::complex<T>>
#include <pybind11/pybind11.h>

#include "kernels/constructors.hpp"
#include "utils/offset_utils.hpp"
#include "utils/output_validation.hpp"
#include "utils/sycl_alloc_utils.hpp"
#include "utils/type_dispatch.hpp"
#include "utils/type_utils.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
//===----------------------------------------------------------------------===//

#include <algorithm>
#include <complex>
#include <cstddef>
#include <cstdint>
#include <iterator>
Expand All @@ -47,9 +46,7 @@
#include <sycl/sycl.hpp>

#include "dpnp4pybind11.hpp"
#include <pybind11/complex.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include "kernels/integer_advanced_indexing.hpp"
#include "utils/memory_overlap.hpp"
Expand Down
3 changes: 0 additions & 3 deletions dpctl_ext/tensor/libtensor/source/tensor_ctors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ static_assert(std::is_same_v<py::ssize_t, dpctl::tensor::ssize_t>);
namespace
{

using dpctl::tensor::c_contiguous_strides;
using dpctl::tensor::f_contiguous_strides;

using dpctl::tensor::overlap::MemoryOverlap;
using dpctl::tensor::overlap::SameLogicalTensors;

Expand Down
2 changes: 0 additions & 2 deletions dpctl_ext/tensor/libtensor/source/zeros_ctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
/// This file defines functions of dpctl.tensor._tensor_impl extensions
//===--------------------------------------------------------------------===//

#include <complex>
#include <cstddef>
#include <stdexcept>
#include <utility>
Expand All @@ -41,7 +40,6 @@
#include <sycl/sycl.hpp>

#include "dpnp4pybind11.hpp"
#include <pybind11/complex.h>
#include <pybind11/pybind11.h>

#include "utils/output_validation.hpp"
Expand Down
1 change: 0 additions & 1 deletion dpctl_ext/tensor/libtensor/source/zeros_ctor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <sycl/sycl.hpp>

#include "dpnp4pybind11.hpp"
#include <pybind11/pybind11.h>

namespace dpctl::tensor::py_internal
{
Expand Down
Loading