From b87fa7cc3bdac5ecb9903811663fc2c3b3bf1fe1 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Wed, 28 Oct 2026 18:07:50 -0700 Subject: [PATCH 1/3] Refactor libtensor and backend into libtensor --- cmake/dpnp-config.cmake | 2 +- dpnp/CMakeLists.txt | 37 +- dpnp/__main__.py | 2 +- .../elementwise_functions_type_utils.cpp | 81 -- .../elementwise_functions_type_utils.hpp | 59 -- .../simplify_iteration_space.cpp | 320 ------- .../simplify_iteration_space.hpp | 85 -- .../type_dispatch_building.hpp | 79 -- .../extensions/indexing/CMakeLists.txt | 43 - .../extensions/indexing/indexing_py.cpp | 42 - .../extensions/statistics/CMakeLists.txt | 47 - dpnp/backend/extensions/ufunc/CMakeLists.txt | 73 -- .../ufunc/elementwise_functions/common.cpp | 88 -- .../ufunc/elementwise_functions/common.hpp | 38 - dpnp/backend/extensions/ufunc/ufunc_py.cpp | 38 - dpnp/backend/extensions/window/CMakeLists.txt | 42 - dpnp/cmake/tensor_build_flags.cmake | 73 ++ dpnp/dpnp_algo/dpnp_elementwise_common.py | 4 +- dpnp/dpnp_algo/dpnp_fill.py | 4 +- dpnp/dpnp_iface.py | 9 +- dpnp/dpnp_iface_bitwise.py | 7 +- dpnp/dpnp_iface_histograms.py | 2 +- dpnp/dpnp_iface_indexing.py | 9 +- dpnp/dpnp_iface_logic.py | 5 +- dpnp/dpnp_iface_mathematical.py | 65 +- dpnp/dpnp_iface_searching.py | 2 +- dpnp/dpnp_iface_statistics.py | 4 +- dpnp/dpnp_iface_trigonometric.py | 23 +- dpnp/dpnp_iface_window.py | 2 +- dpnp/dpnp_utils/dpnp_utils_linearalgebra.py | 4 +- dpnp/fft/dpnp_utils_fft.py | 4 +- .../extensions/blas/CMakeLists.txt | 2 - .../extensions/blas/blas_py.cpp | 2 +- .../extensions/blas/dot.hpp | 0 .../extensions/blas/dot_common.hpp | 0 .../extensions/blas/dotc.hpp | 0 .../extensions/blas/dotu.hpp | 0 .../extensions/blas/gemm.cpp | 0 .../extensions/blas/gemm.hpp | 0 .../extensions/blas/gemm_batch.cpp | 0 .../extensions/blas/gemv.cpp | 0 .../extensions/blas/gemv.hpp | 0 .../extensions/blas/syrk.cpp | 0 .../extensions/blas/syrk.hpp | 0 .../extensions/blas/types_matrix.hpp | 0 .../extensions/fft/CMakeLists.txt | 1 - .../extensions/fft/common.hpp | 0 .../extensions/fft/fft_py.cpp | 2 +- .../extensions/fft/fft_utils.hpp | 0 .../extensions/fft/in_place.hpp | 0 .../extensions/fft/in_place.tpp | 0 .../extensions/fft/out_of_place.hpp | 0 .../extensions/fft/out_of_place.tpp | 0 .../extensions/lapack/CMakeLists.txt | 2 - .../extensions/lapack/common_helpers.hpp | 0 .../extensions/lapack/evd_batch_common.hpp | 0 .../extensions/lapack/evd_common.hpp | 0 .../extensions/lapack/evd_common_utils.hpp | 0 .../extensions/lapack/geqrf.cpp | 0 .../extensions/lapack/geqrf.hpp | 0 .../extensions/lapack/geqrf_batch.cpp | 0 .../extensions/lapack/gesv.cpp | 0 .../extensions/lapack/gesv.hpp | 0 .../extensions/lapack/gesv_batch.cpp | 0 .../extensions/lapack/gesv_common_utils.hpp | 0 .../extensions/lapack/gesvd.cpp | 0 .../extensions/lapack/gesvd.hpp | 0 .../extensions/lapack/gesvd_batch.cpp | 0 .../extensions/lapack/gesvd_common_utils.hpp | 0 .../extensions/lapack/getrf.cpp | 0 .../extensions/lapack/getrf.hpp | 0 .../extensions/lapack/getrf_batch.cpp | 0 .../extensions/lapack/getri.hpp | 0 .../extensions/lapack/getri_batch.cpp | 0 .../extensions/lapack/getrs.cpp | 0 .../extensions/lapack/getrs.hpp | 0 .../extensions/lapack/getrs_batch.cpp | 0 .../extensions/lapack/heevd.cpp | 0 .../extensions/lapack/heevd.hpp | 0 .../extensions/lapack/heevd_batch.cpp | 0 .../extensions/lapack/heevd_batch.hpp | 0 .../extensions/lapack/lapack_py.cpp | 2 +- .../extensions/lapack/linalg_exceptions.hpp | 0 .../extensions/lapack/orgqr.cpp | 0 .../extensions/lapack/orgqr.hpp | 0 .../extensions/lapack/orgqr_batch.cpp | 0 .../extensions/lapack/potrf.cpp | 0 .../extensions/lapack/potrf.hpp | 0 .../extensions/lapack/potrf_batch.cpp | 0 .../extensions/lapack/syevd.cpp | 0 .../extensions/lapack/syevd.hpp | 0 .../extensions/lapack/syevd_batch.cpp | 0 .../extensions/lapack/syevd_batch.hpp | 0 .../extensions/lapack/types_matrix.hpp | 0 .../extensions/lapack/ungqr.cpp | 0 .../extensions/lapack/ungqr.hpp | 0 .../extensions/lapack/ungqr_batch.cpp | 0 .../extensions/sparse/CMakeLists.txt | 2 - .../extensions/sparse/gemv.cpp | 0 .../extensions/sparse/gemv.hpp | 0 .../extensions/sparse/sparse_py.cpp | 0 .../extensions/sparse/types_matrix.hpp | 0 .../extensions/vm/CMakeLists.txt | 8 +- .../extensions/vm/abs.cpp | 7 +- .../extensions/vm/abs.hpp | 0 .../extensions/vm/acos.cpp | 7 +- .../extensions/vm/acos.hpp | 0 .../extensions/vm/acosh.cpp | 7 +- .../extensions/vm/acosh.hpp | 0 .../extensions/vm/add.cpp | 7 +- .../extensions/vm/add.hpp | 0 .../extensions/vm/arg.cpp | 7 +- .../extensions/vm/arg.hpp | 0 .../extensions/vm/asin.cpp | 7 +- .../extensions/vm/asin.hpp | 0 .../extensions/vm/asinh.cpp | 7 +- .../extensions/vm/asinh.hpp | 0 .../extensions/vm/atan.cpp | 7 +- .../extensions/vm/atan.hpp | 0 .../extensions/vm/atan2.cpp | 7 +- .../extensions/vm/atan2.hpp | 0 .../extensions/vm/atanh.cpp | 7 +- .../extensions/vm/atanh.hpp | 0 .../extensions/vm/cbrt.cpp | 7 +- .../extensions/vm/cbrt.hpp | 0 .../extensions/vm/ceil.cpp | 7 +- .../extensions/vm/ceil.hpp | 0 .../extensions/vm/common.hpp | 0 .../extensions/vm/conj.cpp | 7 +- .../extensions/vm/conj.hpp | 0 .../extensions/vm/copysign.cpp | 7 +- .../extensions/vm/copysign.hpp | 0 .../extensions/vm/cos.cpp | 7 +- .../extensions/vm/cos.hpp | 0 .../extensions/vm/cosh.cpp | 7 +- .../extensions/vm/cosh.hpp | 0 .../extensions/vm/div.cpp | 7 +- .../extensions/vm/div.hpp | 0 .../extensions/vm/erf_funcs.cpp | 7 +- .../extensions/vm/erf_funcs.hpp | 0 .../extensions/vm/exp.cpp | 7 +- .../extensions/vm/exp.hpp | 0 .../extensions/vm/exp2.cpp | 7 +- .../extensions/vm/exp2.hpp | 0 .../extensions/vm/expm1.cpp | 7 +- .../extensions/vm/expm1.hpp | 0 .../extensions/vm/floor.cpp | 7 +- .../extensions/vm/floor.hpp | 0 .../extensions/vm/fmax.cpp | 7 +- .../extensions/vm/fmax.hpp | 0 .../extensions/vm/fmin.cpp | 7 +- .../extensions/vm/fmin.hpp | 0 .../extensions/vm/fmod.cpp | 7 +- .../extensions/vm/fmod.hpp | 0 .../extensions/vm/hypot.cpp | 7 +- .../extensions/vm/hypot.hpp | 0 .../extensions/vm/i0.cpp | 7 +- .../extensions/vm/i0.hpp | 0 .../extensions/vm/inv.cpp | 7 +- .../extensions/vm/inv.hpp | 0 .../extensions/vm/ln.cpp | 7 +- .../extensions/vm/ln.hpp | 0 .../extensions/vm/log10.cpp | 7 +- .../extensions/vm/log10.hpp | 0 .../extensions/vm/log1p.cpp | 7 +- .../extensions/vm/log1p.hpp | 0 .../extensions/vm/log2.cpp | 7 +- .../extensions/vm/log2.hpp | 0 .../extensions/vm/modf.cpp | 22 +- .../extensions/vm/modf.hpp | 0 .../extensions/vm/mul.cpp | 7 +- .../extensions/vm/mul.hpp | 0 .../extensions/vm/nextafter.cpp | 7 +- .../extensions/vm/nextafter.hpp | 0 .../extensions/vm/pow.cpp | 7 +- .../extensions/vm/pow.hpp | 0 .../extensions/vm/rint.cpp | 7 +- .../extensions/vm/rint.hpp | 0 .../extensions/vm/sin.cpp | 7 +- .../extensions/vm/sin.hpp | 0 .../extensions/vm/sinh.cpp | 7 +- .../extensions/vm/sinh.hpp | 0 .../extensions/vm/sqr.cpp | 7 +- .../extensions/vm/sqr.hpp | 0 .../extensions/vm/sqrt.cpp | 7 +- .../extensions/vm/sqrt.hpp | 0 .../extensions/vm/sub.cpp | 7 +- .../extensions/vm/sub.hpp | 0 .../extensions/vm/tan.cpp | 7 +- .../extensions/vm/tan.hpp | 0 .../extensions/vm/tanh.cpp | 7 +- .../extensions/vm/tanh.hpp | 0 .../extensions/vm/trunc.cpp | 7 +- .../extensions/vm/trunc.hpp | 0 .../extensions/vm/vm_py.cpp | 2 +- .../include}/ext/common.hpp | 0 .../include}/ext/details/common_internal.hpp | 0 .../ext/details/validation_utils_internal.hpp | 0 .../include}/ext/dispatch_table.hpp | 0 .../include}/ext/validation_utils.hpp | 0 .../include/kernels/accumulators.hpp | 0 .../libtensor/include/kernels/alignment.hpp | 0 .../kernels/boolean_advanced_indexing.hpp | 0 .../include/kernels}/choose.hpp | 4 +- .../libtensor/include/kernels/clip.hpp | 0 .../include/kernels/constructors.hpp | 0 .../include/kernels/copy_and_cast.hpp | 0 .../include/kernels/copy_as_contiguous.hpp | 0 .../include/kernels/dpnp_tensor_types.hpp | 2 +- .../kernels/elementwise_functions/abs.hpp | 0 .../kernels/elementwise_functions/acos.hpp | 0 .../kernels/elementwise_functions/acosh.hpp | 0 .../kernels/elementwise_functions/add.hpp | 0 .../kernels/elementwise_functions/angle.hpp | 0 .../kernels/elementwise_functions/asin.hpp | 0 .../kernels/elementwise_functions/asinh.hpp | 0 .../kernels/elementwise_functions/atan.hpp | 0 .../kernels/elementwise_functions/atan2.hpp | 0 .../kernels/elementwise_functions/atanh.hpp | 0 .../elementwise_functions/bitwise_and.hpp | 0 .../elementwise_functions/bitwise_count.hpp | 4 +- .../elementwise_functions/bitwise_invert.hpp | 0 .../bitwise_left_shift.hpp | 0 .../elementwise_functions/bitwise_or.hpp | 0 .../bitwise_right_shift.hpp | 0 .../elementwise_functions/bitwise_xor.hpp | 0 .../elementwise_functions/cabs_impl.hpp | 0 .../kernels/elementwise_functions/cbrt.hpp | 0 .../kernels/elementwise_functions/ceil.hpp | 0 .../kernels/elementwise_functions/common.hpp | 0 .../elementwise_functions/common_detail.hpp | 0 .../elementwise_functions/common_inplace.hpp | 0 .../common_two_outputs.hpp} | 46 +- .../elementwise_functions/complex_math.hpp | 0 .../kernels/elementwise_functions/conj.hpp | 0 .../elementwise_functions/copysign.hpp | 0 .../kernels/elementwise_functions/cos.hpp | 0 .../kernels/elementwise_functions/cosh.hpp | 0 .../kernels/elementwise_functions/degrees.hpp | 4 +- .../kernels/elementwise_functions/divmod.hpp | 4 +- .../kernels/elementwise_functions/equal.hpp | 0 .../kernels/elementwise_functions/erf.hpp | 4 +- .../kernels/elementwise_functions/erfcx.hpp | 4 +- .../kernels/elementwise_functions/erfinv.hpp | 4 +- .../kernels/elementwise_functions/exp.hpp | 0 .../kernels/elementwise_functions/exp2.hpp | 0 .../kernels/elementwise_functions/expm1.hpp | 0 .../kernels/elementwise_functions/fabs.hpp | 4 +- .../kernels/elementwise_functions/floor.hpp | 0 .../elementwise_functions/floor_divide.hpp | 0 .../kernels/elementwise_functions/fmax.hpp | 4 +- .../kernels/elementwise_functions/fmin.hpp | 4 +- .../kernels/elementwise_functions/fmod.hpp | 4 +- .../kernels/elementwise_functions/frexp.hpp | 4 +- .../kernels/elementwise_functions/gcd.hpp | 4 +- .../kernels/elementwise_functions/greater.hpp | 0 .../elementwise_functions/greater_equal.hpp | 0 .../elementwise_functions/heaviside.hpp | 4 +- .../kernels/elementwise_functions/hypot.hpp | 0 .../kernels/elementwise_functions/i0.hpp | 4 +- .../kernels/elementwise_functions/imag.hpp | 0 .../elementwise_functions/interpolate.hpp | 4 +- .../kernels/elementwise_functions/isclose.hpp | 4 +- .../elementwise_functions/isfinite.hpp | 0 .../kernels/elementwise_functions/isinf.hpp | 0 .../kernels/elementwise_functions/isnan.hpp | 0 .../kernels/elementwise_functions/lcm.hpp | 4 +- .../kernels/elementwise_functions/ldexp.hpp | 4 +- .../kernels/elementwise_functions/less.hpp | 0 .../elementwise_functions/less_equal.hpp | 0 .../kernels/elementwise_functions/log.hpp | 0 .../kernels/elementwise_functions/log10.hpp | 0 .../kernels/elementwise_functions/log1p.hpp | 0 .../kernels/elementwise_functions/log2.hpp | 0 .../elementwise_functions/logaddexp.hpp | 0 .../elementwise_functions/logaddexp2.hpp | 4 +- .../elementwise_functions/logical_and.hpp | 0 .../elementwise_functions/logical_not.hpp | 0 .../elementwise_functions/logical_or.hpp | 0 .../elementwise_functions/logical_xor.hpp | 0 .../kernels/elementwise_functions/maximum.hpp | 0 .../kernels/elementwise_functions/minimum.hpp | 0 .../kernels/elementwise_functions/modf.hpp | 4 +- .../elementwise_functions/multiply.hpp | 0 .../elementwise_functions/nan_to_num.hpp | 4 +- .../elementwise_functions/negative.hpp | 0 .../elementwise_functions/nextafter.hpp | 0 .../elementwise_functions/not_equal.hpp | 0 .../elementwise_functions/positive.hpp | 0 .../kernels/elementwise_functions/pow.hpp | 0 .../kernels/elementwise_functions/proj.hpp | 0 .../kernels/elementwise_functions/radians.hpp | 4 +- .../kernels/elementwise_functions/real.hpp | 0 .../elementwise_functions/reciprocal.hpp | 0 .../elementwise_functions/remainder.hpp | 0 .../kernels/elementwise_functions/round.hpp | 0 .../kernels/elementwise_functions/rsqrt.hpp | 0 .../kernels/elementwise_functions/sign.hpp | 0 .../kernels/elementwise_functions/signbit.hpp | 0 .../kernels/elementwise_functions/sin.hpp | 0 .../kernels/elementwise_functions/sinc.hpp | 4 +- .../kernels/elementwise_functions/sinh.hpp | 0 .../kernels/elementwise_functions/spacing.hpp | 4 +- .../kernels/elementwise_functions/sqrt.hpp | 0 .../kernels/elementwise_functions/square.hpp | 0 .../elementwise_functions/subtract.hpp | 0 .../elementwise_functions/sycl_complex.hpp | 0 .../kernels/elementwise_functions/tan.hpp | 0 .../kernels/elementwise_functions/tanh.hpp | 0 .../elementwise_functions/true_divide.hpp | 0 .../kernels/elementwise_functions/trunc.hpp | 0 .../elementwise_functions/vec_size_util.hpp | 0 .../kernels/integer_advanced_indexing.hpp | 0 .../kernels/linalg_functions/dot_product.hpp | 0 .../include/kernels/linalg_functions/gemm.hpp | 0 .../include/kernels}/putmask.hpp | 4 +- .../libtensor/include/kernels/reductions.hpp | 0 .../libtensor/include/kernels/repeat.hpp | 0 .../include/kernels/sorting/isin.hpp | 0 .../include/kernels/sorting/merge_sort.hpp | 0 .../include/kernels/sorting/radix_select.hpp | 0 .../include/kernels/sorting/radix_sort.hpp | 2 +- .../include/kernels/sorting/radix_utils.hpp | 0 .../kernels/sorting/search_sorted_detail.hpp | 0 .../include/kernels/sorting/searchsorted.hpp | 0 .../kernels/sorting/sort_impl_fn_ptr_t.hpp | 2 +- .../include/kernels/sorting/sort_utils.hpp | 0 .../include/kernels/sorting/topk.hpp | 0 .../include}/kernels/statistics/histogram.hpp | 4 +- .../kernels/statistics/sliding_window1d.hpp | 4 +- .../libtensor/include/kernels/where.hpp | 0 .../include}/kernels/window/bartlett.hpp | 4 +- .../include}/kernels/window/blackman.hpp | 4 +- .../include}/kernels/window/hamming.hpp | 4 +- .../include}/kernels/window/hanning.hpp | 4 +- .../include}/kernels/window/kaiser.hpp | 6 +- .../include/utils/indexing_utils.hpp | 0 .../libtensor/include/utils/math_utils.hpp | 0 .../include/utils/memory_overlap.hpp | 0 .../libtensor/include/utils/offset_utils.hpp | 0 .../include/utils/output_validation.hpp | 0 .../include/utils/rich_comparisons.hpp | 2 +- .../libtensor/include/utils/strided_iters.hpp | 0 .../include/utils/sycl_alloc_utils.hpp | 0 .../libtensor/include/utils/sycl_utils.hpp | 0 .../libtensor/include/utils/type_dispatch.hpp | 0 .../include/utils/type_dispatch_building.hpp | 43 + .../libtensor/include/utils/type_utils.hpp | 0 dpnp/libtensor/source/CMakeLists.txt | 434 ++++++++++ .../libtensor/source/accumulators.cpp | 2 +- .../libtensor/source/accumulators.hpp | 2 +- .../accumulators/accumulate_over_axis.hpp | 2 +- .../accumulators/accumulators_common.cpp | 2 +- .../accumulators/accumulators_common.hpp | 2 +- .../accumulators/cumulative_logsumexp.cpp | 2 +- .../accumulators/cumulative_logsumexp.hpp | 2 +- .../source/accumulators/cumulative_prod.cpp | 2 +- .../source/accumulators/cumulative_prod.hpp | 2 +- .../source/accumulators/cumulative_sum.cpp | 2 +- .../source/accumulators/cumulative_sum.hpp | 2 +- .../source/boolean_advanced_indexing.cpp | 0 .../source/boolean_advanced_indexing.hpp | 2 +- .../indexing => libtensor/source}/choose.cpp | 13 +- .../indexing => libtensor/source}/choose.hpp | 4 +- dpnp/{tensor => }/libtensor/source/clip.cpp | 0 dpnp/{tensor => }/libtensor/source/clip.hpp | 0 .../source/copy_and_cast_usm_to_usm.cpp | 2 +- .../source/copy_and_cast_usm_to_usm.hpp | 2 +- .../libtensor/source/copy_as_contig.cpp | 2 +- .../libtensor/source/copy_as_contig.hpp | 0 .../libtensor/source/copy_for_reshape.cpp | 2 +- .../libtensor/source/copy_for_reshape.hpp | 2 +- .../libtensor/source/copy_for_roll.cpp | 2 +- .../libtensor/source/copy_for_roll.hpp | 2 +- .../copy_numpy_ndarray_into_usm_ndarray.cpp | 2 +- .../copy_numpy_ndarray_into_usm_ndarray.hpp | 2 +- .../source/device_support_queries.cpp | 2 +- .../source/device_support_queries.hpp | 2 +- .../source/elementwise_functions/abs.cpp | 2 +- .../source/elementwise_functions/abs.hpp | 2 +- .../source/elementwise_functions/acos.cpp | 2 +- .../source/elementwise_functions/acos.hpp | 2 +- .../source/elementwise_functions/acosh.cpp | 2 +- .../source/elementwise_functions/acosh.hpp | 2 +- .../source/elementwise_functions/add.cpp | 2 +- .../source/elementwise_functions/add.hpp | 2 +- .../source/elementwise_functions/angle.cpp | 2 +- .../source/elementwise_functions/angle.hpp | 2 +- .../source/elementwise_functions/asin.cpp | 2 +- .../source/elementwise_functions/asin.hpp | 2 +- .../source/elementwise_functions/asinh.cpp | 2 +- .../source/elementwise_functions/asinh.hpp | 2 +- .../source/elementwise_functions/atan.cpp | 2 +- .../source/elementwise_functions/atan.hpp | 2 +- .../source/elementwise_functions/atan2.cpp | 2 +- .../source/elementwise_functions/atan2.hpp | 2 +- .../source/elementwise_functions/atanh.cpp | 2 +- .../source/elementwise_functions/atanh.hpp | 2 +- .../elementwise_functions/bitwise_and.cpp | 2 +- .../elementwise_functions/bitwise_and.hpp | 2 +- .../elementwise_functions/bitwise_count.cpp | 22 +- .../elementwise_functions/bitwise_count.hpp | 4 +- .../elementwise_functions/bitwise_invert.cpp | 2 +- .../elementwise_functions/bitwise_invert.hpp | 2 +- .../bitwise_left_shift.cpp | 2 +- .../bitwise_left_shift.hpp | 2 +- .../elementwise_functions/bitwise_or.cpp | 2 +- .../elementwise_functions/bitwise_or.hpp | 2 +- .../bitwise_right_shift.cpp | 2 +- .../bitwise_right_shift.hpp | 2 +- .../elementwise_functions/bitwise_xor.cpp | 2 +- .../elementwise_functions/bitwise_xor.hpp | 2 +- .../source/elementwise_functions/cbrt.cpp | 2 +- .../source/elementwise_functions/cbrt.hpp | 2 +- .../source/elementwise_functions/ceil.cpp | 2 +- .../source/elementwise_functions/ceil.hpp | 2 +- .../source/elementwise_functions/conj.cpp | 2 +- .../source/elementwise_functions/conj.hpp | 2 +- .../source/elementwise_functions/copysign.cpp | 2 +- .../source/elementwise_functions/copysign.hpp | 2 +- .../source/elementwise_functions/cos.cpp | 2 +- .../source/elementwise_functions/cos.hpp | 2 +- .../source/elementwise_functions/cosh.cpp | 2 +- .../source/elementwise_functions/cosh.hpp | 2 +- .../source}/elementwise_functions/degrees.cpp | 24 +- .../source}/elementwise_functions/degrees.hpp | 4 +- .../source}/elementwise_functions/divmod.cpp | 52 +- .../source}/elementwise_functions/divmod.hpp | 4 +- .../elementwise_common.cpp | 50 +- .../elementwise_common.hpp | 2 +- .../elementwise_functions.hpp | 45 +- .../elementwise_functions_type_utils.cpp | 12 + .../elementwise_functions_type_utils.hpp | 6 + .../source/elementwise_functions/equal.cpp | 2 +- .../source/elementwise_functions/equal.hpp | 2 +- .../elementwise_functions/erf_funcs.cpp | 19 +- .../elementwise_functions/erf_funcs.hpp | 4 +- .../source/elementwise_functions/exp.cpp | 2 +- .../source/elementwise_functions/exp.hpp | 2 +- .../source/elementwise_functions/exp2.cpp | 2 +- .../source/elementwise_functions/exp2.hpp | 2 +- .../source/elementwise_functions/expm1.cpp | 2 +- .../source/elementwise_functions/expm1.hpp | 2 +- .../source}/elementwise_functions/fabs.cpp | 17 +- .../source}/elementwise_functions/fabs.hpp | 4 +- .../elementwise_functions/float_power.cpp | 14 +- .../elementwise_functions/float_power.hpp | 4 +- .../source/elementwise_functions/floor.cpp | 2 +- .../source/elementwise_functions/floor.hpp | 2 +- .../elementwise_functions/floor_divide.cpp | 2 +- .../elementwise_functions/floor_divide.hpp | 2 +- .../source}/elementwise_functions/fmax.cpp | 19 +- .../source}/elementwise_functions/fmax.hpp | 4 +- .../source}/elementwise_functions/fmin.cpp | 19 +- .../source}/elementwise_functions/fmin.hpp | 4 +- .../source}/elementwise_functions/fmod.cpp | 18 +- .../source}/elementwise_functions/fmod.hpp | 4 +- .../source}/elementwise_functions/frexp.cpp | 32 +- .../source}/elementwise_functions/frexp.hpp | 4 +- .../source}/elementwise_functions/gcd.cpp | 18 +- .../source}/elementwise_functions/gcd.hpp | 4 +- .../source/elementwise_functions/greater.cpp | 2 +- .../source/elementwise_functions/greater.hpp | 2 +- .../elementwise_functions/greater_equal.cpp | 2 +- .../elementwise_functions/greater_equal.hpp | 2 +- .../elementwise_functions/heaviside.cpp | 18 +- .../elementwise_functions/heaviside.hpp | 4 +- .../source/elementwise_functions/hypot.cpp | 2 +- .../source/elementwise_functions/hypot.hpp | 2 +- .../source}/elementwise_functions/i0.cpp | 17 +- .../source}/elementwise_functions/i0.hpp | 4 +- .../source/elementwise_functions/imag.cpp | 2 +- .../source/elementwise_functions/imag.hpp | 2 +- .../elementwise_functions/interpolate.cpp | 6 +- .../elementwise_functions/interpolate.hpp | 4 +- .../source}/elementwise_functions/isclose.cpp | 10 +- .../source}/elementwise_functions/isclose.hpp | 4 +- .../source/elementwise_functions/isfinite.cpp | 2 +- .../source/elementwise_functions/isfinite.hpp | 2 +- .../source/elementwise_functions/isinf.cpp | 2 +- .../source/elementwise_functions/isinf.hpp | 2 +- .../source/elementwise_functions/isnan.cpp | 2 +- .../source/elementwise_functions/isnan.hpp | 2 +- .../source}/elementwise_functions/lcm.cpp | 18 +- .../source}/elementwise_functions/lcm.hpp | 4 +- .../source}/elementwise_functions/ldexp.cpp | 18 +- .../source}/elementwise_functions/ldexp.hpp | 4 +- .../source/elementwise_functions/less.cpp | 2 +- .../source/elementwise_functions/less.hpp | 2 +- .../elementwise_functions/less_equal.cpp | 2 +- .../elementwise_functions/less_equal.hpp | 2 +- .../source/elementwise_functions/log.cpp | 2 +- .../source/elementwise_functions/log.hpp | 2 +- .../source/elementwise_functions/log10.cpp | 2 +- .../source/elementwise_functions/log10.hpp | 2 +- .../source/elementwise_functions/log1p.cpp | 2 +- .../source/elementwise_functions/log1p.hpp | 2 +- .../source/elementwise_functions/log2.cpp | 2 +- .../source/elementwise_functions/log2.hpp | 2 +- .../elementwise_functions/logaddexp.cpp | 2 +- .../elementwise_functions/logaddexp.hpp | 2 +- .../elementwise_functions/logaddexp2.cpp | 19 +- .../elementwise_functions/logaddexp2.hpp | 4 +- .../elementwise_functions/logical_and.cpp | 2 +- .../elementwise_functions/logical_and.hpp | 2 +- .../elementwise_functions/logical_not.cpp | 2 +- .../elementwise_functions/logical_not.hpp | 2 +- .../elementwise_functions/logical_or.cpp | 2 +- .../elementwise_functions/logical_or.hpp | 2 +- .../elementwise_functions/logical_xor.cpp | 2 +- .../elementwise_functions/logical_xor.hpp | 2 +- .../source/elementwise_functions/maximum.cpp | 2 +- .../source/elementwise_functions/maximum.hpp | 2 +- .../source/elementwise_functions/minimum.cpp | 2 +- .../source/elementwise_functions/minimum.hpp | 2 +- .../source}/elementwise_functions/modf.cpp | 31 +- .../source}/elementwise_functions/modf.hpp | 4 +- .../source/elementwise_functions/multiply.cpp | 2 +- .../source/elementwise_functions/multiply.hpp | 2 +- .../elementwise_functions/nan_to_num.cpp | 10 +- .../elementwise_functions/nan_to_num.hpp | 4 +- .../source/elementwise_functions/negative.cpp | 2 +- .../source/elementwise_functions/negative.hpp | 2 +- .../elementwise_functions/nextafter.cpp | 2 +- .../elementwise_functions/nextafter.hpp | 2 +- .../elementwise_functions/not_equal.cpp | 2 +- .../elementwise_functions/not_equal.hpp | 2 +- .../elementwise_functions/populate.hpp | 0 .../source/elementwise_functions/positive.cpp | 2 +- .../source/elementwise_functions/positive.hpp | 2 +- .../source/elementwise_functions/pow.cpp | 2 +- .../source/elementwise_functions/pow.hpp | 2 +- .../source/elementwise_functions/proj.cpp | 2 +- .../source/elementwise_functions/proj.hpp | 2 +- .../source}/elementwise_functions/radians.cpp | 24 +- .../source}/elementwise_functions/radians.hpp | 4 +- .../source/elementwise_functions/real.cpp | 2 +- .../source/elementwise_functions/real.hpp | 2 +- .../elementwise_functions/reciprocal.cpp | 2 +- .../elementwise_functions/reciprocal.hpp | 2 +- .../elementwise_functions/remainder.cpp | 2 +- .../elementwise_functions/remainder.hpp | 2 +- .../source/elementwise_functions/round.cpp | 2 +- .../source/elementwise_functions/round.hpp | 2 +- .../source/elementwise_functions/rsqrt.cpp | 2 +- .../source/elementwise_functions/rsqrt.hpp | 2 +- .../source/elementwise_functions/sign.cpp | 2 +- .../source/elementwise_functions/sign.hpp | 2 +- .../source/elementwise_functions/signbit.cpp | 2 +- .../source/elementwise_functions/signbit.hpp | 2 +- .../source/elementwise_functions/sin.cpp | 2 +- .../source/elementwise_functions/sin.hpp | 2 +- .../source}/elementwise_functions/sinc.cpp | 17 +- .../source}/elementwise_functions/sinc.hpp | 4 +- .../source/elementwise_functions/sinh.cpp | 2 +- .../source/elementwise_functions/sinh.hpp | 2 +- .../source}/elementwise_functions/spacing.cpp | 24 +- .../source}/elementwise_functions/spacing.hpp | 4 +- .../source/elementwise_functions/sqrt.cpp | 2 +- .../source/elementwise_functions/sqrt.hpp | 2 +- .../source/elementwise_functions/square.cpp | 2 +- .../source/elementwise_functions/square.hpp | 2 +- .../source/elementwise_functions/subtract.cpp | 2 +- .../source/elementwise_functions/subtract.hpp | 2 +- .../source/elementwise_functions/tan.cpp | 2 +- .../source/elementwise_functions/tan.hpp | 2 +- .../source/elementwise_functions/tanh.cpp | 2 +- .../source/elementwise_functions/tanh.hpp | 2 +- .../elementwise_functions/true_divide.cpp | 2 +- .../elementwise_functions/true_divide.hpp | 2 +- .../source/elementwise_functions/trunc.cpp | 2 +- .../source/elementwise_functions/trunc.hpp | 2 +- .../libtensor/source/eye_ctor.cpp | 2 +- .../libtensor/source/eye_ctor.hpp | 2 +- .../libtensor/source/full_ctor.cpp | 2 +- .../libtensor/source/full_ctor.hpp | 2 +- .../source/integer_advanced_indexing.cpp | 0 .../source/integer_advanced_indexing.hpp | 0 .../libtensor/source/linalg_functions/dot.cpp | 2 +- .../libtensor/source/linalg_functions/dot.hpp | 2 +- .../linalg_functions/dot_atomic_support.hpp | 2 +- .../source/linalg_functions/dot_dispatch.hpp | 2 +- .../libtensor/source/linear_sequences.cpp | 2 +- .../libtensor/source/linear_sequences.hpp | 2 +- .../indexing => libtensor/source}/putmask.cpp | 10 +- .../indexing => libtensor/source}/putmask.hpp | 4 +- .../libtensor/source/reductions/all.cpp | 2 +- .../libtensor/source/reductions/all.hpp | 2 +- .../libtensor/source/reductions/any.cpp | 2 +- .../libtensor/source/reductions/any.hpp | 2 +- .../libtensor/source/reductions/argmax.cpp | 2 +- .../libtensor/source/reductions/argmax.hpp | 2 +- .../libtensor/source/reductions/argmin.cpp | 2 +- .../libtensor/source/reductions/argmin.hpp | 2 +- .../libtensor/source/reductions/logsumexp.cpp | 2 +- .../libtensor/source/reductions/logsumexp.hpp | 2 +- .../libtensor/source/reductions/max.cpp | 2 +- .../libtensor/source/reductions/max.hpp | 2 +- .../libtensor/source/reductions/min.cpp | 2 +- .../libtensor/source/reductions/min.hpp | 2 +- .../libtensor/source/reductions/prod.cpp | 2 +- .../libtensor/source/reductions/prod.hpp | 2 +- .../source/reductions/reduce_hypot.cpp | 2 +- .../source/reductions/reduce_hypot.hpp | 2 +- .../reductions/reduction_atomic_support.hpp | 2 +- .../source/reductions/reduction_common.cpp | 2 +- .../source/reductions/reduction_common.hpp | 2 +- .../source/reductions/reduction_over_axis.hpp | 2 +- .../libtensor/source/reductions/sum.cpp | 2 +- .../libtensor/source/reductions/sum.hpp | 2 +- dpnp/{tensor => }/libtensor/source/repeat.cpp | 2 +- dpnp/{tensor => }/libtensor/source/repeat.hpp | 2 +- .../source/simplify_iteration_space.cpp | 2 +- .../source/simplify_iteration_space.hpp | 2 +- .../libtensor/source/sorting/isin.cpp | 2 +- .../libtensor/source/sorting/isin.hpp | 2 +- .../source/sorting/merge_argsort.cpp | 2 +- .../source/sorting/merge_argsort.hpp | 2 +- .../libtensor/source/sorting/merge_sort.cpp | 2 +- .../libtensor/source/sorting/merge_sort.hpp | 2 +- .../source/sorting/py_argsort_common.hpp | 2 +- .../source/sorting/py_sort_common.hpp | 2 +- .../source/sorting/radix_argsort.cpp | 2 +- .../source/sorting/radix_argsort.hpp | 2 +- .../libtensor/source/sorting/radix_sort.cpp | 2 +- .../libtensor/source/sorting/radix_sort.hpp | 2 +- .../source/sorting/radix_sort_support.hpp | 2 +- .../libtensor/source/sorting/searchsorted.cpp | 2 +- .../libtensor/source/sorting/searchsorted.hpp | 2 +- .../libtensor/source/sorting/topk.cpp | 2 +- .../libtensor/source/sorting/topk.hpp | 2 +- .../source}/statistics/bincount.cpp | 0 .../source}/statistics/bincount.hpp | 0 .../source}/statistics/histogram.cpp | 0 .../source}/statistics/histogram.hpp | 0 .../source}/statistics/histogram_common.cpp | 0 .../source}/statistics/histogram_common.hpp | 3 +- .../source}/statistics/histogramdd.cpp | 0 .../source}/statistics/histogramdd.hpp | 0 .../statistics/sliding_dot_product1d.cpp | 0 .../statistics/sliding_dot_product1d.hpp | 0 .../source}/statistics/sliding_window1d.cpp | 0 .../source}/statistics/sliding_window1d.hpp | 4 +- .../source}/statistics/statistics_py.cpp | 2 +- .../libtensor/source/tensor_accumulation.cpp | 2 +- .../libtensor/source/tensor_ctors.cpp | 12 +- .../libtensor/source/tensor_elementwise.cpp | 2 +- .../libtensor/source/tensor_linalg.cpp | 2 +- .../libtensor/source/tensor_reductions.cpp | 2 +- .../libtensor/source/tensor_sorting.cpp | 2 +- .../libtensor/source/triul_ctor.cpp | 2 +- .../libtensor/source/triul_ctor.hpp | 2 +- dpnp/{tensor => }/libtensor/source/where.cpp | 0 dpnp/{tensor => }/libtensor/source/where.hpp | 0 .../source}/window/common.hpp | 0 .../source}/window/kaiser.cpp | 2 +- .../source}/window/kaiser.hpp | 0 .../source}/window/window_py.cpp | 14 +- .../libtensor/source/zeros_ctor.cpp | 2 +- .../libtensor/source/zeros_ctor.hpp | 2 +- dpnp/linalg/dpnp_iface_linalg.py | 2 +- dpnp/linalg/dpnp_utils_linalg.py | 4 +- dpnp/scipy/linalg/_utils.py | 4 +- dpnp/scipy/sparse/_csr.py | 4 +- dpnp/scipy/sparse/linalg/_iterative.py | 2 +- dpnp/scipy/special/_erf.py | 22 +- dpnp/tensor/CMakeLists.txt | 354 +------- dpnp/tensor/_accumulation.py | 4 +- dpnp/tensor/_array_api.py | 3 +- dpnp/tensor/_clip.py | 4 +- dpnp/tensor/_copy_utils.py | 2 +- dpnp/tensor/_ctors.py | 2 +- dpnp/tensor/_data_types.py | 12 +- dpnp/tensor/_elementwise_common.py | 2 +- dpnp/tensor/_elementwise_funcs.py | 2 +- dpnp/tensor/_indexing_functions.py | 2 +- dpnp/tensor/_linear_algebra_functions.py | 6 +- dpnp/tensor/_manipulation_functions.py | 2 +- dpnp/tensor/_print.py | 2 +- dpnp/tensor/_reduction.py | 4 +- dpnp/tensor/_reshape.py | 3 +- dpnp/tensor/_search_functions.py | 2 +- dpnp/tensor/_searchsorted.py | 17 +- dpnp/tensor/_set_functions.py | 22 +- dpnp/tensor/_sorting.py | 8 +- dpnp/tensor/_statistical_functions.py | 6 +- dpnp/tensor/_type_utils.py | 2 +- dpnp/tensor/_usmarray.pyx | 3 +- dpnp/tensor/_utility_functions.py | 4 +- .../elementwise_functions.hpp | 806 ------------------ dpnp/tests/tensor/elementwise/test_divide.py | 2 +- .../test_tensor_array_api_inspection.py | 2 +- .../test_tensor_statistical_functions.py | 2 +- .../tests/tensor/test_usm_ndarray_indexing.py | 2 +- .../tensor/test_usm_ndarray_manipulation.py | 2 +- .../tensor/test_usm_ndarray_reductions.py | 2 +- dpnp/tests/test_array_api_info.py | 2 +- dpnp/tests/test_scipy_sparse_linalg.py | 2 +- dpnp/tests/test_umath.py | 2 +- scripts/gen_coverage.py | 32 +- setup.py | 8 +- 701 files changed, 1544 insertions(+), 3336 deletions(-) delete mode 100644 dpnp/backend/extensions/elementwise_functions/elementwise_functions_type_utils.cpp delete mode 100644 dpnp/backend/extensions/elementwise_functions/elementwise_functions_type_utils.hpp delete mode 100644 dpnp/backend/extensions/elementwise_functions/simplify_iteration_space.cpp delete mode 100644 dpnp/backend/extensions/elementwise_functions/simplify_iteration_space.hpp delete mode 100644 dpnp/backend/extensions/elementwise_functions/type_dispatch_building.hpp delete mode 100644 dpnp/backend/extensions/indexing/CMakeLists.txt delete mode 100644 dpnp/backend/extensions/indexing/indexing_py.cpp delete mode 100644 dpnp/backend/extensions/statistics/CMakeLists.txt delete mode 100644 dpnp/backend/extensions/ufunc/CMakeLists.txt delete mode 100644 dpnp/backend/extensions/ufunc/elementwise_functions/common.cpp delete mode 100644 dpnp/backend/extensions/ufunc/elementwise_functions/common.hpp delete mode 100644 dpnp/backend/extensions/ufunc/ufunc_py.cpp delete mode 100644 dpnp/backend/extensions/window/CMakeLists.txt create mode 100644 dpnp/cmake/tensor_build_flags.cmake rename dpnp/{backend => libtensor}/extensions/blas/CMakeLists.txt (96%) rename dpnp/{backend => libtensor}/extensions/blas/blas_py.cpp (98%) rename dpnp/{backend => libtensor}/extensions/blas/dot.hpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/dot_common.hpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/dotc.hpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/dotu.hpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/gemm.cpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/gemm.hpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/gemm_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/gemv.cpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/gemv.hpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/syrk.cpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/syrk.hpp (100%) rename dpnp/{backend => libtensor}/extensions/blas/types_matrix.hpp (100%) rename dpnp/{backend => libtensor}/extensions/fft/CMakeLists.txt (98%) rename dpnp/{backend => libtensor}/extensions/fft/common.hpp (100%) rename dpnp/{backend => libtensor}/extensions/fft/fft_py.cpp (98%) rename dpnp/{backend => libtensor}/extensions/fft/fft_utils.hpp (100%) rename dpnp/{backend => libtensor}/extensions/fft/in_place.hpp (100%) rename dpnp/{backend => libtensor}/extensions/fft/in_place.tpp (100%) rename dpnp/{backend => libtensor}/extensions/fft/out_of_place.hpp (100%) rename dpnp/{backend => libtensor}/extensions/fft/out_of_place.tpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/CMakeLists.txt (97%) rename dpnp/{backend => libtensor}/extensions/lapack/common_helpers.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/evd_batch_common.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/evd_common.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/evd_common_utils.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/geqrf.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/geqrf.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/geqrf_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/gesv.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/gesv.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/gesv_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/gesv_common_utils.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/gesvd.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/gesvd.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/gesvd_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/gesvd_common_utils.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/getrf.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/getrf.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/getrf_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/getri.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/getri_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/getrs.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/getrs.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/getrs_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/heevd.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/heevd.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/heevd_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/heevd_batch.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/lapack_py.cpp (99%) rename dpnp/{backend => libtensor}/extensions/lapack/linalg_exceptions.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/orgqr.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/orgqr.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/orgqr_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/potrf.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/potrf.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/potrf_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/syevd.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/syevd.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/syevd_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/syevd_batch.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/types_matrix.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/ungqr.cpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/ungqr.hpp (100%) rename dpnp/{backend => libtensor}/extensions/lapack/ungqr_batch.cpp (100%) rename dpnp/{backend => libtensor}/extensions/sparse/CMakeLists.txt (95%) rename dpnp/{backend => libtensor}/extensions/sparse/gemv.cpp (100%) rename dpnp/{backend => libtensor}/extensions/sparse/gemv.hpp (100%) rename dpnp/{backend => libtensor}/extensions/sparse/sparse_py.cpp (100%) rename dpnp/{backend => libtensor}/extensions/sparse/types_matrix.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/CMakeLists.txt (92%) rename dpnp/{backend => libtensor}/extensions/vm/abs.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/abs.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/acos.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/acos.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/acosh.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/acosh.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/add.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/add.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/arg.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/arg.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/asin.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/asin.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/asinh.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/asinh.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/atan.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/atan.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/atan2.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/atan2.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/atanh.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/atanh.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/cbrt.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/cbrt.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/ceil.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/ceil.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/common.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/conj.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/conj.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/copysign.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/copysign.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/cos.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/cos.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/cosh.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/cosh.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/div.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/div.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/erf_funcs.cpp (96%) rename dpnp/{backend => libtensor}/extensions/vm/erf_funcs.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/exp.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/exp.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/exp2.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/exp2.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/expm1.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/expm1.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/floor.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/floor.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/fmax.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/fmax.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/fmin.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/fmin.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/fmod.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/fmod.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/hypot.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/hypot.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/i0.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/i0.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/inv.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/inv.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/ln.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/ln.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/log10.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/log10.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/log1p.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/log1p.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/log2.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/log2.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/modf.cpp (87%) rename dpnp/{backend => libtensor}/extensions/vm/modf.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/mul.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/mul.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/nextafter.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/nextafter.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/pow.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/pow.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/rint.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/rint.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/sin.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/sin.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/sinh.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/sinh.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/sqr.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/sqr.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/sqrt.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/sqrt.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/sub.cpp (95%) rename dpnp/{backend => libtensor}/extensions/vm/sub.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/tan.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/tan.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/tanh.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/tanh.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/trunc.cpp (94%) rename dpnp/{backend => libtensor}/extensions/vm/trunc.hpp (100%) rename dpnp/{backend => libtensor}/extensions/vm/vm_py.cpp (98%) rename dpnp/{backend/extensions/common => libtensor/include}/ext/common.hpp (100%) rename dpnp/{backend/extensions/common => libtensor/include}/ext/details/common_internal.hpp (100%) rename dpnp/{backend/extensions/common => libtensor/include}/ext/details/validation_utils_internal.hpp (100%) rename dpnp/{backend/extensions/common => libtensor/include}/ext/dispatch_table.hpp (100%) rename dpnp/{backend/extensions/common => libtensor/include}/ext/validation_utils.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/accumulators.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/alignment.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/boolean_advanced_indexing.hpp (100%) rename dpnp/{backend/kernels/indexing => libtensor/include/kernels}/choose.hpp (98%) rename dpnp/{tensor => }/libtensor/include/kernels/clip.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/constructors.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/copy_and_cast.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/copy_as_contiguous.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/dpnp_tensor_types.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/abs.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/acos.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/acosh.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/add.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/angle.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/asin.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/asinh.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/atan.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/atan2.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/atanh.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/bitwise_and.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/bitwise_count.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/bitwise_invert.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/bitwise_or.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/bitwise_right_shift.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/bitwise_xor.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/cabs_impl.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/cbrt.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/ceil.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/common.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/common_detail.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/common_inplace.hpp (100%) rename dpnp/{backend/extensions/elementwise_functions/common.hpp => libtensor/include/kernels/elementwise_functions/common_two_outputs.hpp} (97%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/complex_math.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/conj.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/copysign.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/cos.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/cosh.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/degrees.hpp (96%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/divmod.hpp (98%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/equal.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/erf.hpp (98%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/erfcx.hpp (99%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/erfinv.hpp (98%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/exp.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/exp2.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/expm1.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/fabs.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/floor.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/floor_divide.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/fmax.hpp (97%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/fmin.hpp (97%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/fmod.hpp (96%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/frexp.hpp (96%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/gcd.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/greater.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/greater_equal.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/heaviside.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/hypot.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/i0.hpp (99%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/imag.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/interpolate.hpp (97%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/isclose.hpp (99%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/isfinite.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/isinf.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/isnan.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/lcm.hpp (96%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/ldexp.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/less.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/less_equal.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/log.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/log10.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/log1p.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/log2.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/logaddexp.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/logaddexp2.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/logical_and.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/logical_not.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/logical_or.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/logical_xor.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/maximum.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/minimum.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/modf.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/multiply.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/nan_to_num.hpp (99%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/negative.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/nextafter.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/not_equal.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/positive.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/pow.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/proj.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/radians.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/real.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/reciprocal.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/remainder.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/round.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/rsqrt.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/sign.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/signbit.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/sin.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/sinc.hpp (98%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/sinh.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/elementwise_functions/spacing.hpp (96%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/sqrt.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/square.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/subtract.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/sycl_complex.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/tan.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/tanh.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/true_divide.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/trunc.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/elementwise_functions/vec_size_util.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/integer_advanced_indexing.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/linalg_functions/dot_product.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/linalg_functions/gemm.hpp (100%) rename dpnp/{backend/kernels/indexing => libtensor/include/kernels}/putmask.hpp (99%) rename dpnp/{tensor => }/libtensor/include/kernels/reductions.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/repeat.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/isin.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/merge_sort.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/radix_select.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/radix_sort.hpp (99%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/radix_utils.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/search_sorted_detail.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/searchsorted.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/sort_impl_fn_ptr_t.hpp (97%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/sort_utils.hpp (100%) rename dpnp/{tensor => }/libtensor/include/kernels/sorting/topk.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/statistics/histogram.hpp (97%) rename dpnp/{backend => libtensor/include}/kernels/statistics/sliding_window1d.hpp (98%) rename dpnp/{tensor => }/libtensor/include/kernels/where.hpp (100%) rename dpnp/{backend => libtensor/include}/kernels/window/bartlett.hpp (96%) rename dpnp/{backend => libtensor/include}/kernels/window/blackman.hpp (96%) rename dpnp/{backend => libtensor/include}/kernels/window/hamming.hpp (96%) rename dpnp/{backend => libtensor/include}/kernels/window/hanning.hpp (96%) rename dpnp/{backend => libtensor/include}/kernels/window/kaiser.hpp (94%) rename dpnp/{tensor => }/libtensor/include/utils/indexing_utils.hpp (100%) rename dpnp/{tensor => }/libtensor/include/utils/math_utils.hpp (100%) rename dpnp/{tensor => }/libtensor/include/utils/memory_overlap.hpp (100%) rename dpnp/{tensor => }/libtensor/include/utils/offset_utils.hpp (100%) rename dpnp/{tensor => }/libtensor/include/utils/output_validation.hpp (100%) rename dpnp/{tensor => }/libtensor/include/utils/rich_comparisons.hpp (98%) rename dpnp/{tensor => }/libtensor/include/utils/strided_iters.hpp (100%) rename dpnp/{tensor => }/libtensor/include/utils/sycl_alloc_utils.hpp (100%) rename dpnp/{tensor => }/libtensor/include/utils/sycl_utils.hpp (100%) rename dpnp/{tensor => }/libtensor/include/utils/type_dispatch.hpp (100%) rename dpnp/{tensor => }/libtensor/include/utils/type_dispatch_building.hpp (90%) rename dpnp/{tensor => }/libtensor/include/utils/type_utils.hpp (100%) create mode 100644 dpnp/libtensor/source/CMakeLists.txt rename dpnp/{tensor => }/libtensor/source/accumulators.cpp (99%) rename dpnp/{tensor => }/libtensor/source/accumulators.hpp (97%) rename dpnp/{tensor => }/libtensor/source/accumulators/accumulate_over_axis.hpp (99%) rename dpnp/{tensor => }/libtensor/source/accumulators/accumulators_common.cpp (96%) rename dpnp/{tensor => }/libtensor/source/accumulators/accumulators_common.hpp (96%) rename dpnp/{tensor => }/libtensor/source/accumulators/cumulative_logsumexp.cpp (99%) rename dpnp/{tensor => }/libtensor/source/accumulators/cumulative_logsumexp.hpp (96%) rename dpnp/{tensor => }/libtensor/source/accumulators/cumulative_prod.cpp (99%) rename dpnp/{tensor => }/libtensor/source/accumulators/cumulative_prod.hpp (96%) rename dpnp/{tensor => }/libtensor/source/accumulators/cumulative_sum.cpp (99%) rename dpnp/{tensor => }/libtensor/source/accumulators/cumulative_sum.hpp (96%) rename dpnp/{tensor => }/libtensor/source/boolean_advanced_indexing.cpp (100%) rename dpnp/{tensor => }/libtensor/source/boolean_advanced_indexing.hpp (97%) rename dpnp/{backend/extensions/indexing => libtensor/source}/choose.cpp (98%) rename dpnp/{backend/extensions/indexing => libtensor/source}/choose.hpp (95%) rename dpnp/{tensor => }/libtensor/source/clip.cpp (100%) rename dpnp/{tensor => }/libtensor/source/clip.hpp (100%) rename dpnp/{tensor => }/libtensor/source/copy_and_cast_usm_to_usm.cpp (99%) rename dpnp/{tensor => }/libtensor/source/copy_and_cast_usm_to_usm.hpp (96%) rename dpnp/{tensor => }/libtensor/source/copy_as_contig.cpp (99%) rename dpnp/{tensor => }/libtensor/source/copy_as_contig.hpp (100%) rename dpnp/{tensor => }/libtensor/source/copy_for_reshape.cpp (98%) rename dpnp/{tensor => }/libtensor/source/copy_for_reshape.hpp (97%) rename dpnp/{tensor => }/libtensor/source/copy_for_roll.cpp (99%) rename dpnp/{tensor => }/libtensor/source/copy_for_roll.hpp (97%) rename dpnp/{tensor => }/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp (99%) rename dpnp/{tensor => }/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.hpp (97%) rename dpnp/{tensor => }/libtensor/source/device_support_queries.cpp (98%) rename dpnp/{tensor => }/libtensor/source/device_support_queries.hpp (97%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/abs.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/abs.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/acos.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/acos.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/acosh.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/acosh.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/add.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/add.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/angle.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/angle.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/asin.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/asin.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/asinh.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/asinh.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/atan.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/atan.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/atan2.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/atan2.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/atanh.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/atanh.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_and.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_and.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/bitwise_count.cpp (87%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/bitwise_count.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_invert.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_invert.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_left_shift.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_left_shift.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_or.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_or.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_right_shift.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_right_shift.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_xor.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/bitwise_xor.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/cbrt.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/cbrt.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/ceil.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/ceil.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/conj.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/conj.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/copysign.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/copysign.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/cos.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/cos.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/cosh.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/cosh.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/degrees.cpp (85%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/degrees.hpp (95%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/divmod.cpp (77%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/divmod.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/elementwise_common.cpp (83%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/elementwise_common.hpp (96%) rename dpnp/{backend/extensions => libtensor/source}/elementwise_functions/elementwise_functions.hpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp (90%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/elementwise_functions_type_utils.hpp (92%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/equal.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/equal.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/erf_funcs.cpp (94%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/erf_funcs.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/exp.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/exp.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/exp2.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/exp2.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/expm1.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/expm1.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/fabs.cpp (89%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/fabs.hpp (95%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/float_power.cpp (88%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/float_power.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/floor.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/floor.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/floor_divide.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/floor_divide.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/fmax.cpp (89%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/fmax.hpp (95%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/fmin.cpp (89%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/fmin.hpp (95%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/fmod.cpp (93%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/fmod.hpp (95%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/frexp.cpp (82%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/frexp.hpp (95%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/gcd.cpp (92%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/gcd.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/greater.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/greater.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/greater_equal.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/greater_equal.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/heaviside.cpp (90%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/heaviside.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/hypot.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/hypot.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/i0.cpp (88%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/i0.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/imag.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/imag.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/interpolate.cpp (98%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/interpolate.hpp (95%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/isclose.cpp (97%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/isclose.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/isfinite.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/isfinite.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/isinf.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/isinf.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/isnan.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/isnan.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/lcm.cpp (92%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/lcm.hpp (95%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/ldexp.cpp (92%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/ldexp.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/less.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/less.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/less_equal.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/less_equal.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/log.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/log.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/log10.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/log10.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/log1p.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/log1p.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/log2.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/log2.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logaddexp.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logaddexp.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/logaddexp2.cpp (89%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/logaddexp2.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logical_and.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logical_and.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logical_not.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logical_not.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logical_or.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logical_or.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logical_xor.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/logical_xor.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/maximum.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/maximum.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/minimum.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/minimum.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/modf.cpp (83%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/modf.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/multiply.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/multiply.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/nan_to_num.cpp (98%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/nan_to_num.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/negative.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/negative.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/nextafter.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/nextafter.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/not_equal.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/not_equal.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/populate.hpp (100%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/positive.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/positive.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/pow.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/pow.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/proj.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/proj.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/radians.cpp (85%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/radians.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/real.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/real.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/reciprocal.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/reciprocal.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/remainder.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/remainder.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/round.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/round.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/rsqrt.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/rsqrt.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/sign.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/sign.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/signbit.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/signbit.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/sin.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/sin.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/sinc.cpp (89%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/sinc.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/sinh.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/sinh.hpp (96%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/spacing.cpp (85%) rename dpnp/{backend/extensions/ufunc => libtensor/source}/elementwise_functions/spacing.hpp (95%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/sqrt.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/sqrt.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/square.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/square.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/subtract.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/subtract.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/tan.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/tan.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/tanh.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/tanh.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/true_divide.cpp (99%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/true_divide.hpp (96%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/trunc.cpp (98%) rename dpnp/{tensor => }/libtensor/source/elementwise_functions/trunc.hpp (96%) rename dpnp/{tensor => }/libtensor/source/eye_ctor.cpp (98%) rename dpnp/{tensor => }/libtensor/source/eye_ctor.hpp (97%) rename dpnp/{tensor => }/libtensor/source/full_ctor.cpp (99%) rename dpnp/{tensor => }/libtensor/source/full_ctor.hpp (97%) rename dpnp/{tensor => }/libtensor/source/integer_advanced_indexing.cpp (100%) rename dpnp/{tensor => }/libtensor/source/integer_advanced_indexing.hpp (100%) rename dpnp/{tensor => }/libtensor/source/linalg_functions/dot.cpp (99%) rename dpnp/{tensor => }/libtensor/source/linalg_functions/dot.hpp (96%) rename dpnp/{tensor => }/libtensor/source/linalg_functions/dot_atomic_support.hpp (97%) rename dpnp/{tensor => }/libtensor/source/linalg_functions/dot_dispatch.hpp (99%) rename dpnp/{tensor => }/libtensor/source/linear_sequences.cpp (99%) rename dpnp/{tensor => }/libtensor/source/linear_sequences.hpp (97%) rename dpnp/{backend/extensions/indexing => libtensor/source}/putmask.cpp (97%) rename dpnp/{backend/extensions/indexing => libtensor/source}/putmask.hpp (95%) rename dpnp/{tensor => }/libtensor/source/reductions/all.cpp (98%) rename dpnp/{tensor => }/libtensor/source/reductions/all.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/any.cpp (98%) rename dpnp/{tensor => }/libtensor/source/reductions/any.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/argmax.cpp (99%) rename dpnp/{tensor => }/libtensor/source/reductions/argmax.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/argmin.cpp (99%) rename dpnp/{tensor => }/libtensor/source/reductions/argmin.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/logsumexp.cpp (99%) rename dpnp/{tensor => }/libtensor/source/reductions/logsumexp.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/max.cpp (99%) rename dpnp/{tensor => }/libtensor/source/reductions/max.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/min.cpp (99%) rename dpnp/{tensor => }/libtensor/source/reductions/min.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/prod.cpp (99%) rename dpnp/{tensor => }/libtensor/source/reductions/prod.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/reduce_hypot.cpp (99%) rename dpnp/{tensor => }/libtensor/source/reductions/reduce_hypot.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/reduction_atomic_support.hpp (98%) rename dpnp/{tensor => }/libtensor/source/reductions/reduction_common.cpp (97%) rename dpnp/{tensor => }/libtensor/source/reductions/reduction_common.hpp (96%) rename dpnp/{tensor => }/libtensor/source/reductions/reduction_over_axis.hpp (99%) rename dpnp/{tensor => }/libtensor/source/reductions/sum.cpp (99%) rename dpnp/{tensor => }/libtensor/source/reductions/sum.hpp (96%) rename dpnp/{tensor => }/libtensor/source/repeat.cpp (99%) rename dpnp/{tensor => }/libtensor/source/repeat.hpp (98%) rename dpnp/{tensor => }/libtensor/source/simplify_iteration_space.cpp (99%) rename dpnp/{tensor => }/libtensor/source/simplify_iteration_space.hpp (98%) rename dpnp/{tensor => }/libtensor/source/sorting/isin.cpp (99%) rename dpnp/{tensor => }/libtensor/source/sorting/isin.hpp (96%) rename dpnp/{tensor => }/libtensor/source/sorting/merge_argsort.cpp (98%) rename dpnp/{tensor => }/libtensor/source/sorting/merge_argsort.hpp (96%) rename dpnp/{tensor => }/libtensor/source/sorting/merge_sort.cpp (98%) rename dpnp/{tensor => }/libtensor/source/sorting/merge_sort.hpp (96%) rename dpnp/{tensor => }/libtensor/source/sorting/py_argsort_common.hpp (98%) rename dpnp/{tensor => }/libtensor/source/sorting/py_sort_common.hpp (98%) rename dpnp/{tensor => }/libtensor/source/sorting/radix_argsort.cpp (99%) rename dpnp/{tensor => }/libtensor/source/sorting/radix_argsort.hpp (96%) rename dpnp/{tensor => }/libtensor/source/sorting/radix_sort.cpp (99%) rename dpnp/{tensor => }/libtensor/source/sorting/radix_sort.hpp (96%) rename dpnp/{tensor => }/libtensor/source/sorting/radix_sort_support.hpp (97%) rename dpnp/{tensor => }/libtensor/source/sorting/searchsorted.cpp (99%) rename dpnp/{tensor => }/libtensor/source/sorting/searchsorted.hpp (96%) rename dpnp/{tensor => }/libtensor/source/sorting/topk.cpp (99%) rename dpnp/{tensor => }/libtensor/source/sorting/topk.hpp (96%) rename dpnp/{backend/extensions => libtensor/source}/statistics/bincount.cpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/bincount.hpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/histogram.cpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/histogram.hpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/histogram_common.cpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/histogram_common.hpp (98%) rename dpnp/{backend/extensions => libtensor/source}/statistics/histogramdd.cpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/histogramdd.hpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/sliding_dot_product1d.cpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/sliding_dot_product1d.hpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/sliding_window1d.cpp (100%) rename dpnp/{backend/extensions => libtensor/source}/statistics/sliding_window1d.hpp (98%) rename dpnp/{backend/extensions => libtensor/source}/statistics/statistics_py.cpp (96%) rename dpnp/{tensor => }/libtensor/source/tensor_accumulation.cpp (96%) rename dpnp/{tensor => }/libtensor/source/tensor_ctors.cpp (98%) rename dpnp/{tensor => }/libtensor/source/tensor_elementwise.cpp (96%) rename dpnp/{tensor => }/libtensor/source/tensor_linalg.cpp (96%) rename dpnp/{tensor => }/libtensor/source/tensor_reductions.cpp (96%) rename dpnp/{tensor => }/libtensor/source/tensor_sorting.cpp (97%) rename dpnp/{tensor => }/libtensor/source/triul_ctor.cpp (99%) rename dpnp/{tensor => }/libtensor/source/triul_ctor.hpp (97%) rename dpnp/{tensor => }/libtensor/source/where.cpp (100%) rename dpnp/{tensor => }/libtensor/source/where.hpp (100%) rename dpnp/{backend/extensions => libtensor/source}/window/common.hpp (100%) rename dpnp/{backend/extensions => libtensor/source}/window/kaiser.cpp (98%) rename dpnp/{backend/extensions => libtensor/source}/window/kaiser.hpp (100%) rename dpnp/{backend/extensions => libtensor/source}/window/window_py.cpp (92%) rename dpnp/{tensor => }/libtensor/source/zeros_ctor.cpp (98%) rename dpnp/{tensor => }/libtensor/source/zeros_ctor.hpp (96%) delete mode 100644 dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp diff --git a/cmake/dpnp-config.cmake b/cmake/dpnp-config.cmake index 33cf5fe98580..3b185944aa48 100644 --- a/cmake/dpnp-config.cmake +++ b/cmake/dpnp-config.cmake @@ -50,7 +50,7 @@ get_filename_component(_dpnp_dir "${Dpnp_INCLUDE_DIR}" DIRECTORY) find_path( Dpnp_TENSOR_INCLUDE_DIR kernels - PATHS "${_dpnp_dir}/tensor/libtensor/include" + PATHS "${_dpnp_dir}/libtensor/include" NO_DEFAULT_PATH ) diff --git a/dpnp/CMakeLists.txt b/dpnp/CMakeLists.txt index b2942cd6a854..61e0481d1390 100644 --- a/dpnp/CMakeLists.txt +++ b/dpnp/CMakeLists.txt @@ -188,12 +188,13 @@ function(build_dpnp_cython_ext_with_backend _trgt _src _dest) target_link_libraries(${_trgt} PRIVATE dpnp_backend_library) endfunction() -# Builds a pybind11 extension of dpnp/backend/extensions with the options all of -# them share. INCLUDE_DIRS come before the common include directories, and -# LARGE_RANGES is for modules whose kernels can be launched over more than -# INT_MAX work-items. -function(build_dpnp_pybind11_ext _trgt _dest) - cmake_parse_arguments(PARSE_ARGV 2 _arg "LARGE_RANGES" "" "SOURCES;INCLUDE_DIRS") +# Builds a pybind11 extension of dpnp/libtensor/extensions with the options all +# of them share and installs it into dpnp/libtensor, next to the libtensor +# modules. +# INCLUDE_DIRS come before the common include directories, and LARGE_RANGES is +# for modules whose kernels can be launched over more than INT_MAX work-items. +function(build_dpnp_pybind11_ext _trgt) + cmake_parse_arguments(PARSE_ARGV 1 _arg "LARGE_RANGES" "" "SOURCES;INCLUDE_DIRS") pybind11_add_module(${_trgt} MODULE ${_arg_SOURCES}) add_sycl_to_target(TARGET ${_trgt} SOURCES ${_arg_SOURCES}) @@ -214,7 +215,7 @@ function(build_dpnp_pybind11_ext _trgt _dest) PRIVATE ${_arg_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/dpnp/include - ${CMAKE_SOURCE_DIR}/dpnp/tensor/libtensor/include + ${CMAKE_SOURCE_DIR}/dpnp/libtensor/include ) # treat below headers as system to suppress the warnings there during the build @@ -254,27 +255,21 @@ function(build_dpnp_pybind11_ext _trgt _dest) endif() if(DPNP_WITH_REDIST) - set_target_properties( - ${_trgt} - PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../" - ) + set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../..") endif() - install(TARGETS ${_trgt} DESTINATION ${_dest}) + install(TARGETS ${_trgt} DESTINATION "dpnp/libtensor") endfunction() add_subdirectory(tensor) add_subdirectory(backend) -add_subdirectory(backend/extensions/blas) -add_subdirectory(backend/extensions/fft) -add_subdirectory(backend/extensions/indexing) -add_subdirectory(backend/extensions/lapack) -add_subdirectory(backend/extensions/statistics) -add_subdirectory(backend/extensions/ufunc) -add_subdirectory(backend/extensions/vm) -add_subdirectory(backend/extensions/window) -add_subdirectory(backend/extensions/sparse) +add_subdirectory(libtensor/source) +add_subdirectory(libtensor/extensions/blas) +add_subdirectory(libtensor/extensions/fft) +add_subdirectory(libtensor/extensions/lapack) +add_subdirectory(libtensor/extensions/vm) +add_subdirectory(libtensor/extensions/sparse) add_subdirectory(dpnp_algo) add_subdirectory(dpnp_utils) diff --git a/dpnp/__main__.py b/dpnp/__main__.py index 7520a63a784d..e925b31c8ede 100644 --- a/dpnp/__main__.py +++ b/dpnp/__main__.py @@ -51,7 +51,7 @@ def print_include_flags() -> None: def get_tensor_include_dir() -> str: """Returns path to dpnp libtensor include directory""" - libtensor_dir = os.path.join(_dpnp_dir(), "tensor", "libtensor", "include") + libtensor_dir = os.path.join(_dpnp_dir(), "libtensor", "include") return libtensor_dir diff --git a/dpnp/backend/extensions/elementwise_functions/elementwise_functions_type_utils.cpp b/dpnp/backend/extensions/elementwise_functions/elementwise_functions_type_utils.cpp deleted file mode 100644 index 6a2bc13d7d2b..000000000000 --- a/dpnp/backend/extensions/elementwise_functions/elementwise_functions_type_utils.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2024, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** - -#include -#include - -#include - -#include "dpnp4pybind11.hpp" - -#include "elementwise_functions_type_utils.hpp" - -// dpnp tensor headers -#include "utils/type_dispatch.hpp" - -namespace dpnp::extensions::py_internal::type_utils -{ -namespace py = pybind11; -namespace td_ns = dpnp::tensor::type_dispatch; - -py::dtype _dtype_from_typenum(td_ns::typenum_t dst_typenum_t) -{ - switch (dst_typenum_t) { - case td_ns::typenum_t::BOOL: - return py::dtype("?"); - case td_ns::typenum_t::INT8: - return py::dtype("i1"); - case td_ns::typenum_t::UINT8: - return py::dtype("u1"); - case td_ns::typenum_t::INT16: - return py::dtype("i2"); - case td_ns::typenum_t::UINT16: - return py::dtype("u2"); - case td_ns::typenum_t::INT32: - return py::dtype("i4"); - case td_ns::typenum_t::UINT32: - return py::dtype("u4"); - case td_ns::typenum_t::INT64: - return py::dtype("i8"); - case td_ns::typenum_t::UINT64: - return py::dtype("u8"); - case td_ns::typenum_t::HALF: - return py::dtype("f2"); - case td_ns::typenum_t::FLOAT: - return py::dtype("f4"); - case td_ns::typenum_t::DOUBLE: - return py::dtype("f8"); - case td_ns::typenum_t::CFLOAT: - return py::dtype("c8"); - case td_ns::typenum_t::CDOUBLE: - return py::dtype("c16"); - default: - throw py::value_error("Unrecognized dst_typeid"); - } -} -} // namespace dpnp::extensions::py_internal::type_utils diff --git a/dpnp/backend/extensions/elementwise_functions/elementwise_functions_type_utils.hpp b/dpnp/backend/extensions/elementwise_functions/elementwise_functions_type_utils.hpp deleted file mode 100644 index ffc0573c7aa1..000000000000 --- a/dpnp/backend/extensions/elementwise_functions/elementwise_functions_type_utils.hpp +++ /dev/null @@ -1,59 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2024, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** - -#pragma once - -#include -#include - -#include "dpnp4pybind11.hpp" - -// dpnp tensor headers -#include "utils/type_dispatch.hpp" - -namespace dpnp::extensions::py_internal::type_utils -{ -namespace py = pybind11; -namespace td_ns = dpnp::tensor::type_dispatch; - -/*! @brief Produce dtype from a type number */ -extern py::dtype _dtype_from_typenum(td_ns::typenum_t); - -/*! @brief Lookup typeid of the result from typeid of - * argument and the mapping table */ -template -output_idT _result_typeid(int arg_typeid, const output_idT *fn_output_id) -{ - if (arg_typeid < 0 || arg_typeid >= td_ns::num_types) { - throw py::value_error("Input typeid " + std::to_string(arg_typeid) + - " is outside of expected bounds."); - } - - return fn_output_id[arg_typeid]; -} -} // namespace dpnp::extensions::py_internal::type_utils diff --git a/dpnp/backend/extensions/elementwise_functions/simplify_iteration_space.cpp b/dpnp/backend/extensions/elementwise_functions/simplify_iteration_space.cpp deleted file mode 100644 index d489d847e610..000000000000 --- a/dpnp/backend/extensions/elementwise_functions/simplify_iteration_space.cpp +++ /dev/null @@ -1,320 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2024, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** - -#include -#include -#include - -#include "simplify_iteration_space.hpp" - -// dpnp tensor headers -#include "utils/strided_iters.hpp" - -namespace dpnp::extensions::py_internal -{ -namespace py = pybind11; -namespace st_ns = dpnp::tensor::strides; - -void simplify_iteration_space(int &nd, - const py::ssize_t *const &shape, - std::vector const &src_strides, - std::vector const &dst_strides, - // output - std::vector &simplified_shape, - std::vector &simplified_src_strides, - std::vector &simplified_dst_strides, - py::ssize_t &src_offset, - py::ssize_t &dst_offset) -{ - if (nd > 1) { - // Simplify iteration space to reduce dimensionality - // and improve access pattern - simplified_shape.reserve(nd); - simplified_shape.insert(std::begin(simplified_shape), shape, - shape + nd); - assert(simplified_shape.size() == static_cast(nd)); - - simplified_src_strides.reserve(nd); - simplified_src_strides.insert(std::end(simplified_src_strides), - std::begin(src_strides), - std::end(src_strides)); - assert(simplified_src_strides.size() == static_cast(nd)); - - simplified_dst_strides.reserve(nd); - simplified_dst_strides.insert(std::end(simplified_dst_strides), - std::begin(dst_strides), - std::end(dst_strides)); - assert(simplified_dst_strides.size() == static_cast(nd)); - - int contracted_nd = st_ns::simplify_iteration_two_strides( - nd, simplified_shape.data(), simplified_src_strides.data(), - simplified_dst_strides.data(), - src_offset, // modified by reference - dst_offset // modified by reference - ); - simplified_shape.resize(contracted_nd); - simplified_src_strides.resize(contracted_nd); - simplified_dst_strides.resize(contracted_nd); - - nd = contracted_nd; - } - else if (nd == 1) { - src_offset = 0; - dst_offset = 0; - // Populate vectors - simplified_shape.reserve(nd); - simplified_shape.push_back(shape[0]); - assert(simplified_shape.size() == static_cast(nd)); - - simplified_src_strides.reserve(nd); - simplified_dst_strides.reserve(nd); - - if (src_strides[0] < 0 && dst_strides[0] < 0) { - simplified_src_strides.push_back(-src_strides[0]); - simplified_dst_strides.push_back(-dst_strides[0]); - if (shape[0] > 1) { - src_offset += (shape[0] - 1) * src_strides[0]; - dst_offset += (shape[0] - 1) * dst_strides[0]; - } - } - else { - simplified_src_strides.push_back(src_strides[0]); - simplified_dst_strides.push_back(dst_strides[0]); - } - - assert(simplified_src_strides.size() == static_cast(nd)); - assert(simplified_dst_strides.size() == static_cast(nd)); - } -} - -void simplify_iteration_space_3( - int &nd, - const py::ssize_t *const &shape, - // src1 - std::vector const &src1_strides, - // src2 - std::vector const &src2_strides, - // dst - std::vector const &dst_strides, - // output - std::vector &simplified_shape, - std::vector &simplified_src1_strides, - std::vector &simplified_src2_strides, - std::vector &simplified_dst_strides, - py::ssize_t &src1_offset, - py::ssize_t &src2_offset, - py::ssize_t &dst_offset) -{ - if (nd > 1) { - // Simplify iteration space to reduce dimensionality - // and improve access pattern - simplified_shape.reserve(nd); - simplified_shape.insert(std::end(simplified_shape), shape, shape + nd); - assert(simplified_shape.size() == static_cast(nd)); - - simplified_src1_strides.reserve(nd); - simplified_src1_strides.insert(std::end(simplified_src1_strides), - std::begin(src1_strides), - std::end(src1_strides)); - assert(simplified_src1_strides.size() == static_cast(nd)); - - simplified_src2_strides.reserve(nd); - simplified_src2_strides.insert(std::end(simplified_src2_strides), - std::begin(src2_strides), - std::end(src2_strides)); - assert(simplified_src2_strides.size() == static_cast(nd)); - - simplified_dst_strides.reserve(nd); - simplified_dst_strides.insert(std::end(simplified_dst_strides), - std::begin(dst_strides), - std::end(dst_strides)); - assert(simplified_dst_strides.size() == static_cast(nd)); - - int contracted_nd = st_ns::simplify_iteration_three_strides( - nd, simplified_shape.data(), simplified_src1_strides.data(), - simplified_src2_strides.data(), simplified_dst_strides.data(), - src1_offset, // modified by reference - src2_offset, // modified by reference - dst_offset // modified by reference - ); - simplified_shape.resize(contracted_nd); - simplified_src1_strides.resize(contracted_nd); - simplified_src2_strides.resize(contracted_nd); - simplified_dst_strides.resize(contracted_nd); - - nd = contracted_nd; - } - else if (nd == 1) { - src1_offset = 0; - src2_offset = 0; - dst_offset = 0; - // Populate vectors - simplified_shape.reserve(nd); - simplified_shape.push_back(shape[0]); - assert(simplified_shape.size() == static_cast(nd)); - - simplified_src1_strides.reserve(nd); - simplified_src2_strides.reserve(nd); - simplified_dst_strides.reserve(nd); - - if ((src1_strides[0] < 0) && (src2_strides[0] < 0) && - (dst_strides[0] < 0)) { - simplified_src1_strides.push_back(-src1_strides[0]); - simplified_src2_strides.push_back(-src2_strides[0]); - simplified_dst_strides.push_back(-dst_strides[0]); - if (shape[0] > 1) { - src1_offset += src1_strides[0] * (shape[0] - 1); - src2_offset += src2_strides[0] * (shape[0] - 1); - dst_offset += dst_strides[0] * (shape[0] - 1); - } - } - else { - simplified_src1_strides.push_back(src1_strides[0]); - simplified_src2_strides.push_back(src2_strides[0]); - simplified_dst_strides.push_back(dst_strides[0]); - } - - assert(simplified_src1_strides.size() == static_cast(nd)); - assert(simplified_src2_strides.size() == static_cast(nd)); - assert(simplified_dst_strides.size() == static_cast(nd)); - } -} - -void simplify_iteration_space_4( - int &nd, - const py::ssize_t *const &shape, - // src1 - std::vector const &src1_strides, - // src2 - std::vector const &src2_strides, - // src3 - std::vector const &src3_strides, - // dst - std::vector const &dst_strides, - // output - std::vector &simplified_shape, - std::vector &simplified_src1_strides, - std::vector &simplified_src2_strides, - std::vector &simplified_src3_strides, - std::vector &simplified_dst_strides, - py::ssize_t &src1_offset, - py::ssize_t &src2_offset, - py::ssize_t &src3_offset, - py::ssize_t &dst_offset) -{ - using dpnp::tensor::strides::simplify_iteration_four_strides; - if (nd > 1) { - // Simplify iteration space to reduce dimensionality - // and improve access pattern - simplified_shape.reserve(nd); - simplified_shape.insert(std::end(simplified_shape), shape, shape + nd); - assert(simplified_shape.size() == static_cast(nd)); - - simplified_src1_strides.reserve(nd); - simplified_src1_strides.insert(std::end(simplified_src1_strides), - std::begin(src1_strides), - std::end(src1_strides)); - assert(simplified_src1_strides.size() == static_cast(nd)); - - simplified_src2_strides.reserve(nd); - simplified_src2_strides.insert(std::end(simplified_src2_strides), - std::begin(src2_strides), - std::end(src2_strides)); - assert(simplified_src2_strides.size() == static_cast(nd)); - - simplified_src3_strides.reserve(nd); - simplified_src3_strides.insert(std::end(simplified_src3_strides), - std::begin(src3_strides), - std::end(src3_strides)); - assert(simplified_src3_strides.size() == static_cast(nd)); - - simplified_dst_strides.reserve(nd); - simplified_dst_strides.insert(std::end(simplified_dst_strides), - std::begin(dst_strides), - std::end(dst_strides)); - assert(simplified_dst_strides.size() == static_cast(nd)); - - int contracted_nd = simplify_iteration_four_strides( - nd, simplified_shape.data(), simplified_src1_strides.data(), - simplified_src2_strides.data(), simplified_src3_strides.data(), - simplified_dst_strides.data(), - src1_offset, // modified by reference - src2_offset, // modified by reference - src3_offset, // modified by reference - dst_offset // modified by reference - ); - simplified_shape.resize(contracted_nd); - simplified_src1_strides.resize(contracted_nd); - simplified_src2_strides.resize(contracted_nd); - simplified_src3_strides.resize(contracted_nd); - simplified_dst_strides.resize(contracted_nd); - - nd = contracted_nd; - } - else if (nd == 1) { - src1_offset = 0; - src2_offset = 0; - src3_offset = 0; - dst_offset = 0; - // Populate vectors - simplified_shape.reserve(nd); - simplified_shape.push_back(shape[0]); - assert(simplified_shape.size() == static_cast(nd)); - - simplified_src1_strides.reserve(nd); - simplified_src2_strides.reserve(nd); - simplified_src3_strides.reserve(nd); - simplified_dst_strides.reserve(nd); - - if ((src1_strides[0] < 0) && (src2_strides[0] < 0) && - (src3_strides[0] < 0) && (dst_strides[0] < 0)) { - simplified_src1_strides.push_back(-src1_strides[0]); - simplified_src2_strides.push_back(-src2_strides[0]); - simplified_src3_strides.push_back(-src3_strides[0]); - simplified_dst_strides.push_back(-dst_strides[0]); - if (shape[0] > 1) { - src1_offset += src1_strides[0] * (shape[0] - 1); - src2_offset += src2_strides[0] * (shape[0] - 1); - src3_offset += src3_strides[0] * (shape[0] - 1); - dst_offset += dst_strides[0] * (shape[0] - 1); - } - } - else { - simplified_src1_strides.push_back(src1_strides[0]); - simplified_src2_strides.push_back(src2_strides[0]); - simplified_src3_strides.push_back(src3_strides[0]); - simplified_dst_strides.push_back(dst_strides[0]); - } - - assert(simplified_src1_strides.size() == static_cast(nd)); - assert(simplified_src2_strides.size() == static_cast(nd)); - assert(simplified_src3_strides.size() == static_cast(nd)); - assert(simplified_dst_strides.size() == static_cast(nd)); - } -} -} // namespace dpnp::extensions::py_internal diff --git a/dpnp/backend/extensions/elementwise_functions/simplify_iteration_space.hpp b/dpnp/backend/extensions/elementwise_functions/simplify_iteration_space.hpp deleted file mode 100644 index 5dc7b196b3e0..000000000000 --- a/dpnp/backend/extensions/elementwise_functions/simplify_iteration_space.hpp +++ /dev/null @@ -1,85 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2024, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** - -#pragma once - -#include -#include - -namespace dpnp::extensions::py_internal -{ -namespace py = pybind11; - -void simplify_iteration_space(int &, - const py::ssize_t *const &, - std::vector const &, - std::vector const &, - std::vector &, - std::vector &, - std::vector &, - py::ssize_t &, - py::ssize_t &); - -void simplify_iteration_space_3(int &, - const py::ssize_t *const &, - // src1 - std::vector const &, - // src2 - std::vector const &, - // dst - std::vector const &, - // output - std::vector &, - std::vector &, - std::vector &, - std::vector &, - py::ssize_t &, - py::ssize_t &, - py::ssize_t &); - -void simplify_iteration_space_4(int &, - const py::ssize_t *const &, - // src1 - std::vector const &, - // src2 - std::vector const &, - // src3 - std::vector const &, - // dst - std::vector const &, - // output - std::vector &, - std::vector &, - std::vector &, - std::vector &, - std::vector &, - py::ssize_t &, - py::ssize_t &, - py::ssize_t &, - py::ssize_t &); -} // namespace dpnp::extensions::py_internal diff --git a/dpnp/backend/extensions/elementwise_functions/type_dispatch_building.hpp b/dpnp/backend/extensions/elementwise_functions/type_dispatch_building.hpp deleted file mode 100644 index 80d4d1f72dde..000000000000 --- a/dpnp/backend/extensions/elementwise_functions/type_dispatch_building.hpp +++ /dev/null @@ -1,79 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2025, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** - -#pragma once - -#include - -#include "utils/type_dispatch.hpp" - -namespace dpnp::extensions::py_internal::type_dispatch -{ -/** - * Extends dpnp::tensor::type_dispatch::TypeMapResultEntry helper structure - * with support of the two result types. - */ -template -struct TypeMapTwoResultsEntry : std::bool_constant> -{ - using result_type1 = ResTy1; - using result_type2 = ResTy2; -}; - -/** - * Extends dpnp::tensor::type_dispatch::BinaryTypeMapResultEntry helper - * structure with support of the two result types. - */ -template -struct BinaryTypeMapTwoResultsEntry - : std::bool_constant, - std::is_same>> -{ - using result_type1 = ResTy1; - using result_type2 = ResTy2; -}; - -/** - * Extends dpnp::tensor::type_dispatch::DefaultResultEntry helper structure - * with support of the two result types. - */ -template -struct DefaultTwoResultsEntry : std::true_type -{ - using result_type1 = Ty; - using result_type2 = Ty; -}; -} // namespace dpnp::extensions::py_internal::type_dispatch diff --git a/dpnp/backend/extensions/indexing/CMakeLists.txt b/dpnp/backend/extensions/indexing/CMakeLists.txt deleted file mode 100644 index 78957a4b028f..000000000000 --- a/dpnp/backend/extensions/indexing/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -# ***************************************************************************** -# Copyright (c) 2025, Intel Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# - Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# - Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# - Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -# ***************************************************************************** - -set(python_module_name _indexing_impl) -set(_module_src - ${CMAKE_CURRENT_SOURCE_DIR}/choose.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/putmask.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/indexing_py.cpp -) - -build_dpnp_pybind11_ext( - ${python_module_name} - "dpnp/backend/extensions/indexing" - SOURCES ${_module_src} - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../ ${CMAKE_CURRENT_SOURCE_DIR}/../common - LARGE_RANGES -) diff --git a/dpnp/backend/extensions/indexing/indexing_py.cpp b/dpnp/backend/extensions/indexing/indexing_py.cpp deleted file mode 100644 index 23a3bcaeb1a1..000000000000 --- a/dpnp/backend/extensions/indexing/indexing_py.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2025, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** -// -// This file defines functions of dpnp.backend._indexing_impl extensions -// -//***************************************************************************** - -#include - -#include "choose.hpp" -#include "putmask.hpp" - -PYBIND11_MODULE(_indexing_impl, m, py::mod_gil_not_used()) -{ - dpnp::extensions::indexing::init_choose(m); - dpnp::extensions::indexing::init_putmask(m); -} diff --git a/dpnp/backend/extensions/statistics/CMakeLists.txt b/dpnp/backend/extensions/statistics/CMakeLists.txt deleted file mode 100644 index 088b1e667338..000000000000 --- a/dpnp/backend/extensions/statistics/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- -# ***************************************************************************** -# Copyright (c) 2024, Intel Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# - Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# - Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# - Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -# ***************************************************************************** - -set(python_module_name _statistics_impl) -set(_module_src - ${CMAKE_CURRENT_SOURCE_DIR}/bincount.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/histogram.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/histogramdd.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/histogram_common.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/sliding_dot_product1d.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/sliding_window1d.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/statistics_py.cpp -) - -build_dpnp_pybind11_ext( - ${python_module_name} - "dpnp/backend/extensions/statistics" - SOURCES ${_module_src} - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../ ${CMAKE_CURRENT_SOURCE_DIR}/../common - LARGE_RANGES -) diff --git a/dpnp/backend/extensions/ufunc/CMakeLists.txt b/dpnp/backend/extensions/ufunc/CMakeLists.txt deleted file mode 100644 index 7f1059bcdc85..000000000000 --- a/dpnp/backend/extensions/ufunc/CMakeLists.txt +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- -# ***************************************************************************** -# Copyright (c) 2024, Intel Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# - Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# - Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# - Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -# ***************************************************************************** - -set(_elementwise_sources - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/bitwise_count.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/common.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/degrees.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/divmod.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/erf_funcs.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/fabs.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/float_power.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/fmax.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/fmin.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/fmod.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/frexp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/gcd.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/heaviside.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/i0.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/interpolate.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/isclose.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/lcm.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/ldexp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/logaddexp2.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/modf.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/nan_to_num.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/radians.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/sinc.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/spacing.cpp -) - -set(python_module_name _ufunc_impl) - -set(_module_src - # TODO: remove sources from `elementwise_functions` folder - ${CMAKE_CURRENT_SOURCE_DIR}/../elementwise_functions/elementwise_functions_type_utils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../elementwise_functions/simplify_iteration_space.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ufunc_py.cpp - ${_elementwise_sources} -) - -build_dpnp_pybind11_ext( - ${python_module_name} - "dpnp/backend/extensions/ufunc" - SOURCES ${_module_src} - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../ ${CMAKE_CURRENT_SOURCE_DIR}/../common - LARGE_RANGES -) diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/common.cpp b/dpnp/backend/extensions/ufunc/elementwise_functions/common.cpp deleted file mode 100644 index 9254e87e52c4..000000000000 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/common.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2024, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** - -#include - -#include "bitwise_count.hpp" -#include "degrees.hpp" -#include "divmod.hpp" -#include "erf_funcs.hpp" -#include "fabs.hpp" -#include "float_power.hpp" -#include "fmax.hpp" -#include "fmin.hpp" -#include "fmod.hpp" -#include "frexp.hpp" -#include "gcd.hpp" -#include "heaviside.hpp" -#include "i0.hpp" -#include "interpolate.hpp" -#include "isclose.hpp" -#include "lcm.hpp" -#include "ldexp.hpp" -#include "logaddexp2.hpp" -#include "modf.hpp" -#include "nan_to_num.hpp" -#include "radians.hpp" -#include "sinc.hpp" -#include "spacing.hpp" - -namespace py = pybind11; - -namespace dpnp::extensions::ufunc -{ -/** - * @brief Add elementwise functions to Python module - */ -void init_elementwise_functions(py::module_ m) -{ - init_bitwise_count(m); - init_degrees(m); - init_divmod(m); - init_erf_funcs(m); - init_fabs(m); - init_float_power(m); - init_fmax(m); - init_fmin(m); - init_fmod(m); - init_frexp(m); - init_gcd(m); - init_heaviside(m); - init_i0(m); - init_interpolate(m); - init_isclose(m); - init_lcm(m); - init_ldexp(m); - init_logaddexp2(m); - init_modf(m); - init_nan_to_num(m); - init_radians(m); - init_sinc(m); - init_spacing(m); -} -} // namespace dpnp::extensions::ufunc diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/common.hpp b/dpnp/backend/extensions/ufunc/elementwise_functions/common.hpp deleted file mode 100644 index 8cad6a650962..000000000000 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/common.hpp +++ /dev/null @@ -1,38 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2024, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** - -#pragma once - -#include - -namespace py = pybind11; - -namespace dpnp::extensions::ufunc -{ -void init_elementwise_functions(py::module_); -} // namespace dpnp::extensions::ufunc diff --git a/dpnp/backend/extensions/ufunc/ufunc_py.cpp b/dpnp/backend/extensions/ufunc/ufunc_py.cpp deleted file mode 100644 index 6ac16e7a48e9..000000000000 --- a/dpnp/backend/extensions/ufunc/ufunc_py.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2024, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** - -#include - -#include "elementwise_functions/common.hpp" - -namespace ufunc_ns = dpnp::extensions::ufunc; - -PYBIND11_MODULE(_ufunc_impl, m, py::mod_gil_not_used()) -{ - ufunc_ns::init_elementwise_functions(m); -} diff --git a/dpnp/backend/extensions/window/CMakeLists.txt b/dpnp/backend/extensions/window/CMakeLists.txt deleted file mode 100644 index f25e9464ac57..000000000000 --- a/dpnp/backend/extensions/window/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -# ***************************************************************************** -# Copyright (c) 2025, Intel Corporation -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# - Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# - Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# - Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. -# ***************************************************************************** - -set(python_module_name _window_impl) -set(_module_src - ${CMAKE_CURRENT_SOURCE_DIR}/kaiser.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/window_py.cpp -) - -build_dpnp_pybind11_ext( - ${python_module_name} - "dpnp/backend/extensions/window" - SOURCES ${_module_src} - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../ ${CMAKE_CURRENT_SOURCE_DIR}/../common - LARGE_RANGES -) diff --git a/dpnp/cmake/tensor_build_flags.cmake b/dpnp/cmake/tensor_build_flags.cmake new file mode 100644 index 000000000000..6097cd57e4d1 --- /dev/null +++ b/dpnp/cmake/tensor_build_flags.cmake @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +# ***************************************************************************** +# Copyright (c) 2026, Intel Corporation +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# - Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# - Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. +# ***************************************************************************** + +# Directory-scoped build flags shared by the dpnp.tensor Cython extensions and +# the libtensor pybind11 modules built in dpnp/libtensor/source. Include it from +# the CMakeLists.txt of a directory before defining any targets there. + +# Tensor-specific flags + +# dpctl doesn't add -fsycl globally +# only to pybind11 module sources via add_sycl_to_target() +string(REPLACE "-fsycl " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + +# Use LLD linker (dpctl sets this at root level) +if(UNIX) + add_link_options("-fuse-ld=lld") +endif() + +# Remove global coverage flags for tensor +# use link-time only approach like dpctl +if(DPNP_GENERATE_COVERAGE) + string(REPLACE "-fprofile-instr-generate " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "-fcoverage-mapping " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "-fno-sycl-use-footer " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +endif() + +# Tensor-specific debug flags +# Disable device code debug info for Debug and Coverage builds to speed up linking +if( + CMAKE_BUILD_TYPE STREQUAL "Debug" + OR CMAKE_BUILD_TYPE STREQUAL "DEBUG" + OR CMAKE_BUILD_TYPE STREQUAL "Coverage" +) + if(WIN32) + add_compile_options(-Xsycl-target-frontend=spir64 "-g0") + elseif(UNIX) + add_compile_options(-Xsycl-target-frontend=spir64 "-g0") + if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "DEBUG") + string(REPLACE "-g1" "-g" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") + string(REPLACE "-g1" "-g" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + endif() + endif() +endif() + +# Match dpctl warning flags +# Suppress unused parameter warnings +add_compile_options(-Wno-unused-parameter) diff --git a/dpnp/dpnp_algo/dpnp_elementwise_common.py b/dpnp/dpnp_algo/dpnp_elementwise_common.py index 8790c479365e..14ecf295e3f5 100644 --- a/dpnp/dpnp_algo/dpnp_elementwise_common.py +++ b/dpnp/dpnp_algo/dpnp_elementwise_common.py @@ -33,12 +33,12 @@ import numpy import dpnp -import dpnp.backend.extensions.vm._vm_impl as vmi +import dpnp.libtensor._tensor_impl as dti +import dpnp.libtensor._vm_impl as vmi # pylint: disable=no-name-in-module import dpnp.tensor as dpt import dpnp.tensor._copy_utils as dtc -import dpnp.tensor._tensor_impl as dti import dpnp.tensor._type_utils as dtu from dpnp.dpnp_array import dpnp_array from dpnp.dpnp_utils import get_usm_allocations diff --git a/dpnp/dpnp_algo/dpnp_fill.py b/dpnp/dpnp_algo/dpnp_fill.py index 84aa9e47b27e..8ffd2e6f2fad 100644 --- a/dpnp/dpnp_algo/dpnp_fill.py +++ b/dpnp/dpnp_algo/dpnp_fill.py @@ -33,12 +33,12 @@ import dpnp import dpnp.tensor as dpt from dpnp.exceptions import ExecutionPlacementError -from dpnp.tensor._ctors import _cast_fill_val -from dpnp.tensor._tensor_impl import ( +from dpnp.libtensor._tensor_impl import ( _copy_usm_ndarray_into_usm_ndarray, _full_usm_ndarray, _zeros_usm_ndarray, ) +from dpnp.tensor._ctors import _cast_fill_val def dpnp_fill(arr, val): diff --git a/dpnp/dpnp_iface.py b/dpnp/dpnp_iface.py index 2561e24b4a01..fd5c411eac3f 100644 --- a/dpnp/dpnp_iface.py +++ b/dpnp/dpnp_iface.py @@ -49,10 +49,10 @@ import numpy import dpnp +import dpnp.libtensor._tensor_impl as ti # pylint: disable=no-name-in-module import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from .dpnp_array import dpnp_array from .dpnp_utils import ( @@ -428,14 +428,17 @@ def get_dpnp_descriptor( def get_include(): r""" - Return the directory that contains \*.h header files of dpnp C++ backend. + Return the directory that contains \*.h header files of dpnp C++ library + (libtensor). An extension module that needs to be compiled against dpnp backend should use this function to locate the appropriate include directory. + It is the same directory as returned by + ``python -m dpnp --tensor-include-dir``. """ - return os.path.join(os.path.dirname(__file__), "backend", "include") + return os.path.join(os.path.dirname(__file__), "libtensor", "include") def get_normalized_queue_device(obj=None, device=None, sycl_queue=None): diff --git a/dpnp/dpnp_iface_bitwise.py b/dpnp/dpnp_iface_bitwise.py index 350cc740782d..301fa0571669 100644 --- a/dpnp/dpnp_iface_bitwise.py +++ b/dpnp/dpnp_iface_bitwise.py @@ -45,8 +45,7 @@ import numpy -import dpnp.backend.extensions.ufunc._ufunc_impl as ufi -import dpnp.tensor._tensor_elementwise_impl as ti +import dpnp.libtensor._tensor_elementwise_impl as ti from dpnp.dpnp_algo.dpnp_elementwise_common import DPNPBinaryFunc, DPNPUnaryFunc @@ -260,8 +259,8 @@ def binary_repr(num, width=None): bitwise_count = DPNPUnaryFunc( "bitwise_count", - ufi._bitwise_count_result_type, - ufi._bitwise_count, + ti._bitwise_count_result_type, + ti._bitwise_count, _BITWISE_COUNT_DOCSTRING, ) diff --git a/dpnp/dpnp_iface_histograms.py b/dpnp/dpnp_iface_histograms.py index 1ac51d18f4c8..0a968d62ea93 100644 --- a/dpnp/dpnp_iface_histograms.py +++ b/dpnp/dpnp_iface_histograms.py @@ -48,7 +48,7 @@ import dpnp # pylint: disable=no-name-in-module -import dpnp.backend.extensions.statistics._statistics_impl as statistics_ext +import dpnp.libtensor._statistics_impl as statistics_ext from dpnp.dpnp_utils.dpnp_utils_common import ( result_type_for_device, to_supported_dtypes, diff --git a/dpnp/dpnp_iface_indexing.py b/dpnp/dpnp_iface_indexing.py index 05f6cfd76bc7..de82c555aa07 100644 --- a/dpnp/dpnp_iface_indexing.py +++ b/dpnp/dpnp_iface_indexing.py @@ -50,11 +50,8 @@ import dpnp # pylint: disable=no-name-in-module -import dpnp.backend.extensions.indexing._indexing_impl as indexing_ext - -# pylint: disable=no-name-in-module +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from .dpnp_array import dpnp_array from .dpnp_utils import get_usm_allocations @@ -145,7 +142,7 @@ def _choose_run(inds, chcs, q, usm_type, out=None, mode=0): _manager = dpu.SequentialOrderManager[q] dep_evs = _manager.submitted_events - h_ev, choose_ev = indexing_ext._choose(inds, chcs, out, mode, q, dep_evs) + h_ev, choose_ev = ti._choose(inds, chcs, out, mode, q, dep_evs) _manager.add_event_pair(h_ev, choose_ev) return out @@ -1914,7 +1911,7 @@ def putmask(a, /, mask, values): _manager = dpu.SequentialOrderManager[exec_q] dep_evs = _manager.submitted_events - h_ev, putmask_ev = indexing_ext._putmask( + h_ev, putmask_ev = ti._putmask( usm_a, usm_mask, usm_values_1d, exec_q, dep_evs ) _manager.add_event_pair(h_ev, putmask_ev) diff --git a/dpnp/dpnp_iface_logic.py b/dpnp/dpnp_iface_logic.py index 0a1379d20735..91b584678a56 100644 --- a/dpnp/dpnp_iface_logic.py +++ b/dpnp/dpnp_iface_logic.py @@ -47,9 +47,8 @@ import numpy import dpnp -import dpnp.backend.extensions.ufunc._ufunc_impl as ufi +import dpnp.libtensor._tensor_elementwise_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_elementwise_impl as ti from dpnp.tensor._type_utils import _resolve_weak_types_all_py_ints from .dpnp_algo.dpnp_elementwise_common import DPNPBinaryFunc, DPNPUnaryFunc @@ -108,7 +107,7 @@ def _isclose_scalar_tol(a, b, rtol, atol, equal_nan): ) _manager = dpu.SequentialOrderManager[exec_q] - mem_ev, ht_ev = ufi._isclose_scalar( + mem_ev, ht_ev = ti._isclose_scalar( a.get_array(), b.get_array(), rtol, diff --git a/dpnp/dpnp_iface_mathematical.py b/dpnp/dpnp_iface_mathematical.py index e5d7daa26a24..bb7e043c7ab9 100644 --- a/dpnp/dpnp_iface_mathematical.py +++ b/dpnp/dpnp_iface_mathematical.py @@ -50,9 +50,8 @@ import numpy import dpnp -import dpnp.backend.extensions.ufunc._ufunc_impl as ufi +import dpnp.libtensor._tensor_elementwise_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_elementwise_impl as ti import dpnp.tensor._type_utils as dtu from .dpnp_algo.dpnp_elementwise_common import ( @@ -1634,8 +1633,8 @@ def diff(a, n=1, axis=-1, prepend=None, append=None): divmod = DPNPBinaryTwoOutputsFunc( "divmod", - ufi._divmod_result_type, - ufi._divmod, + ti._divmod_result_type, + ti._divmod, _DIVMOD_DOCSTRING, ) @@ -1786,8 +1785,8 @@ def ediff1d(ary, to_end=None, to_begin=None): fabs = DPNPUnaryFunc( "fabs", - ufi._fabs_result_type, - ufi._fabs, + ti._fabs_result_type, + ti._fabs, _FABS_DOCSTRING, mkl_fn_to_call="_mkl_abs_to_call", mkl_impl_fn="_abs", @@ -1967,7 +1966,7 @@ def ediff1d(ary, to_end=None, to_begin=None): float_power = DPNPBinaryFunc( "float_power", - ufi._float_power_result_type, + ti._float_power_result_type, ti._pow, _FLOAT_POWER_DOCSTRING, mkl_fn_to_call="_mkl_pow_to_call", @@ -2209,8 +2208,8 @@ def ediff1d(ary, to_end=None, to_begin=None): fmax = DPNPBinaryFunc( "fmax", - ufi._fmax_result_type, - ufi._fmax, + ti._fmax_result_type, + ti._fmax, _FMAX_DOCSTRING, mkl_fn_to_call="_mkl_fmax_to_call", mkl_impl_fn="_fmax", @@ -2302,8 +2301,8 @@ def ediff1d(ary, to_end=None, to_begin=None): fmin = DPNPBinaryFunc( "fmin", - ufi._fmin_result_type, - ufi._fmin, + ti._fmin_result_type, + ti._fmin, _FMIN_DOCSTRING, mkl_fn_to_call="_mkl_fmin_to_call", mkl_impl_fn="_fmin", @@ -2387,8 +2386,8 @@ def ediff1d(ary, to_end=None, to_begin=None): fmod = DPNPBinaryFunc( "fmod", - ufi._fmod_result_type, - ufi._fmod, + ti._fmod_result_type, + ti._fmod, _FMOD_DOCSTRING, mkl_fn_to_call="_mkl_fmod_to_call", mkl_impl_fn="_fmod", @@ -2467,8 +2466,8 @@ def ediff1d(ary, to_end=None, to_begin=None): frexp = DPNPUnaryTwoOutputsFunc( "frexp", - ufi._frexp_result_type, - ufi._frexp, + ti._frexp_result_type, + ti._frexp, _FREXP_DOCSTRING, ) @@ -2530,8 +2529,8 @@ def ediff1d(ary, to_end=None, to_begin=None): gcd = DPNPBinaryFunc( "gcd", - ufi._gcd_result_type, - ufi._gcd, + ti._gcd_result_type, + ti._gcd, _GCD_DOCSTRING, acceptance_fn=acceptance_fn_gcd_lcm, ) @@ -2803,8 +2802,8 @@ def gradient(f, *varargs, axis=None, edge_order=1): heaviside = DPNPBinaryFunc( "heaviside", - ufi._heaviside_result_type, - ufi._heaviside, + ti._heaviside_result_type, + ti._heaviside, _HEAVISIDE_DOCSTRING, ) @@ -2853,8 +2852,8 @@ def gradient(f, *varargs, axis=None, edge_order=1): i0 = DPNPI0( "i0", - ufi._i0_result_type, - ufi._i0, + ti._i0_result_type, + ti._i0, _I0_DOCSTRING, mkl_fn_to_call="_mkl_i0_to_call", mkl_impl_fn="_i0", @@ -3084,7 +3083,7 @@ def interp(x, xp, fp, left=None, right=None, period=None): right_usm = right.get_array() if right is not None else None _manager = dpu.SequentialOrderManager[exec_q] - mem_ev, ht_ev = ufi._interpolate( + mem_ev, ht_ev = ti._interpolate( x.get_array(), idx.get_array(), xp.get_array(), @@ -3157,8 +3156,8 @@ def interp(x, xp, fp, left=None, right=None, period=None): lcm = DPNPBinaryFunc( "lcm", - ufi._lcm_result_type, - ufi._lcm, + ti._lcm_result_type, + ti._lcm, _LCM_DOCSTRING, acceptance_fn=acceptance_fn_gcd_lcm, ) @@ -3229,8 +3228,8 @@ def interp(x, xp, fp, left=None, right=None, period=None): ldexp = DPNPBinaryFunc( "ldexp", - ufi._ldexp_result_type, - ufi._ldexp, + ti._ldexp_result_type, + ti._ldexp, _LDEXP_DOCSTRING, weak_type_resolver=resolve_weak_types_2nd_arg_int, ) @@ -3509,8 +3508,8 @@ def interp(x, xp, fp, left=None, right=None, period=None): modf = DPNPUnaryTwoOutputsFunc( "modf", - ufi._modf_result_type, - ufi._modf, + ti._modf_result_type, + ti._modf, _MODF_DOCSTRING, mkl_fn_to_call="_mkl_modf_to_call", mkl_impl_fn="_modf", @@ -3743,7 +3742,7 @@ def _check_nan_inf(val, val_dt): q = x.sycl_queue _manager = dpu.SequentialOrderManager[q] - h_ev, comp_ev = ufi._nan_to_num( + h_ev, comp_ev = ti._nan_to_num( x_ary, nan, max_f, @@ -4776,8 +4775,8 @@ def real_if_close(a, tol=100): sinc = DPNPSinc( "sinc", - ufi._sinc_result_type, - ufi._sinc, + ti._sinc_result_type, + ti._sinc, _SINC_DOCSTRING, ) @@ -4837,8 +4836,8 @@ def real_if_close(a, tol=100): spacing = DPNPUnaryFunc( "spacing", - ufi._spacing_result_type, - ufi._spacing, + ti._spacing_result_type, + ti._spacing, _SPACING_DOCSTRING, ) diff --git a/dpnp/dpnp_iface_searching.py b/dpnp/dpnp_iface_searching.py index d72130a6f1f4..52890705afbc 100644 --- a/dpnp/dpnp_iface_searching.py +++ b/dpnp/dpnp_iface_searching.py @@ -44,8 +44,8 @@ import dpnp # pylint: disable=no-name-in-module +import dpnp.libtensor._tensor_impl as dti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as dti from .dpnp_array import dpnp_array from .dpnp_utils.dpnp_utils_reduction import dpnp_wrap_reduction_call diff --git a/dpnp/dpnp_iface_statistics.py b/dpnp/dpnp_iface_statistics.py index 114072407ca8..d86b37f3c5ba 100644 --- a/dpnp/dpnp_iface_statistics.py +++ b/dpnp/dpnp_iface_statistics.py @@ -47,9 +47,9 @@ import numpy import dpnp -import dpnp.backend.extensions.statistics._statistics_impl as statistics_ext +import dpnp.libtensor._statistics_impl as statistics_ext +import dpnp.libtensor._tensor_elementwise_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_elementwise_impl as ti from .dpnp_utils import get_usm_allocations from .dpnp_utils.dpnp_utils_common import ( diff --git a/dpnp/dpnp_iface_trigonometric.py b/dpnp/dpnp_iface_trigonometric.py index b82f090de476..a7fe7c6c9ae6 100644 --- a/dpnp/dpnp_iface_trigonometric.py +++ b/dpnp/dpnp_iface_trigonometric.py @@ -43,9 +43,8 @@ # pylint: disable=no-name-in-module import dpnp -import dpnp.backend.extensions.ufunc._ufunc_impl as ufi +import dpnp.libtensor._tensor_elementwise_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_elementwise_impl as ti import dpnp.tensor._type_utils as dtu from .dpnp_algo.dpnp_elementwise_common import DPNPBinaryFunc, DPNPUnaryFunc @@ -996,8 +995,8 @@ def cumlogsumexp( deg2rad = DPNPUnaryFunc( "deg2rad", - ufi._radians_result_type, - ufi._radians, + ti._radians_result_type, + ti._radians, _DEG2RAD_DOCSTRING, ) @@ -1067,8 +1066,8 @@ def cumlogsumexp( degrees = DPNPUnaryFunc( "degrees", - ufi._degrees_result_type, - ufi._degrees, + ti._degrees_result_type, + ti._degrees, _DEGREES_DOCSTRING, ) @@ -1817,8 +1816,8 @@ def cumlogsumexp( logaddexp2 = DPNPBinaryFunc( "logaddexp2", - ufi._logaddexp2_result_type, - ufi._logaddexp2, + ti._logaddexp2_result_type, + ti._logaddexp2, _LOGADDEXP2_DOCSTRING, ) @@ -1974,8 +1973,8 @@ def logsumexp(x, /, *, axis=None, dtype=None, keepdims=False, out=None): rad2deg = DPNPUnaryFunc( "rad2deg", - ufi._degrees_result_type, - ufi._degrees, + ti._degrees_result_type, + ti._degrees, _RAD2DEG_DOCSTRING, ) @@ -2046,8 +2045,8 @@ def logsumexp(x, /, *, axis=None, dtype=None, keepdims=False, out=None): radians = DPNPUnaryFunc( "radians", - ufi._radians_result_type, - ufi._radians, + ti._radians_result_type, + ti._radians, _RADIANS_DOCSTRING, ) diff --git a/dpnp/dpnp_iface_window.py b/dpnp/dpnp_iface_window.py index bc12e714663c..e87a3faed8bf 100644 --- a/dpnp/dpnp_iface_window.py +++ b/dpnp/dpnp_iface_window.py @@ -46,7 +46,7 @@ import dpctl.utils as dpu import dpnp -import dpnp.backend.extensions.window._window_impl as wi +import dpnp.libtensor._window_impl as wi def _call_window_kernel( diff --git a/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py b/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py index 8b7b643c11d3..f0659d43a10d 100644 --- a/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py +++ b/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py @@ -30,11 +30,11 @@ import numpy import dpnp -import dpnp.backend.extensions.blas._blas_impl as bi +import dpnp.libtensor._blas_impl as bi +import dpnp.libtensor._tensor_impl as ti # pylint: disable=no-name-in-module import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from dpnp.dpnp_array import dpnp_array from dpnp.dpnp_utils import get_usm_allocations from dpnp.exceptions import AxisError, ExecutionPlacementError diff --git a/dpnp/fft/dpnp_utils_fft.py b/dpnp/fft/dpnp_utils_fft.py index 6d4ffc9ed12b..78893a3c01e4 100644 --- a/dpnp/fft/dpnp_utils_fft.py +++ b/dpnp/fft/dpnp_utils_fft.py @@ -45,8 +45,8 @@ import numpy import dpnp -import dpnp.backend.extensions.fft._fft_impl as fi -import dpnp.tensor._tensor_impl as ti +import dpnp.libtensor._fft_impl as fi +import dpnp.libtensor._tensor_impl as ti from dpnp.exceptions import ExecutionPlacementError from dpnp.tensor import get_execution_queue from dpnp.tensor._numpy_helper import ( diff --git a/dpnp/backend/extensions/blas/CMakeLists.txt b/dpnp/libtensor/extensions/blas/CMakeLists.txt similarity index 96% rename from dpnp/backend/extensions/blas/CMakeLists.txt rename to dpnp/libtensor/extensions/blas/CMakeLists.txt index bb0ca93390e4..02ba56063e0d 100644 --- a/dpnp/backend/extensions/blas/CMakeLists.txt +++ b/dpnp/libtensor/extensions/blas/CMakeLists.txt @@ -38,9 +38,7 @@ set(_module_src build_dpnp_pybind11_ext( ${python_module_name} - "dpnp/backend/extensions/blas" SOURCES ${_module_src} - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../common LARGE_RANGES ) diff --git a/dpnp/backend/extensions/blas/blas_py.cpp b/dpnp/libtensor/extensions/blas/blas_py.cpp similarity index 98% rename from dpnp/backend/extensions/blas/blas_py.cpp rename to dpnp/libtensor/extensions/blas/blas_py.cpp index 28714194abb2..e0e65c9a066c 100644 --- a/dpnp/backend/extensions/blas/blas_py.cpp +++ b/dpnp/libtensor/extensions/blas/blas_py.cpp @@ -26,7 +26,7 @@ // THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************** // -// This file defines functions of dpnp.backend._blas_impl extensions +// This file defines functions of dpnp.libtensor._blas_impl extensions // //***************************************************************************** diff --git a/dpnp/backend/extensions/blas/dot.hpp b/dpnp/libtensor/extensions/blas/dot.hpp similarity index 100% rename from dpnp/backend/extensions/blas/dot.hpp rename to dpnp/libtensor/extensions/blas/dot.hpp diff --git a/dpnp/backend/extensions/blas/dot_common.hpp b/dpnp/libtensor/extensions/blas/dot_common.hpp similarity index 100% rename from dpnp/backend/extensions/blas/dot_common.hpp rename to dpnp/libtensor/extensions/blas/dot_common.hpp diff --git a/dpnp/backend/extensions/blas/dotc.hpp b/dpnp/libtensor/extensions/blas/dotc.hpp similarity index 100% rename from dpnp/backend/extensions/blas/dotc.hpp rename to dpnp/libtensor/extensions/blas/dotc.hpp diff --git a/dpnp/backend/extensions/blas/dotu.hpp b/dpnp/libtensor/extensions/blas/dotu.hpp similarity index 100% rename from dpnp/backend/extensions/blas/dotu.hpp rename to dpnp/libtensor/extensions/blas/dotu.hpp diff --git a/dpnp/backend/extensions/blas/gemm.cpp b/dpnp/libtensor/extensions/blas/gemm.cpp similarity index 100% rename from dpnp/backend/extensions/blas/gemm.cpp rename to dpnp/libtensor/extensions/blas/gemm.cpp diff --git a/dpnp/backend/extensions/blas/gemm.hpp b/dpnp/libtensor/extensions/blas/gemm.hpp similarity index 100% rename from dpnp/backend/extensions/blas/gemm.hpp rename to dpnp/libtensor/extensions/blas/gemm.hpp diff --git a/dpnp/backend/extensions/blas/gemm_batch.cpp b/dpnp/libtensor/extensions/blas/gemm_batch.cpp similarity index 100% rename from dpnp/backend/extensions/blas/gemm_batch.cpp rename to dpnp/libtensor/extensions/blas/gemm_batch.cpp diff --git a/dpnp/backend/extensions/blas/gemv.cpp b/dpnp/libtensor/extensions/blas/gemv.cpp similarity index 100% rename from dpnp/backend/extensions/blas/gemv.cpp rename to dpnp/libtensor/extensions/blas/gemv.cpp diff --git a/dpnp/backend/extensions/blas/gemv.hpp b/dpnp/libtensor/extensions/blas/gemv.hpp similarity index 100% rename from dpnp/backend/extensions/blas/gemv.hpp rename to dpnp/libtensor/extensions/blas/gemv.hpp diff --git a/dpnp/backend/extensions/blas/syrk.cpp b/dpnp/libtensor/extensions/blas/syrk.cpp similarity index 100% rename from dpnp/backend/extensions/blas/syrk.cpp rename to dpnp/libtensor/extensions/blas/syrk.cpp diff --git a/dpnp/backend/extensions/blas/syrk.hpp b/dpnp/libtensor/extensions/blas/syrk.hpp similarity index 100% rename from dpnp/backend/extensions/blas/syrk.hpp rename to dpnp/libtensor/extensions/blas/syrk.hpp diff --git a/dpnp/backend/extensions/blas/types_matrix.hpp b/dpnp/libtensor/extensions/blas/types_matrix.hpp similarity index 100% rename from dpnp/backend/extensions/blas/types_matrix.hpp rename to dpnp/libtensor/extensions/blas/types_matrix.hpp diff --git a/dpnp/backend/extensions/fft/CMakeLists.txt b/dpnp/libtensor/extensions/fft/CMakeLists.txt similarity index 98% rename from dpnp/backend/extensions/fft/CMakeLists.txt rename to dpnp/libtensor/extensions/fft/CMakeLists.txt index b663091ff512..3a30562b1ff1 100644 --- a/dpnp/backend/extensions/fft/CMakeLists.txt +++ b/dpnp/libtensor/extensions/fft/CMakeLists.txt @@ -32,7 +32,6 @@ set(_module_src ${CMAKE_CURRENT_SOURCE_DIR}/fft_py.cpp) build_dpnp_pybind11_ext( ${python_module_name} - "dpnp/backend/extensions/fft" SOURCES ${_module_src} ) diff --git a/dpnp/backend/extensions/fft/common.hpp b/dpnp/libtensor/extensions/fft/common.hpp similarity index 100% rename from dpnp/backend/extensions/fft/common.hpp rename to dpnp/libtensor/extensions/fft/common.hpp diff --git a/dpnp/backend/extensions/fft/fft_py.cpp b/dpnp/libtensor/extensions/fft/fft_py.cpp similarity index 98% rename from dpnp/backend/extensions/fft/fft_py.cpp rename to dpnp/libtensor/extensions/fft/fft_py.cpp index 5e88cb6111da..590ca739302c 100644 --- a/dpnp/backend/extensions/fft/fft_py.cpp +++ b/dpnp/libtensor/extensions/fft/fft_py.cpp @@ -26,7 +26,7 @@ // THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************** // -// This file defines functions of dpnp.backend._fft_impl extensions +// This file defines functions of dpnp.libtensor._fft_impl extensions // //***************************************************************************** diff --git a/dpnp/backend/extensions/fft/fft_utils.hpp b/dpnp/libtensor/extensions/fft/fft_utils.hpp similarity index 100% rename from dpnp/backend/extensions/fft/fft_utils.hpp rename to dpnp/libtensor/extensions/fft/fft_utils.hpp diff --git a/dpnp/backend/extensions/fft/in_place.hpp b/dpnp/libtensor/extensions/fft/in_place.hpp similarity index 100% rename from dpnp/backend/extensions/fft/in_place.hpp rename to dpnp/libtensor/extensions/fft/in_place.hpp diff --git a/dpnp/backend/extensions/fft/in_place.tpp b/dpnp/libtensor/extensions/fft/in_place.tpp similarity index 100% rename from dpnp/backend/extensions/fft/in_place.tpp rename to dpnp/libtensor/extensions/fft/in_place.tpp diff --git a/dpnp/backend/extensions/fft/out_of_place.hpp b/dpnp/libtensor/extensions/fft/out_of_place.hpp similarity index 100% rename from dpnp/backend/extensions/fft/out_of_place.hpp rename to dpnp/libtensor/extensions/fft/out_of_place.hpp diff --git a/dpnp/backend/extensions/fft/out_of_place.tpp b/dpnp/libtensor/extensions/fft/out_of_place.tpp similarity index 100% rename from dpnp/backend/extensions/fft/out_of_place.tpp rename to dpnp/libtensor/extensions/fft/out_of_place.tpp diff --git a/dpnp/backend/extensions/lapack/CMakeLists.txt b/dpnp/libtensor/extensions/lapack/CMakeLists.txt similarity index 97% rename from dpnp/backend/extensions/lapack/CMakeLists.txt rename to dpnp/libtensor/extensions/lapack/CMakeLists.txt index b24065c998e1..7fabc921a865 100644 --- a/dpnp/backend/extensions/lapack/CMakeLists.txt +++ b/dpnp/libtensor/extensions/lapack/CMakeLists.txt @@ -55,9 +55,7 @@ set(_module_src build_dpnp_pybind11_ext( ${python_module_name} - "dpnp/backend/extensions/lapack" SOURCES ${_module_src} - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../common ) if(_use_onemath) diff --git a/dpnp/backend/extensions/lapack/common_helpers.hpp b/dpnp/libtensor/extensions/lapack/common_helpers.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/common_helpers.hpp rename to dpnp/libtensor/extensions/lapack/common_helpers.hpp diff --git a/dpnp/backend/extensions/lapack/evd_batch_common.hpp b/dpnp/libtensor/extensions/lapack/evd_batch_common.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/evd_batch_common.hpp rename to dpnp/libtensor/extensions/lapack/evd_batch_common.hpp diff --git a/dpnp/backend/extensions/lapack/evd_common.hpp b/dpnp/libtensor/extensions/lapack/evd_common.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/evd_common.hpp rename to dpnp/libtensor/extensions/lapack/evd_common.hpp diff --git a/dpnp/backend/extensions/lapack/evd_common_utils.hpp b/dpnp/libtensor/extensions/lapack/evd_common_utils.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/evd_common_utils.hpp rename to dpnp/libtensor/extensions/lapack/evd_common_utils.hpp diff --git a/dpnp/backend/extensions/lapack/geqrf.cpp b/dpnp/libtensor/extensions/lapack/geqrf.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/geqrf.cpp rename to dpnp/libtensor/extensions/lapack/geqrf.cpp diff --git a/dpnp/backend/extensions/lapack/geqrf.hpp b/dpnp/libtensor/extensions/lapack/geqrf.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/geqrf.hpp rename to dpnp/libtensor/extensions/lapack/geqrf.hpp diff --git a/dpnp/backend/extensions/lapack/geqrf_batch.cpp b/dpnp/libtensor/extensions/lapack/geqrf_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/geqrf_batch.cpp rename to dpnp/libtensor/extensions/lapack/geqrf_batch.cpp diff --git a/dpnp/backend/extensions/lapack/gesv.cpp b/dpnp/libtensor/extensions/lapack/gesv.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/gesv.cpp rename to dpnp/libtensor/extensions/lapack/gesv.cpp diff --git a/dpnp/backend/extensions/lapack/gesv.hpp b/dpnp/libtensor/extensions/lapack/gesv.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/gesv.hpp rename to dpnp/libtensor/extensions/lapack/gesv.hpp diff --git a/dpnp/backend/extensions/lapack/gesv_batch.cpp b/dpnp/libtensor/extensions/lapack/gesv_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/gesv_batch.cpp rename to dpnp/libtensor/extensions/lapack/gesv_batch.cpp diff --git a/dpnp/backend/extensions/lapack/gesv_common_utils.hpp b/dpnp/libtensor/extensions/lapack/gesv_common_utils.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/gesv_common_utils.hpp rename to dpnp/libtensor/extensions/lapack/gesv_common_utils.hpp diff --git a/dpnp/backend/extensions/lapack/gesvd.cpp b/dpnp/libtensor/extensions/lapack/gesvd.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/gesvd.cpp rename to dpnp/libtensor/extensions/lapack/gesvd.cpp diff --git a/dpnp/backend/extensions/lapack/gesvd.hpp b/dpnp/libtensor/extensions/lapack/gesvd.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/gesvd.hpp rename to dpnp/libtensor/extensions/lapack/gesvd.hpp diff --git a/dpnp/backend/extensions/lapack/gesvd_batch.cpp b/dpnp/libtensor/extensions/lapack/gesvd_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/gesvd_batch.cpp rename to dpnp/libtensor/extensions/lapack/gesvd_batch.cpp diff --git a/dpnp/backend/extensions/lapack/gesvd_common_utils.hpp b/dpnp/libtensor/extensions/lapack/gesvd_common_utils.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/gesvd_common_utils.hpp rename to dpnp/libtensor/extensions/lapack/gesvd_common_utils.hpp diff --git a/dpnp/backend/extensions/lapack/getrf.cpp b/dpnp/libtensor/extensions/lapack/getrf.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/getrf.cpp rename to dpnp/libtensor/extensions/lapack/getrf.cpp diff --git a/dpnp/backend/extensions/lapack/getrf.hpp b/dpnp/libtensor/extensions/lapack/getrf.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/getrf.hpp rename to dpnp/libtensor/extensions/lapack/getrf.hpp diff --git a/dpnp/backend/extensions/lapack/getrf_batch.cpp b/dpnp/libtensor/extensions/lapack/getrf_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/getrf_batch.cpp rename to dpnp/libtensor/extensions/lapack/getrf_batch.cpp diff --git a/dpnp/backend/extensions/lapack/getri.hpp b/dpnp/libtensor/extensions/lapack/getri.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/getri.hpp rename to dpnp/libtensor/extensions/lapack/getri.hpp diff --git a/dpnp/backend/extensions/lapack/getri_batch.cpp b/dpnp/libtensor/extensions/lapack/getri_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/getri_batch.cpp rename to dpnp/libtensor/extensions/lapack/getri_batch.cpp diff --git a/dpnp/backend/extensions/lapack/getrs.cpp b/dpnp/libtensor/extensions/lapack/getrs.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/getrs.cpp rename to dpnp/libtensor/extensions/lapack/getrs.cpp diff --git a/dpnp/backend/extensions/lapack/getrs.hpp b/dpnp/libtensor/extensions/lapack/getrs.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/getrs.hpp rename to dpnp/libtensor/extensions/lapack/getrs.hpp diff --git a/dpnp/backend/extensions/lapack/getrs_batch.cpp b/dpnp/libtensor/extensions/lapack/getrs_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/getrs_batch.cpp rename to dpnp/libtensor/extensions/lapack/getrs_batch.cpp diff --git a/dpnp/backend/extensions/lapack/heevd.cpp b/dpnp/libtensor/extensions/lapack/heevd.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/heevd.cpp rename to dpnp/libtensor/extensions/lapack/heevd.cpp diff --git a/dpnp/backend/extensions/lapack/heevd.hpp b/dpnp/libtensor/extensions/lapack/heevd.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/heevd.hpp rename to dpnp/libtensor/extensions/lapack/heevd.hpp diff --git a/dpnp/backend/extensions/lapack/heevd_batch.cpp b/dpnp/libtensor/extensions/lapack/heevd_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/heevd_batch.cpp rename to dpnp/libtensor/extensions/lapack/heevd_batch.cpp diff --git a/dpnp/backend/extensions/lapack/heevd_batch.hpp b/dpnp/libtensor/extensions/lapack/heevd_batch.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/heevd_batch.hpp rename to dpnp/libtensor/extensions/lapack/heevd_batch.hpp diff --git a/dpnp/backend/extensions/lapack/lapack_py.cpp b/dpnp/libtensor/extensions/lapack/lapack_py.cpp similarity index 99% rename from dpnp/backend/extensions/lapack/lapack_py.cpp rename to dpnp/libtensor/extensions/lapack/lapack_py.cpp index eca276f719c4..bbe07d191764 100644 --- a/dpnp/backend/extensions/lapack/lapack_py.cpp +++ b/dpnp/libtensor/extensions/lapack/lapack_py.cpp @@ -26,7 +26,7 @@ // THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************** // -// This file defines functions of dpnp.backend._lapack_impl extensions +// This file defines functions of dpnp.libtensor._lapack_impl extensions // //***************************************************************************** diff --git a/dpnp/backend/extensions/lapack/linalg_exceptions.hpp b/dpnp/libtensor/extensions/lapack/linalg_exceptions.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/linalg_exceptions.hpp rename to dpnp/libtensor/extensions/lapack/linalg_exceptions.hpp diff --git a/dpnp/backend/extensions/lapack/orgqr.cpp b/dpnp/libtensor/extensions/lapack/orgqr.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/orgqr.cpp rename to dpnp/libtensor/extensions/lapack/orgqr.cpp diff --git a/dpnp/backend/extensions/lapack/orgqr.hpp b/dpnp/libtensor/extensions/lapack/orgqr.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/orgqr.hpp rename to dpnp/libtensor/extensions/lapack/orgqr.hpp diff --git a/dpnp/backend/extensions/lapack/orgqr_batch.cpp b/dpnp/libtensor/extensions/lapack/orgqr_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/orgqr_batch.cpp rename to dpnp/libtensor/extensions/lapack/orgqr_batch.cpp diff --git a/dpnp/backend/extensions/lapack/potrf.cpp b/dpnp/libtensor/extensions/lapack/potrf.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/potrf.cpp rename to dpnp/libtensor/extensions/lapack/potrf.cpp diff --git a/dpnp/backend/extensions/lapack/potrf.hpp b/dpnp/libtensor/extensions/lapack/potrf.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/potrf.hpp rename to dpnp/libtensor/extensions/lapack/potrf.hpp diff --git a/dpnp/backend/extensions/lapack/potrf_batch.cpp b/dpnp/libtensor/extensions/lapack/potrf_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/potrf_batch.cpp rename to dpnp/libtensor/extensions/lapack/potrf_batch.cpp diff --git a/dpnp/backend/extensions/lapack/syevd.cpp b/dpnp/libtensor/extensions/lapack/syevd.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/syevd.cpp rename to dpnp/libtensor/extensions/lapack/syevd.cpp diff --git a/dpnp/backend/extensions/lapack/syevd.hpp b/dpnp/libtensor/extensions/lapack/syevd.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/syevd.hpp rename to dpnp/libtensor/extensions/lapack/syevd.hpp diff --git a/dpnp/backend/extensions/lapack/syevd_batch.cpp b/dpnp/libtensor/extensions/lapack/syevd_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/syevd_batch.cpp rename to dpnp/libtensor/extensions/lapack/syevd_batch.cpp diff --git a/dpnp/backend/extensions/lapack/syevd_batch.hpp b/dpnp/libtensor/extensions/lapack/syevd_batch.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/syevd_batch.hpp rename to dpnp/libtensor/extensions/lapack/syevd_batch.hpp diff --git a/dpnp/backend/extensions/lapack/types_matrix.hpp b/dpnp/libtensor/extensions/lapack/types_matrix.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/types_matrix.hpp rename to dpnp/libtensor/extensions/lapack/types_matrix.hpp diff --git a/dpnp/backend/extensions/lapack/ungqr.cpp b/dpnp/libtensor/extensions/lapack/ungqr.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/ungqr.cpp rename to dpnp/libtensor/extensions/lapack/ungqr.cpp diff --git a/dpnp/backend/extensions/lapack/ungqr.hpp b/dpnp/libtensor/extensions/lapack/ungqr.hpp similarity index 100% rename from dpnp/backend/extensions/lapack/ungqr.hpp rename to dpnp/libtensor/extensions/lapack/ungqr.hpp diff --git a/dpnp/backend/extensions/lapack/ungqr_batch.cpp b/dpnp/libtensor/extensions/lapack/ungqr_batch.cpp similarity index 100% rename from dpnp/backend/extensions/lapack/ungqr_batch.cpp rename to dpnp/libtensor/extensions/lapack/ungqr_batch.cpp diff --git a/dpnp/backend/extensions/sparse/CMakeLists.txt b/dpnp/libtensor/extensions/sparse/CMakeLists.txt similarity index 95% rename from dpnp/backend/extensions/sparse/CMakeLists.txt rename to dpnp/libtensor/extensions/sparse/CMakeLists.txt index 3355b5fe8c0f..e249f9ddb766 100644 --- a/dpnp/backend/extensions/sparse/CMakeLists.txt +++ b/dpnp/libtensor/extensions/sparse/CMakeLists.txt @@ -35,9 +35,7 @@ set(_module_src build_dpnp_pybind11_ext( ${python_module_name} - "dpnp/backend/extensions/sparse" SOURCES ${_module_src} - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../common ) if(_use_onemath) diff --git a/dpnp/backend/extensions/sparse/gemv.cpp b/dpnp/libtensor/extensions/sparse/gemv.cpp similarity index 100% rename from dpnp/backend/extensions/sparse/gemv.cpp rename to dpnp/libtensor/extensions/sparse/gemv.cpp diff --git a/dpnp/backend/extensions/sparse/gemv.hpp b/dpnp/libtensor/extensions/sparse/gemv.hpp similarity index 100% rename from dpnp/backend/extensions/sparse/gemv.hpp rename to dpnp/libtensor/extensions/sparse/gemv.hpp diff --git a/dpnp/backend/extensions/sparse/sparse_py.cpp b/dpnp/libtensor/extensions/sparse/sparse_py.cpp similarity index 100% rename from dpnp/backend/extensions/sparse/sparse_py.cpp rename to dpnp/libtensor/extensions/sparse/sparse_py.cpp diff --git a/dpnp/backend/extensions/sparse/types_matrix.hpp b/dpnp/libtensor/extensions/sparse/types_matrix.hpp similarity index 100% rename from dpnp/backend/extensions/sparse/types_matrix.hpp rename to dpnp/libtensor/extensions/sparse/types_matrix.hpp diff --git a/dpnp/backend/extensions/vm/CMakeLists.txt b/dpnp/libtensor/extensions/vm/CMakeLists.txt similarity index 92% rename from dpnp/backend/extensions/vm/CMakeLists.txt rename to dpnp/libtensor/extensions/vm/CMakeLists.txt index 082d23c0d54d..b90425fbed98 100644 --- a/dpnp/backend/extensions/vm/CMakeLists.txt +++ b/dpnp/libtensor/extensions/vm/CMakeLists.txt @@ -78,9 +78,7 @@ if(NOT _use_onemath) endif() set(_module_src - # TODO: remove sources from `elementwise_functions` folder - ${CMAKE_CURRENT_SOURCE_DIR}/../elementwise_functions/elementwise_functions_type_utils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../elementwise_functions/simplify_iteration_space.cpp + ${CMAKE_SOURCE_DIR}/dpnp/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/vm_py.cpp ${_elementwise_sources} ) @@ -89,10 +87,10 @@ set(python_module_name _vm_impl) build_dpnp_pybind11_ext( ${python_module_name} - "dpnp/backend/extensions/vm" SOURCES ${_module_src} - INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../common + INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/dpnp/libtensor/source ) +target_link_libraries(${python_module_name} PRIVATE simplify_iteration_space) if(_use_onemath) target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH) diff --git a/dpnp/backend/extensions/vm/abs.cpp b/dpnp/libtensor/extensions/vm/abs.cpp similarity index 94% rename from dpnp/backend/extensions/vm/abs.cpp rename to dpnp/libtensor/extensions/vm/abs.cpp index 4402dd1c0326..2c2ade041fba 100644 --- a/dpnp/backend/extensions/vm/abs.cpp +++ b/dpnp/libtensor/extensions/vm/abs.cpp @@ -43,10 +43,7 @@ #include "abs.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/abs.hpp b/dpnp/libtensor/extensions/vm/abs.hpp similarity index 100% rename from dpnp/backend/extensions/vm/abs.hpp rename to dpnp/libtensor/extensions/vm/abs.hpp diff --git a/dpnp/backend/extensions/vm/acos.cpp b/dpnp/libtensor/extensions/vm/acos.cpp similarity index 94% rename from dpnp/backend/extensions/vm/acos.cpp rename to dpnp/libtensor/extensions/vm/acos.cpp index 9c66c60da8ca..5242a01bbf31 100644 --- a/dpnp/backend/extensions/vm/acos.cpp +++ b/dpnp/libtensor/extensions/vm/acos.cpp @@ -43,10 +43,7 @@ #include "acos.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/acos.hpp b/dpnp/libtensor/extensions/vm/acos.hpp similarity index 100% rename from dpnp/backend/extensions/vm/acos.hpp rename to dpnp/libtensor/extensions/vm/acos.hpp diff --git a/dpnp/backend/extensions/vm/acosh.cpp b/dpnp/libtensor/extensions/vm/acosh.cpp similarity index 94% rename from dpnp/backend/extensions/vm/acosh.cpp rename to dpnp/libtensor/extensions/vm/acosh.cpp index 5fb1dd1ebcd9..3518a3ec94eb 100644 --- a/dpnp/backend/extensions/vm/acosh.cpp +++ b/dpnp/libtensor/extensions/vm/acosh.cpp @@ -43,10 +43,7 @@ #include "acosh.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/acosh.hpp b/dpnp/libtensor/extensions/vm/acosh.hpp similarity index 100% rename from dpnp/backend/extensions/vm/acosh.hpp rename to dpnp/libtensor/extensions/vm/acosh.hpp diff --git a/dpnp/backend/extensions/vm/add.cpp b/dpnp/libtensor/extensions/vm/add.cpp similarity index 95% rename from dpnp/backend/extensions/vm/add.cpp rename to dpnp/libtensor/extensions/vm/add.cpp index 3ac73662a937..49c0a2faf116 100644 --- a/dpnp/backend/extensions/vm/add.cpp +++ b/dpnp/libtensor/extensions/vm/add.cpp @@ -44,10 +44,7 @@ #include "add.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -57,7 +54,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/add.hpp b/dpnp/libtensor/extensions/vm/add.hpp similarity index 100% rename from dpnp/backend/extensions/vm/add.hpp rename to dpnp/libtensor/extensions/vm/add.hpp diff --git a/dpnp/backend/extensions/vm/arg.cpp b/dpnp/libtensor/extensions/vm/arg.cpp similarity index 94% rename from dpnp/backend/extensions/vm/arg.cpp rename to dpnp/libtensor/extensions/vm/arg.cpp index 1b025662cd8e..75ab640dbf86 100644 --- a/dpnp/backend/extensions/vm/arg.cpp +++ b/dpnp/libtensor/extensions/vm/arg.cpp @@ -43,10 +43,7 @@ #include "arg.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/arg.hpp b/dpnp/libtensor/extensions/vm/arg.hpp similarity index 100% rename from dpnp/backend/extensions/vm/arg.hpp rename to dpnp/libtensor/extensions/vm/arg.hpp diff --git a/dpnp/backend/extensions/vm/asin.cpp b/dpnp/libtensor/extensions/vm/asin.cpp similarity index 94% rename from dpnp/backend/extensions/vm/asin.cpp rename to dpnp/libtensor/extensions/vm/asin.cpp index 93f271e34485..3ad3f42c0975 100644 --- a/dpnp/backend/extensions/vm/asin.cpp +++ b/dpnp/libtensor/extensions/vm/asin.cpp @@ -43,10 +43,7 @@ #include "asin.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/asin.hpp b/dpnp/libtensor/extensions/vm/asin.hpp similarity index 100% rename from dpnp/backend/extensions/vm/asin.hpp rename to dpnp/libtensor/extensions/vm/asin.hpp diff --git a/dpnp/backend/extensions/vm/asinh.cpp b/dpnp/libtensor/extensions/vm/asinh.cpp similarity index 94% rename from dpnp/backend/extensions/vm/asinh.cpp rename to dpnp/libtensor/extensions/vm/asinh.cpp index 1ea0c296464a..7c3788ebebb2 100644 --- a/dpnp/backend/extensions/vm/asinh.cpp +++ b/dpnp/libtensor/extensions/vm/asinh.cpp @@ -43,10 +43,7 @@ #include "asinh.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/asinh.hpp b/dpnp/libtensor/extensions/vm/asinh.hpp similarity index 100% rename from dpnp/backend/extensions/vm/asinh.hpp rename to dpnp/libtensor/extensions/vm/asinh.hpp diff --git a/dpnp/backend/extensions/vm/atan.cpp b/dpnp/libtensor/extensions/vm/atan.cpp similarity index 94% rename from dpnp/backend/extensions/vm/atan.cpp rename to dpnp/libtensor/extensions/vm/atan.cpp index 26a7f7155a14..b8df2c0390da 100644 --- a/dpnp/backend/extensions/vm/atan.cpp +++ b/dpnp/libtensor/extensions/vm/atan.cpp @@ -43,10 +43,7 @@ #include "atan.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/atan.hpp b/dpnp/libtensor/extensions/vm/atan.hpp similarity index 100% rename from dpnp/backend/extensions/vm/atan.hpp rename to dpnp/libtensor/extensions/vm/atan.hpp diff --git a/dpnp/backend/extensions/vm/atan2.cpp b/dpnp/libtensor/extensions/vm/atan2.cpp similarity index 95% rename from dpnp/backend/extensions/vm/atan2.cpp rename to dpnp/libtensor/extensions/vm/atan2.cpp index 3ee102d46f3c..643668613fb5 100644 --- a/dpnp/backend/extensions/vm/atan2.cpp +++ b/dpnp/libtensor/extensions/vm/atan2.cpp @@ -43,10 +43,7 @@ #include "atan2.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/atan2.hpp b/dpnp/libtensor/extensions/vm/atan2.hpp similarity index 100% rename from dpnp/backend/extensions/vm/atan2.hpp rename to dpnp/libtensor/extensions/vm/atan2.hpp diff --git a/dpnp/backend/extensions/vm/atanh.cpp b/dpnp/libtensor/extensions/vm/atanh.cpp similarity index 94% rename from dpnp/backend/extensions/vm/atanh.cpp rename to dpnp/libtensor/extensions/vm/atanh.cpp index 42d7d3de3278..2a71dfcad88a 100644 --- a/dpnp/backend/extensions/vm/atanh.cpp +++ b/dpnp/libtensor/extensions/vm/atanh.cpp @@ -43,10 +43,7 @@ #include "atanh.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/atanh.hpp b/dpnp/libtensor/extensions/vm/atanh.hpp similarity index 100% rename from dpnp/backend/extensions/vm/atanh.hpp rename to dpnp/libtensor/extensions/vm/atanh.hpp diff --git a/dpnp/backend/extensions/vm/cbrt.cpp b/dpnp/libtensor/extensions/vm/cbrt.cpp similarity index 94% rename from dpnp/backend/extensions/vm/cbrt.cpp rename to dpnp/libtensor/extensions/vm/cbrt.cpp index d83e366668f8..3a37a8f30508 100644 --- a/dpnp/backend/extensions/vm/cbrt.cpp +++ b/dpnp/libtensor/extensions/vm/cbrt.cpp @@ -42,10 +42,7 @@ #include "cbrt.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/cbrt.hpp b/dpnp/libtensor/extensions/vm/cbrt.hpp similarity index 100% rename from dpnp/backend/extensions/vm/cbrt.hpp rename to dpnp/libtensor/extensions/vm/cbrt.hpp diff --git a/dpnp/backend/extensions/vm/ceil.cpp b/dpnp/libtensor/extensions/vm/ceil.cpp similarity index 94% rename from dpnp/backend/extensions/vm/ceil.cpp rename to dpnp/libtensor/extensions/vm/ceil.cpp index 1f494c4c41b7..88698445a346 100644 --- a/dpnp/backend/extensions/vm/ceil.cpp +++ b/dpnp/libtensor/extensions/vm/ceil.cpp @@ -42,10 +42,7 @@ #include "ceil.hpp" #include "common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/ceil.hpp b/dpnp/libtensor/extensions/vm/ceil.hpp similarity index 100% rename from dpnp/backend/extensions/vm/ceil.hpp rename to dpnp/libtensor/extensions/vm/ceil.hpp diff --git a/dpnp/backend/extensions/vm/common.hpp b/dpnp/libtensor/extensions/vm/common.hpp similarity index 100% rename from dpnp/backend/extensions/vm/common.hpp rename to dpnp/libtensor/extensions/vm/common.hpp diff --git a/dpnp/backend/extensions/vm/conj.cpp b/dpnp/libtensor/extensions/vm/conj.cpp similarity index 94% rename from dpnp/backend/extensions/vm/conj.cpp rename to dpnp/libtensor/extensions/vm/conj.cpp index 23ae85be814e..3a8e38e67995 100644 --- a/dpnp/backend/extensions/vm/conj.cpp +++ b/dpnp/libtensor/extensions/vm/conj.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "conj.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/conj.hpp b/dpnp/libtensor/extensions/vm/conj.hpp similarity index 100% rename from dpnp/backend/extensions/vm/conj.hpp rename to dpnp/libtensor/extensions/vm/conj.hpp diff --git a/dpnp/backend/extensions/vm/copysign.cpp b/dpnp/libtensor/extensions/vm/copysign.cpp similarity index 95% rename from dpnp/backend/extensions/vm/copysign.cpp rename to dpnp/libtensor/extensions/vm/copysign.cpp index 543e77d704ab..ec5e7d4e23a4 100644 --- a/dpnp/backend/extensions/vm/copysign.cpp +++ b/dpnp/libtensor/extensions/vm/copysign.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "copysign.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/copysign.hpp b/dpnp/libtensor/extensions/vm/copysign.hpp similarity index 100% rename from dpnp/backend/extensions/vm/copysign.hpp rename to dpnp/libtensor/extensions/vm/copysign.hpp diff --git a/dpnp/backend/extensions/vm/cos.cpp b/dpnp/libtensor/extensions/vm/cos.cpp similarity index 94% rename from dpnp/backend/extensions/vm/cos.cpp rename to dpnp/libtensor/extensions/vm/cos.cpp index 90a77b543778..98653c1be014 100644 --- a/dpnp/backend/extensions/vm/cos.cpp +++ b/dpnp/libtensor/extensions/vm/cos.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "cos.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/cos.hpp b/dpnp/libtensor/extensions/vm/cos.hpp similarity index 100% rename from dpnp/backend/extensions/vm/cos.hpp rename to dpnp/libtensor/extensions/vm/cos.hpp diff --git a/dpnp/backend/extensions/vm/cosh.cpp b/dpnp/libtensor/extensions/vm/cosh.cpp similarity index 94% rename from dpnp/backend/extensions/vm/cosh.cpp rename to dpnp/libtensor/extensions/vm/cosh.cpp index 8ea80f29145d..d655b2dcc68c 100644 --- a/dpnp/backend/extensions/vm/cosh.cpp +++ b/dpnp/libtensor/extensions/vm/cosh.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "cosh.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/cosh.hpp b/dpnp/libtensor/extensions/vm/cosh.hpp similarity index 100% rename from dpnp/backend/extensions/vm/cosh.hpp rename to dpnp/libtensor/extensions/vm/cosh.hpp diff --git a/dpnp/backend/extensions/vm/div.cpp b/dpnp/libtensor/extensions/vm/div.cpp similarity index 95% rename from dpnp/backend/extensions/vm/div.cpp rename to dpnp/libtensor/extensions/vm/div.cpp index 386684d11a81..68de80960d64 100644 --- a/dpnp/backend/extensions/vm/div.cpp +++ b/dpnp/libtensor/extensions/vm/div.cpp @@ -44,10 +44,7 @@ #include "common.hpp" #include "div.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -57,7 +54,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/div.hpp b/dpnp/libtensor/extensions/vm/div.hpp similarity index 100% rename from dpnp/backend/extensions/vm/div.hpp rename to dpnp/libtensor/extensions/vm/div.hpp diff --git a/dpnp/backend/extensions/vm/erf_funcs.cpp b/dpnp/libtensor/extensions/vm/erf_funcs.cpp similarity index 96% rename from dpnp/backend/extensions/vm/erf_funcs.cpp rename to dpnp/libtensor/extensions/vm/erf_funcs.cpp index b43b7a19945e..38796ae15ff6 100644 --- a/dpnp/backend/extensions/vm/erf_funcs.cpp +++ b/dpnp/libtensor/extensions/vm/erf_funcs.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "erf_funcs.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; using ext::common::init_dispatch_vector; diff --git a/dpnp/backend/extensions/vm/erf_funcs.hpp b/dpnp/libtensor/extensions/vm/erf_funcs.hpp similarity index 100% rename from dpnp/backend/extensions/vm/erf_funcs.hpp rename to dpnp/libtensor/extensions/vm/erf_funcs.hpp diff --git a/dpnp/backend/extensions/vm/exp.cpp b/dpnp/libtensor/extensions/vm/exp.cpp similarity index 94% rename from dpnp/backend/extensions/vm/exp.cpp rename to dpnp/libtensor/extensions/vm/exp.cpp index fb765d0d7f2e..bbcefdc460b1 100644 --- a/dpnp/backend/extensions/vm/exp.cpp +++ b/dpnp/libtensor/extensions/vm/exp.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "exp.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/exp.hpp b/dpnp/libtensor/extensions/vm/exp.hpp similarity index 100% rename from dpnp/backend/extensions/vm/exp.hpp rename to dpnp/libtensor/extensions/vm/exp.hpp diff --git a/dpnp/backend/extensions/vm/exp2.cpp b/dpnp/libtensor/extensions/vm/exp2.cpp similarity index 94% rename from dpnp/backend/extensions/vm/exp2.cpp rename to dpnp/libtensor/extensions/vm/exp2.cpp index 3472187f7d4a..d25e9b89bcd8 100644 --- a/dpnp/backend/extensions/vm/exp2.cpp +++ b/dpnp/libtensor/extensions/vm/exp2.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "exp2.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/exp2.hpp b/dpnp/libtensor/extensions/vm/exp2.hpp similarity index 100% rename from dpnp/backend/extensions/vm/exp2.hpp rename to dpnp/libtensor/extensions/vm/exp2.hpp diff --git a/dpnp/backend/extensions/vm/expm1.cpp b/dpnp/libtensor/extensions/vm/expm1.cpp similarity index 94% rename from dpnp/backend/extensions/vm/expm1.cpp rename to dpnp/libtensor/extensions/vm/expm1.cpp index 9ad3db32813b..6d62800bc735 100644 --- a/dpnp/backend/extensions/vm/expm1.cpp +++ b/dpnp/libtensor/extensions/vm/expm1.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "expm1.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/expm1.hpp b/dpnp/libtensor/extensions/vm/expm1.hpp similarity index 100% rename from dpnp/backend/extensions/vm/expm1.hpp rename to dpnp/libtensor/extensions/vm/expm1.hpp diff --git a/dpnp/backend/extensions/vm/floor.cpp b/dpnp/libtensor/extensions/vm/floor.cpp similarity index 94% rename from dpnp/backend/extensions/vm/floor.cpp rename to dpnp/libtensor/extensions/vm/floor.cpp index 086097a5db52..91350e695887 100644 --- a/dpnp/backend/extensions/vm/floor.cpp +++ b/dpnp/libtensor/extensions/vm/floor.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "floor.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/floor.hpp b/dpnp/libtensor/extensions/vm/floor.hpp similarity index 100% rename from dpnp/backend/extensions/vm/floor.hpp rename to dpnp/libtensor/extensions/vm/floor.hpp diff --git a/dpnp/backend/extensions/vm/fmax.cpp b/dpnp/libtensor/extensions/vm/fmax.cpp similarity index 95% rename from dpnp/backend/extensions/vm/fmax.cpp rename to dpnp/libtensor/extensions/vm/fmax.cpp index 709c96b27080..a7093f0a95c3 100644 --- a/dpnp/backend/extensions/vm/fmax.cpp +++ b/dpnp/libtensor/extensions/vm/fmax.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "fmax.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/fmax.hpp b/dpnp/libtensor/extensions/vm/fmax.hpp similarity index 100% rename from dpnp/backend/extensions/vm/fmax.hpp rename to dpnp/libtensor/extensions/vm/fmax.hpp diff --git a/dpnp/backend/extensions/vm/fmin.cpp b/dpnp/libtensor/extensions/vm/fmin.cpp similarity index 95% rename from dpnp/backend/extensions/vm/fmin.cpp rename to dpnp/libtensor/extensions/vm/fmin.cpp index a20c07136c87..47cc154c91e4 100644 --- a/dpnp/backend/extensions/vm/fmin.cpp +++ b/dpnp/libtensor/extensions/vm/fmin.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "fmin.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/fmin.hpp b/dpnp/libtensor/extensions/vm/fmin.hpp similarity index 100% rename from dpnp/backend/extensions/vm/fmin.hpp rename to dpnp/libtensor/extensions/vm/fmin.hpp diff --git a/dpnp/backend/extensions/vm/fmod.cpp b/dpnp/libtensor/extensions/vm/fmod.cpp similarity index 95% rename from dpnp/backend/extensions/vm/fmod.cpp rename to dpnp/libtensor/extensions/vm/fmod.cpp index a9b66e820da9..56481afa5ef4 100644 --- a/dpnp/backend/extensions/vm/fmod.cpp +++ b/dpnp/libtensor/extensions/vm/fmod.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "fmod.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/fmod.hpp b/dpnp/libtensor/extensions/vm/fmod.hpp similarity index 100% rename from dpnp/backend/extensions/vm/fmod.hpp rename to dpnp/libtensor/extensions/vm/fmod.hpp diff --git a/dpnp/backend/extensions/vm/hypot.cpp b/dpnp/libtensor/extensions/vm/hypot.cpp similarity index 95% rename from dpnp/backend/extensions/vm/hypot.cpp rename to dpnp/libtensor/extensions/vm/hypot.cpp index d979fc4dcd4a..88195916d322 100644 --- a/dpnp/backend/extensions/vm/hypot.cpp +++ b/dpnp/libtensor/extensions/vm/hypot.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "hypot.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/hypot.hpp b/dpnp/libtensor/extensions/vm/hypot.hpp similarity index 100% rename from dpnp/backend/extensions/vm/hypot.hpp rename to dpnp/libtensor/extensions/vm/hypot.hpp diff --git a/dpnp/backend/extensions/vm/i0.cpp b/dpnp/libtensor/extensions/vm/i0.cpp similarity index 94% rename from dpnp/backend/extensions/vm/i0.cpp rename to dpnp/libtensor/extensions/vm/i0.cpp index a2ce992877a2..68d3d8660647 100644 --- a/dpnp/backend/extensions/vm/i0.cpp +++ b/dpnp/libtensor/extensions/vm/i0.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "i0.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/i0.hpp b/dpnp/libtensor/extensions/vm/i0.hpp similarity index 100% rename from dpnp/backend/extensions/vm/i0.hpp rename to dpnp/libtensor/extensions/vm/i0.hpp diff --git a/dpnp/backend/extensions/vm/inv.cpp b/dpnp/libtensor/extensions/vm/inv.cpp similarity index 94% rename from dpnp/backend/extensions/vm/inv.cpp rename to dpnp/libtensor/extensions/vm/inv.cpp index 1df30d520ef7..5575be3cb42b 100644 --- a/dpnp/backend/extensions/vm/inv.cpp +++ b/dpnp/libtensor/extensions/vm/inv.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "inv.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/inv.hpp b/dpnp/libtensor/extensions/vm/inv.hpp similarity index 100% rename from dpnp/backend/extensions/vm/inv.hpp rename to dpnp/libtensor/extensions/vm/inv.hpp diff --git a/dpnp/backend/extensions/vm/ln.cpp b/dpnp/libtensor/extensions/vm/ln.cpp similarity index 94% rename from dpnp/backend/extensions/vm/ln.cpp rename to dpnp/libtensor/extensions/vm/ln.cpp index 029266d38cce..8ce83e2c4762 100644 --- a/dpnp/backend/extensions/vm/ln.cpp +++ b/dpnp/libtensor/extensions/vm/ln.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "ln.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/ln.hpp b/dpnp/libtensor/extensions/vm/ln.hpp similarity index 100% rename from dpnp/backend/extensions/vm/ln.hpp rename to dpnp/libtensor/extensions/vm/ln.hpp diff --git a/dpnp/backend/extensions/vm/log10.cpp b/dpnp/libtensor/extensions/vm/log10.cpp similarity index 94% rename from dpnp/backend/extensions/vm/log10.cpp rename to dpnp/libtensor/extensions/vm/log10.cpp index 4eb0b4a7781d..b175c336a8c2 100644 --- a/dpnp/backend/extensions/vm/log10.cpp +++ b/dpnp/libtensor/extensions/vm/log10.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "log10.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/log10.hpp b/dpnp/libtensor/extensions/vm/log10.hpp similarity index 100% rename from dpnp/backend/extensions/vm/log10.hpp rename to dpnp/libtensor/extensions/vm/log10.hpp diff --git a/dpnp/backend/extensions/vm/log1p.cpp b/dpnp/libtensor/extensions/vm/log1p.cpp similarity index 94% rename from dpnp/backend/extensions/vm/log1p.cpp rename to dpnp/libtensor/extensions/vm/log1p.cpp index 7a1673ad7e0a..336ddb8cbc80 100644 --- a/dpnp/backend/extensions/vm/log1p.cpp +++ b/dpnp/libtensor/extensions/vm/log1p.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "log1p.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/log1p.hpp b/dpnp/libtensor/extensions/vm/log1p.hpp similarity index 100% rename from dpnp/backend/extensions/vm/log1p.hpp rename to dpnp/libtensor/extensions/vm/log1p.hpp diff --git a/dpnp/backend/extensions/vm/log2.cpp b/dpnp/libtensor/extensions/vm/log2.cpp similarity index 94% rename from dpnp/backend/extensions/vm/log2.cpp rename to dpnp/libtensor/extensions/vm/log2.cpp index 95395a069921..c17f4e19ab12 100644 --- a/dpnp/backend/extensions/vm/log2.cpp +++ b/dpnp/libtensor/extensions/vm/log2.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "log2.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/log2.hpp b/dpnp/libtensor/extensions/vm/log2.hpp similarity index 100% rename from dpnp/backend/extensions/vm/log2.hpp rename to dpnp/libtensor/extensions/vm/log2.hpp diff --git a/dpnp/backend/extensions/vm/modf.cpp b/dpnp/libtensor/extensions/vm/modf.cpp similarity index 87% rename from dpnp/backend/extensions/vm/modf.cpp rename to dpnp/libtensor/extensions/vm/modf.cpp index 7ba980462888..68b6f9459108 100644 --- a/dpnp/backend/extensions/vm/modf.cpp +++ b/dpnp/libtensor/extensions/vm/modf.cpp @@ -43,13 +43,10 @@ #include "common.hpp" #include "modf.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" -#include "../elementwise_functions/common.hpp" -#include "../elementwise_functions/type_dispatch_building.hpp" +#include "kernels/elementwise_functions/common_two_outputs.hpp" +#include "utils/type_dispatch_building.hpp" // dpnp tensor headers #include "utils/type_dispatch.hpp" @@ -58,14 +55,13 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl { -namespace ew_cmn_ns = dpnp::extensions::py_internal::elementwise_common; +namespace ew_cmn_ns = dpnp::tensor::kernels::elementwise_common; namespace mkl_vm = oneapi::mkl::vm; // OneMKL namespace with VM functions -namespace td_int_ns = py_int::type_dispatch; namespace tu_ns = dpnp::tensor::type_utils; /** @@ -78,10 +74,10 @@ template struct OutputType { using table_type = - std::disjunction, - td_int_ns::TypeMapTwoResultsEntry, - td_int_ns::TypeMapTwoResultsEntry, - td_int_ns::DefaultTwoResultsEntry>; + std::disjunction, + td_ns::TypeMapTwoResultsEntry, + td_ns::TypeMapTwoResultsEntry, + td_ns::DefaultTwoResultsEntry>; using value_type1 = typename table_type::result_type1; using value_type2 = typename table_type::result_type2; }; diff --git a/dpnp/backend/extensions/vm/modf.hpp b/dpnp/libtensor/extensions/vm/modf.hpp similarity index 100% rename from dpnp/backend/extensions/vm/modf.hpp rename to dpnp/libtensor/extensions/vm/modf.hpp diff --git a/dpnp/backend/extensions/vm/mul.cpp b/dpnp/libtensor/extensions/vm/mul.cpp similarity index 95% rename from dpnp/backend/extensions/vm/mul.cpp rename to dpnp/libtensor/extensions/vm/mul.cpp index 1e48af3c6714..a25f6794da48 100644 --- a/dpnp/backend/extensions/vm/mul.cpp +++ b/dpnp/libtensor/extensions/vm/mul.cpp @@ -44,10 +44,7 @@ #include "common.hpp" #include "mul.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -57,7 +54,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/mul.hpp b/dpnp/libtensor/extensions/vm/mul.hpp similarity index 100% rename from dpnp/backend/extensions/vm/mul.hpp rename to dpnp/libtensor/extensions/vm/mul.hpp diff --git a/dpnp/backend/extensions/vm/nextafter.cpp b/dpnp/libtensor/extensions/vm/nextafter.cpp similarity index 95% rename from dpnp/backend/extensions/vm/nextafter.cpp rename to dpnp/libtensor/extensions/vm/nextafter.cpp index eb2d82e23f9b..32e4df5895df 100644 --- a/dpnp/backend/extensions/vm/nextafter.cpp +++ b/dpnp/libtensor/extensions/vm/nextafter.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "nextafter.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/nextafter.hpp b/dpnp/libtensor/extensions/vm/nextafter.hpp similarity index 100% rename from dpnp/backend/extensions/vm/nextafter.hpp rename to dpnp/libtensor/extensions/vm/nextafter.hpp diff --git a/dpnp/backend/extensions/vm/pow.cpp b/dpnp/libtensor/extensions/vm/pow.cpp similarity index 95% rename from dpnp/backend/extensions/vm/pow.cpp rename to dpnp/libtensor/extensions/vm/pow.cpp index c970abbbf350..7aed34fe5fd3 100644 --- a/dpnp/backend/extensions/vm/pow.cpp +++ b/dpnp/libtensor/extensions/vm/pow.cpp @@ -44,10 +44,7 @@ #include "common.hpp" #include "pow.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -57,7 +54,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/pow.hpp b/dpnp/libtensor/extensions/vm/pow.hpp similarity index 100% rename from dpnp/backend/extensions/vm/pow.hpp rename to dpnp/libtensor/extensions/vm/pow.hpp diff --git a/dpnp/backend/extensions/vm/rint.cpp b/dpnp/libtensor/extensions/vm/rint.cpp similarity index 94% rename from dpnp/backend/extensions/vm/rint.cpp rename to dpnp/libtensor/extensions/vm/rint.cpp index ff333d877a30..5723065c53ac 100644 --- a/dpnp/backend/extensions/vm/rint.cpp +++ b/dpnp/libtensor/extensions/vm/rint.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "rint.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/rint.hpp b/dpnp/libtensor/extensions/vm/rint.hpp similarity index 100% rename from dpnp/backend/extensions/vm/rint.hpp rename to dpnp/libtensor/extensions/vm/rint.hpp diff --git a/dpnp/backend/extensions/vm/sin.cpp b/dpnp/libtensor/extensions/vm/sin.cpp similarity index 94% rename from dpnp/backend/extensions/vm/sin.cpp rename to dpnp/libtensor/extensions/vm/sin.cpp index cdf7e6b57816..9dec89ad9d6b 100644 --- a/dpnp/backend/extensions/vm/sin.cpp +++ b/dpnp/libtensor/extensions/vm/sin.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "sin.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/sin.hpp b/dpnp/libtensor/extensions/vm/sin.hpp similarity index 100% rename from dpnp/backend/extensions/vm/sin.hpp rename to dpnp/libtensor/extensions/vm/sin.hpp diff --git a/dpnp/backend/extensions/vm/sinh.cpp b/dpnp/libtensor/extensions/vm/sinh.cpp similarity index 94% rename from dpnp/backend/extensions/vm/sinh.cpp rename to dpnp/libtensor/extensions/vm/sinh.cpp index 6593c3c907e7..ab3d77b9add1 100644 --- a/dpnp/backend/extensions/vm/sinh.cpp +++ b/dpnp/libtensor/extensions/vm/sinh.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "sinh.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/sinh.hpp b/dpnp/libtensor/extensions/vm/sinh.hpp similarity index 100% rename from dpnp/backend/extensions/vm/sinh.hpp rename to dpnp/libtensor/extensions/vm/sinh.hpp diff --git a/dpnp/backend/extensions/vm/sqr.cpp b/dpnp/libtensor/extensions/vm/sqr.cpp similarity index 94% rename from dpnp/backend/extensions/vm/sqr.cpp rename to dpnp/libtensor/extensions/vm/sqr.cpp index e6b8f2180c22..80e30762a0b0 100644 --- a/dpnp/backend/extensions/vm/sqr.cpp +++ b/dpnp/libtensor/extensions/vm/sqr.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "sqr.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/sqr.hpp b/dpnp/libtensor/extensions/vm/sqr.hpp similarity index 100% rename from dpnp/backend/extensions/vm/sqr.hpp rename to dpnp/libtensor/extensions/vm/sqr.hpp diff --git a/dpnp/backend/extensions/vm/sqrt.cpp b/dpnp/libtensor/extensions/vm/sqrt.cpp similarity index 94% rename from dpnp/backend/extensions/vm/sqrt.cpp rename to dpnp/libtensor/extensions/vm/sqrt.cpp index 27bda2a1a912..2a1bb7f7a991 100644 --- a/dpnp/backend/extensions/vm/sqrt.cpp +++ b/dpnp/libtensor/extensions/vm/sqrt.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "sqrt.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/sqrt.hpp b/dpnp/libtensor/extensions/vm/sqrt.hpp similarity index 100% rename from dpnp/backend/extensions/vm/sqrt.hpp rename to dpnp/libtensor/extensions/vm/sqrt.hpp diff --git a/dpnp/backend/extensions/vm/sub.cpp b/dpnp/libtensor/extensions/vm/sub.cpp similarity index 95% rename from dpnp/backend/extensions/vm/sub.cpp rename to dpnp/libtensor/extensions/vm/sub.cpp index 099f6d11dc87..022ec5bfefaa 100644 --- a/dpnp/backend/extensions/vm/sub.cpp +++ b/dpnp/libtensor/extensions/vm/sub.cpp @@ -44,10 +44,7 @@ #include "common.hpp" #include "sub.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -57,7 +54,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/sub.hpp b/dpnp/libtensor/extensions/vm/sub.hpp similarity index 100% rename from dpnp/backend/extensions/vm/sub.hpp rename to dpnp/libtensor/extensions/vm/sub.hpp diff --git a/dpnp/backend/extensions/vm/tan.cpp b/dpnp/libtensor/extensions/vm/tan.cpp similarity index 94% rename from dpnp/backend/extensions/vm/tan.cpp rename to dpnp/libtensor/extensions/vm/tan.cpp index 9c1d43011122..a4ff4842c4af 100644 --- a/dpnp/backend/extensions/vm/tan.cpp +++ b/dpnp/libtensor/extensions/vm/tan.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "tan.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/tan.hpp b/dpnp/libtensor/extensions/vm/tan.hpp similarity index 100% rename from dpnp/backend/extensions/vm/tan.hpp rename to dpnp/libtensor/extensions/vm/tan.hpp diff --git a/dpnp/backend/extensions/vm/tanh.cpp b/dpnp/libtensor/extensions/vm/tanh.cpp similarity index 94% rename from dpnp/backend/extensions/vm/tanh.cpp rename to dpnp/libtensor/extensions/vm/tanh.cpp index bf8ef3d0b018..9734a2fc7185 100644 --- a/dpnp/backend/extensions/vm/tanh.cpp +++ b/dpnp/libtensor/extensions/vm/tanh.cpp @@ -43,10 +43,7 @@ #include "common.hpp" #include "tanh.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -56,7 +53,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/tanh.hpp b/dpnp/libtensor/extensions/vm/tanh.hpp similarity index 100% rename from dpnp/backend/extensions/vm/tanh.hpp rename to dpnp/libtensor/extensions/vm/tanh.hpp diff --git a/dpnp/backend/extensions/vm/trunc.cpp b/dpnp/libtensor/extensions/vm/trunc.cpp similarity index 94% rename from dpnp/backend/extensions/vm/trunc.cpp rename to dpnp/libtensor/extensions/vm/trunc.cpp index f04216176373..57a749916af9 100644 --- a/dpnp/backend/extensions/vm/trunc.cpp +++ b/dpnp/libtensor/extensions/vm/trunc.cpp @@ -42,10 +42,7 @@ #include "common.hpp" #include "trunc.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions/elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" @@ -55,7 +52,7 @@ namespace dpnp::extensions::vm { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; +namespace py_int = dpnp::tensor::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl diff --git a/dpnp/backend/extensions/vm/trunc.hpp b/dpnp/libtensor/extensions/vm/trunc.hpp similarity index 100% rename from dpnp/backend/extensions/vm/trunc.hpp rename to dpnp/libtensor/extensions/vm/trunc.hpp diff --git a/dpnp/backend/extensions/vm/vm_py.cpp b/dpnp/libtensor/extensions/vm/vm_py.cpp similarity index 98% rename from dpnp/backend/extensions/vm/vm_py.cpp rename to dpnp/libtensor/extensions/vm/vm_py.cpp index 8c42671a0b27..8965fbc79584 100644 --- a/dpnp/backend/extensions/vm/vm_py.cpp +++ b/dpnp/libtensor/extensions/vm/vm_py.cpp @@ -26,7 +26,7 @@ // THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************** // -// This file defines functions of dpnp.backend._vm_impl extensions +// This file defines functions of dpnp.libtensor._vm_impl extensions // //***************************************************************************** diff --git a/dpnp/backend/extensions/common/ext/common.hpp b/dpnp/libtensor/include/ext/common.hpp similarity index 100% rename from dpnp/backend/extensions/common/ext/common.hpp rename to dpnp/libtensor/include/ext/common.hpp diff --git a/dpnp/backend/extensions/common/ext/details/common_internal.hpp b/dpnp/libtensor/include/ext/details/common_internal.hpp similarity index 100% rename from dpnp/backend/extensions/common/ext/details/common_internal.hpp rename to dpnp/libtensor/include/ext/details/common_internal.hpp diff --git a/dpnp/backend/extensions/common/ext/details/validation_utils_internal.hpp b/dpnp/libtensor/include/ext/details/validation_utils_internal.hpp similarity index 100% rename from dpnp/backend/extensions/common/ext/details/validation_utils_internal.hpp rename to dpnp/libtensor/include/ext/details/validation_utils_internal.hpp diff --git a/dpnp/backend/extensions/common/ext/dispatch_table.hpp b/dpnp/libtensor/include/ext/dispatch_table.hpp similarity index 100% rename from dpnp/backend/extensions/common/ext/dispatch_table.hpp rename to dpnp/libtensor/include/ext/dispatch_table.hpp diff --git a/dpnp/backend/extensions/common/ext/validation_utils.hpp b/dpnp/libtensor/include/ext/validation_utils.hpp similarity index 100% rename from dpnp/backend/extensions/common/ext/validation_utils.hpp rename to dpnp/libtensor/include/ext/validation_utils.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/accumulators.hpp b/dpnp/libtensor/include/kernels/accumulators.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/accumulators.hpp rename to dpnp/libtensor/include/kernels/accumulators.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/alignment.hpp b/dpnp/libtensor/include/kernels/alignment.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/alignment.hpp rename to dpnp/libtensor/include/kernels/alignment.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/boolean_advanced_indexing.hpp b/dpnp/libtensor/include/kernels/boolean_advanced_indexing.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/boolean_advanced_indexing.hpp rename to dpnp/libtensor/include/kernels/boolean_advanced_indexing.hpp diff --git a/dpnp/backend/kernels/indexing/choose.hpp b/dpnp/libtensor/include/kernels/choose.hpp similarity index 98% rename from dpnp/backend/kernels/indexing/choose.hpp rename to dpnp/libtensor/include/kernels/choose.hpp index 853394780475..b7f9a9e57db0 100644 --- a/dpnp/backend/kernels/indexing/choose.hpp +++ b/dpnp/libtensor/include/kernels/choose.hpp @@ -35,7 +35,7 @@ #include "kernels/dpnp_tensor_types.hpp" #include "utils/strided_iters.hpp" -namespace dpnp::kernels::choose +namespace dpnp::tensor::kernels::choose { using dpnp::tensor::ssize_t; @@ -125,4 +125,4 @@ struct NthStrideOffsetUnpacked static_assert(sycl::is_device_copyable_v); } // namespace strides -} // namespace dpnp::kernels::choose +} // namespace dpnp::tensor::kernels::choose diff --git a/dpnp/tensor/libtensor/include/kernels/clip.hpp b/dpnp/libtensor/include/kernels/clip.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/clip.hpp rename to dpnp/libtensor/include/kernels/clip.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/constructors.hpp b/dpnp/libtensor/include/kernels/constructors.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/constructors.hpp rename to dpnp/libtensor/include/kernels/constructors.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/copy_and_cast.hpp b/dpnp/libtensor/include/kernels/copy_and_cast.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/copy_and_cast.hpp rename to dpnp/libtensor/include/kernels/copy_and_cast.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/copy_as_contiguous.hpp b/dpnp/libtensor/include/kernels/copy_as_contiguous.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/copy_as_contiguous.hpp rename to dpnp/libtensor/include/kernels/copy_as_contiguous.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/dpnp_tensor_types.hpp b/dpnp/libtensor/include/kernels/dpnp_tensor_types.hpp similarity index 96% rename from dpnp/tensor/libtensor/include/kernels/dpnp_tensor_types.hpp rename to dpnp/libtensor/include/kernels/dpnp_tensor_types.hpp index 6f9777b6e416..348b16be06a6 100644 --- a/dpnp/tensor/libtensor/include/kernels/dpnp_tensor_types.hpp +++ b/dpnp/libtensor/include/kernels/dpnp_tensor_types.hpp @@ -27,7 +27,7 @@ //***************************************************************************** /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/abs.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/abs.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/abs.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/abs.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/acos.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/acos.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/acos.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/acos.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/acosh.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/acosh.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/acosh.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/acosh.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/add.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/add.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/add.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/add.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/angle.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/angle.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/angle.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/angle.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/asin.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/asin.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/asin.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/asin.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/asinh.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/asinh.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/asinh.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/asinh.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/atan.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/atan.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/atan.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/atan.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/atan2.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/atan2.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/atan2.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/atan2.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/atanh.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/atanh.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/atanh.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/atanh.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_and.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/bitwise_and.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_and.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/bitwise_and.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/bitwise_count.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/bitwise_count.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/bitwise_count.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/bitwise_count.hpp index d73d9303145e..3201a8404af2 100644 --- a/dpnp/backend/kernels/elementwise_functions/bitwise_count.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/bitwise_count.hpp @@ -33,7 +33,7 @@ // dpnp tensor headers #include "utils/type_utils.hpp" -namespace dpnp::kernels::bitwise_count +namespace dpnp::tensor::kernels::bitwise_count { namespace tu_ns = dpnp::tensor::type_utils; @@ -59,4 +59,4 @@ struct BitwiseCountFunctor } } }; -} // namespace dpnp::kernels::bitwise_count +} // namespace dpnp::tensor::kernels::bitwise_count diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_invert.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/bitwise_invert.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_invert.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/bitwise_invert.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_or.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/bitwise_or.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_or.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/bitwise_or.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_right_shift.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/bitwise_right_shift.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_right_shift.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/bitwise_right_shift.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_xor.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/bitwise_xor.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/bitwise_xor.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/bitwise_xor.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/cabs_impl.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/cabs_impl.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/cabs_impl.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/cabs_impl.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/cbrt.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/cbrt.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/cbrt.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/cbrt.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/ceil.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/ceil.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/ceil.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/ceil.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/common.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/common.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/common.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/common.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/common_detail.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/common_detail.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/common_detail.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/common_detail.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/common_inplace.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/common_inplace.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/common_inplace.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/common_inplace.hpp diff --git a/dpnp/backend/extensions/elementwise_functions/common.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/common_two_outputs.hpp similarity index 97% rename from dpnp/backend/extensions/elementwise_functions/common.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/common_two_outputs.hpp index 8cfdb6b46890..a0dd592a8102 100644 --- a/dpnp/backend/extensions/elementwise_functions/common.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/common_two_outputs.hpp @@ -25,6 +25,13 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF // THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************** +// +//===---------------------------------------------------------------------===// +/// +/// \file +/// This file defines common code for elementwise tensor operations with two +/// output arrays. +//===---------------------------------------------------------------------===// #pragma once @@ -36,19 +43,16 @@ #include -// dpnp tensor headers #include "kernels/alignment.hpp" #include "kernels/elementwise_functions/common.hpp" #include "utils/sycl_utils.hpp" -namespace dpnp::extensions::py_internal::elementwise_common +namespace dpnp::tensor::kernels::elementwise_common { using dpnp::tensor::kernels::alignment_utils::disabled_sg_loadstore_wrapper_krn; using dpnp::tensor::kernels::alignment_utils::is_aligned; using dpnp::tensor::kernels::alignment_utils::required_alignment; -using dpnp::tensor::kernels::elementwise_common::select_lws; - using dpnp::tensor::sycl_utils::sub_group_load; using dpnp::tensor::sycl_utils::sub_group_store; @@ -56,8 +60,8 @@ using dpnp::tensor::sycl_utils::sub_group_store; * @brief Functor for evaluation of a unary function with two output arrays on * contiguous arrays. * - * @note It extends UnaryContigFunctor from - * dpnp::tensor::kernels::elementwise_common namespace. + * @note It extends UnaryContigFunctor with support of + * the two output arrays. */ template class UnaryTwoOutputsType, @@ -599,8 +603,8 @@ sycl::event * @brief Function to submit a kernel for unary functor with two output arrays * on strided data. * - * @note It extends unary_strided_impl from - * dpnp::tensor::kernels::elementwise_common namespace. + * @note It extends unary_strided_impl with support of + * the two output arrays. */ template class UnaryTwoOutputsType, @@ -655,8 +659,8 @@ sycl::event unary_two_outputs_strided_impl( * @brief Function to submit a kernel for binary functor with two output arrays * on contiguous arrays. * - * @note It extends binary_contig_impl from - * dpnp::tensor::kernels::elementwise_common namespace. + * @note It extends binary_contig_impl with support of + * the two output arrays. */ template < typename argTy1, @@ -748,8 +752,8 @@ sycl::event * @brief Function to submit a kernel for binary functor with two output arrays * on strided data. * - * @note It extends binary_strided_impl from - * dpnp::tensor::kernels::elementwise_common namespace. + * @note It extends binary_strided_impl with support of + * the two output arrays. */ template &, const std::vector &); -} // namespace dpnp::extensions::py_internal::elementwise_common +} // namespace dpnp::tensor::kernels::elementwise_common diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/complex_math.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/complex_math.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/complex_math.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/complex_math.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/conj.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/conj.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/copysign.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/copysign.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/copysign.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/copysign.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/cos.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/cos.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/cos.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/cos.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/cosh.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/cosh.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/cosh.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/cosh.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/degrees.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/degrees.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/degrees.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/degrees.hpp index 8493a1821a6a..664faf0e0ab2 100644 --- a/dpnp/backend/kernels/elementwise_functions/degrees.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/degrees.hpp @@ -30,7 +30,7 @@ #include -namespace dpnp::kernels::degrees +namespace dpnp::tensor::kernels::degrees { template struct DegreesFunctor @@ -52,4 +52,4 @@ struct DegreesFunctor return sycl::degrees(x); } }; -} // namespace dpnp::kernels::degrees +} // namespace dpnp::tensor::kernels::degrees diff --git a/dpnp/backend/kernels/elementwise_functions/divmod.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/divmod.hpp similarity index 98% rename from dpnp/backend/kernels/elementwise_functions/divmod.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/divmod.hpp index 37a79cffb7f2..5e0fd3ce9a27 100644 --- a/dpnp/backend/kernels/elementwise_functions/divmod.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/divmod.hpp @@ -33,7 +33,7 @@ #include -namespace dpnp::kernels::divmod +namespace dpnp::tensor::kernels::divmod { template struct DivmodFunctor @@ -117,4 +117,4 @@ struct DivmodFunctor private: bool l_xor(bool b1, bool b2) const { return (b1 != b2); } }; -} // namespace dpnp::kernels::divmod +} // namespace dpnp::tensor::kernels::divmod diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/equal.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/equal.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/equal.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/equal.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/erf.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/erf.hpp similarity index 98% rename from dpnp/backend/kernels/elementwise_functions/erf.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/erf.hpp index 4ead1174a0c1..d73ac7d30b72 100644 --- a/dpnp/backend/kernels/elementwise_functions/erf.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/erf.hpp @@ -46,7 +46,7 @@ #include "erfinv.hpp" #endif -namespace dpnp::kernels::erfs +namespace dpnp::tensor::kernels::erfs { template struct BaseFunctor @@ -97,4 +97,4 @@ MACRO_DEFINE_FUNCTOR(sycl::erfc, Erfc); MACRO_DEFINE_FUNCTOR(erfcx, Erfcx); MACRO_DEFINE_FUNCTOR(erfinv, Erfinv); MACRO_DEFINE_FUNCTOR(erfcinv, Erfcinv); -} // namespace dpnp::kernels::erfs +} // namespace dpnp::tensor::kernels::erfs diff --git a/dpnp/backend/kernels/elementwise_functions/erfcx.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/erfcx.hpp similarity index 99% rename from dpnp/backend/kernels/elementwise_functions/erfcx.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/erfcx.hpp index 1dd3205d3484..cc7cdcab296d 100644 --- a/dpnp/backend/kernels/elementwise_functions/erfcx.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/erfcx.hpp @@ -31,7 +31,7 @@ #include #include -namespace dpnp::kernels::erfs::impl +namespace dpnp::tensor::kernels::erfs::impl { /** Steven G. Johnson, October 2012. @@ -1648,4 +1648,4 @@ inline Tp erfcx(Tp x) : (x < -6.1 ? 2 * sycl::exp(x * x) : 2 * sycl::exp(x * x) - erfcx_y100(400 / (4 - x))); } -} // namespace dpnp::kernels::erfs::impl +} // namespace dpnp::tensor::kernels::erfs::impl diff --git a/dpnp/backend/kernels/elementwise_functions/erfinv.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/erfinv.hpp similarity index 98% rename from dpnp/backend/kernels/elementwise_functions/erfinv.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/erfinv.hpp index 80409d6c14a4..f14ca082e8c4 100644 --- a/dpnp/backend/kernels/elementwise_functions/erfinv.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/erfinv.hpp @@ -31,7 +31,7 @@ #include #include -namespace dpnp::kernels::erfs::impl +namespace dpnp::tensor::kernels::erfs::impl { template inline Tp polevl(Tp x, const Tp *coeff, int i) @@ -216,4 +216,4 @@ inline Tp erfcinv(Tp y) } return std::numeric_limits::quiet_NaN(); } -} // namespace dpnp::kernels::erfs::impl +} // namespace dpnp::tensor::kernels::erfs::impl diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/exp.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/exp.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/exp.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/exp.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/exp2.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/exp2.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/exp2.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/exp2.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/expm1.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/expm1.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/expm1.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/expm1.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/fabs.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/fabs.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/fabs.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/fabs.hpp index 13c5e81898b7..4cf5707972b3 100644 --- a/dpnp/backend/kernels/elementwise_functions/fabs.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/fabs.hpp @@ -30,7 +30,7 @@ #include -namespace dpnp::kernels::fabs +namespace dpnp::tensor::kernels::fabs { template struct FabsFunctor @@ -46,4 +46,4 @@ struct FabsFunctor resT operator()(const argT &x) const { return sycl::fabs(x); } }; -} // namespace dpnp::kernels::fabs +} // namespace dpnp::tensor::kernels::fabs diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/floor.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/floor.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/floor.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/floor.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/floor_divide.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/floor_divide.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/floor_divide.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/floor_divide.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/fmax.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/fmax.hpp similarity index 97% rename from dpnp/backend/kernels/elementwise_functions/fmax.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/fmax.hpp index b7521c1367fe..3ce9747daa8f 100644 --- a/dpnp/backend/kernels/elementwise_functions/fmax.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/fmax.hpp @@ -34,7 +34,7 @@ #include "utils/math_utils.hpp" #include "utils/type_utils.hpp" -namespace dpnp::kernels::fmax +namespace dpnp::tensor::kernels::fmax { namespace mu_ns = dpnp::tensor::math_utils; namespace tu_ns = dpnp::tensor::type_utils; @@ -81,4 +81,4 @@ struct FmaxFunctor return sycl::fmax(in1, in2); } }; -} // namespace dpnp::kernels::fmax +} // namespace dpnp::tensor::kernels::fmax diff --git a/dpnp/backend/kernels/elementwise_functions/fmin.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/fmin.hpp similarity index 97% rename from dpnp/backend/kernels/elementwise_functions/fmin.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/fmin.hpp index 3fdd1a2aa260..d0dbd576a38e 100644 --- a/dpnp/backend/kernels/elementwise_functions/fmin.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/fmin.hpp @@ -34,7 +34,7 @@ #include "utils/math_utils.hpp" #include "utils/type_utils.hpp" -namespace dpnp::kernels::fmin +namespace dpnp::tensor::kernels::fmin { namespace mu_ns = dpnp::tensor::math_utils; namespace tu_ns = dpnp::tensor::type_utils; @@ -81,4 +81,4 @@ struct FminFunctor return sycl::fmin(in1, in2); } }; -} // namespace dpnp::kernels::fmin +} // namespace dpnp::tensor::kernels::fmin diff --git a/dpnp/backend/kernels/elementwise_functions/fmod.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/fmod.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/fmod.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/fmod.hpp index e9278f9be41c..9495ed13b1fe 100644 --- a/dpnp/backend/kernels/elementwise_functions/fmod.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/fmod.hpp @@ -30,7 +30,7 @@ #include -namespace dpnp::kernels::fmod +namespace dpnp::tensor::kernels::fmod { template struct FmodFunctor @@ -60,4 +60,4 @@ struct FmodFunctor return sycl::fmod(in1, in2); } }; -} // namespace dpnp::kernels::fmod +} // namespace dpnp::tensor::kernels::fmod diff --git a/dpnp/backend/kernels/elementwise_functions/frexp.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/frexp.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/frexp.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/frexp.hpp index 8ab800fef15e..ad6acf38fcf3 100644 --- a/dpnp/backend/kernels/elementwise_functions/frexp.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/frexp.hpp @@ -30,7 +30,7 @@ #include -namespace dpnp::kernels::frexp +namespace dpnp::tensor::kernels::frexp { template struct FrexpFunctor @@ -50,4 +50,4 @@ struct FrexpFunctor return sycl::frexp(in, &exp); } }; -} // namespace dpnp::kernels::frexp +} // namespace dpnp::tensor::kernels::frexp diff --git a/dpnp/backend/kernels/elementwise_functions/gcd.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/gcd.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/gcd.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/gcd.hpp index 5b7e76e5c3c7..632c7bb268b7 100644 --- a/dpnp/backend/kernels/elementwise_functions/gcd.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/gcd.hpp @@ -31,7 +31,7 @@ #include #include -namespace dpnp::kernels::gcd +namespace dpnp::tensor::kernels::gcd { template struct GcdFunctor @@ -47,4 +47,4 @@ struct GcdFunctor return oneapi::dpl::gcd(in1, in2); } }; -} // namespace dpnp::kernels::gcd +} // namespace dpnp::tensor::kernels::gcd diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/greater.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/greater.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/greater.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/greater.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/greater_equal.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/greater_equal.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/greater_equal.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/greater_equal.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/heaviside.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/heaviside.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/heaviside.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/heaviside.hpp index d2f3efbbdcac..2738070ce5c1 100644 --- a/dpnp/backend/kernels/elementwise_functions/heaviside.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/heaviside.hpp @@ -34,7 +34,7 @@ #include "utils/math_utils.hpp" #include "utils/type_utils.hpp" -namespace dpnp::kernels::heaviside +namespace dpnp::tensor::kernels::heaviside { namespace mu_ns = dpnp::tensor::math_utils; namespace tu_ns = dpnp::tensor::type_utils; @@ -57,4 +57,4 @@ struct HeavisideFunctor return resT(in1 > 0); } }; -} // namespace dpnp::kernels::heaviside +} // namespace dpnp::tensor::kernels::heaviside diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/hypot.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/hypot.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/hypot.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/hypot.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/i0.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/i0.hpp similarity index 99% rename from dpnp/backend/kernels/elementwise_functions/i0.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/i0.hpp index 7b244dd1164d..fa226d2c8384 100644 --- a/dpnp/backend/kernels/elementwise_functions/i0.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/i0.hpp @@ -43,7 +43,7 @@ #include #endif -namespace dpnp::kernels::i0 +namespace dpnp::tensor::kernels::i0 { #if defined(__SYCL_EXT_INTEL_MATH_SUPPORT) using sycl::ext::intel::math::cyl_bessel_i0; @@ -274,4 +274,4 @@ struct I0Functor } } }; -} // namespace dpnp::kernels::i0 +} // namespace dpnp::tensor::kernels::i0 diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/imag.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/imag.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/imag.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/imag.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/interpolate.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/interpolate.hpp similarity index 97% rename from dpnp/backend/kernels/elementwise_functions/interpolate.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/interpolate.hpp index 704820ad3c1e..191e3c5cb32b 100644 --- a/dpnp/backend/kernels/elementwise_functions/interpolate.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/interpolate.hpp @@ -35,7 +35,7 @@ #include "ext/common.hpp" -namespace dpnp::kernels::interpolate +namespace dpnp::tensor::kernels::interpolate { using ext::common::IsNan; @@ -106,4 +106,4 @@ class InterpolateFunctor } } }; -} // namespace dpnp::kernels::interpolate +} // namespace dpnp::tensor::kernels::interpolate diff --git a/dpnp/backend/kernels/elementwise_functions/isclose.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/isclose.hpp similarity index 99% rename from dpnp/backend/kernels/elementwise_functions/isclose.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/isclose.hpp index 883d4081f86c..00a5ea715427 100644 --- a/dpnp/backend/kernels/elementwise_functions/isclose.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/isclose.hpp @@ -42,7 +42,7 @@ #include "utils/sycl_utils.hpp" #include "utils/type_utils.hpp" -namespace dpnp::kernels::isclose +namespace dpnp::tensor::kernels::isclose { template @@ -335,4 +335,4 @@ sycl::event return comp_ev; } -} // namespace dpnp::kernels::isclose +} // namespace dpnp::tensor::kernels::isclose diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/isfinite.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/isfinite.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/isfinite.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/isfinite.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/isinf.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/isinf.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/isinf.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/isinf.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/isnan.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/isnan.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/isnan.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/isnan.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/lcm.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/lcm.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/lcm.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/lcm.hpp index 5ea8df3789b7..2635f21b3d6a 100644 --- a/dpnp/backend/kernels/elementwise_functions/lcm.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/lcm.hpp @@ -31,7 +31,7 @@ #include #include -namespace dpnp::kernels::lcm +namespace dpnp::tensor::kernels::lcm { template struct LcmFunctor @@ -59,4 +59,4 @@ struct LcmFunctor // return oneapi::dpl::lcm(in1, in2); } }; -} // namespace dpnp::kernels::lcm +} // namespace dpnp::tensor::kernels::lcm diff --git a/dpnp/backend/kernels/elementwise_functions/ldexp.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/ldexp.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/ldexp.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/ldexp.hpp index 12ecd10e43ae..beaa7bb302a4 100644 --- a/dpnp/backend/kernels/elementwise_functions/ldexp.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/ldexp.hpp @@ -34,7 +34,7 @@ #include "utils/math_utils.hpp" #include "utils/type_utils.hpp" -namespace dpnp::kernels::ldexp +namespace dpnp::tensor::kernels::ldexp { template struct LdexpFunctor @@ -55,4 +55,4 @@ struct LdexpFunctor return resT(0); } }; -} // namespace dpnp::kernels::ldexp +} // namespace dpnp::tensor::kernels::ldexp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/less.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/less.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/less.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/less.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/less_equal.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/less_equal.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/less_equal.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/less_equal.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/log.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/log.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/log.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/log.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/log10.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/log10.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/log10.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/log10.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/log1p.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/log1p.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/log1p.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/log1p.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/log2.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/log2.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/log2.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/log2.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/logaddexp.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/logaddexp.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/logaddexp2.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/logaddexp2.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/logaddexp2.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/logaddexp2.hpp index 2287f6cd7857..8e45d789ee53 100644 --- a/dpnp/backend/kernels/elementwise_functions/logaddexp2.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/logaddexp2.hpp @@ -31,7 +31,7 @@ #include #include -namespace dpnp::kernels::logaddexp2 +namespace dpnp::tensor::kernels::logaddexp2 { constexpr double log2e = 1.442695040888963407359924681001892137; @@ -70,4 +70,4 @@ struct Logaddexp2Functor return logaddexp2(in1, in2); } }; -} // namespace dpnp::kernels::logaddexp2 +} // namespace dpnp::tensor::kernels::logaddexp2 diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/logical_and.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/logical_and.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/logical_and.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/logical_and.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/logical_not.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/logical_not.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/logical_not.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/logical_not.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/logical_or.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/logical_or.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/logical_or.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/logical_or.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/logical_xor.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/logical_xor.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/logical_xor.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/logical_xor.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/maximum.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/maximum.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/maximum.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/maximum.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/minimum.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/minimum.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/minimum.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/minimum.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/modf.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/modf.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/modf.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/modf.hpp index 07a8ef65e55e..454c295de32f 100644 --- a/dpnp/backend/kernels/elementwise_functions/modf.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/modf.hpp @@ -30,7 +30,7 @@ #include -namespace dpnp::kernels::modf +namespace dpnp::tensor::kernels::modf { template struct ModfFunctor @@ -50,4 +50,4 @@ struct ModfFunctor return sycl::modf(in, &integral); } }; -} // namespace dpnp::kernels::modf +} // namespace dpnp::tensor::kernels::modf diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/multiply.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/multiply.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/multiply.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/multiply.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/nan_to_num.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/nan_to_num.hpp similarity index 99% rename from dpnp/backend/kernels/elementwise_functions/nan_to_num.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/nan_to_num.hpp index edbbe7f028b8..095d75e4a4fc 100644 --- a/dpnp/backend/kernels/elementwise_functions/nan_to_num.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/nan_to_num.hpp @@ -41,7 +41,7 @@ #include "utils/sycl_utils.hpp" #include "utils/type_utils.hpp" -namespace dpnp::kernels::nan_to_num +namespace dpnp::tensor::kernels::nan_to_num { template @@ -284,4 +284,4 @@ sycl::event nan_to_num_contig_impl(sycl::queue &exec_q, return comp_ev; } -} // namespace dpnp::kernels::nan_to_num +} // namespace dpnp::tensor::kernels::nan_to_num diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/negative.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/negative.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/negative.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/negative.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/nextafter.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/nextafter.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/nextafter.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/nextafter.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/not_equal.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/not_equal.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/not_equal.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/not_equal.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/positive.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/positive.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/positive.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/positive.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/pow.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/pow.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/pow.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/pow.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/proj.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/proj.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/proj.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/proj.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/radians.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/radians.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/radians.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/radians.hpp index cb676249a6ac..16d184670b94 100644 --- a/dpnp/backend/kernels/elementwise_functions/radians.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/radians.hpp @@ -30,7 +30,7 @@ #include -namespace dpnp::kernels::radians +namespace dpnp::tensor::kernels::radians { template struct RadiansFunctor @@ -52,4 +52,4 @@ struct RadiansFunctor return sycl::radians(x); } }; -} // namespace dpnp::kernels::radians +} // namespace dpnp::tensor::kernels::radians diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/real.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/real.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/real.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/real.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/reciprocal.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/reciprocal.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/reciprocal.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/reciprocal.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/remainder.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/remainder.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/round.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/round.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/round.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/round.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/rsqrt.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/rsqrt.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/rsqrt.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/rsqrt.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/sign.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/sign.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/sign.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/sign.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/signbit.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/signbit.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/signbit.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/signbit.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/sin.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/sin.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/sin.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/sin.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/sinc.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/sinc.hpp similarity index 98% rename from dpnp/backend/kernels/elementwise_functions/sinc.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/sinc.hpp index a3f914b7f666..098ef452120c 100644 --- a/dpnp/backend/kernels/elementwise_functions/sinc.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/sinc.hpp @@ -39,7 +39,7 @@ #include "kernels/elementwise_functions/sycl_complex.hpp" #include "utils/type_utils.hpp" -namespace dpnp::kernels::sinc +namespace dpnp::tensor::kernels::sinc { namespace tu_ns = dpnp::tensor::type_utils; @@ -197,4 +197,4 @@ struct SincFunctor } } }; -} // namespace dpnp::kernels::sinc +} // namespace dpnp::tensor::kernels::sinc diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/sinh.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/sinh.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/sinh.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/sinh.hpp diff --git a/dpnp/backend/kernels/elementwise_functions/spacing.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/spacing.hpp similarity index 96% rename from dpnp/backend/kernels/elementwise_functions/spacing.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/spacing.hpp index c7d849a3bd6b..c86c0c3ba166 100644 --- a/dpnp/backend/kernels/elementwise_functions/spacing.hpp +++ b/dpnp/libtensor/include/kernels/elementwise_functions/spacing.hpp @@ -30,7 +30,7 @@ #include -namespace dpnp::kernels::spacing +namespace dpnp::tensor::kernels::spacing { template struct SpacingFunctor @@ -64,4 +64,4 @@ struct SpacingFunctor } } }; -} // namespace dpnp::kernels::spacing +} // namespace dpnp::tensor::kernels::spacing diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/sqrt.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/sqrt.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/sqrt.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/sqrt.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/square.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/square.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/square.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/square.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/subtract.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/subtract.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/subtract.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/subtract.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/sycl_complex.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/sycl_complex.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/sycl_complex.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/sycl_complex.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/tan.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/tan.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/tan.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/tan.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/tanh.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/tanh.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/tanh.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/tanh.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/true_divide.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/true_divide.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/true_divide.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/true_divide.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/trunc.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/trunc.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/trunc.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/trunc.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/elementwise_functions/vec_size_util.hpp b/dpnp/libtensor/include/kernels/elementwise_functions/vec_size_util.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/elementwise_functions/vec_size_util.hpp rename to dpnp/libtensor/include/kernels/elementwise_functions/vec_size_util.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/integer_advanced_indexing.hpp b/dpnp/libtensor/include/kernels/integer_advanced_indexing.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/integer_advanced_indexing.hpp rename to dpnp/libtensor/include/kernels/integer_advanced_indexing.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/linalg_functions/dot_product.hpp b/dpnp/libtensor/include/kernels/linalg_functions/dot_product.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/linalg_functions/dot_product.hpp rename to dpnp/libtensor/include/kernels/linalg_functions/dot_product.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/linalg_functions/gemm.hpp b/dpnp/libtensor/include/kernels/linalg_functions/gemm.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/linalg_functions/gemm.hpp rename to dpnp/libtensor/include/kernels/linalg_functions/gemm.hpp diff --git a/dpnp/backend/kernels/indexing/putmask.hpp b/dpnp/libtensor/include/kernels/putmask.hpp similarity index 99% rename from dpnp/backend/kernels/indexing/putmask.hpp rename to dpnp/libtensor/include/kernels/putmask.hpp index 37650072ac0c..729d64c34931 100644 --- a/dpnp/backend/kernels/indexing/putmask.hpp +++ b/dpnp/libtensor/include/kernels/putmask.hpp @@ -41,7 +41,7 @@ #include "utils/sycl_utils.hpp" #include "utils/type_utils.hpp" -namespace dpnp::kernels::putmask +namespace dpnp::tensor::kernels::putmask { using dpnp::tensor::ssize_t; @@ -287,4 +287,4 @@ sycl::event putmask_contig_impl(sycl::queue &exec_q, return comp_ev; } -} // namespace dpnp::kernels::putmask +} // namespace dpnp::tensor::kernels::putmask diff --git a/dpnp/tensor/libtensor/include/kernels/reductions.hpp b/dpnp/libtensor/include/kernels/reductions.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/reductions.hpp rename to dpnp/libtensor/include/kernels/reductions.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/repeat.hpp b/dpnp/libtensor/include/kernels/repeat.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/repeat.hpp rename to dpnp/libtensor/include/kernels/repeat.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/isin.hpp b/dpnp/libtensor/include/kernels/sorting/isin.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/sorting/isin.hpp rename to dpnp/libtensor/include/kernels/sorting/isin.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/merge_sort.hpp b/dpnp/libtensor/include/kernels/sorting/merge_sort.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/sorting/merge_sort.hpp rename to dpnp/libtensor/include/kernels/sorting/merge_sort.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/radix_select.hpp b/dpnp/libtensor/include/kernels/sorting/radix_select.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/sorting/radix_select.hpp rename to dpnp/libtensor/include/kernels/sorting/radix_select.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/radix_sort.hpp b/dpnp/libtensor/include/kernels/sorting/radix_sort.hpp similarity index 99% rename from dpnp/tensor/libtensor/include/kernels/sorting/radix_sort.hpp rename to dpnp/libtensor/include/kernels/sorting/radix_sort.hpp index 6950890af85d..3d3531b0eb03 100644 --- a/dpnp/tensor/libtensor/include/kernels/sorting/radix_sort.hpp +++ b/dpnp/libtensor/include/kernels/sorting/radix_sort.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/radix_utils.hpp b/dpnp/libtensor/include/kernels/sorting/radix_utils.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/sorting/radix_utils.hpp rename to dpnp/libtensor/include/kernels/sorting/radix_utils.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/search_sorted_detail.hpp b/dpnp/libtensor/include/kernels/sorting/search_sorted_detail.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/sorting/search_sorted_detail.hpp rename to dpnp/libtensor/include/kernels/sorting/search_sorted_detail.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/searchsorted.hpp b/dpnp/libtensor/include/kernels/sorting/searchsorted.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/sorting/searchsorted.hpp rename to dpnp/libtensor/include/kernels/sorting/searchsorted.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/sort_impl_fn_ptr_t.hpp b/dpnp/libtensor/include/kernels/sorting/sort_impl_fn_ptr_t.hpp similarity index 97% rename from dpnp/tensor/libtensor/include/kernels/sorting/sort_impl_fn_ptr_t.hpp rename to dpnp/libtensor/include/kernels/sorting/sort_impl_fn_ptr_t.hpp index 2cff5d9585f2..f02583bc239b 100644 --- a/dpnp/tensor/libtensor/include/kernels/sorting/sort_impl_fn_ptr_t.hpp +++ b/dpnp/libtensor/include/kernels/sorting/sort_impl_fn_ptr_t.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/sort_utils.hpp b/dpnp/libtensor/include/kernels/sorting/sort_utils.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/sorting/sort_utils.hpp rename to dpnp/libtensor/include/kernels/sorting/sort_utils.hpp diff --git a/dpnp/tensor/libtensor/include/kernels/sorting/topk.hpp b/dpnp/libtensor/include/kernels/sorting/topk.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/sorting/topk.hpp rename to dpnp/libtensor/include/kernels/sorting/topk.hpp diff --git a/dpnp/backend/kernels/statistics/histogram.hpp b/dpnp/libtensor/include/kernels/statistics/histogram.hpp similarity index 97% rename from dpnp/backend/kernels/statistics/histogram.hpp rename to dpnp/libtensor/include/kernels/statistics/histogram.hpp index 6d0fedbe0bc3..99ddefe00ff5 100644 --- a/dpnp/backend/kernels/statistics/histogram.hpp +++ b/dpnp/libtensor/include/kernels/statistics/histogram.hpp @@ -33,7 +33,7 @@ #include -namespace dpnp::kernels::histogram +namespace dpnp::tensor::kernels::histogram { template class HistogramFunctor @@ -96,4 +96,4 @@ class HistogramFunctor hist.finalize(item); } }; -} // namespace dpnp::kernels::histogram +} // namespace dpnp::tensor::kernels::histogram diff --git a/dpnp/backend/kernels/statistics/sliding_window1d.hpp b/dpnp/libtensor/include/kernels/statistics/sliding_window1d.hpp similarity index 98% rename from dpnp/backend/kernels/statistics/sliding_window1d.hpp rename to dpnp/libtensor/include/kernels/statistics/sliding_window1d.hpp index 5b3c5535afd4..16ef7e514cc8 100644 --- a/dpnp/backend/kernels/statistics/sliding_window1d.hpp +++ b/dpnp/libtensor/include/kernels/statistics/sliding_window1d.hpp @@ -35,7 +35,7 @@ #include "ext/common.hpp" -namespace dpnp::kernels::sliding_window1d +namespace dpnp::tensor::kernels::sliding_window1d { using ext::common::CeilDiv; @@ -271,4 +271,4 @@ class SlidingWindow1dSmallFunctor // [out_end](auto &&ptr) { return ptr < out_end; }); } }; -} // namespace dpnp::kernels::sliding_window1d +} // namespace dpnp::tensor::kernels::sliding_window1d diff --git a/dpnp/tensor/libtensor/include/kernels/where.hpp b/dpnp/libtensor/include/kernels/where.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/kernels/where.hpp rename to dpnp/libtensor/include/kernels/where.hpp diff --git a/dpnp/backend/kernels/window/bartlett.hpp b/dpnp/libtensor/include/kernels/window/bartlett.hpp similarity index 96% rename from dpnp/backend/kernels/window/bartlett.hpp rename to dpnp/libtensor/include/kernels/window/bartlett.hpp index 20d410150dcb..3ac4c27806eb 100644 --- a/dpnp/backend/kernels/window/bartlett.hpp +++ b/dpnp/libtensor/include/kernels/window/bartlett.hpp @@ -32,7 +32,7 @@ #include -namespace dpnp::kernels::bartlett +namespace dpnp::tensor::kernels::bartlett { template class BartlettFunctor @@ -52,4 +52,4 @@ class BartlettFunctor res[i] = T(1) - sycl::fabs(i - alpha) / alpha; } }; -} // namespace dpnp::kernels::bartlett +} // namespace dpnp::tensor::kernels::bartlett diff --git a/dpnp/backend/kernels/window/blackman.hpp b/dpnp/libtensor/include/kernels/window/blackman.hpp similarity index 96% rename from dpnp/backend/kernels/window/blackman.hpp rename to dpnp/libtensor/include/kernels/window/blackman.hpp index 9df7cb8728e2..6191c6ace98f 100644 --- a/dpnp/backend/kernels/window/blackman.hpp +++ b/dpnp/libtensor/include/kernels/window/blackman.hpp @@ -32,7 +32,7 @@ #include -namespace dpnp::kernels::blackman +namespace dpnp::tensor::kernels::blackman { template class BlackmanFunctor @@ -53,4 +53,4 @@ class BlackmanFunctor T(0.08) * sycl::cospi(T(2) * alpha); } }; -} // namespace dpnp::kernels::blackman +} // namespace dpnp::tensor::kernels::blackman diff --git a/dpnp/backend/kernels/window/hamming.hpp b/dpnp/libtensor/include/kernels/window/hamming.hpp similarity index 96% rename from dpnp/backend/kernels/window/hamming.hpp rename to dpnp/libtensor/include/kernels/window/hamming.hpp index 895ecb0e588c..2dc6d47b4184 100644 --- a/dpnp/backend/kernels/window/hamming.hpp +++ b/dpnp/libtensor/include/kernels/window/hamming.hpp @@ -32,7 +32,7 @@ #include -namespace dpnp::kernels::hamming +namespace dpnp::tensor::kernels::hamming { template class HammingFunctor @@ -51,4 +51,4 @@ class HammingFunctor res[i] = T(0.54) - T(0.46) * sycl::cospi(T(2) * i / (N - 1)); } }; -} // namespace dpnp::kernels::hamming +} // namespace dpnp::tensor::kernels::hamming diff --git a/dpnp/backend/kernels/window/hanning.hpp b/dpnp/libtensor/include/kernels/window/hanning.hpp similarity index 96% rename from dpnp/backend/kernels/window/hanning.hpp rename to dpnp/libtensor/include/kernels/window/hanning.hpp index 35b441f921f8..193087065008 100644 --- a/dpnp/backend/kernels/window/hanning.hpp +++ b/dpnp/libtensor/include/kernels/window/hanning.hpp @@ -32,7 +32,7 @@ #include -namespace dpnp::kernels::hanning +namespace dpnp::tensor::kernels::hanning { template class HanningFunctor @@ -51,4 +51,4 @@ class HanningFunctor res[i] = T(0.5) - T(0.5) * sycl::cospi(T(2) * i / (N - 1)); } }; -} // namespace dpnp::kernels::hanning +} // namespace dpnp::tensor::kernels::hanning diff --git a/dpnp/backend/kernels/window/kaiser.hpp b/dpnp/libtensor/include/kernels/window/kaiser.hpp similarity index 94% rename from dpnp/backend/kernels/window/kaiser.hpp rename to dpnp/libtensor/include/kernels/window/kaiser.hpp index ce8c8e52fd18..7ff6299a0b09 100644 --- a/dpnp/backend/kernels/window/kaiser.hpp +++ b/dpnp/libtensor/include/kernels/window/kaiser.hpp @@ -34,7 +34,7 @@ #include "kernels/elementwise_functions/i0.hpp" -namespace dpnp::kernels::kaiser +namespace dpnp::tensor::kernels::kaiser { template class KaiserFunctor @@ -52,7 +52,7 @@ class KaiserFunctor void operator()(sycl::id<1> id) const { - using dpnp::kernels::i0::cyl_bessel_i0; + using dpnp::tensor::kernels::i0::cyl_bessel_i0; const auto i = id.get(0); const T alpha = (N - 1) / T(2); @@ -61,4 +61,4 @@ class KaiserFunctor cyl_bessel_i0(beta); } }; -} // namespace dpnp::kernels::kaiser +} // namespace dpnp::tensor::kernels::kaiser diff --git a/dpnp/tensor/libtensor/include/utils/indexing_utils.hpp b/dpnp/libtensor/include/utils/indexing_utils.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/indexing_utils.hpp rename to dpnp/libtensor/include/utils/indexing_utils.hpp diff --git a/dpnp/tensor/libtensor/include/utils/math_utils.hpp b/dpnp/libtensor/include/utils/math_utils.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/math_utils.hpp rename to dpnp/libtensor/include/utils/math_utils.hpp diff --git a/dpnp/tensor/libtensor/include/utils/memory_overlap.hpp b/dpnp/libtensor/include/utils/memory_overlap.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/memory_overlap.hpp rename to dpnp/libtensor/include/utils/memory_overlap.hpp diff --git a/dpnp/tensor/libtensor/include/utils/offset_utils.hpp b/dpnp/libtensor/include/utils/offset_utils.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/offset_utils.hpp rename to dpnp/libtensor/include/utils/offset_utils.hpp diff --git a/dpnp/tensor/libtensor/include/utils/output_validation.hpp b/dpnp/libtensor/include/utils/output_validation.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/output_validation.hpp rename to dpnp/libtensor/include/utils/output_validation.hpp diff --git a/dpnp/tensor/libtensor/include/utils/rich_comparisons.hpp b/dpnp/libtensor/include/utils/rich_comparisons.hpp similarity index 98% rename from dpnp/tensor/libtensor/include/utils/rich_comparisons.hpp rename to dpnp/libtensor/include/utils/rich_comparisons.hpp index 93029b9d4107..3eea91bf2a29 100644 --- a/dpnp/tensor/libtensor/include/utils/rich_comparisons.hpp +++ b/dpnp/libtensor/include/utils/rich_comparisons.hpp @@ -27,7 +27,7 @@ //***************************************************************************** /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/include/utils/strided_iters.hpp b/dpnp/libtensor/include/utils/strided_iters.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/strided_iters.hpp rename to dpnp/libtensor/include/utils/strided_iters.hpp diff --git a/dpnp/tensor/libtensor/include/utils/sycl_alloc_utils.hpp b/dpnp/libtensor/include/utils/sycl_alloc_utils.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/sycl_alloc_utils.hpp rename to dpnp/libtensor/include/utils/sycl_alloc_utils.hpp diff --git a/dpnp/tensor/libtensor/include/utils/sycl_utils.hpp b/dpnp/libtensor/include/utils/sycl_utils.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/sycl_utils.hpp rename to dpnp/libtensor/include/utils/sycl_utils.hpp diff --git a/dpnp/tensor/libtensor/include/utils/type_dispatch.hpp b/dpnp/libtensor/include/utils/type_dispatch.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/type_dispatch.hpp rename to dpnp/libtensor/include/utils/type_dispatch.hpp diff --git a/dpnp/tensor/libtensor/include/utils/type_dispatch_building.hpp b/dpnp/libtensor/include/utils/type_dispatch_building.hpp similarity index 90% rename from dpnp/tensor/libtensor/include/utils/type_dispatch_building.hpp rename to dpnp/libtensor/include/utils/type_dispatch_building.hpp index ec89c9ad4eab..33bcd2b68487 100644 --- a/dpnp/tensor/libtensor/include/utils/type_dispatch_building.hpp +++ b/dpnp/libtensor/include/utils/type_dispatch_building.hpp @@ -191,6 +191,49 @@ struct DefaultResultEntry : std::true_type using result_type = Ty; }; +/** + * Extends TypeMapResultEntry helper structure + * with support of the two result types. + */ +template +struct TypeMapTwoResultsEntry : std::bool_constant> +{ + using result_type1 = ResTy1; + using result_type2 = ResTy2; +}; + +/** + * Extends BinaryTypeMapResultEntry helper structure with support of the two + * result types. + */ +template +struct BinaryTypeMapTwoResultsEntry + : std::bool_constant, + std::is_same>> +{ + using result_type1 = ResTy1; + using result_type2 = ResTy2; +}; + +/** + * Extends DefaultResultEntry helper structure + * with support of the two result types. + */ +template +struct DefaultTwoResultsEntry : std::true_type +{ + using result_type1 = Ty; + using result_type2 = Ty; +}; + /*! @brief Utility struct to convert C++ type into typeid integer */ template struct GetTypeid diff --git a/dpnp/tensor/libtensor/include/utils/type_utils.hpp b/dpnp/libtensor/include/utils/type_utils.hpp similarity index 100% rename from dpnp/tensor/libtensor/include/utils/type_utils.hpp rename to dpnp/libtensor/include/utils/type_utils.hpp diff --git a/dpnp/libtensor/source/CMakeLists.txt b/dpnp/libtensor/source/CMakeLists.txt new file mode 100644 index 000000000000..7c8b4662ed67 --- /dev/null +++ b/dpnp/libtensor/source/CMakeLists.txt @@ -0,0 +1,434 @@ +# -*- coding: utf-8 -*- +# ***************************************************************************** +# Copyright (c) 2026, Intel Corporation +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# - Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# - Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. +# ***************************************************************************** + +# Builds the pybind11 modules of libtensor. All of them are installed into +# dpnp/libtensor, next to the MKL-based extensions. + +include(${CMAKE_SOURCE_DIR}/dpnp/cmake/tensor_build_flags.cmake) + +get_filename_component( + _libtensor_include_dir + ${CMAKE_CURRENT_SOURCE_DIR}/../include + ABSOLUTE +) + +# Sources of the functions dpnp implements beyond the array API. They are +# compiled into the same modules as the libtensor functions but keep the +# floating-point and coverage settings of the former dpnp extensions. +set(_dpnp_elementwise_sources + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/bitwise_count.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/degrees.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/divmod.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/erf_funcs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/fabs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/float_power.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/fmax.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/fmin.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/fmod.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/frexp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/gcd.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/heaviside.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/i0.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/interpolate.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/isclose.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/lcm.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/ldexp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/logaddexp2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/modf.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/nan_to_num.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/radians.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/sinc.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/spacing.cpp +) +set(_dpnp_indexing_sources + ${CMAKE_CURRENT_SOURCE_DIR}/choose.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/putmask.cpp +) +set(_statistics_impl_sources + ${CMAKE_CURRENT_SOURCE_DIR}/statistics/bincount.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/statistics/histogram.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/statistics/histogramdd.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/statistics/histogram_common.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/statistics/sliding_dot_product1d.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/statistics/sliding_window1d.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/statistics/statistics_py.cpp +) +set(_window_impl_sources + ${CMAKE_CURRENT_SOURCE_DIR}/window/kaiser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/window/window_py.cpp +) +set(_dpnp_sources + ${_dpnp_elementwise_sources} + ${_dpnp_indexing_sources} + ${_statistics_impl_sources} + ${_window_impl_sources} +) + +set(_static_lib_sources ${CMAKE_CURRENT_SOURCE_DIR}/simplify_iteration_space.cpp) +set(_tensor_impl_sources + ${CMAKE_CURRENT_SOURCE_DIR}/tensor_ctors.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/accumulators.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/copy_and_cast_usm_to_usm.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/copy_as_contig.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/copy_numpy_ndarray_into_usm_ndarray.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/copy_for_reshape.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/copy_for_roll.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/linear_sequences.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/integer_advanced_indexing.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/boolean_advanced_indexing.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/eye_ctor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/full_ctor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/zeros_ctor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/triul_ctor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/where.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device_support_queries.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/repeat.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/clip.cpp + ${_dpnp_indexing_sources} +) +set(_accumulator_sources + ${CMAKE_CURRENT_SOURCE_DIR}/accumulators/accumulators_common.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/accumulators/cumulative_logsumexp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/accumulators/cumulative_prod.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/accumulators/cumulative_sum.cpp +) +set(_elementwise_sources + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/elementwise_common.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/elementwise_functions_type_utils.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/abs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/acos.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/acosh.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/add.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/angle.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/asin.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/asinh.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/atan.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/atan2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/atanh.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/bitwise_and.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/bitwise_invert.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/bitwise_left_shift.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/bitwise_or.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/bitwise_right_shift.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/bitwise_xor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/cbrt.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/ceil.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/conj.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/copysign.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/cos.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/cosh.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/equal.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/exp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/exp2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/expm1.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/floor_divide.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/floor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/greater_equal.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/greater.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/hypot.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/imag.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/isfinite.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/isinf.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/isnan.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/less_equal.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/less.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/log.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/log1p.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/log2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/log10.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/logaddexp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/logical_and.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/logical_not.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/logical_or.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/logical_xor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/maximum.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/minimum.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/multiply.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/negative.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/nextafter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/not_equal.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/positive.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/pow.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/proj.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/real.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/reciprocal.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/remainder.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/round.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/rsqrt.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/sign.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/signbit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/sin.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/sinh.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/sqrt.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/square.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/subtract.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/tan.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/tanh.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/true_divide.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/trunc.cpp +) +set(_reduction_sources + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/reduction_common.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/all.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/any.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/argmax.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/argmin.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/logsumexp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/max.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/min.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/prod.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/reduce_hypot.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/reductions/sum.cpp +) +set(_sorting_sources + ${CMAKE_CURRENT_SOURCE_DIR}/sorting/isin.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/sorting/merge_sort.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/sorting/merge_argsort.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/sorting/radix_sort.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/sorting/radix_argsort.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/sorting/searchsorted.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/sorting/topk.cpp +) +set(_linalg_sources + ${CMAKE_CURRENT_SOURCE_DIR}/elementwise_functions/elementwise_functions_type_utils.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/linalg_functions/dot.cpp +) +set(_tensor_accumulation_impl_sources + ${CMAKE_CURRENT_SOURCE_DIR}/tensor_accumulation.cpp + ${_accumulator_sources} +) +set(_tensor_elementwise_impl_sources + ${CMAKE_CURRENT_SOURCE_DIR}/tensor_elementwise.cpp + ${_elementwise_sources} + ${_dpnp_elementwise_sources} +) +set(_tensor_reductions_impl_sources + ${CMAKE_CURRENT_SOURCE_DIR}/tensor_reductions.cpp + ${_reduction_sources} +) +set(_tensor_sorting_impl_sources + ${CMAKE_CURRENT_SOURCE_DIR}/tensor_sorting.cpp + ${_sorting_sources} +) +set(_tensor_linalg_impl_sources + ${CMAKE_CURRENT_SOURCE_DIR}/tensor_linalg.cpp + ${_linalg_sources} +) + +set(_static_lib_trgt simplify_iteration_space) + +add_library(${_static_lib_trgt} STATIC ${_static_lib_sources}) +target_include_directories( + ${_static_lib_trgt} + PRIVATE + # ${Python_INCLUDE_DIRS} + # ${Dpctl_INCLUDE_DIR} + ${_libtensor_include_dir} +) +target_link_libraries(${_static_lib_trgt} PRIVATE pybind11::headers Python::Module) +set_target_properties(${_static_lib_trgt} PROPERTIES POSITION_INDEPENDENT_CODE ON) + +set(_py_trgts) + +set(python_module_name _tensor_impl) +pybind11_add_module(${python_module_name} MODULE ${_tensor_impl_sources}) +add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_impl_sources}) +target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) +list(APPEND _py_trgts ${python_module_name}) + +set(python_module_name _tensor_accumulation_impl) +pybind11_add_module(${python_module_name} MODULE ${_tensor_accumulation_impl_sources}) +add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_accumulation_impl_sources}) +target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) +list(APPEND _py_trgts ${python_module_name}) + +set(python_module_name _tensor_elementwise_impl) +pybind11_add_module(${python_module_name} MODULE ${_tensor_elementwise_impl_sources}) +add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_elementwise_impl_sources}) +target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) +list(APPEND _py_trgts ${python_module_name}) + +set(python_module_name _tensor_reductions_impl) +pybind11_add_module(${python_module_name} MODULE ${_tensor_reductions_impl_sources}) +add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_reductions_impl_sources}) +target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) +list(APPEND _py_trgts ${python_module_name}) + +set(python_module_name _tensor_sorting_impl) +pybind11_add_module(${python_module_name} MODULE ${_tensor_sorting_impl_sources}) +add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_sorting_impl_sources}) +target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) +list(APPEND _py_trgts ${python_module_name}) + +set(python_module_name _tensor_linalg_impl) +pybind11_add_module(${python_module_name} MODULE ${_tensor_linalg_impl_sources}) +add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_linalg_impl_sources}) +target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) +list(APPEND _py_trgts ${python_module_name}) + +set(python_module_name _statistics_impl) +pybind11_add_module(${python_module_name} MODULE ${_statistics_impl_sources}) +add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_statistics_impl_sources}) +list(APPEND _py_trgts ${python_module_name}) + +set(python_module_name _window_impl) +pybind11_add_module(${python_module_name} MODULE ${_window_impl_sources}) +add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_window_impl_sources}) +list(APPEND _py_trgts ${python_module_name}) + +set(_clang_prefix "") +if(WIN32) + set(_clang_prefix "/clang:") +endif() + +set(_no_fast_math_sources + ${CMAKE_CURRENT_SOURCE_DIR}/copy_and_cast_usm_to_usm.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/full_ctor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/linear_sequences.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/clip.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/where.cpp +) +list( + APPEND _no_fast_math_sources + ${_elementwise_sources} + ${_reduction_sources} + ${_sorting_sources} + ${_linalg_sources} + ${_accumulator_sources} +) + +foreach(_src_fn ${_no_fast_math_sources}) + get_source_file_property(_cmpl_options_prop ${_src_fn} COMPILE_OPTIONS) + set(_combined_options_prop ${_cmpl_options_prop} "${_clang_prefix}-fno-fast-math") + set_source_files_properties( + ${_src_fn} + PROPERTIES COMPILE_OPTIONS "${_combined_options_prop}" + ) +endforeach() + +foreach(_src_fn ${_dpnp_sources}) + get_source_file_property(_cmpl_options_prop ${_src_fn} COMPILE_OPTIONS) + set(_combined_options_prop + ${_cmpl_options_prop} + "${_clang_prefix}-fno-approx-func" + "${_clang_prefix}-fno-finite-math-only" + ) + if(DPNP_GENERATE_COVERAGE) + list( + APPEND _combined_options_prop + -fprofile-instr-generate + -fcoverage-mapping + -fno-sycl-use-footer + ) + endif() + set_source_files_properties( + ${_src_fn} + PROPERTIES COMPILE_OPTIONS "${_combined_options_prop}" + ) +endforeach() + +set(_compiler_definitions "") + +foreach(_src_fn ${_elementwise_sources}) + get_source_file_property(_cmpl_options_defs ${_src_fn} COMPILE_DEFINITIONS) + if(${_cmpl_options_defs}) + set(_combined_options_defs ${_cmpl_options_defs} "${_compiler_definitions}") + else() + set(_combined_options_defs "${_compiler_definitions}") + endif() + set_source_files_properties( + ${_src_fn} + PROPERTIES COMPILE_DEFINITIONS "${_combined_options_defs}" + ) +endforeach() + +set(_linker_options "LINKER:${DPNP_LDFLAGS}") +foreach(python_module_name ${_py_trgts}) + target_compile_options( + ${python_module_name} + PRIVATE -fno-sycl-id-queries-fit-in-int + ) + target_link_options( + ${python_module_name} + PRIVATE -fsycl-device-code-split=per_kernel -fno-sycl-id-queries-fit-in-int + ) + if(DPNP_TENSOR_OFFLOAD_COMPRESS) + target_link_options(${python_module_name} PRIVATE --offload-compress) + endif() + + target_include_directories( + ${python_module_name} + PRIVATE + ${CMAKE_SOURCE_DIR}/dpnp/include + ${_libtensor_include_dir} + ${CMAKE_CURRENT_SOURCE_DIR}/ + ) + + target_include_directories( + ${python_module_name} + SYSTEM + PRIVATE + ${SYCL_INCLUDE_DIR} + ${Dpctl_INCLUDE_DIR} + ${CMAKE_BINARY_DIR} # For generated Cython headers + ) + target_link_options(${python_module_name} PRIVATE ${_linker_options}) + if(DPNP_GENERATE_COVERAGE) + if(DPNP_TENSOR_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS) + target_compile_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) + endif() + target_link_options( + ${python_module_name} + PRIVATE -fprofile-instr-generate -fcoverage-mapping + ) + endif() + if(_dpnp_sycl_targets) + # make fat binary + target_compile_options( + ${python_module_name} + PRIVATE ${_dpnp_sycl_target_compile_options} + ) + target_link_options( + ${python_module_name} + PRIVATE ${_dpnp_sycl_target_link_options} + ) + endif() + # Ensure Cython modules build first so _usmarray.h exists + add_dependencies(${python_module_name} _usmarray) + if(DPNP_WITH_REDIST) + set_target_properties( + ${python_module_name} + PROPERTIES INSTALL_RPATH "$ORIGIN/../../../.." + ) + endif() + install(TARGETS ${python_module_name} DESTINATION "dpnp/libtensor") +endforeach() diff --git a/dpnp/tensor/libtensor/source/accumulators.cpp b/dpnp/libtensor/source/accumulators.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/accumulators.cpp rename to dpnp/libtensor/source/accumulators.cpp index 8605496087ff..e4341698ffac 100644 --- a/dpnp/tensor/libtensor/source/accumulators.cpp +++ b/dpnp/libtensor/source/accumulators.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/accumulators.hpp b/dpnp/libtensor/source/accumulators.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/accumulators.hpp rename to dpnp/libtensor/source/accumulators.hpp index 0f9539437d21..731182b06a82 100644 --- a/dpnp/tensor/libtensor/source/accumulators.hpp +++ b/dpnp/libtensor/source/accumulators.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/accumulators/accumulate_over_axis.hpp b/dpnp/libtensor/source/accumulators/accumulate_over_axis.hpp similarity index 99% rename from dpnp/tensor/libtensor/source/accumulators/accumulate_over_axis.hpp rename to dpnp/libtensor/source/accumulators/accumulate_over_axis.hpp index 9810c82016f1..d842d031eaa2 100644 --- a/dpnp/tensor/libtensor/source/accumulators/accumulate_over_axis.hpp +++ b/dpnp/libtensor/source/accumulators/accumulate_over_axis.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/accumulators/accumulators_common.cpp b/dpnp/libtensor/source/accumulators/accumulators_common.cpp similarity index 96% rename from dpnp/tensor/libtensor/source/accumulators/accumulators_common.cpp rename to dpnp/libtensor/source/accumulators/accumulators_common.cpp index 6a95ef01beec..a76ab47eb99a 100644 --- a/dpnp/tensor/libtensor/source/accumulators/accumulators_common.cpp +++ b/dpnp/libtensor/source/accumulators/accumulators_common.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/accumulators/accumulators_common.hpp b/dpnp/libtensor/source/accumulators/accumulators_common.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/accumulators/accumulators_common.hpp rename to dpnp/libtensor/source/accumulators/accumulators_common.hpp index d33cc7f1d84c..e6a798bdcadd 100644 --- a/dpnp/tensor/libtensor/source/accumulators/accumulators_common.hpp +++ b/dpnp/libtensor/source/accumulators/accumulators_common.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/accumulators/cumulative_logsumexp.cpp b/dpnp/libtensor/source/accumulators/cumulative_logsumexp.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/accumulators/cumulative_logsumexp.cpp rename to dpnp/libtensor/source/accumulators/cumulative_logsumexp.cpp index 5f8611499ff0..a786f423dec5 100644 --- a/dpnp/tensor/libtensor/source/accumulators/cumulative_logsumexp.cpp +++ b/dpnp/libtensor/source/accumulators/cumulative_logsumexp.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/accumulators/cumulative_logsumexp.hpp b/dpnp/libtensor/source/accumulators/cumulative_logsumexp.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/accumulators/cumulative_logsumexp.hpp rename to dpnp/libtensor/source/accumulators/cumulative_logsumexp.hpp index 967712e1b57c..6c6275199f29 100644 --- a/dpnp/tensor/libtensor/source/accumulators/cumulative_logsumexp.hpp +++ b/dpnp/libtensor/source/accumulators/cumulative_logsumexp.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/accumulators/cumulative_prod.cpp b/dpnp/libtensor/source/accumulators/cumulative_prod.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/accumulators/cumulative_prod.cpp rename to dpnp/libtensor/source/accumulators/cumulative_prod.cpp index 20828a80e476..a1b762feec32 100644 --- a/dpnp/tensor/libtensor/source/accumulators/cumulative_prod.cpp +++ b/dpnp/libtensor/source/accumulators/cumulative_prod.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/accumulators/cumulative_prod.hpp b/dpnp/libtensor/source/accumulators/cumulative_prod.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/accumulators/cumulative_prod.hpp rename to dpnp/libtensor/source/accumulators/cumulative_prod.hpp index 177f933800f7..1ef6f40dc50a 100644 --- a/dpnp/tensor/libtensor/source/accumulators/cumulative_prod.hpp +++ b/dpnp/libtensor/source/accumulators/cumulative_prod.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/accumulators/cumulative_sum.cpp b/dpnp/libtensor/source/accumulators/cumulative_sum.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/accumulators/cumulative_sum.cpp rename to dpnp/libtensor/source/accumulators/cumulative_sum.cpp index 69b538eb2c1f..c451722d2833 100644 --- a/dpnp/tensor/libtensor/source/accumulators/cumulative_sum.cpp +++ b/dpnp/libtensor/source/accumulators/cumulative_sum.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/accumulators/cumulative_sum.hpp b/dpnp/libtensor/source/accumulators/cumulative_sum.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/accumulators/cumulative_sum.hpp rename to dpnp/libtensor/source/accumulators/cumulative_sum.hpp index 056d02c74ab8..4e4b8aaf602a 100644 --- a/dpnp/tensor/libtensor/source/accumulators/cumulative_sum.hpp +++ b/dpnp/libtensor/source/accumulators/cumulative_sum.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/boolean_advanced_indexing.cpp b/dpnp/libtensor/source/boolean_advanced_indexing.cpp similarity index 100% rename from dpnp/tensor/libtensor/source/boolean_advanced_indexing.cpp rename to dpnp/libtensor/source/boolean_advanced_indexing.cpp diff --git a/dpnp/tensor/libtensor/source/boolean_advanced_indexing.hpp b/dpnp/libtensor/source/boolean_advanced_indexing.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/boolean_advanced_indexing.hpp rename to dpnp/libtensor/source/boolean_advanced_indexing.hpp index e8231178bdb3..dbcfe9f171eb 100644 --- a/dpnp/tensor/libtensor/source/boolean_advanced_indexing.hpp +++ b/dpnp/libtensor/source/boolean_advanced_indexing.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #pragma once diff --git a/dpnp/backend/extensions/indexing/choose.cpp b/dpnp/libtensor/source/choose.cpp similarity index 98% rename from dpnp/backend/extensions/indexing/choose.cpp rename to dpnp/libtensor/source/choose.cpp index cffc376233d7..015fd5140abc 100644 --- a/dpnp/backend/extensions/indexing/choose.cpp +++ b/dpnp/libtensor/source/choose.cpp @@ -45,7 +45,7 @@ #include "dpnp4pybind11.hpp" #include "ext/common.hpp" -#include "kernels/indexing/choose.hpp" +#include "kernels/choose.hpp" // dpnp tensor headers #include "utils/indexing_utils.hpp" @@ -56,7 +56,7 @@ #include "utils/type_dispatch.hpp" #include "utils/type_utils.hpp" -namespace dpnp::extensions::indexing +namespace dpnp::tensor::py_internal { namespace py = pybind11; @@ -112,13 +112,12 @@ sycl::event choose_impl(sycl::queue &q, shape_and_strides}; using NthChoiceIndexerT = - dpnp::kernels::choose::strides::NthStrideOffsetUnpacked; + dpnp::tensor::kernels::choose::strides::NthStrideOffsetUnpacked; const NthChoiceIndexerT choices_indexer{ nd, chc_offsets, shape_and_strides, shape_and_strides + 3 * nd}; - using ChooseFunc = - dpnp::kernels::choose::ChooseFunctor; + using ChooseFunc = dpnp::tensor::kernels::choose::ChooseFunctor< + ProjectorT, InOutIndexerT, NthChoiceIndexerT, indTy, Ty>; cgh.parallel_for(sycl::range<1>(nelems), ChooseFunc(ind_tp, dst_tp, chcs_cp, n_chcs, @@ -525,4 +524,4 @@ void init_choose(py::module_ m) return; } -} // namespace dpnp::extensions::indexing +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/indexing/choose.hpp b/dpnp/libtensor/source/choose.hpp similarity index 95% rename from dpnp/backend/extensions/indexing/choose.hpp rename to dpnp/libtensor/source/choose.hpp index 2861e1c33d8a..b8594af081ef 100644 --- a/dpnp/backend/extensions/indexing/choose.hpp +++ b/dpnp/libtensor/source/choose.hpp @@ -32,7 +32,7 @@ namespace py = pybind11; -namespace dpnp::extensions::indexing +namespace dpnp::tensor::py_internal { void init_choose(py::module_ m); -} // namespace dpnp::extensions::indexing +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/tensor/libtensor/source/clip.cpp b/dpnp/libtensor/source/clip.cpp similarity index 100% rename from dpnp/tensor/libtensor/source/clip.cpp rename to dpnp/libtensor/source/clip.cpp diff --git a/dpnp/tensor/libtensor/source/clip.hpp b/dpnp/libtensor/source/clip.hpp similarity index 100% rename from dpnp/tensor/libtensor/source/clip.hpp rename to dpnp/libtensor/source/clip.hpp diff --git a/dpnp/tensor/libtensor/source/copy_and_cast_usm_to_usm.cpp b/dpnp/libtensor/source/copy_and_cast_usm_to_usm.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/copy_and_cast_usm_to_usm.cpp rename to dpnp/libtensor/source/copy_and_cast_usm_to_usm.cpp index 85bb9e6947e3..d39db9aba2ca 100644 --- a/dpnp/tensor/libtensor/source/copy_and_cast_usm_to_usm.cpp +++ b/dpnp/libtensor/source/copy_and_cast_usm_to_usm.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/copy_and_cast_usm_to_usm.hpp b/dpnp/libtensor/source/copy_and_cast_usm_to_usm.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/copy_and_cast_usm_to_usm.hpp rename to dpnp/libtensor/source/copy_and_cast_usm_to_usm.hpp index 0183d2ebc18c..704107b54881 100644 --- a/dpnp/tensor/libtensor/source/copy_and_cast_usm_to_usm.hpp +++ b/dpnp/libtensor/source/copy_and_cast_usm_to_usm.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/copy_as_contig.cpp b/dpnp/libtensor/source/copy_as_contig.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/copy_as_contig.cpp rename to dpnp/libtensor/source/copy_as_contig.cpp index 66ace2138032..43b3b9517559 100644 --- a/dpnp/tensor/libtensor/source/copy_as_contig.cpp +++ b/dpnp/libtensor/source/copy_as_contig.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/copy_as_contig.hpp b/dpnp/libtensor/source/copy_as_contig.hpp similarity index 100% rename from dpnp/tensor/libtensor/source/copy_as_contig.hpp rename to dpnp/libtensor/source/copy_as_contig.hpp diff --git a/dpnp/tensor/libtensor/source/copy_for_reshape.cpp b/dpnp/libtensor/source/copy_for_reshape.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/copy_for_reshape.cpp rename to dpnp/libtensor/source/copy_for_reshape.cpp index 688a5763c551..4ccd91c848bc 100644 --- a/dpnp/tensor/libtensor/source/copy_for_reshape.cpp +++ b/dpnp/libtensor/source/copy_for_reshape.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/copy_for_reshape.hpp b/dpnp/libtensor/source/copy_for_reshape.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/copy_for_reshape.hpp rename to dpnp/libtensor/source/copy_for_reshape.hpp index 843183ed5b95..c80d6acd01a7 100644 --- a/dpnp/tensor/libtensor/source/copy_for_reshape.hpp +++ b/dpnp/libtensor/source/copy_for_reshape.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/copy_for_roll.cpp b/dpnp/libtensor/source/copy_for_roll.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/copy_for_roll.cpp rename to dpnp/libtensor/source/copy_for_roll.cpp index 4ff6cca14e48..3a397540e28d 100644 --- a/dpnp/tensor/libtensor/source/copy_for_roll.cpp +++ b/dpnp/libtensor/source/copy_for_roll.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/copy_for_roll.hpp b/dpnp/libtensor/source/copy_for_roll.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/copy_for_roll.hpp rename to dpnp/libtensor/source/copy_for_roll.hpp index 9b14e98ba38d..8befe8709733 100644 --- a/dpnp/tensor/libtensor/source/copy_for_roll.hpp +++ b/dpnp/libtensor/source/copy_for_roll.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp b/dpnp/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp rename to dpnp/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp index 8785e51258f5..2b89bc2098a6 100644 --- a/dpnp/tensor/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp +++ b/dpnp/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.hpp b/dpnp/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.hpp rename to dpnp/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.hpp index 9871e7d68eb2..7b549dbe13f6 100644 --- a/dpnp/tensor/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.hpp +++ b/dpnp/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/device_support_queries.cpp b/dpnp/libtensor/source/device_support_queries.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/device_support_queries.cpp rename to dpnp/libtensor/source/device_support_queries.cpp index 530dde211635..fa11e22a7a65 100644 --- a/dpnp/tensor/libtensor/source/device_support_queries.cpp +++ b/dpnp/libtensor/source/device_support_queries.cpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/device_support_queries.hpp b/dpnp/libtensor/source/device_support_queries.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/device_support_queries.hpp rename to dpnp/libtensor/source/device_support_queries.hpp index ccb8d66aede3..b41fc874bf0b 100644 --- a/dpnp/tensor/libtensor/source/device_support_queries.hpp +++ b/dpnp/libtensor/source/device_support_queries.hpp @@ -28,7 +28,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/abs.cpp b/dpnp/libtensor/source/elementwise_functions/abs.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/abs.cpp rename to dpnp/libtensor/source/elementwise_functions/abs.cpp index e0487e89f52d..fc24d16f1a24 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/abs.cpp +++ b/dpnp/libtensor/source/elementwise_functions/abs.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/abs.hpp b/dpnp/libtensor/source/elementwise_functions/abs.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/abs.hpp rename to dpnp/libtensor/source/elementwise_functions/abs.hpp index 1504f28d0199..858a52127084 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/abs.hpp +++ b/dpnp/libtensor/source/elementwise_functions/abs.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/acos.cpp b/dpnp/libtensor/source/elementwise_functions/acos.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/acos.cpp rename to dpnp/libtensor/source/elementwise_functions/acos.cpp index 0cfd711d711e..67e729dba379 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/acos.cpp +++ b/dpnp/libtensor/source/elementwise_functions/acos.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/acos.hpp b/dpnp/libtensor/source/elementwise_functions/acos.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/acos.hpp rename to dpnp/libtensor/source/elementwise_functions/acos.hpp index 517bee921fb4..9af7f8dbd00c 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/acos.hpp +++ b/dpnp/libtensor/source/elementwise_functions/acos.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/acosh.cpp b/dpnp/libtensor/source/elementwise_functions/acosh.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/acosh.cpp rename to dpnp/libtensor/source/elementwise_functions/acosh.cpp index c7334736f510..6679796c8fb9 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/acosh.cpp +++ b/dpnp/libtensor/source/elementwise_functions/acosh.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/acosh.hpp b/dpnp/libtensor/source/elementwise_functions/acosh.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/acosh.hpp rename to dpnp/libtensor/source/elementwise_functions/acosh.hpp index 5a9d4dd8e5b9..c29f1e5d8aa9 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/acosh.hpp +++ b/dpnp/libtensor/source/elementwise_functions/acosh.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/add.cpp b/dpnp/libtensor/source/elementwise_functions/add.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/elementwise_functions/add.cpp rename to dpnp/libtensor/source/elementwise_functions/add.cpp index 7ba2fd8a37f3..878a77c3559b 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/add.cpp +++ b/dpnp/libtensor/source/elementwise_functions/add.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/add.hpp b/dpnp/libtensor/source/elementwise_functions/add.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/add.hpp rename to dpnp/libtensor/source/elementwise_functions/add.hpp index 2d668184a523..906ad8727d56 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/add.hpp +++ b/dpnp/libtensor/source/elementwise_functions/add.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/angle.cpp b/dpnp/libtensor/source/elementwise_functions/angle.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/angle.cpp rename to dpnp/libtensor/source/elementwise_functions/angle.cpp index 8d3336796ad4..57b4820025aa 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/angle.cpp +++ b/dpnp/libtensor/source/elementwise_functions/angle.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/angle.hpp b/dpnp/libtensor/source/elementwise_functions/angle.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/angle.hpp rename to dpnp/libtensor/source/elementwise_functions/angle.hpp index 630e8dbbc077..d4fae26ab6bc 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/angle.hpp +++ b/dpnp/libtensor/source/elementwise_functions/angle.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/asin.cpp b/dpnp/libtensor/source/elementwise_functions/asin.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/asin.cpp rename to dpnp/libtensor/source/elementwise_functions/asin.cpp index 7c62285af510..1f2a111cc20b 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/asin.cpp +++ b/dpnp/libtensor/source/elementwise_functions/asin.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/asin.hpp b/dpnp/libtensor/source/elementwise_functions/asin.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/asin.hpp rename to dpnp/libtensor/source/elementwise_functions/asin.hpp index 260ed3232e80..cc12a1bb2282 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/asin.hpp +++ b/dpnp/libtensor/source/elementwise_functions/asin.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/asinh.cpp b/dpnp/libtensor/source/elementwise_functions/asinh.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/asinh.cpp rename to dpnp/libtensor/source/elementwise_functions/asinh.cpp index e560dc3330bf..05e57e3350c1 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/asinh.cpp +++ b/dpnp/libtensor/source/elementwise_functions/asinh.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/asinh.hpp b/dpnp/libtensor/source/elementwise_functions/asinh.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/asinh.hpp rename to dpnp/libtensor/source/elementwise_functions/asinh.hpp index 1c5ac0bbf125..f99071086fe0 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/asinh.hpp +++ b/dpnp/libtensor/source/elementwise_functions/asinh.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/atan.cpp b/dpnp/libtensor/source/elementwise_functions/atan.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/atan.cpp rename to dpnp/libtensor/source/elementwise_functions/atan.cpp index b72a3437524b..61b9645b0648 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/atan.cpp +++ b/dpnp/libtensor/source/elementwise_functions/atan.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/atan.hpp b/dpnp/libtensor/source/elementwise_functions/atan.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/atan.hpp rename to dpnp/libtensor/source/elementwise_functions/atan.hpp index be69279f28c1..4f4c0ea88030 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/atan.hpp +++ b/dpnp/libtensor/source/elementwise_functions/atan.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/atan2.cpp b/dpnp/libtensor/source/elementwise_functions/atan2.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/atan2.cpp rename to dpnp/libtensor/source/elementwise_functions/atan2.cpp index aaef3bdd45d7..6f77d8b27de8 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/atan2.cpp +++ b/dpnp/libtensor/source/elementwise_functions/atan2.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/atan2.hpp b/dpnp/libtensor/source/elementwise_functions/atan2.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/atan2.hpp rename to dpnp/libtensor/source/elementwise_functions/atan2.hpp index 0bf08fedb770..1ebcc3ff53be 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/atan2.hpp +++ b/dpnp/libtensor/source/elementwise_functions/atan2.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/atanh.cpp b/dpnp/libtensor/source/elementwise_functions/atanh.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/atanh.cpp rename to dpnp/libtensor/source/elementwise_functions/atanh.cpp index 0d8dd64a1e3d..1761cba61c38 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/atanh.cpp +++ b/dpnp/libtensor/source/elementwise_functions/atanh.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/atanh.hpp b/dpnp/libtensor/source/elementwise_functions/atanh.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/atanh.hpp rename to dpnp/libtensor/source/elementwise_functions/atanh.hpp index 20a09d584f1f..3f5faf71ea1e 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/atanh.hpp +++ b/dpnp/libtensor/source/elementwise_functions/atanh.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/bitwise_and.cpp b/dpnp/libtensor/source/elementwise_functions/bitwise_and.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/elementwise_functions/bitwise_and.cpp rename to dpnp/libtensor/source/elementwise_functions/bitwise_and.cpp index 43fd70e46be4..b0df866c649d 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/bitwise_and.cpp +++ b/dpnp/libtensor/source/elementwise_functions/bitwise_and.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/bitwise_and.hpp b/dpnp/libtensor/source/elementwise_functions/bitwise_and.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/bitwise_and.hpp rename to dpnp/libtensor/source/elementwise_functions/bitwise_and.hpp index 14dae1aa5a49..afe58590a832 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/bitwise_and.hpp +++ b/dpnp/libtensor/source/elementwise_functions/bitwise_and.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/bitwise_count.cpp b/dpnp/libtensor/source/elementwise_functions/bitwise_count.cpp similarity index 87% rename from dpnp/backend/extensions/ufunc/elementwise_functions/bitwise_count.cpp rename to dpnp/libtensor/source/elementwise_functions/bitwise_count.cpp index eb0b7edd6d6d..1a77d9652e65 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/bitwise_count.cpp +++ b/dpnp/libtensor/source/elementwise_functions/bitwise_count.cpp @@ -42,19 +42,15 @@ #include "kernels/elementwise_functions/bitwise_count.hpp" #include "populate.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" #include "utils/type_dispatch.hpp" -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; namespace impl { @@ -82,7 +78,7 @@ struct OutputType td_ns::DefaultResultEntry>::result_type; }; -using dpnp::kernels::bitwise_count::BitwiseCountFunctor; +using dpnp::tensor::kernels::bitwise_count::BitwiseCountFunctor; template >::result_type; }; -using dpnp::kernels::degrees::DegreesFunctor; +using dpnp::tensor::kernels::degrees::DegreesFunctor; template struct OutputType { using table_type = typename std::disjunction< // disjunction is C++17 // feature, supported by DPC++ - td_int_ns:: - BinaryTypeMapTwoResultsEntry, - td_int_ns:: - BinaryTypeMapTwoResultsEntry, - td_int_ns:: + td_ns::BinaryTypeMapTwoResultsEntry, + td_ns::BinaryTypeMapTwoResultsEntry, + td_ns:: BinaryTypeMapTwoResultsEntry, - td_int_ns:: - BinaryTypeMapTwoResultsEntry, - td_int_ns:: + td_ns::BinaryTypeMapTwoResultsEntry, + td_ns:: BinaryTypeMapTwoResultsEntry, - td_int_ns:: - BinaryTypeMapTwoResultsEntry, - td_int_ns:: + td_ns::BinaryTypeMapTwoResultsEntry, + td_ns:: BinaryTypeMapTwoResultsEntry, - td_int_ns:: - BinaryTypeMapTwoResultsEntry, - td_int_ns::BinaryTypeMapTwoResultsEntry, - td_int_ns::BinaryTypeMapTwoResultsEntry, - td_int_ns::BinaryTypeMapTwoResultsEntry, - td_int_ns::DefaultTwoResultsEntry>; + td_ns::BinaryTypeMapTwoResultsEntry, + td_ns::BinaryTypeMapTwoResultsEntry, + td_ns::BinaryTypeMapTwoResultsEntry, + td_ns::BinaryTypeMapTwoResultsEntry, + td_ns::DefaultTwoResultsEntry>; using value_type1 = typename table_type::result_type1; using value_type2 = typename table_type::result_type2; }; @@ -156,7 +146,7 @@ void init_divmod(py::module_ m) const arrayT &dst1, const arrayT &dst2, sycl::queue &exec_q, const event_vecT &depends = {}) { - return py_int::py_binary_two_outputs_ufunc( + return py_binary_two_outputs_ufunc( src1, src2, dst1, dst2, exec_q, depends, divmod_output_typeid_table, divmod_contig_dispatch_table, divmod_strided_dispatch_table); @@ -167,10 +157,10 @@ void init_divmod(py::module_ m) auto divmod_result_type_pyapi = [&](const py::dtype &dtype1, const py::dtype &dtype2) { - return py_int::py_binary_two_outputs_ufunc_result_type( + return py_binary_two_outputs_ufunc_result_type( dtype1, dtype2, divmod_output_typeid_table); }; m.def("_divmod_result_type", divmod_result_type_pyapi); } } -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/divmod.hpp b/dpnp/libtensor/source/elementwise_functions/divmod.hpp similarity index 95% rename from dpnp/backend/extensions/ufunc/elementwise_functions/divmod.hpp rename to dpnp/libtensor/source/elementwise_functions/divmod.hpp index e62f9e195c15..6ca6551b8199 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/divmod.hpp +++ b/dpnp/libtensor/source/elementwise_functions/divmod.hpp @@ -32,7 +32,7 @@ namespace py = pybind11; -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { void init_divmod(py::module_ m); -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_common.cpp b/dpnp/libtensor/source/elementwise_functions/elementwise_common.cpp similarity index 83% rename from dpnp/tensor/libtensor/source/elementwise_functions/elementwise_common.cpp rename to dpnp/libtensor/source/elementwise_functions/elementwise_common.cpp index ccc9343d4c80..3723f6c56b9a 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_common.cpp +++ b/dpnp/libtensor/source/elementwise_functions/elementwise_common.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// @@ -46,6 +46,7 @@ #include "atan2.hpp" #include "atanh.hpp" #include "bitwise_and.hpp" +#include "bitwise_count.hpp" #include "bitwise_invert.hpp" #include "bitwise_left_shift.hpp" #include "bitwise_or.hpp" @@ -57,19 +58,35 @@ #include "copysign.hpp" #include "cos.hpp" #include "cosh.hpp" +#include "degrees.hpp" +#include "divmod.hpp" #include "equal.hpp" +#include "erf_funcs.hpp" #include "exp.hpp" #include "exp2.hpp" #include "expm1.hpp" +#include "fabs.hpp" +#include "float_power.hpp" #include "floor.hpp" #include "floor_divide.hpp" +#include "fmax.hpp" +#include "fmin.hpp" +#include "fmod.hpp" +#include "frexp.hpp" +#include "gcd.hpp" #include "greater.hpp" #include "greater_equal.hpp" +#include "heaviside.hpp" #include "hypot.hpp" +#include "i0.hpp" #include "imag.hpp" +#include "interpolate.hpp" +#include "isclose.hpp" #include "isfinite.hpp" #include "isinf.hpp" #include "isnan.hpp" +#include "lcm.hpp" +#include "ldexp.hpp" #include "less.hpp" #include "less_equal.hpp" #include "log.hpp" @@ -77,19 +94,23 @@ #include "log1p.hpp" #include "log2.hpp" #include "logaddexp.hpp" +#include "logaddexp2.hpp" #include "logical_and.hpp" #include "logical_not.hpp" #include "logical_or.hpp" #include "logical_xor.hpp" #include "maximum.hpp" #include "minimum.hpp" +#include "modf.hpp" #include "multiply.hpp" +#include "nan_to_num.hpp" #include "negative.hpp" #include "nextafter.hpp" #include "not_equal.hpp" #include "positive.hpp" #include "pow.hpp" #include "proj.hpp" +#include "radians.hpp" #include "real.hpp" #include "reciprocal.hpp" #include "remainder.hpp" @@ -98,7 +119,9 @@ #include "sign.hpp" #include "signbit.hpp" #include "sin.hpp" +#include "sinc.hpp" #include "sinh.hpp" +#include "spacing.hpp" #include "sqrt.hpp" #include "square.hpp" #include "subtract.hpp" @@ -126,6 +149,7 @@ void init_elementwise_functions(py::module_ m) init_atan2(m); init_atanh(m); init_bitwise_and(m); + init_bitwise_count(m); init_bitwise_invert(m); init_bitwise_left_shift(m); init_bitwise_or(m); @@ -137,20 +161,36 @@ void init_elementwise_functions(py::module_ m) init_copysign(m); init_cos(m); init_cosh(m); + init_degrees(m); init_divide(m); + init_divmod(m); init_equal(m); + init_erf_funcs(m); init_exp(m); init_exp2(m); init_expm1(m); + init_fabs(m); + init_float_power(m); init_floor(m); init_floor_divide(m); + init_fmax(m); + init_fmin(m); + init_fmod(m); + init_frexp(m); + init_gcd(m); init_greater(m); init_greater_equal(m); + init_heaviside(m); init_hypot(m); + init_i0(m); init_imag(m); + init_interpolate(m); + init_isclose(m); init_isfinite(m); init_isinf(m); init_isnan(m); + init_lcm(m); + init_ldexp(m); init_less(m); init_less_equal(m); init_log(m); @@ -158,19 +198,23 @@ void init_elementwise_functions(py::module_ m) init_log1p(m); init_log2(m); init_logaddexp(m); + init_logaddexp2(m); init_logical_and(m); init_logical_not(m); init_logical_or(m); init_logical_xor(m); init_maximum(m); init_minimum(m); + init_modf(m); init_multiply(m); - init_nextafter(m); + init_nan_to_num(m); init_negative(m); + init_nextafter(m); init_not_equal(m); init_positive(m); init_pow(m); init_proj(m); + init_radians(m); init_real(m); init_reciprocal(m); init_remainder(m); @@ -179,7 +223,9 @@ void init_elementwise_functions(py::module_ m) init_sign(m); init_signbit(m); init_sin(m); + init_sinc(m); init_sinh(m); + init_spacing(m); init_sqrt(m); init_square(m); init_subtract(m); diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_common.hpp b/dpnp/libtensor/source/elementwise_functions/elementwise_common.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/elementwise_common.hpp rename to dpnp/libtensor/source/elementwise_functions/elementwise_common.hpp index 13b90b52b0c8..d258d2a3f9ae 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_common.hpp +++ b/dpnp/libtensor/source/elementwise_functions/elementwise_common.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/backend/extensions/elementwise_functions/elementwise_functions.hpp b/dpnp/libtensor/source/elementwise_functions/elementwise_functions.hpp similarity index 98% rename from dpnp/backend/extensions/elementwise_functions/elementwise_functions.hpp rename to dpnp/libtensor/source/elementwise_functions/elementwise_functions.hpp index adaf77a8970e..56c5d78f185c 100644 --- a/dpnp/backend/extensions/elementwise_functions/elementwise_functions.hpp +++ b/dpnp/libtensor/source/elementwise_functions/elementwise_functions.hpp @@ -1,5 +1,5 @@ //***************************************************************************** -// Copyright (c) 2024, Intel Corporation +// Copyright (c) 2026, Intel Corporation // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -25,28 +25,33 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF // THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************** +// +//===---------------------------------------------------------------------===// +/// +/// \file +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl +/// extension, specifically functions for elementwise operations. +//===---------------------------------------------------------------------===// #pragma once #include -#include -#include #include +#include +#include #include #include -#include -#include - #include #include "dpnp4pybind11.hpp" +#include +#include #include "elementwise_functions_type_utils.hpp" -#include "simplify_iteration_space.hpp" - -// dpnp tensor headers #include "kernels/alignment.hpp" +#include "kernels/dpnp_tensor_types.hpp" +#include "simplify_iteration_space.hpp" #include "utils/memory_overlap.hpp" #include "utils/offset_utils.hpp" #include "utils/output_validation.hpp" @@ -55,16 +60,15 @@ static_assert(std::is_same_v); -namespace dpnp::extensions::py_internal +namespace dpnp::tensor::py_internal { + namespace py = pybind11; namespace td_ns = dpnp::tensor::type_dispatch; using dpnp::tensor::kernels::alignment_utils::is_aligned; using dpnp::tensor::kernels::alignment_utils::required_alignment; -using type_utils::_result_typeid; - /*! @brief Template implementing Python API for unary elementwise functions */ template (res); @@ -506,6 +512,7 @@ std::pair throw py::value_error(e.what()); } + using type_utils::_result_typeid; std::pair dst_typeids = _result_typeid(src_typeid, output_types); int dst1_typeid = dst_typeids.first; int dst2_typeid = dst_typeids.second; @@ -551,7 +558,7 @@ std::pair py_binary_ufunc( const dpnp::tensor::usm_ndarray &src2, const dpnp::tensor::usm_ndarray &dst, // dst = op(src1, src2), elementwise sycl::queue &exec_q, - const std::vector &depends, + const std::vector depends, // const output_typesT &output_type_table, const contig_dispatchT &contig_dispatch_table, @@ -799,7 +806,6 @@ std::pair py_binary_ufunc( // async free of shape_strides temporary sycl::event tmp_cleanup_ev = dpnp::tensor::alloc_utils::async_smart_free( exec_q, {strided_fn_ev}, shape_strides_owner); - host_tasks.push_back(tmp_cleanup_ev); return std::make_pair( @@ -847,8 +853,10 @@ py::object py_binary_ufunc_result_type(const py::dtype &input1_dtype, } } -/*! @brief Template implementing Python API for querying of type support by - * binary elementwise functions */ +/** + * @brief Template implementing Python API for a binary elementwise function + * with two output arrays. + */ template @@ -1126,7 +1134,7 @@ std::pair py_binary_inplace_ufunc(const dpnp::tensor::usm_ndarray &lhs, const dpnp::tensor::usm_ndarray &rhs, sycl::queue &exec_q, - const std::vector &depends, + const std::vector depends, // const output_typesT &output_type_table, const contig_dispatchT &contig_dispatch_table, @@ -1316,4 +1324,5 @@ std::pair dpnp::utils::keep_args_alive(exec_q, {rhs, lhs}, host_tasks), strided_fn_ev); } -} // namespace dpnp::extensions::py_internal + +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp b/dpnp/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp similarity index 90% rename from dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp rename to dpnp/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp index c3abb9cc1409..f6fbc6557102 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp +++ b/dpnp/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp @@ -34,6 +34,7 @@ //===---------------------------------------------------------------------===// #include +#include #include #include @@ -93,4 +94,15 @@ int _result_typeid(int arg_typeid, const int *fn_output_id) return fn_output_id[arg_typeid]; } +std::pair _result_typeid(int arg_typeid, + const std::pair *fn_output_id) +{ + if (arg_typeid < 0 || arg_typeid >= td_ns::num_types) { + throw py::value_error("Input typeid " + std::to_string(arg_typeid) + + " is outside of expected bounds."); + } + + return fn_output_id[arg_typeid]; +} + } // namespace dpnp::tensor::py_internal::type_utils diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions_type_utils.hpp b/dpnp/libtensor/source/elementwise_functions/elementwise_functions_type_utils.hpp similarity index 92% rename from dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions_type_utils.hpp rename to dpnp/libtensor/source/elementwise_functions/elementwise_functions_type_utils.hpp index ae055c5e0c11..75c49b5950f2 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions_type_utils.hpp +++ b/dpnp/libtensor/source/elementwise_functions/elementwise_functions_type_utils.hpp @@ -35,6 +35,8 @@ #pragma once +#include + #include #include @@ -53,4 +55,8 @@ extern py::dtype _dtype_from_typenum(td_ns::typenum_t); * argument and the mapping table */ extern int _result_typeid(int, const int *); +/*! @brief Lookup typeids of the two results from typeid of + * argument and the mapping table */ +extern std::pair _result_typeid(int, const std::pair *); + } // namespace dpnp::tensor::py_internal::type_utils diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/equal.cpp b/dpnp/libtensor/source/elementwise_functions/equal.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/equal.cpp rename to dpnp/libtensor/source/elementwise_functions/equal.cpp index a1f7b4f96448..312e5b7da8a9 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/equal.cpp +++ b/dpnp/libtensor/source/elementwise_functions/equal.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/equal.hpp b/dpnp/libtensor/source/elementwise_functions/equal.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/equal.hpp rename to dpnp/libtensor/source/elementwise_functions/equal.hpp index e62e17180f1f..e125f125c6fa 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/equal.hpp +++ b/dpnp/libtensor/source/elementwise_functions/equal.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/erf_funcs.cpp b/dpnp/libtensor/source/elementwise_functions/erf_funcs.cpp similarity index 94% rename from dpnp/backend/extensions/ufunc/elementwise_functions/erf_funcs.cpp rename to dpnp/libtensor/source/elementwise_functions/erf_funcs.cpp index cc54cf373aa4..513033dbb632 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/erf_funcs.cpp +++ b/dpnp/libtensor/source/elementwise_functions/erf_funcs.cpp @@ -43,19 +43,15 @@ // utils extension header #include "ext/common.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" #include "utils/type_dispatch.hpp" -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; using ext::common::init_dispatch_vector; @@ -101,7 +97,7 @@ using ew_cmn_ns::unary_strided_impl_fn_ptr_t; #define MACRO_DEFINE_IMPL(__name__, __f_name__) \ \ - using dpnp::kernels::erfs::__f_name__##Functor; \ + using dpnp::tensor::kernels::erfs::__f_name__##Functor; \ \ template \ @@ -205,9 +201,8 @@ static void populate(py::module_ m, auto pyapi = [&, contig_dispatch_vector, strided_dispatch_vector]( const arrayT &src, const arrayT &dst, sycl::queue &exec_q, const std::vector &depends = {}) { - return py_int::py_unary_ufunc( - src, dst, exec_q, depends, output_typeid_vector, - contig_dispatch_vector, strided_dispatch_vector); + return py_unary_ufunc(src, dst, exec_q, depends, output_typeid_vector, + contig_dispatch_vector, strided_dispatch_vector); }; m.def(name, pyapi, docstring, py::arg("sycl_queue"), py::arg("src"), py::arg("dst"), py::arg("depends") = py::list()); @@ -226,7 +221,7 @@ void init_erf_funcs(py::module_ m) init_dispatch_vector(output_typeid_vector); auto erf_result_type_pyapi = [&](const py::dtype &dtype) { - return py_int::py_unary_ufunc_result_type(dtype, output_typeid_vector); + return py_unary_ufunc_result_type(dtype, output_typeid_vector); }; m.def("_erf_result_type", erf_result_type_pyapi); @@ -250,4 +245,4 @@ void init_erf_funcs(py::module_ m) m, "_erfcinv", "", impl::erfcinv_contig_dispatch_vector, impl::erfcinv_strided_dispatch_vector); } -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/erf_funcs.hpp b/dpnp/libtensor/source/elementwise_functions/erf_funcs.hpp similarity index 95% rename from dpnp/backend/extensions/ufunc/elementwise_functions/erf_funcs.hpp rename to dpnp/libtensor/source/elementwise_functions/erf_funcs.hpp index 63a769bfb397..05de2af36185 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/erf_funcs.hpp +++ b/dpnp/libtensor/source/elementwise_functions/erf_funcs.hpp @@ -32,7 +32,7 @@ namespace py = pybind11; -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { void init_erf_funcs(py::module_ m); -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/exp.cpp b/dpnp/libtensor/source/elementwise_functions/exp.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/exp.cpp rename to dpnp/libtensor/source/elementwise_functions/exp.cpp index 33cf3623a0f2..4cf562bde797 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/exp.cpp +++ b/dpnp/libtensor/source/elementwise_functions/exp.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/exp.hpp b/dpnp/libtensor/source/elementwise_functions/exp.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/exp.hpp rename to dpnp/libtensor/source/elementwise_functions/exp.hpp index 208262805d41..d79ee0c380c4 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/exp.hpp +++ b/dpnp/libtensor/source/elementwise_functions/exp.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/exp2.cpp b/dpnp/libtensor/source/elementwise_functions/exp2.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/exp2.cpp rename to dpnp/libtensor/source/elementwise_functions/exp2.cpp index c3aff802f18b..e0765b017c83 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/exp2.cpp +++ b/dpnp/libtensor/source/elementwise_functions/exp2.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/exp2.hpp b/dpnp/libtensor/source/elementwise_functions/exp2.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/exp2.hpp rename to dpnp/libtensor/source/elementwise_functions/exp2.hpp index fe767d8d4fe3..49764045d0a5 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/exp2.hpp +++ b/dpnp/libtensor/source/elementwise_functions/exp2.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/expm1.cpp b/dpnp/libtensor/source/elementwise_functions/expm1.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/expm1.cpp rename to dpnp/libtensor/source/elementwise_functions/expm1.cpp index e1251787e342..6f105c53e14c 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/expm1.cpp +++ b/dpnp/libtensor/source/elementwise_functions/expm1.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/expm1.hpp b/dpnp/libtensor/source/elementwise_functions/expm1.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/expm1.hpp rename to dpnp/libtensor/source/elementwise_functions/expm1.hpp index b271af36a9f3..a219a1c6d921 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/expm1.hpp +++ b/dpnp/libtensor/source/elementwise_functions/expm1.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/fabs.cpp b/dpnp/libtensor/source/elementwise_functions/fabs.cpp similarity index 89% rename from dpnp/backend/extensions/ufunc/elementwise_functions/fabs.cpp rename to dpnp/libtensor/source/elementwise_functions/fabs.cpp index 0a1878d76c06..301698412a8c 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/fabs.cpp +++ b/dpnp/libtensor/source/elementwise_functions/fabs.cpp @@ -41,19 +41,15 @@ #include "kernels/elementwise_functions/fabs.hpp" #include "populate.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" #include "utils/type_dispatch.hpp" -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; namespace impl { @@ -76,7 +72,7 @@ struct OutputType td_ns::DefaultResultEntry>::result_type; }; -using dpnp::kernels::fabs::FabsFunctor; +using dpnp::tensor::kernels::fabs::FabsFunctor; template using OutputType = max_ns::MaximumOutputType; -using dpnp::kernels::fmax::FmaxFunctor; +using dpnp::tensor::kernels::fmax::FmaxFunctor; template using OutputType = min_ns::MinimumOutputType; -using dpnp::kernels::fmin::FminFunctor; +using dpnp::tensor::kernels::fmin::FminFunctor; template >::result_type; }; -using dpnp::kernels::fmod::FmodFunctor; +using dpnp::tensor::kernels::fmod::FmodFunctor; template struct OutputType { using table_type = std::disjunction< // disjunction is C++17 // feature, supported by DPC++ - td_int_ns:: - TypeMapTwoResultsEntry, - td_int_ns::TypeMapTwoResultsEntry, - td_int_ns::TypeMapTwoResultsEntry, - td_int_ns::DefaultTwoResultsEntry>; + td_ns::TypeMapTwoResultsEntry, + td_ns::TypeMapTwoResultsEntry, + td_ns::TypeMapTwoResultsEntry, + td_ns::DefaultTwoResultsEntry>; using value_type1 = typename table_type::result_type1; using value_type2 = typename table_type::result_type2; }; @@ -133,7 +127,7 @@ void init_frexp(py::module_ m) auto frexp_pyapi = [&](const arrayT &src, const arrayT &dst1, const arrayT &dst2, sycl::queue &exec_q, const event_vecT &depends = {}) { - return py_int::py_unary_two_outputs_ufunc( + return py_unary_two_outputs_ufunc( src, dst1, dst2, exec_q, depends, frexp_output_typeid_vector, frexp_contig_dispatch_vector, frexp_strided_dispatch_vector); }; @@ -142,10 +136,10 @@ void init_frexp(py::module_ m) py::arg("depends") = py::list()); auto frexp_result_type_pyapi = [&](const py::dtype &dtype) { - return py_int::py_unary_two_outputs_ufunc_result_type( + return py_unary_two_outputs_ufunc_result_type( dtype, frexp_output_typeid_vector); }; m.def("_frexp_result_type", frexp_result_type_pyapi); } } -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/frexp.hpp b/dpnp/libtensor/source/elementwise_functions/frexp.hpp similarity index 95% rename from dpnp/backend/extensions/ufunc/elementwise_functions/frexp.hpp rename to dpnp/libtensor/source/elementwise_functions/frexp.hpp index e87f63ce1cbb..d7e773eb33dc 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/frexp.hpp +++ b/dpnp/libtensor/source/elementwise_functions/frexp.hpp @@ -32,7 +32,7 @@ namespace py = pybind11; -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { void init_frexp(py::module_ m); -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/gcd.cpp b/dpnp/libtensor/source/elementwise_functions/gcd.cpp similarity index 92% rename from dpnp/backend/extensions/ufunc/elementwise_functions/gcd.cpp rename to dpnp/libtensor/source/elementwise_functions/gcd.cpp index ec882f796daf..3fc6129e2621 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/gcd.cpp +++ b/dpnp/libtensor/source/elementwise_functions/gcd.cpp @@ -42,19 +42,15 @@ #include "kernels/elementwise_functions/gcd.hpp" #include "populate.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" #include "utils/type_dispatch.hpp" -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl @@ -109,7 +105,7 @@ struct OutputType td_ns::DefaultResultEntry>::result_type; }; -using dpnp::kernels::gcd::GcdFunctor; +using dpnp::tensor::kernels::gcd::GcdFunctor; template >::result_type; }; -using dpnp::kernels::heaviside::HeavisideFunctor; +using dpnp::tensor::kernels::heaviside::HeavisideFunctor; template >::result_type; }; -using dpnp::kernels::i0::I0Functor; +using dpnp::tensor::kernels::i0::I0Functor; template ; + dpnp::tensor::kernels::interpolate::InterpolateFunctor; cgh.parallel_for( sycl::range<1>(n), @@ -273,4 +273,4 @@ void init_interpolate(py::module_ m) py::arg("right"), py::arg("out"), py::arg("sycl_queue"), py::arg("depends") = py::list()); } -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/interpolate.hpp b/dpnp/libtensor/source/elementwise_functions/interpolate.hpp similarity index 95% rename from dpnp/backend/extensions/ufunc/elementwise_functions/interpolate.hpp rename to dpnp/libtensor/source/elementwise_functions/interpolate.hpp index bcf19b4663be..20d8b3335b80 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/interpolate.hpp +++ b/dpnp/libtensor/source/elementwise_functions/interpolate.hpp @@ -32,7 +32,7 @@ namespace py = pybind11; -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { void init_interpolate(py::module_ m); -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/isclose.cpp b/dpnp/libtensor/source/elementwise_functions/isclose.cpp similarity index 97% rename from dpnp/backend/extensions/ufunc/elementwise_functions/isclose.cpp rename to dpnp/libtensor/source/elementwise_functions/isclose.cpp index fa882a6d62ff..4f8d0e8d95dc 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/isclose.cpp +++ b/dpnp/libtensor/source/elementwise_functions/isclose.cpp @@ -42,7 +42,7 @@ #include "kernels/elementwise_functions/isclose.hpp" -#include "../../elementwise_functions/simplify_iteration_space.hpp" +#include "simplify_iteration_space.hpp" // dpnp tensor headers #include "utils/offset_utils.hpp" @@ -69,7 +69,7 @@ using ext::validation::check_same_dtype; using ext::validation::check_same_size; using ext::validation::check_writable; -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { namespace impl @@ -115,7 +115,7 @@ sycl::event isclose_strided_scalar_call(sycl::queue &exec_q, const scT atol = py::cast(py_atol); const bool equal_nan = py::cast(py_equal_nan); - return dpnp::kernels::isclose::isclose_strided_scalar_impl( + return dpnp::tensor::kernels::isclose::isclose_strided_scalar_impl( exec_q, nd, nelems, shape_strides, rtol, atol, equal_nan, in1_p, in1_offset, in2_p, in2_offset, out_p, out_offset, depends); } @@ -149,7 +149,7 @@ sycl::event isclose_contig_scalar_call(sycl::queue &q, const scT atol = py::cast(py_atol); const bool equal_nan = py::cast(py_equal_nan); - return dpnp::kernels::isclose::isclose_contig_scalar_impl( + return dpnp::tensor::kernels::isclose::isclose_contig_scalar_impl( q, nelems, rtol, atol, equal_nan, in1_p, in2_p, out_p, depends); } @@ -379,4 +379,4 @@ void init_isclose(py::module_ m) py::arg("depends") = py::list()); } -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/isclose.hpp b/dpnp/libtensor/source/elementwise_functions/isclose.hpp similarity index 95% rename from dpnp/backend/extensions/ufunc/elementwise_functions/isclose.hpp rename to dpnp/libtensor/source/elementwise_functions/isclose.hpp index 9e73f99ae64f..ed6db0fb80e3 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/isclose.hpp +++ b/dpnp/libtensor/source/elementwise_functions/isclose.hpp @@ -32,7 +32,7 @@ namespace py = pybind11; -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { void init_isclose(py::module_ m); -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/isfinite.cpp b/dpnp/libtensor/source/elementwise_functions/isfinite.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/isfinite.cpp rename to dpnp/libtensor/source/elementwise_functions/isfinite.cpp index 5a269667c0e9..033112bbaa89 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/isfinite.cpp +++ b/dpnp/libtensor/source/elementwise_functions/isfinite.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/isfinite.hpp b/dpnp/libtensor/source/elementwise_functions/isfinite.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/isfinite.hpp rename to dpnp/libtensor/source/elementwise_functions/isfinite.hpp index 49c8d451e72c..f996f9f45b61 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/isfinite.hpp +++ b/dpnp/libtensor/source/elementwise_functions/isfinite.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/isinf.cpp b/dpnp/libtensor/source/elementwise_functions/isinf.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/isinf.cpp rename to dpnp/libtensor/source/elementwise_functions/isinf.cpp index c464bac8384f..bf1f0824a39e 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/isinf.cpp +++ b/dpnp/libtensor/source/elementwise_functions/isinf.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/isinf.hpp b/dpnp/libtensor/source/elementwise_functions/isinf.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/isinf.hpp rename to dpnp/libtensor/source/elementwise_functions/isinf.hpp index 21082f81bb7c..2f3b8d4d4d4a 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/isinf.hpp +++ b/dpnp/libtensor/source/elementwise_functions/isinf.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/isnan.cpp b/dpnp/libtensor/source/elementwise_functions/isnan.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/isnan.cpp rename to dpnp/libtensor/source/elementwise_functions/isnan.cpp index add713120bfd..1f3c2c91f4d7 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/isnan.cpp +++ b/dpnp/libtensor/source/elementwise_functions/isnan.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/isnan.hpp b/dpnp/libtensor/source/elementwise_functions/isnan.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/isnan.hpp rename to dpnp/libtensor/source/elementwise_functions/isnan.hpp index 3e68cc085de0..b93b95c0f949 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/isnan.hpp +++ b/dpnp/libtensor/source/elementwise_functions/isnan.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/lcm.cpp b/dpnp/libtensor/source/elementwise_functions/lcm.cpp similarity index 92% rename from dpnp/backend/extensions/ufunc/elementwise_functions/lcm.cpp rename to dpnp/libtensor/source/elementwise_functions/lcm.cpp index 0f58d27816d8..6e6c86a7cd19 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/lcm.cpp +++ b/dpnp/libtensor/source/elementwise_functions/lcm.cpp @@ -42,19 +42,15 @@ #include "lcm.hpp" #include "populate.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" #include "utils/type_dispatch.hpp" -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; namespace td_ns = dpnp::tensor::type_dispatch; namespace impl @@ -109,7 +105,7 @@ struct OutputType td_ns::DefaultResultEntry>::result_type; }; -using dpnp::kernels::lcm::LcmFunctor; +using dpnp::tensor::kernels::lcm::LcmFunctor; template >::result_type; }; -using dpnp::kernels::ldexp::LdexpFunctor; +using dpnp::tensor::kernels::ldexp::LdexpFunctor; template using OutputType = logaddexp_ns::LogAddExpOutputType; -using dpnp::kernels::logaddexp2::Logaddexp2Functor; +using dpnp::tensor::kernels::logaddexp2::Logaddexp2Functor; template struct OutputType { using table_type = std::disjunction< // disjunction is C++17 // feature, supported by DPC++ - td_int_ns::TypeMapTwoResultsEntry, - td_int_ns::TypeMapTwoResultsEntry, - td_int_ns::TypeMapTwoResultsEntry, - td_int_ns::DefaultTwoResultsEntry>; + td_ns::TypeMapTwoResultsEntry, + td_ns::TypeMapTwoResultsEntry, + td_ns::TypeMapTwoResultsEntry, + td_ns::DefaultTwoResultsEntry>; using value_type1 = typename table_type::result_type1; using value_type2 = typename table_type::result_type2; }; @@ -132,7 +127,7 @@ void init_modf(py::module_ m) auto modf_pyapi = [&](const arrayT &src, const arrayT &dst1, const arrayT &dst2, sycl::queue &exec_q, const event_vecT &depends = {}) { - return py_int::py_unary_two_outputs_ufunc( + return py_unary_two_outputs_ufunc( src, dst1, dst2, exec_q, depends, modf_output_typeid_vector, modf_contig_dispatch_vector, modf_strided_dispatch_vector); }; @@ -141,10 +136,10 @@ void init_modf(py::module_ m) py::arg("depends") = py::list()); auto modf_result_type_pyapi = [&](const py::dtype &dtype) { - return py_int::py_unary_two_outputs_ufunc_result_type( + return py_unary_two_outputs_ufunc_result_type( dtype, modf_output_typeid_vector); }; m.def("_modf_result_type", modf_result_type_pyapi); } } -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/modf.hpp b/dpnp/libtensor/source/elementwise_functions/modf.hpp similarity index 95% rename from dpnp/backend/extensions/ufunc/elementwise_functions/modf.hpp rename to dpnp/libtensor/source/elementwise_functions/modf.hpp index 3c57ba6834f4..f3bc34c971bc 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/modf.hpp +++ b/dpnp/libtensor/source/elementwise_functions/modf.hpp @@ -32,7 +32,7 @@ namespace py = pybind11; -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { void init_modf(py::module_ m); -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/multiply.cpp b/dpnp/libtensor/source/elementwise_functions/multiply.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/elementwise_functions/multiply.cpp rename to dpnp/libtensor/source/elementwise_functions/multiply.cpp index 5eac5f7e06cf..0b660407f84b 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/multiply.cpp +++ b/dpnp/libtensor/source/elementwise_functions/multiply.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/multiply.hpp b/dpnp/libtensor/source/elementwise_functions/multiply.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/multiply.hpp rename to dpnp/libtensor/source/elementwise_functions/multiply.hpp index 728ba00b56ba..1866a86c33a6 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/multiply.hpp +++ b/dpnp/libtensor/source/elementwise_functions/multiply.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/nan_to_num.cpp b/dpnp/libtensor/source/elementwise_functions/nan_to_num.cpp similarity index 98% rename from dpnp/backend/extensions/ufunc/elementwise_functions/nan_to_num.cpp rename to dpnp/libtensor/source/elementwise_functions/nan_to_num.cpp index b5c3c7aa4f39..bad533298cdc 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/nan_to_num.cpp +++ b/dpnp/libtensor/source/elementwise_functions/nan_to_num.cpp @@ -46,7 +46,7 @@ #include "kernels/elementwise_functions/nan_to_num.hpp" -#include "../../elementwise_functions/simplify_iteration_space.hpp" +#include "simplify_iteration_space.hpp" // dpnp tensor headers #include "utils/memory_overlap.hpp" @@ -65,7 +65,7 @@ namespace td_ns = dpnp::tensor::type_dispatch; using ext::common::value_type_of; // declare pybind11 wrappers in py_internal namespace -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { namespace impl @@ -109,7 +109,7 @@ sycl::event nan_to_num_strided_call(sycl::queue &exec_q, const scT posinf_v = py::cast(py_posinf); const scT neginf_v = py::cast(py_neginf); - using dpnp::kernels::nan_to_num::nan_to_num_strided_impl; + using dpnp::tensor::kernels::nan_to_num::nan_to_num_strided_impl; sycl::event to_num_ev = nan_to_num_strided_impl( exec_q, nd, nelems, shape_strides, nan_v, posinf_v, neginf_v, arg_p, arg_offset, dst_p, dst_offset, depends); @@ -144,7 +144,7 @@ sycl::event nan_to_num_contig_call(sycl::queue &exec_q, const scT posinf_v = py::cast(py_posinf); const scT neginf_v = py::cast(py_neginf); - using dpnp::kernels::nan_to_num::nan_to_num_contig_impl; + using dpnp::tensor::kernels::nan_to_num::nan_to_num_contig_impl; sycl::event to_num_contig_ev = nan_to_num_contig_impl( exec_q, nelems, nan_v, posinf_v, neginf_v, arg_p, dst_p, depends); @@ -399,4 +399,4 @@ void init_nan_to_num(py::module_ m) } } -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/nan_to_num.hpp b/dpnp/libtensor/source/elementwise_functions/nan_to_num.hpp similarity index 95% rename from dpnp/backend/extensions/ufunc/elementwise_functions/nan_to_num.hpp rename to dpnp/libtensor/source/elementwise_functions/nan_to_num.hpp index 851e78b81a3e..8253ca0e03c0 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/nan_to_num.hpp +++ b/dpnp/libtensor/source/elementwise_functions/nan_to_num.hpp @@ -32,7 +32,7 @@ namespace py = pybind11; -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { void init_nan_to_num(py::module_ m); -} // namespace dpnp::extensions::ufunc +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/negative.cpp b/dpnp/libtensor/source/elementwise_functions/negative.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/negative.cpp rename to dpnp/libtensor/source/elementwise_functions/negative.cpp index 79e9921b4c71..4cfc31e6a5c3 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/negative.cpp +++ b/dpnp/libtensor/source/elementwise_functions/negative.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/negative.hpp b/dpnp/libtensor/source/elementwise_functions/negative.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/negative.hpp rename to dpnp/libtensor/source/elementwise_functions/negative.hpp index 8f167988cf5e..ac8162219091 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/negative.hpp +++ b/dpnp/libtensor/source/elementwise_functions/negative.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/nextafter.cpp b/dpnp/libtensor/source/elementwise_functions/nextafter.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/nextafter.cpp rename to dpnp/libtensor/source/elementwise_functions/nextafter.cpp index 1e7c8ee26ed1..6418bb807505 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/nextafter.cpp +++ b/dpnp/libtensor/source/elementwise_functions/nextafter.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/nextafter.hpp b/dpnp/libtensor/source/elementwise_functions/nextafter.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/nextafter.hpp rename to dpnp/libtensor/source/elementwise_functions/nextafter.hpp index b176c5e7a698..f440c7acb9a6 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/nextafter.hpp +++ b/dpnp/libtensor/source/elementwise_functions/nextafter.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/not_equal.cpp b/dpnp/libtensor/source/elementwise_functions/not_equal.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/not_equal.cpp rename to dpnp/libtensor/source/elementwise_functions/not_equal.cpp index 40c275458578..e1ddc2e8d084 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/not_equal.cpp +++ b/dpnp/libtensor/source/elementwise_functions/not_equal.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/not_equal.hpp b/dpnp/libtensor/source/elementwise_functions/not_equal.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/not_equal.hpp rename to dpnp/libtensor/source/elementwise_functions/not_equal.hpp index 378efc53b11b..534eede7cc60 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/not_equal.hpp +++ b/dpnp/libtensor/source/elementwise_functions/not_equal.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/populate.hpp b/dpnp/libtensor/source/elementwise_functions/populate.hpp similarity index 100% rename from dpnp/backend/extensions/ufunc/elementwise_functions/populate.hpp rename to dpnp/libtensor/source/elementwise_functions/populate.hpp diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/positive.cpp b/dpnp/libtensor/source/elementwise_functions/positive.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/positive.cpp rename to dpnp/libtensor/source/elementwise_functions/positive.cpp index b4319c6584ac..604898b173c7 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/positive.cpp +++ b/dpnp/libtensor/source/elementwise_functions/positive.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/positive.hpp b/dpnp/libtensor/source/elementwise_functions/positive.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/positive.hpp rename to dpnp/libtensor/source/elementwise_functions/positive.hpp index 8a827984809f..67ddfe6df2cb 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/positive.hpp +++ b/dpnp/libtensor/source/elementwise_functions/positive.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/pow.cpp b/dpnp/libtensor/source/elementwise_functions/pow.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/elementwise_functions/pow.cpp rename to dpnp/libtensor/source/elementwise_functions/pow.cpp index 08c8b8e38cba..59a985a3efef 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/pow.cpp +++ b/dpnp/libtensor/source/elementwise_functions/pow.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/pow.hpp b/dpnp/libtensor/source/elementwise_functions/pow.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/pow.hpp rename to dpnp/libtensor/source/elementwise_functions/pow.hpp index f3be3d2a82fb..23e3ffa15ffb 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/pow.hpp +++ b/dpnp/libtensor/source/elementwise_functions/pow.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/proj.cpp b/dpnp/libtensor/source/elementwise_functions/proj.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/elementwise_functions/proj.cpp rename to dpnp/libtensor/source/elementwise_functions/proj.cpp index 38a73df193b3..831c59d3168a 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/proj.cpp +++ b/dpnp/libtensor/source/elementwise_functions/proj.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/proj.hpp b/dpnp/libtensor/source/elementwise_functions/proj.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/elementwise_functions/proj.hpp rename to dpnp/libtensor/source/elementwise_functions/proj.hpp index 99edfb1ac4ee..32b174837faa 100644 --- a/dpnp/tensor/libtensor/source/elementwise_functions/proj.hpp +++ b/dpnp/libtensor/source/elementwise_functions/proj.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension, specifically functions for elementwise operations. //===---------------------------------------------------------------------===// diff --git a/dpnp/backend/extensions/ufunc/elementwise_functions/radians.cpp b/dpnp/libtensor/source/elementwise_functions/radians.cpp similarity index 85% rename from dpnp/backend/extensions/ufunc/elementwise_functions/radians.cpp rename to dpnp/libtensor/source/elementwise_functions/radians.cpp index 10bfe47a3ab2..6e7ece1c4f05 100644 --- a/dpnp/backend/extensions/ufunc/elementwise_functions/radians.cpp +++ b/dpnp/libtensor/source/elementwise_functions/radians.cpp @@ -41,19 +41,15 @@ #include "populate.hpp" #include "radians.hpp" -// include a local copy of elementwise common header from dpnp tensor: -// dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp -// TODO: replace by consolidating with tensor post-migration -#include "../../elementwise_functions/elementwise_functions.hpp" +#include "elementwise_functions.hpp" // dpnp tensor headers #include "kernels/elementwise_functions/common.hpp" #include "utils/type_dispatch.hpp" -namespace dpnp::extensions::ufunc +namespace dpnp::tensor::py_internal { namespace py = pybind11; -namespace py_int = dpnp::extensions::py_internal; namespace impl { @@ -76,7 +72,7 @@ struct OutputType td_ns::DefaultResultEntry>::result_type; }; -using dpnp::kernels::radians::RadiansFunctor; +using dpnp::tensor::kernels::radians::RadiansFunctor; template >::result_type; }; -using dpnp::kernels::sinc::SincFunctor; +using dpnp::tensor::kernels::sinc::SincFunctor; template >::result_type; }; -using dpnp::kernels::spacing::SpacingFunctor; +using dpnp::tensor::kernels::spacing::SpacingFunctor; template diff --git a/dpnp/tensor/libtensor/source/eye_ctor.hpp b/dpnp/libtensor/source/eye_ctor.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/eye_ctor.hpp rename to dpnp/libtensor/source/eye_ctor.hpp index 765537f2ab29..9fa15a0068fd 100644 --- a/dpnp/tensor/libtensor/source/eye_ctor.hpp +++ b/dpnp/libtensor/source/eye_ctor.hpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/full_ctor.cpp b/dpnp/libtensor/source/full_ctor.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/full_ctor.cpp rename to dpnp/libtensor/source/full_ctor.cpp index b2380057c5f0..c2820af5d536 100644 --- a/dpnp/tensor/libtensor/source/full_ctor.cpp +++ b/dpnp/libtensor/source/full_ctor.cpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/full_ctor.hpp b/dpnp/libtensor/source/full_ctor.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/full_ctor.hpp rename to dpnp/libtensor/source/full_ctor.hpp index bae3fcfeb672..2856f5e56d91 100644 --- a/dpnp/tensor/libtensor/source/full_ctor.hpp +++ b/dpnp/libtensor/source/full_ctor.hpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/integer_advanced_indexing.cpp b/dpnp/libtensor/source/integer_advanced_indexing.cpp similarity index 100% rename from dpnp/tensor/libtensor/source/integer_advanced_indexing.cpp rename to dpnp/libtensor/source/integer_advanced_indexing.cpp diff --git a/dpnp/tensor/libtensor/source/integer_advanced_indexing.hpp b/dpnp/libtensor/source/integer_advanced_indexing.hpp similarity index 100% rename from dpnp/tensor/libtensor/source/integer_advanced_indexing.hpp rename to dpnp/libtensor/source/integer_advanced_indexing.hpp diff --git a/dpnp/tensor/libtensor/source/linalg_functions/dot.cpp b/dpnp/libtensor/source/linalg_functions/dot.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/linalg_functions/dot.cpp rename to dpnp/libtensor/source/linalg_functions/dot.cpp index 4bb98d5f990a..925ea9165c16 100644 --- a/dpnp/tensor/libtensor/source/linalg_functions/dot.cpp +++ b/dpnp/libtensor/source/linalg_functions/dot.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/linalg_functions/dot.hpp b/dpnp/libtensor/source/linalg_functions/dot.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/linalg_functions/dot.hpp rename to dpnp/libtensor/source/linalg_functions/dot.hpp index a340bba3ac68..1b07f73f7dd3 100644 --- a/dpnp/tensor/libtensor/source/linalg_functions/dot.hpp +++ b/dpnp/libtensor/source/linalg_functions/dot.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/linalg_functions/dot_atomic_support.hpp b/dpnp/libtensor/source/linalg_functions/dot_atomic_support.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/linalg_functions/dot_atomic_support.hpp rename to dpnp/libtensor/source/linalg_functions/dot_atomic_support.hpp index ce017cc181dc..2a3fce212cbb 100644 --- a/dpnp/tensor/libtensor/source/linalg_functions/dot_atomic_support.hpp +++ b/dpnp/libtensor/source/linalg_functions/dot_atomic_support.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/linalg_functions/dot_dispatch.hpp b/dpnp/libtensor/source/linalg_functions/dot_dispatch.hpp similarity index 99% rename from dpnp/tensor/libtensor/source/linalg_functions/dot_dispatch.hpp rename to dpnp/libtensor/source/linalg_functions/dot_dispatch.hpp index 6f4ec7c8309d..da8608fe401e 100644 --- a/dpnp/tensor/libtensor/source/linalg_functions/dot_dispatch.hpp +++ b/dpnp/libtensor/source/linalg_functions/dot_dispatch.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/linear_sequences.cpp b/dpnp/libtensor/source/linear_sequences.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/linear_sequences.cpp rename to dpnp/libtensor/source/linear_sequences.cpp index 2905498ab55c..1e92281f44a0 100644 --- a/dpnp/tensor/libtensor/source/linear_sequences.cpp +++ b/dpnp/libtensor/source/linear_sequences.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===---------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/linear_sequences.hpp b/dpnp/libtensor/source/linear_sequences.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/linear_sequences.hpp rename to dpnp/libtensor/source/linear_sequences.hpp index 7de0acfa5e30..823743fcabcd 100644 --- a/dpnp/tensor/libtensor/source/linear_sequences.hpp +++ b/dpnp/libtensor/source/linear_sequences.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===---------------------------------------------------------------------===// #pragma once diff --git a/dpnp/backend/extensions/indexing/putmask.cpp b/dpnp/libtensor/source/putmask.cpp similarity index 97% rename from dpnp/backend/extensions/indexing/putmask.cpp rename to dpnp/libtensor/source/putmask.cpp index bc489fde5482..92f65c9a6680 100644 --- a/dpnp/backend/extensions/indexing/putmask.cpp +++ b/dpnp/libtensor/source/putmask.cpp @@ -39,7 +39,7 @@ #include "dpnp4pybind11.hpp" -#include "kernels/indexing/putmask.hpp" +#include "kernels/putmask.hpp" // dpnp tensor headers #include "utils/memory_overlap.hpp" @@ -66,7 +66,7 @@ using ext::validation::check_same_dtype; using ext::validation::check_same_size; using ext::validation::check_writable; -namespace dpnp::extensions::indexing +namespace dpnp::tensor::py_internal { using ext::common::init_dispatch_vector; @@ -96,7 +96,7 @@ sycl::event putmask_strided_call(sycl::queue &q, const std::size_t values_size, const std::vector &depends) { - return dpnp::kernels::putmask::putmask_strided_impl( + return dpnp::tensor::kernels::putmask::putmask_strided_impl( q, nd, nelems, shape_strides, dst_p, dst_offset, mask_p, mask_offset, values_p, values_size, depends); } @@ -119,7 +119,7 @@ sycl::event putmask_contig_call(sycl::queue &q, const std::size_t values_size, const std::vector &depends) { - return dpnp::kernels::putmask::putmask_contig_impl( + return dpnp::tensor::kernels::putmask::putmask_contig_impl( q, nelems, dst_p, mask_p, values_p, values_size, depends); } @@ -281,4 +281,4 @@ void init_putmask(py::module_ &m) return; } -} // namespace dpnp::extensions::indexing +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/backend/extensions/indexing/putmask.hpp b/dpnp/libtensor/source/putmask.hpp similarity index 95% rename from dpnp/backend/extensions/indexing/putmask.hpp rename to dpnp/libtensor/source/putmask.hpp index 6c65231edc6d..f77074ec6f17 100644 --- a/dpnp/backend/extensions/indexing/putmask.hpp +++ b/dpnp/libtensor/source/putmask.hpp @@ -32,7 +32,7 @@ namespace py = pybind11; -namespace dpnp::extensions::indexing +namespace dpnp::tensor::py_internal { void init_putmask(py::module_ &m); -} // namespace dpnp::extensions::indexing +} // namespace dpnp::tensor::py_internal diff --git a/dpnp/tensor/libtensor/source/reductions/all.cpp b/dpnp/libtensor/source/reductions/all.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/reductions/all.cpp rename to dpnp/libtensor/source/reductions/all.cpp index 8c54a36119a9..90bd82745c26 100644 --- a/dpnp/tensor/libtensor/source/reductions/all.cpp +++ b/dpnp/libtensor/source/reductions/all.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/all.hpp b/dpnp/libtensor/source/reductions/all.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/all.hpp rename to dpnp/libtensor/source/reductions/all.hpp index 1a23740ad34e..f9b65910c9c4 100644 --- a/dpnp/tensor/libtensor/source/reductions/all.hpp +++ b/dpnp/libtensor/source/reductions/all.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/any.cpp b/dpnp/libtensor/source/reductions/any.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/reductions/any.cpp rename to dpnp/libtensor/source/reductions/any.cpp index fc7d12ba33ae..9f32fbe48b30 100644 --- a/dpnp/tensor/libtensor/source/reductions/any.cpp +++ b/dpnp/libtensor/source/reductions/any.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/any.hpp b/dpnp/libtensor/source/reductions/any.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/any.hpp rename to dpnp/libtensor/source/reductions/any.hpp index fd78eabf32d4..c53aff2f2415 100644 --- a/dpnp/tensor/libtensor/source/reductions/any.hpp +++ b/dpnp/libtensor/source/reductions/any.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/argmax.cpp b/dpnp/libtensor/source/reductions/argmax.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/reductions/argmax.cpp rename to dpnp/libtensor/source/reductions/argmax.cpp index 88b0bf7d58de..549744c811b1 100644 --- a/dpnp/tensor/libtensor/source/reductions/argmax.cpp +++ b/dpnp/libtensor/source/reductions/argmax.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/argmax.hpp b/dpnp/libtensor/source/reductions/argmax.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/argmax.hpp rename to dpnp/libtensor/source/reductions/argmax.hpp index b8a8eb4e3688..01986962cde0 100644 --- a/dpnp/tensor/libtensor/source/reductions/argmax.hpp +++ b/dpnp/libtensor/source/reductions/argmax.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/argmin.cpp b/dpnp/libtensor/source/reductions/argmin.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/reductions/argmin.cpp rename to dpnp/libtensor/source/reductions/argmin.cpp index b7887f24ae2d..12eb6a651397 100644 --- a/dpnp/tensor/libtensor/source/reductions/argmin.cpp +++ b/dpnp/libtensor/source/reductions/argmin.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/argmin.hpp b/dpnp/libtensor/source/reductions/argmin.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/argmin.hpp rename to dpnp/libtensor/source/reductions/argmin.hpp index 0ea66023bfec..d93b17bc2ac1 100644 --- a/dpnp/tensor/libtensor/source/reductions/argmin.hpp +++ b/dpnp/libtensor/source/reductions/argmin.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/logsumexp.cpp b/dpnp/libtensor/source/reductions/logsumexp.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/reductions/logsumexp.cpp rename to dpnp/libtensor/source/reductions/logsumexp.cpp index 0bf632d4f41d..d37f0dd93164 100644 --- a/dpnp/tensor/libtensor/source/reductions/logsumexp.cpp +++ b/dpnp/libtensor/source/reductions/logsumexp.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/logsumexp.hpp b/dpnp/libtensor/source/reductions/logsumexp.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/logsumexp.hpp rename to dpnp/libtensor/source/reductions/logsumexp.hpp index 16cbb00875c1..0faa6a71a6de 100644 --- a/dpnp/tensor/libtensor/source/reductions/logsumexp.hpp +++ b/dpnp/libtensor/source/reductions/logsumexp.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/max.cpp b/dpnp/libtensor/source/reductions/max.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/reductions/max.cpp rename to dpnp/libtensor/source/reductions/max.cpp index 34d24031390d..d1ec694adfcc 100644 --- a/dpnp/tensor/libtensor/source/reductions/max.cpp +++ b/dpnp/libtensor/source/reductions/max.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/max.hpp b/dpnp/libtensor/source/reductions/max.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/max.hpp rename to dpnp/libtensor/source/reductions/max.hpp index fb09d7cdcb06..cd6bf590adf8 100644 --- a/dpnp/tensor/libtensor/source/reductions/max.hpp +++ b/dpnp/libtensor/source/reductions/max.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/min.cpp b/dpnp/libtensor/source/reductions/min.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/reductions/min.cpp rename to dpnp/libtensor/source/reductions/min.cpp index 7379c234eef1..89431207ef13 100644 --- a/dpnp/tensor/libtensor/source/reductions/min.cpp +++ b/dpnp/libtensor/source/reductions/min.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/min.hpp b/dpnp/libtensor/source/reductions/min.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/min.hpp rename to dpnp/libtensor/source/reductions/min.hpp index aa50600bc793..c39a481b72c9 100644 --- a/dpnp/tensor/libtensor/source/reductions/min.hpp +++ b/dpnp/libtensor/source/reductions/min.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/prod.cpp b/dpnp/libtensor/source/reductions/prod.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/reductions/prod.cpp rename to dpnp/libtensor/source/reductions/prod.cpp index 3db10ab6b9ff..90df9739a0f6 100644 --- a/dpnp/tensor/libtensor/source/reductions/prod.cpp +++ b/dpnp/libtensor/source/reductions/prod.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/prod.hpp b/dpnp/libtensor/source/reductions/prod.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/prod.hpp rename to dpnp/libtensor/source/reductions/prod.hpp index a9a309d586c5..287a1d5b0ef9 100644 --- a/dpnp/tensor/libtensor/source/reductions/prod.hpp +++ b/dpnp/libtensor/source/reductions/prod.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/reduce_hypot.cpp b/dpnp/libtensor/source/reductions/reduce_hypot.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/reductions/reduce_hypot.cpp rename to dpnp/libtensor/source/reductions/reduce_hypot.cpp index 80bab9a67795..0484e0f45ad3 100644 --- a/dpnp/tensor/libtensor/source/reductions/reduce_hypot.cpp +++ b/dpnp/libtensor/source/reductions/reduce_hypot.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/reduce_hypot.hpp b/dpnp/libtensor/source/reductions/reduce_hypot.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/reduce_hypot.hpp rename to dpnp/libtensor/source/reductions/reduce_hypot.hpp index 1c56d1cad05f..907f540ad57c 100644 --- a/dpnp/tensor/libtensor/source/reductions/reduce_hypot.hpp +++ b/dpnp/libtensor/source/reductions/reduce_hypot.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/reduction_atomic_support.hpp b/dpnp/libtensor/source/reductions/reduction_atomic_support.hpp similarity index 98% rename from dpnp/tensor/libtensor/source/reductions/reduction_atomic_support.hpp rename to dpnp/libtensor/source/reductions/reduction_atomic_support.hpp index b8c37458577c..568f75dd5afa 100644 --- a/dpnp/tensor/libtensor/source/reductions/reduction_atomic_support.hpp +++ b/dpnp/libtensor/source/reductions/reduction_atomic_support.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/reduction_common.cpp b/dpnp/libtensor/source/reductions/reduction_common.cpp similarity index 97% rename from dpnp/tensor/libtensor/source/reductions/reduction_common.cpp rename to dpnp/libtensor/source/reductions/reduction_common.cpp index b99cfce24d41..31218a6dd7dd 100644 --- a/dpnp/tensor/libtensor/source/reductions/reduction_common.cpp +++ b/dpnp/libtensor/source/reductions/reduction_common.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/reduction_common.hpp b/dpnp/libtensor/source/reductions/reduction_common.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/reduction_common.hpp rename to dpnp/libtensor/source/reductions/reduction_common.hpp index 3dd1356820c1..206fe12f26f4 100644 --- a/dpnp/tensor/libtensor/source/reductions/reduction_common.hpp +++ b/dpnp/libtensor/source/reductions/reduction_common.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/reduction_over_axis.hpp b/dpnp/libtensor/source/reductions/reduction_over_axis.hpp similarity index 99% rename from dpnp/tensor/libtensor/source/reductions/reduction_over_axis.hpp rename to dpnp/libtensor/source/reductions/reduction_over_axis.hpp index 6be8646e4056..cbbbf5018d89 100644 --- a/dpnp/tensor/libtensor/source/reductions/reduction_over_axis.hpp +++ b/dpnp/libtensor/source/reductions/reduction_over_axis.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension, specifically functions for reductions. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/sum.cpp b/dpnp/libtensor/source/reductions/sum.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/reductions/sum.cpp rename to dpnp/libtensor/source/reductions/sum.cpp index 6c4cc7067afe..5fabacbd6164 100644 --- a/dpnp/tensor/libtensor/source/reductions/sum.cpp +++ b/dpnp/libtensor/source/reductions/sum.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/reductions/sum.hpp b/dpnp/libtensor/source/reductions/sum.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/reductions/sum.hpp rename to dpnp/libtensor/source/reductions/sum.hpp index cb118c42a940..1778d969b554 100644 --- a/dpnp/tensor/libtensor/source/reductions/sum.hpp +++ b/dpnp/libtensor/source/reductions/sum.hpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/repeat.cpp b/dpnp/libtensor/source/repeat.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/repeat.cpp rename to dpnp/libtensor/source/repeat.cpp index bbb004006a41..afd664d4fb42 100644 --- a/dpnp/tensor/libtensor/source/repeat.cpp +++ b/dpnp/libtensor/source/repeat.cpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/repeat.hpp b/dpnp/libtensor/source/repeat.hpp similarity index 98% rename from dpnp/tensor/libtensor/source/repeat.hpp rename to dpnp/libtensor/source/repeat.hpp index cfa309021927..8739aaef33fa 100644 --- a/dpnp/tensor/libtensor/source/repeat.hpp +++ b/dpnp/libtensor/source/repeat.hpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/simplify_iteration_space.cpp b/dpnp/libtensor/source/simplify_iteration_space.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/simplify_iteration_space.cpp rename to dpnp/libtensor/source/simplify_iteration_space.cpp index 440dd11f3605..464b57d186f9 100644 --- a/dpnp/tensor/libtensor/source/simplify_iteration_space.cpp +++ b/dpnp/libtensor/source/simplify_iteration_space.cpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/simplify_iteration_space.hpp b/dpnp/libtensor/source/simplify_iteration_space.hpp similarity index 98% rename from dpnp/tensor/libtensor/source/simplify_iteration_space.hpp rename to dpnp/libtensor/source/simplify_iteration_space.hpp index b0add7777f09..434ff588f7d9 100644 --- a/dpnp/tensor/libtensor/source/simplify_iteration_space.hpp +++ b/dpnp/libtensor/source/simplify_iteration_space.hpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/sorting/isin.cpp b/dpnp/libtensor/source/sorting/isin.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/sorting/isin.cpp rename to dpnp/libtensor/source/sorting/isin.cpp index 7c917930b237..4855441833b3 100644 --- a/dpnp/tensor/libtensor/source/sorting/isin.cpp +++ b/dpnp/libtensor/source/sorting/isin.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/isin.hpp b/dpnp/libtensor/source/sorting/isin.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/sorting/isin.hpp rename to dpnp/libtensor/source/sorting/isin.hpp index c6d19c1c274a..9b8a5397d2d5 100644 --- a/dpnp/tensor/libtensor/source/sorting/isin.hpp +++ b/dpnp/libtensor/source/sorting/isin.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/merge_argsort.cpp b/dpnp/libtensor/source/sorting/merge_argsort.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/sorting/merge_argsort.cpp rename to dpnp/libtensor/source/sorting/merge_argsort.cpp index 11dbc2956617..624f761affc2 100644 --- a/dpnp/tensor/libtensor/source/sorting/merge_argsort.cpp +++ b/dpnp/libtensor/source/sorting/merge_argsort.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/merge_argsort.hpp b/dpnp/libtensor/source/sorting/merge_argsort.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/sorting/merge_argsort.hpp rename to dpnp/libtensor/source/sorting/merge_argsort.hpp index 04d7f6fa5362..9df00338a438 100644 --- a/dpnp/tensor/libtensor/source/sorting/merge_argsort.hpp +++ b/dpnp/libtensor/source/sorting/merge_argsort.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/merge_sort.cpp b/dpnp/libtensor/source/sorting/merge_sort.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/sorting/merge_sort.cpp rename to dpnp/libtensor/source/sorting/merge_sort.cpp index 5aad634e25dd..258e677742ae 100644 --- a/dpnp/tensor/libtensor/source/sorting/merge_sort.cpp +++ b/dpnp/libtensor/source/sorting/merge_sort.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/merge_sort.hpp b/dpnp/libtensor/source/sorting/merge_sort.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/sorting/merge_sort.hpp rename to dpnp/libtensor/source/sorting/merge_sort.hpp index 81cff792c931..f1f79c17a1d9 100644 --- a/dpnp/tensor/libtensor/source/sorting/merge_sort.hpp +++ b/dpnp/libtensor/source/sorting/merge_sort.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/py_argsort_common.hpp b/dpnp/libtensor/source/sorting/py_argsort_common.hpp similarity index 98% rename from dpnp/tensor/libtensor/source/sorting/py_argsort_common.hpp rename to dpnp/libtensor/source/sorting/py_argsort_common.hpp index a3f4774b90c4..39a6fde49fb3 100644 --- a/dpnp/tensor/libtensor/source/sorting/py_argsort_common.hpp +++ b/dpnp/libtensor/source/sorting/py_argsort_common.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/py_sort_common.hpp b/dpnp/libtensor/source/sorting/py_sort_common.hpp similarity index 98% rename from dpnp/tensor/libtensor/source/sorting/py_sort_common.hpp rename to dpnp/libtensor/source/sorting/py_sort_common.hpp index a80063a85f62..d05615f4927c 100644 --- a/dpnp/tensor/libtensor/source/sorting/py_sort_common.hpp +++ b/dpnp/libtensor/source/sorting/py_sort_common.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/radix_argsort.cpp b/dpnp/libtensor/source/sorting/radix_argsort.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/sorting/radix_argsort.cpp rename to dpnp/libtensor/source/sorting/radix_argsort.cpp index f2d0de615f69..7b4b7ab94cf2 100644 --- a/dpnp/tensor/libtensor/source/sorting/radix_argsort.cpp +++ b/dpnp/libtensor/source/sorting/radix_argsort.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/radix_argsort.hpp b/dpnp/libtensor/source/sorting/radix_argsort.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/sorting/radix_argsort.hpp rename to dpnp/libtensor/source/sorting/radix_argsort.hpp index cffa452e07bf..0599ac4fe0d7 100644 --- a/dpnp/tensor/libtensor/source/sorting/radix_argsort.hpp +++ b/dpnp/libtensor/source/sorting/radix_argsort.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/radix_sort.cpp b/dpnp/libtensor/source/sorting/radix_sort.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/sorting/radix_sort.cpp rename to dpnp/libtensor/source/sorting/radix_sort.cpp index 3837ea51c15e..1dfbda6a4192 100644 --- a/dpnp/tensor/libtensor/source/sorting/radix_sort.cpp +++ b/dpnp/libtensor/source/sorting/radix_sort.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/radix_sort.hpp b/dpnp/libtensor/source/sorting/radix_sort.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/sorting/radix_sort.hpp rename to dpnp/libtensor/source/sorting/radix_sort.hpp index 29b8e4303d83..77f7f84f2fa7 100644 --- a/dpnp/tensor/libtensor/source/sorting/radix_sort.hpp +++ b/dpnp/libtensor/source/sorting/radix_sort.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/radix_sort_support.hpp b/dpnp/libtensor/source/sorting/radix_sort_support.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/sorting/radix_sort_support.hpp rename to dpnp/libtensor/source/sorting/radix_sort_support.hpp index d730e5080059..1b4d7bd7053a 100644 --- a/dpnp/tensor/libtensor/source/sorting/radix_sort_support.hpp +++ b/dpnp/libtensor/source/sorting/radix_sort_support.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/searchsorted.cpp b/dpnp/libtensor/source/sorting/searchsorted.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/sorting/searchsorted.cpp rename to dpnp/libtensor/source/sorting/searchsorted.cpp index 512df8e0342a..78d694c7ac95 100644 --- a/dpnp/tensor/libtensor/source/sorting/searchsorted.cpp +++ b/dpnp/libtensor/source/sorting/searchsorted.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/searchsorted.hpp b/dpnp/libtensor/source/sorting/searchsorted.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/sorting/searchsorted.hpp rename to dpnp/libtensor/source/sorting/searchsorted.hpp index 6dcf1ed0c6dd..4ba257df7fe3 100644 --- a/dpnp/tensor/libtensor/source/sorting/searchsorted.hpp +++ b/dpnp/libtensor/source/sorting/searchsorted.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/topk.cpp b/dpnp/libtensor/source/sorting/topk.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/sorting/topk.cpp rename to dpnp/libtensor/source/sorting/topk.cpp index 6e5239953d72..c884db7e688f 100644 --- a/dpnp/tensor/libtensor/source/sorting/topk.cpp +++ b/dpnp/libtensor/source/sorting/topk.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/sorting/topk.hpp b/dpnp/libtensor/source/sorting/topk.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/sorting/topk.hpp rename to dpnp/libtensor/source/sorting/topk.hpp index 618f35ab9b4a..76048d6c534d 100644 --- a/dpnp/tensor/libtensor/source/sorting/topk.hpp +++ b/dpnp/libtensor/source/sorting/topk.hpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/backend/extensions/statistics/bincount.cpp b/dpnp/libtensor/source/statistics/bincount.cpp similarity index 100% rename from dpnp/backend/extensions/statistics/bincount.cpp rename to dpnp/libtensor/source/statistics/bincount.cpp diff --git a/dpnp/backend/extensions/statistics/bincount.hpp b/dpnp/libtensor/source/statistics/bincount.hpp similarity index 100% rename from dpnp/backend/extensions/statistics/bincount.hpp rename to dpnp/libtensor/source/statistics/bincount.hpp diff --git a/dpnp/backend/extensions/statistics/histogram.cpp b/dpnp/libtensor/source/statistics/histogram.cpp similarity index 100% rename from dpnp/backend/extensions/statistics/histogram.cpp rename to dpnp/libtensor/source/statistics/histogram.cpp diff --git a/dpnp/backend/extensions/statistics/histogram.hpp b/dpnp/libtensor/source/statistics/histogram.hpp similarity index 100% rename from dpnp/backend/extensions/statistics/histogram.hpp rename to dpnp/libtensor/source/statistics/histogram.hpp diff --git a/dpnp/backend/extensions/statistics/histogram_common.cpp b/dpnp/libtensor/source/statistics/histogram_common.cpp similarity index 100% rename from dpnp/backend/extensions/statistics/histogram_common.cpp rename to dpnp/libtensor/source/statistics/histogram_common.cpp diff --git a/dpnp/backend/extensions/statistics/histogram_common.hpp b/dpnp/libtensor/source/statistics/histogram_common.hpp similarity index 98% rename from dpnp/backend/extensions/statistics/histogram_common.hpp rename to dpnp/libtensor/source/statistics/histogram_common.hpp index 165a93bd981b..da13bd6474ce 100644 --- a/dpnp/backend/extensions/statistics/histogram_common.hpp +++ b/dpnp/libtensor/source/statistics/histogram_common.hpp @@ -293,7 +293,8 @@ void submit_histogram(const T *in, sycl::handler &cgh) { using HistogramKernel = - dpnp::kernels::histogram::HistogramFunctor; + dpnp::tensor::kernels::histogram::HistogramFunctor; cgh.parallel_for( nd_range, diff --git a/dpnp/backend/extensions/statistics/histogramdd.cpp b/dpnp/libtensor/source/statistics/histogramdd.cpp similarity index 100% rename from dpnp/backend/extensions/statistics/histogramdd.cpp rename to dpnp/libtensor/source/statistics/histogramdd.cpp diff --git a/dpnp/backend/extensions/statistics/histogramdd.hpp b/dpnp/libtensor/source/statistics/histogramdd.hpp similarity index 100% rename from dpnp/backend/extensions/statistics/histogramdd.hpp rename to dpnp/libtensor/source/statistics/histogramdd.hpp diff --git a/dpnp/backend/extensions/statistics/sliding_dot_product1d.cpp b/dpnp/libtensor/source/statistics/sliding_dot_product1d.cpp similarity index 100% rename from dpnp/backend/extensions/statistics/sliding_dot_product1d.cpp rename to dpnp/libtensor/source/statistics/sliding_dot_product1d.cpp diff --git a/dpnp/backend/extensions/statistics/sliding_dot_product1d.hpp b/dpnp/libtensor/source/statistics/sliding_dot_product1d.hpp similarity index 100% rename from dpnp/backend/extensions/statistics/sliding_dot_product1d.hpp rename to dpnp/libtensor/source/statistics/sliding_dot_product1d.hpp diff --git a/dpnp/backend/extensions/statistics/sliding_window1d.cpp b/dpnp/libtensor/source/statistics/sliding_window1d.cpp similarity index 100% rename from dpnp/backend/extensions/statistics/sliding_window1d.cpp rename to dpnp/libtensor/source/statistics/sliding_window1d.cpp diff --git a/dpnp/backend/extensions/statistics/sliding_window1d.hpp b/dpnp/libtensor/source/statistics/sliding_window1d.hpp similarity index 98% rename from dpnp/backend/extensions/statistics/sliding_window1d.hpp rename to dpnp/libtensor/source/statistics/sliding_window1d.hpp index df0ba25919d3..a25bf156fa7e 100644 --- a/dpnp/backend/extensions/statistics/sliding_window1d.hpp +++ b/dpnp/libtensor/source/statistics/sliding_window1d.hpp @@ -434,7 +434,7 @@ void submit_sliding_window1d(const PaddedSpan &a, sycl::handler &cgh) { using SlidingWindow1dKernel = - dpnp::kernels::sliding_window1d::SlidingWindow1dFunctor< + dpnp::tensor::kernels::sliding_window1d::SlidingWindow1dFunctor< WorkPI, PaddedSpan, Span, Op, Red, Span, RegistryData, RegistryWindow>; @@ -456,7 +456,7 @@ void submit_sliding_window1d_small_kernel(const PaddedSpan &a, sycl::handler &cgh) { using SlidingWindow1dSmallKernel = - dpnp::kernels::sliding_window1d::SlidingWindow1dSmallFunctor< + dpnp::tensor::kernels::sliding_window1d::SlidingWindow1dSmallFunctor< WorkPI, PaddedSpan, Span, Op, Red, Span, RegistryData, RegistryWindow>; diff --git a/dpnp/backend/extensions/statistics/statistics_py.cpp b/dpnp/libtensor/source/statistics/statistics_py.cpp similarity index 96% rename from dpnp/backend/extensions/statistics/statistics_py.cpp rename to dpnp/libtensor/source/statistics/statistics_py.cpp index ca4cb0fa41c3..f8492d1fb070 100644 --- a/dpnp/backend/extensions/statistics/statistics_py.cpp +++ b/dpnp/libtensor/source/statistics/statistics_py.cpp @@ -26,7 +26,7 @@ // THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************** // -// This file defines functions of dpnp.backend._statistics_impl extensions +// This file defines functions of dpnp.libtensor._statistics_impl extensions // //***************************************************************************** diff --git a/dpnp/tensor/libtensor/source/tensor_accumulation.cpp b/dpnp/libtensor/source/tensor_accumulation.cpp similarity index 96% rename from dpnp/tensor/libtensor/source/tensor_accumulation.cpp rename to dpnp/libtensor/source/tensor_accumulation.cpp index b11197d51e57..a615c02540a0 100644 --- a/dpnp/tensor/libtensor/source/tensor_accumulation.cpp +++ b/dpnp/libtensor/source/tensor_accumulation.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_accumulation_impl +/// This file defines functions of dpnp.libtensor._tensor_accumulation_impl // extensions //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/tensor_ctors.cpp b/dpnp/libtensor/source/tensor_ctors.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/tensor_ctors.cpp rename to dpnp/libtensor/source/tensor_ctors.cpp index c64db812d471..35cb3584e6a4 100644 --- a/dpnp/tensor/libtensor/source/tensor_ctors.cpp +++ b/dpnp/libtensor/source/tensor_ctors.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #include @@ -45,6 +45,7 @@ #include "accumulators.hpp" #include "boolean_advanced_indexing.hpp" +#include "choose.hpp" #include "clip.hpp" #include "copy_and_cast_usm_to_usm.hpp" #include "copy_as_contig.hpp" @@ -57,6 +58,7 @@ #include "integer_advanced_indexing.hpp" #include "kernels/dpnp_tensor_types.hpp" #include "linear_sequences.hpp" +#include "putmask.hpp" #include "repeat.hpp" #include "simplify_iteration_space.hpp" #include "triul_ctor.hpp" @@ -134,6 +136,11 @@ using dpnp::tensor::py_internal::py_where; /* =========================== Clip ============================== */ using dpnp::tensor::py_internal::py_clip; +/* =========================== Choose and putmask ========================== */ + +using dpnp::tensor::py_internal::init_choose; +using dpnp::tensor::py_internal::init_putmask; + // populate dispatch tables void init_dispatch_tables(void) { @@ -494,4 +501,7 @@ PYBIND11_MODULE(_tensor_impl, m, py::mod_gil_not_used()) "Returns a tuple of events: (hev, ev)", py::arg("src"), py::arg("min"), py::arg("max"), py::arg("dst"), py::arg("sycl_queue"), py::arg("depends") = py::list()); + + init_choose(m); + init_putmask(m); } diff --git a/dpnp/tensor/libtensor/source/tensor_elementwise.cpp b/dpnp/libtensor/source/tensor_elementwise.cpp similarity index 96% rename from dpnp/tensor/libtensor/source/tensor_elementwise.cpp rename to dpnp/libtensor/source/tensor_elementwise.cpp index 8a76058106fa..67047c9ec9a3 100644 --- a/dpnp/tensor/libtensor/source/tensor_elementwise.cpp +++ b/dpnp/libtensor/source/tensor_elementwise.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl +/// This file defines functions of dpnp.libtensor._tensor_elementwise_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/tensor_linalg.cpp b/dpnp/libtensor/source/tensor_linalg.cpp similarity index 96% rename from dpnp/tensor/libtensor/source/tensor_linalg.cpp rename to dpnp/libtensor/source/tensor_linalg.cpp index eecd8246384a..7440b4b1ab5d 100644 --- a/dpnp/tensor/libtensor/source/tensor_linalg.cpp +++ b/dpnp/libtensor/source/tensor_linalg.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===----------------------------------------------------------------------===// #include "linalg_functions/dot.hpp" diff --git a/dpnp/tensor/libtensor/source/tensor_reductions.cpp b/dpnp/libtensor/source/tensor_reductions.cpp similarity index 96% rename from dpnp/tensor/libtensor/source/tensor_reductions.cpp rename to dpnp/libtensor/source/tensor_reductions.cpp index 838c283a5bea..3e0fd8abc9c5 100644 --- a/dpnp/tensor/libtensor/source/tensor_reductions.cpp +++ b/dpnp/libtensor/source/tensor_reductions.cpp @@ -29,7 +29,7 @@ //===---------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_reductions_impl +/// This file defines functions of dpnp.libtensor._tensor_reductions_impl /// extension. //===---------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/tensor_sorting.cpp b/dpnp/libtensor/source/tensor_sorting.cpp similarity index 97% rename from dpnp/tensor/libtensor/source/tensor_sorting.cpp rename to dpnp/libtensor/source/tensor_sorting.cpp index fd7de6308d04..ec6646f74c6d 100644 --- a/dpnp/tensor/libtensor/source/tensor_sorting.cpp +++ b/dpnp/libtensor/source/tensor_sorting.cpp @@ -29,7 +29,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_sorting_impl +/// This file defines functions of dpnp.libtensor._tensor_sorting_impl /// extension. //===----------------------------------------------------------------------===// diff --git a/dpnp/tensor/libtensor/source/triul_ctor.cpp b/dpnp/libtensor/source/triul_ctor.cpp similarity index 99% rename from dpnp/tensor/libtensor/source/triul_ctor.cpp rename to dpnp/libtensor/source/triul_ctor.cpp index 90127e509b75..83c232be4fd8 100644 --- a/dpnp/tensor/libtensor/source/triul_ctor.cpp +++ b/dpnp/libtensor/source/triul_ctor.cpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #include // for std::copy diff --git a/dpnp/tensor/libtensor/source/triul_ctor.hpp b/dpnp/libtensor/source/triul_ctor.hpp similarity index 97% rename from dpnp/tensor/libtensor/source/triul_ctor.hpp rename to dpnp/libtensor/source/triul_ctor.hpp index 00525725b67f..06d26481b0af 100644 --- a/dpnp/tensor/libtensor/source/triul_ctor.hpp +++ b/dpnp/libtensor/source/triul_ctor.hpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/tensor/libtensor/source/where.cpp b/dpnp/libtensor/source/where.cpp similarity index 100% rename from dpnp/tensor/libtensor/source/where.cpp rename to dpnp/libtensor/source/where.cpp diff --git a/dpnp/tensor/libtensor/source/where.hpp b/dpnp/libtensor/source/where.hpp similarity index 100% rename from dpnp/tensor/libtensor/source/where.hpp rename to dpnp/libtensor/source/where.hpp diff --git a/dpnp/backend/extensions/window/common.hpp b/dpnp/libtensor/source/window/common.hpp similarity index 100% rename from dpnp/backend/extensions/window/common.hpp rename to dpnp/libtensor/source/window/common.hpp diff --git a/dpnp/backend/extensions/window/kaiser.cpp b/dpnp/libtensor/source/window/kaiser.cpp similarity index 98% rename from dpnp/backend/extensions/window/kaiser.cpp rename to dpnp/libtensor/source/window/kaiser.cpp index 0b99dbc3947c..44560223e28c 100644 --- a/dpnp/backend/extensions/window/kaiser.cpp +++ b/dpnp/libtensor/source/window/kaiser.cpp @@ -70,7 +70,7 @@ sycl::event kaiser_impl(sycl::queue &exec_q, sycl::event kaiser_ev = exec_q.submit([&](sycl::handler &cgh) { cgh.depends_on(depends); - using KaiserKernel = dpnp::kernels::kaiser::KaiserFunctor; + using KaiserKernel = dpnp::tensor::kernels::kaiser::KaiserFunctor; cgh.parallel_for(sycl::range<1>(nelems), KaiserKernel(res, nelems, beta)); }); diff --git a/dpnp/backend/extensions/window/kaiser.hpp b/dpnp/libtensor/source/window/kaiser.hpp similarity index 100% rename from dpnp/backend/extensions/window/kaiser.hpp rename to dpnp/libtensor/source/window/kaiser.hpp diff --git a/dpnp/backend/extensions/window/window_py.cpp b/dpnp/libtensor/source/window/window_py.cpp similarity index 92% rename from dpnp/backend/extensions/window/window_py.cpp rename to dpnp/libtensor/source/window/window_py.cpp index d052f3156c26..64b6ff9f38ab 100644 --- a/dpnp/backend/extensions/window/window_py.cpp +++ b/dpnp/libtensor/source/window/window_py.cpp @@ -26,7 +26,7 @@ // THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************** // -// This file defines functions of dpnp.backend._window_impl extensions +// This file defines functions of dpnp.libtensor._window_impl extensions // //***************************************************************************** @@ -53,20 +53,20 @@ using window_ns::window_fn_ptr_t; namespace dpnp_td_ns = dpnp::tensor::type_dispatch; template -using BartlettFactory = - window_ns::Factory; +using BartlettFactory = window_ns:: + Factory; template -using BlackmanFactory = - window_ns::Factory; +using BlackmanFactory = window_ns:: + Factory; template using HammingFactory = - window_ns::Factory; + window_ns::Factory; template using HanningFactory = - window_ns::Factory; + window_ns::Factory; static window_fn_ptr_t bartlett_dispatch_vector[dpnp_td_ns::num_types]; static window_fn_ptr_t blackman_dispatch_vector[dpnp_td_ns::num_types]; diff --git a/dpnp/tensor/libtensor/source/zeros_ctor.cpp b/dpnp/libtensor/source/zeros_ctor.cpp similarity index 98% rename from dpnp/tensor/libtensor/source/zeros_ctor.cpp rename to dpnp/libtensor/source/zeros_ctor.cpp index 3d6f99c4907e..faae13b2bd52 100644 --- a/dpnp/tensor/libtensor/source/zeros_ctor.cpp +++ b/dpnp/libtensor/source/zeros_ctor.cpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #include diff --git a/dpnp/tensor/libtensor/source/zeros_ctor.hpp b/dpnp/libtensor/source/zeros_ctor.hpp similarity index 96% rename from dpnp/tensor/libtensor/source/zeros_ctor.hpp rename to dpnp/libtensor/source/zeros_ctor.hpp index 67f421e124e7..1c03a102fc2b 100644 --- a/dpnp/tensor/libtensor/source/zeros_ctor.hpp +++ b/dpnp/libtensor/source/zeros_ctor.hpp @@ -29,7 +29,7 @@ //===--------------------------------------------------------------------===// /// /// \file -/// This file defines functions of dpnp.tensor._tensor_impl extensions +/// This file defines functions of dpnp.libtensor._tensor_impl extensions //===--------------------------------------------------------------------===// #pragma once diff --git a/dpnp/linalg/dpnp_iface_linalg.py b/dpnp/linalg/dpnp_iface_linalg.py index 8ed355278cbe..3f300a6937d4 100644 --- a/dpnp/linalg/dpnp_iface_linalg.py +++ b/dpnp/linalg/dpnp_iface_linalg.py @@ -47,7 +47,7 @@ import numpy import dpnp -from dpnp.backend.extensions.lapack._lapack_impl import LinAlgError +from dpnp.libtensor._lapack_impl import LinAlgError from dpnp.tensor._numpy_helper import normalize_axis_tuple from .dpnp_utils_linalg import ( diff --git a/dpnp/linalg/dpnp_utils_linalg.py b/dpnp/linalg/dpnp_utils_linalg.py index 954fcfac4b9b..d5be77b3b907 100644 --- a/dpnp/linalg/dpnp_utils_linalg.py +++ b/dpnp/linalg/dpnp_utils_linalg.py @@ -47,10 +47,10 @@ from numpy import prod import dpnp -import dpnp.backend.extensions.lapack._lapack_impl as li +import dpnp.libtensor._lapack_impl as li # pylint: disable=no-name-in-module -import dpnp.tensor._tensor_impl as ti +import dpnp.libtensor._tensor_impl as ti from dpnp.dpnp_utils import get_usm_allocations from dpnp.tensor._numpy_helper import normalize_axis_index diff --git a/dpnp/scipy/linalg/_utils.py b/dpnp/scipy/linalg/_utils.py index 6b0deb377211..00dd80672431 100644 --- a/dpnp/scipy/linalg/_utils.py +++ b/dpnp/scipy/linalg/_utils.py @@ -46,10 +46,10 @@ import dpctl.utils as dpu import dpnp -import dpnp.backend.extensions.lapack._lapack_impl as li +import dpnp.libtensor._lapack_impl as li # pylint: disable=no-name-in-module -import dpnp.tensor._tensor_impl as ti +import dpnp.libtensor._tensor_impl as ti from dpnp.dpnp_utils import get_usm_allocations from dpnp.linalg.dpnp_utils_linalg import _common_type, _real_type diff --git a/dpnp/scipy/sparse/_csr.py b/dpnp/scipy/sparse/_csr.py index ee3296231857..ff9a1d182e91 100644 --- a/dpnp/scipy/sparse/_csr.py +++ b/dpnp/scipy/sparse/_csr.py @@ -61,7 +61,7 @@ import dpnp as _dpnp # pylint: disable-next=no-name-in-module -import dpnp.backend.extensions.sparse._sparse_impl as _si +import dpnp.libtensor._sparse_impl as _si import dpnp.tensor as _dpt from dpnp.exceptions import ExecutionPlacementError @@ -75,7 +75,7 @@ # pylint: disable=duplicate-code # Value dtypes the oneMKL sparse::gemv dispatch table registers -# (see dpnp/backend/extensions/sparse/types_matrix.hpp). ``dot`` raises +# (see dpnp/libtensor/extensions/sparse/types_matrix.hpp). ``dot`` raises # for anything outside this set. _SPMV_VALUE_DTYPES = frozenset("fdFD") # Index dtypes oneMKL accepts (int32, int64). Matches the second diff --git a/dpnp/scipy/sparse/linalg/_iterative.py b/dpnp/scipy/sparse/linalg/_iterative.py index 8220fdfc2459..25d54988a4da 100644 --- a/dpnp/scipy/sparse/linalg/_iterative.py +++ b/dpnp/scipy/sparse/linalg/_iterative.py @@ -80,7 +80,7 @@ # pylint cannot introspect the compiled extension. # pylint: disable-next=no-name-in-module -import dpnp.backend.extensions.blas._blas_impl as bi +import dpnp.libtensor._blas_impl as bi import dpnp.tensor as dpt from dpnp.exceptions import ExecutionPlacementError diff --git a/dpnp/scipy/special/_erf.py b/dpnp/scipy/special/_erf.py index 49dfaa88a453..2726f3800bf9 100644 --- a/dpnp/scipy/special/_erf.py +++ b/dpnp/scipy/special/_erf.py @@ -41,7 +41,7 @@ # pylint: disable=no-name-in-module # pylint: disable=protected-access -import dpnp.backend.extensions.ufunc._ufunc_impl as ufi +import dpnp.libtensor._tensor_elementwise_impl as ti from dpnp.dpnp_algo.dpnp_elementwise_common import DPNPUnaryFunc @@ -124,8 +124,8 @@ def __call__(self, x, /, out=None): # pylint: disable=arguments-differ erf = DPNPErf( "erf", - ufi._erf_result_type, - ufi._erf, + ti._erf_result_type, + ti._erf, _ERF_DOCSTRING, mkl_fn_to_call="_mkl_erf_to_call", mkl_impl_fn="_erf", @@ -173,8 +173,8 @@ def __call__(self, x, /, out=None): # pylint: disable=arguments-differ erfc = DPNPErf( "erfc", - ufi._erf_result_type, - ufi._erfc, + ti._erf_result_type, + ti._erfc, _ERFC_DOCSTRING, mkl_fn_to_call="_mkl_erf_to_call", mkl_impl_fn="_erfc", @@ -222,8 +222,8 @@ def __call__(self, x, /, out=None): # pylint: disable=arguments-differ erfcx = DPNPErf( "erfcx", - ufi._erf_result_type, - ufi._erfcx, + ti._erf_result_type, + ti._erfcx, _ERFCX_DOCSTRING, mkl_fn_to_call="_mkl_erf_to_call", mkl_impl_fn="_erfcx", @@ -278,8 +278,8 @@ def __call__(self, x, /, out=None): # pylint: disable=arguments-differ erfinv = DPNPErf( "erfinv", - ufi._erf_result_type, - ufi._erfinv, + ti._erf_result_type, + ti._erfinv, _ERFINV_DOCSTRING, mkl_fn_to_call="_mkl_erf_to_call", mkl_impl_fn="_erfinv", @@ -337,8 +337,8 @@ def __call__(self, x, /, out=None): # pylint: disable=arguments-differ erfcinv = DPNPErf( "erfcinv", - ufi._erf_result_type, - ufi._erfcinv, + ti._erf_result_type, + ti._erfcinv, _ERFCINV_DOCSTRING, mkl_fn_to_call="_mkl_erf_to_call", mkl_impl_fn="_erfcinv", diff --git a/dpnp/tensor/CMakeLists.txt b/dpnp/tensor/CMakeLists.txt index 4ec0bada6104..16b849f56900 100644 --- a/dpnp/tensor/CMakeLists.txt +++ b/dpnp/tensor/CMakeLists.txt @@ -29,46 +29,7 @@ find_package(Python COMPONENTS Development.Module) -# Tensor-specific flags - -# dpctl doesn't add -fsycl globally -# only to pybind11 module sources via add_sycl_to_target() -string(REPLACE "-fsycl " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - -# Use LLD linker (dpctl sets this at root level) -if(UNIX) - add_link_options("-fuse-ld=lld") -endif() - -# Remove global coverage flags for tensor -# use link-time only approach like dpctl -if(DPNP_GENERATE_COVERAGE) - string(REPLACE "-fprofile-instr-generate " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REPLACE "-fcoverage-mapping " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REPLACE "-fno-sycl-use-footer " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -endif() - -# Tensor-specific debug flags -# Disable device code debug info for Debug and Coverage builds to speed up linking -if( - CMAKE_BUILD_TYPE STREQUAL "Debug" - OR CMAKE_BUILD_TYPE STREQUAL "DEBUG" - OR CMAKE_BUILD_TYPE STREQUAL "Coverage" -) - if(WIN32) - add_compile_options(-Xsycl-target-frontend=spir64 "-g0") - elseif(UNIX) - add_compile_options(-Xsycl-target-frontend=spir64 "-g0") - if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "DEBUG") - string(REPLACE "-g1" "-g" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") - string(REPLACE "-g1" "-g" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - endif() - endif() -endif() - -# Match dpctl warning flags -# Suppress unused parameter warnings -add_compile_options(-Wno-unused-parameter) +include(${CMAKE_SOURCE_DIR}/dpnp/cmake/tensor_build_flags.cmake) file(GLOB _cython_sources *.pyx) foreach(_cy_file ${_cython_sources}) @@ -79,316 +40,3 @@ foreach(_cy_file ${_cython_sources}) PRIVATE ${CMAKE_SOURCE_DIR}/dpnp/include ${CMAKE_CURRENT_SOURCE_DIR}/include ) endforeach() - -# TODO: reuse this library for dpnp ufunc extension build -set(_static_lib_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/simplify_iteration_space.cpp -) -set(_tensor_impl_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/tensor_ctors.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/accumulators.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_and_cast_usm_to_usm.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_as_contig.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_reshape.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_for_roll.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/integer_advanced_indexing.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/boolean_advanced_indexing.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/eye_ctor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/full_ctor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/zeros_ctor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/triul_ctor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/where.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/device_support_queries.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/repeat.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/clip.cpp -) -set(_accumulator_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/accumulators/accumulators_common.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/accumulators/cumulative_logsumexp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/accumulators/cumulative_prod.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/accumulators/cumulative_sum.cpp -) -set(_elementwise_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/elementwise_common.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/abs.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/acos.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/acosh.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/add.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/angle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/asin.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/asinh.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/atan.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/atan2.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/atanh.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/bitwise_and.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/bitwise_invert.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/bitwise_left_shift.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/bitwise_or.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/bitwise_right_shift.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/bitwise_xor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/cbrt.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/ceil.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/conj.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/copysign.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/cos.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/cosh.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/equal.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/exp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/exp2.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/expm1.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/floor_divide.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/floor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/greater_equal.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/greater.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/hypot.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/imag.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/isfinite.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/isinf.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/isnan.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/less_equal.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/less.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/log.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/log1p.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/log2.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/log10.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/logaddexp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/logical_and.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/logical_not.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/logical_or.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/logical_xor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/maximum.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/minimum.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/multiply.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/negative.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/nextafter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/not_equal.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/positive.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/pow.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/proj.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/real.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/reciprocal.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/remainder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/round.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/rsqrt.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/sign.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/signbit.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/sin.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/sinh.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/sqrt.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/square.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/subtract.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/tan.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/tanh.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/true_divide.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/trunc.cpp -) -set(_reduction_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/reduction_common.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/all.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/any.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/argmax.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/argmin.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/logsumexp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/max.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/min.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/prod.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/reduce_hypot.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/reductions/sum.cpp -) -set(_sorting_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/sorting/isin.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/sorting/merge_sort.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/sorting/merge_argsort.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/sorting/radix_sort.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/sorting/radix_argsort.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/sorting/searchsorted.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/sorting/topk.cpp -) -set(_linalg_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/elementwise_functions/elementwise_functions_type_utils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linalg_functions/dot.cpp -) -set(_tensor_accumulation_impl_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/tensor_accumulation.cpp - ${_accumulator_sources} -) -set(_tensor_elementwise_impl_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/tensor_elementwise.cpp - ${_elementwise_sources} -) -set(_tensor_reductions_impl_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/tensor_reductions.cpp - ${_reduction_sources} -) -set(_tensor_sorting_impl_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/tensor_sorting.cpp - ${_sorting_sources} -) -set(_tensor_linalg_impl_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/tensor_linalg.cpp - ${_linalg_sources} -) - -set(_static_lib_trgt simplify_iteration_space) - -add_library(${_static_lib_trgt} STATIC ${_static_lib_sources}) -target_include_directories( - ${_static_lib_trgt} - PRIVATE - # ${Python_INCLUDE_DIRS} - # ${Dpctl_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/include -) -target_link_libraries(${_static_lib_trgt} PRIVATE pybind11::headers Python::Module) -set_target_properties(${_static_lib_trgt} PROPERTIES POSITION_INDEPENDENT_CODE ON) - -set(_py_trgts) - -set(python_module_name _tensor_impl) -pybind11_add_module(${python_module_name} MODULE ${_tensor_impl_sources}) -add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_impl_sources}) -target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) -list(APPEND _py_trgts ${python_module_name}) - -set(python_module_name _tensor_accumulation_impl) -pybind11_add_module(${python_module_name} MODULE ${_tensor_accumulation_impl_sources}) -add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_accumulation_impl_sources}) -target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) -list(APPEND _py_trgts ${python_module_name}) - -set(python_module_name _tensor_elementwise_impl) -pybind11_add_module(${python_module_name} MODULE ${_tensor_elementwise_impl_sources}) -add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_elementwise_impl_sources}) -target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) -list(APPEND _py_trgts ${python_module_name}) - -set(python_module_name _tensor_reductions_impl) -pybind11_add_module(${python_module_name} MODULE ${_tensor_reductions_impl_sources}) -add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_reductions_impl_sources}) -target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) -list(APPEND _py_trgts ${python_module_name}) - -set(python_module_name _tensor_sorting_impl) -pybind11_add_module(${python_module_name} MODULE ${_tensor_sorting_impl_sources}) -add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_sorting_impl_sources}) -target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) -list(APPEND _py_trgts ${python_module_name}) - -set(python_module_name _tensor_linalg_impl) -pybind11_add_module(${python_module_name} MODULE ${_tensor_linalg_impl_sources}) -add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_tensor_linalg_impl_sources}) -target_link_libraries(${python_module_name} PRIVATE ${_static_lib_trgt}) -list(APPEND _py_trgts ${python_module_name}) - -set(_clang_prefix "") -if(WIN32) - set(_clang_prefix "/clang:") -endif() - -set(_no_fast_math_sources - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/copy_and_cast_usm_to_usm.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/full_ctor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/linear_sequences.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/clip.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/where.cpp -) -list( - APPEND _no_fast_math_sources - ${_elementwise_sources} - ${_reduction_sources} - ${_sorting_sources} - ${_linalg_sources} - ${_accumulator_sources} -) - -foreach(_src_fn ${_no_fast_math_sources}) - get_source_file_property(_cmpl_options_prop ${_src_fn} COMPILE_OPTIONS) - set(_combined_options_prop ${_cmpl_options_prop} "${_clang_prefix}-fno-fast-math") - set_source_files_properties( - ${_src_fn} - PROPERTIES COMPILE_OPTIONS "${_combined_options_prop}" - ) -endforeach() - -set(_compiler_definitions "") - -foreach(_src_fn ${_elementwise_sources}) - get_source_file_property(_cmpl_options_defs ${_src_fn} COMPILE_DEFINITIONS) - if(${_cmpl_options_defs}) - set(_combined_options_defs ${_cmpl_options_defs} "${_compiler_definitions}") - else() - set(_combined_options_defs "${_compiler_definitions}") - endif() - set_source_files_properties( - ${_src_fn} - PROPERTIES COMPILE_DEFINITIONS "${_combined_options_defs}" - ) -endforeach() - -set(_linker_options "LINKER:${DPNP_LDFLAGS}") -foreach(python_module_name ${_py_trgts}) - target_compile_options( - ${python_module_name} - PRIVATE -fno-sycl-id-queries-fit-in-int - ) - target_link_options( - ${python_module_name} - PRIVATE -fsycl-device-code-split=per_kernel -fno-sycl-id-queries-fit-in-int - ) - if(DPNP_TENSOR_OFFLOAD_COMPRESS) - target_link_options(${python_module_name} PRIVATE --offload-compress) - endif() - - target_include_directories( - ${python_module_name} - PRIVATE - ${CMAKE_SOURCE_DIR}/dpnp/include - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/include - ${CMAKE_CURRENT_SOURCE_DIR}/libtensor/source/ - ) - - target_include_directories( - ${python_module_name} - SYSTEM - PRIVATE - ${SYCL_INCLUDE_DIR} - ${Dpctl_INCLUDE_DIR} - ${CMAKE_BINARY_DIR} # For generated Cython headers - ) - target_link_options(${python_module_name} PRIVATE ${_linker_options}) - if(DPNP_GENERATE_COVERAGE) - if(DPNP_TENSOR_GENERATE_COVERAGE_FOR_PYBIND11_EXTENSIONS) - target_compile_options( - ${python_module_name} - PRIVATE -fprofile-instr-generate -fcoverage-mapping - ) - endif() - target_link_options( - ${python_module_name} - PRIVATE -fprofile-instr-generate -fcoverage-mapping - ) - endif() - if(_dpnp_sycl_targets) - # make fat binary - target_compile_options( - ${python_module_name} - PRIVATE ${_dpnp_sycl_target_compile_options} - ) - target_link_options( - ${python_module_name} - PRIVATE ${_dpnp_sycl_target_link_options} - ) - endif() - # Ensure Cython modules build first so _usmarray.h exists - add_dependencies(${python_module_name} _usmarray) - if(DPNP_WITH_REDIST) - set_target_properties( - ${python_module_name} - PROPERTIES INSTALL_RPATH "$ORIGIN/../../../.." - ) - endif() - install(TARGETS ${python_module_name} DESTINATION "dpnp/tensor") -endforeach() diff --git a/dpnp/tensor/_accumulation.py b/dpnp/tensor/_accumulation.py index 4def71efc587..d5a56521f495 100644 --- a/dpnp/tensor/_accumulation.py +++ b/dpnp/tensor/_accumulation.py @@ -28,9 +28,9 @@ from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_accumulation_impl as tai +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_accumulation_impl as tai -import dpnp.tensor._tensor_impl as ti from ._numpy_helper import normalize_axis_index from ._type_utils import ( diff --git a/dpnp/tensor/_array_api.py b/dpnp/tensor/_array_api.py index e304e1ee5074..b3650883a98e 100644 --- a/dpnp/tensor/_array_api.py +++ b/dpnp/tensor/_array_api.py @@ -29,8 +29,7 @@ import dpctl import dpnp.tensor as dpt - -from ._tensor_impl import ( +from dpnp.libtensor._tensor_impl import ( default_device_complex_type, default_device_fp_type, default_device_index_type, diff --git a/dpnp/tensor/_clip.py b/dpnp/tensor/_clip.py index 44434fc0bb0c..0e9c77f8103c 100644 --- a/dpnp/tensor/_clip.py +++ b/dpnp/tensor/_clip.py @@ -28,9 +28,9 @@ from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_elementwise_impl as tei +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_elementwise_impl as tei -import dpnp.tensor._tensor_impl as ti from ._copy_utils import ( _empty_like_orderK, diff --git a/dpnp/tensor/_copy_utils.py b/dpnp/tensor/_copy_utils.py index 48f53c308976..e54147366abe 100644 --- a/dpnp/tensor/_copy_utils.py +++ b/dpnp/tensor/_copy_utils.py @@ -35,8 +35,8 @@ import numpy as np from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from ._data_types import _get_dtype from ._device import normalize_queue_device diff --git a/dpnp/tensor/_ctors.py b/dpnp/tensor/_ctors.py index 28ff46267aa4..1aeef2408986 100644 --- a/dpnp/tensor/_ctors.py +++ b/dpnp/tensor/_ctors.py @@ -34,8 +34,8 @@ import numpy as np from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from ._copy_utils import ( _empty_like_orderK, diff --git a/dpnp/tensor/_data_types.py b/dpnp/tensor/_data_types.py index 1f8aba44efdc..877fc8aee0a2 100644 --- a/dpnp/tensor/_data_types.py +++ b/dpnp/tensor/_data_types.py @@ -33,14 +33,18 @@ from numpy import integer as np_integer from numpy import issubdtype as np_issubdtype -from ._tensor_impl import ( +from dpnp.libtensor._tensor_impl import ( default_device_bool_type as ti_default_device_bool_type, ) -from ._tensor_impl import ( +from dpnp.libtensor._tensor_impl import ( default_device_complex_type as ti_default_device_complex_type, ) -from ._tensor_impl import default_device_fp_type as ti_default_device_fp_type -from ._tensor_impl import default_device_int_type as ti_default_device_int_type +from dpnp.libtensor._tensor_impl import ( + default_device_fp_type as ti_default_device_fp_type, +) +from dpnp.libtensor._tensor_impl import ( + default_device_int_type as ti_default_device_int_type, +) bool = dtype("bool") int8 = dtype("int8") diff --git a/dpnp/tensor/_elementwise_common.py b/dpnp/tensor/_elementwise_common.py index fa3fe871aed2..844f120269de 100644 --- a/dpnp/tensor/_elementwise_common.py +++ b/dpnp/tensor/_elementwise_common.py @@ -28,8 +28,8 @@ from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from ._copy_utils import _empty_like_orderK, _empty_like_pair_orderK from ._manipulation_functions import _broadcast_shape_impl diff --git a/dpnp/tensor/_elementwise_funcs.py b/dpnp/tensor/_elementwise_funcs.py index 4040f33bf38e..116519e83df0 100644 --- a/dpnp/tensor/_elementwise_funcs.py +++ b/dpnp/tensor/_elementwise_funcs.py @@ -26,7 +26,7 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** -import dpnp.tensor._tensor_elementwise_impl as ti +import dpnp.libtensor._tensor_elementwise_impl as ti from ._elementwise_common import BinaryElementwiseFunc, UnaryElementwiseFunc from ._type_utils import ( diff --git a/dpnp/tensor/_indexing_functions.py b/dpnp/tensor/_indexing_functions.py index e6fbd96267ea..dc81ba54ce68 100644 --- a/dpnp/tensor/_indexing_functions.py +++ b/dpnp/tensor/_indexing_functions.py @@ -30,8 +30,8 @@ from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from ._copy_utils import ( _extract_impl, diff --git a/dpnp/tensor/_linear_algebra_functions.py b/dpnp/tensor/_linear_algebra_functions.py index c349784fdd83..84723d27f8eb 100644 --- a/dpnp/tensor/_linear_algebra_functions.py +++ b/dpnp/tensor/_linear_algebra_functions.py @@ -30,10 +30,10 @@ from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_elementwise_impl as tei +import dpnp.libtensor._tensor_impl as ti +import dpnp.libtensor._tensor_linalg_impl as tli import dpnp.tensor as dpt -import dpnp.tensor._tensor_elementwise_impl as tei -import dpnp.tensor._tensor_impl as ti -import dpnp.tensor._tensor_linalg_impl as tli from ._copy_utils import _empty_like_orderK, _empty_like_pair_orderK from ._manipulation_functions import _broadcast_shape_impl diff --git a/dpnp/tensor/_manipulation_functions.py b/dpnp/tensor/_manipulation_functions.py index 7e3ffa05c57a..13ad4dfff9aa 100644 --- a/dpnp/tensor/_manipulation_functions.py +++ b/dpnp/tensor/_manipulation_functions.py @@ -32,8 +32,8 @@ import numpy as np from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from ._numpy_helper import normalize_axis_index, normalize_axis_tuple from ._type_utils import _supported_dtype, _to_device_supported_dtype diff --git a/dpnp/tensor/_print.py b/dpnp/tensor/_print.py index b5cc3d08931c..d5bb5dc02cef 100644 --- a/dpnp/tensor/_print.py +++ b/dpnp/tensor/_print.py @@ -35,8 +35,8 @@ import numpy as np from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti __doc__ = "Print functions for :class:`dpnp.tensor.usm_ndarray`." diff --git a/dpnp/tensor/_reduction.py b/dpnp/tensor/_reduction.py index 782fc2b0b442..ad5064fa8fe5 100644 --- a/dpnp/tensor/_reduction.py +++ b/dpnp/tensor/_reduction.py @@ -28,9 +28,9 @@ from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_impl as ti +import dpnp.libtensor._tensor_reductions_impl as tri import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti -import dpnp.tensor._tensor_reductions_impl as tri from ._numpy_helper import normalize_axis_tuple from ._type_utils import ( diff --git a/dpnp/tensor/_reshape.py b/dpnp/tensor/_reshape.py index 441a59c80b3e..9885cce3721a 100644 --- a/dpnp/tensor/_reshape.py +++ b/dpnp/tensor/_reshape.py @@ -32,8 +32,7 @@ from dpctl.utils import SequentialOrderManager import dpnp.tensor as dpt - -from ._tensor_impl import ( +from dpnp.libtensor._tensor_impl import ( _copy_usm_ndarray_for_reshape, _ravel_multi_index, _unravel_index, diff --git a/dpnp/tensor/_search_functions.py b/dpnp/tensor/_search_functions.py index 5c15575017dd..60c81ed59803 100644 --- a/dpnp/tensor/_search_functions.py +++ b/dpnp/tensor/_search_functions.py @@ -28,8 +28,8 @@ from dpctl.utils import SequentialOrderManager +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from ._copy_utils import _empty_like_orderK, _empty_like_triple_orderK from ._manipulation_functions import _broadcast_shape_impl diff --git a/dpnp/tensor/_searchsorted.py b/dpnp/tensor/_searchsorted.py index 5776e908ec6d..39491b02f1e8 100644 --- a/dpnp/tensor/_searchsorted.py +++ b/dpnp/tensor/_searchsorted.py @@ -31,6 +31,17 @@ import dpctl.utils as du import dpnp.tensor as dpt +from dpnp.libtensor._tensor_impl import ( + _copy_usm_ndarray_into_usm_ndarray as ti_copy, +) +from dpnp.libtensor._tensor_impl import _take as ti_take +from dpnp.libtensor._tensor_impl import ( + default_device_index_type as ti_default_device_index_type, +) +from dpnp.libtensor._tensor_sorting_impl import ( + _searchsorted_left, + _searchsorted_right, +) from ._compute_follows_data import ( ExecutionPlacementError, @@ -40,12 +51,6 @@ from ._copy_utils import _empty_like_orderK from ._ctors import empty_like from ._scalar_utils import _get_dtype, _get_queue_usm_type, _validate_dtype -from ._tensor_impl import _copy_usm_ndarray_into_usm_ndarray as ti_copy -from ._tensor_impl import _take as ti_take -from ._tensor_impl import ( - default_device_index_type as ti_default_device_index_type, -) -from ._tensor_sorting_impl import _searchsorted_left, _searchsorted_right from ._type_utils import ( _resolve_weak_types_all_py_ints, _to_device_supported_dtype, diff --git a/dpnp/tensor/_set_functions.py b/dpnp/tensor/_set_functions.py index e2e5851f131a..0c51b25fc999 100644 --- a/dpnp/tensor/_set_functions.py +++ b/dpnp/tensor/_set_functions.py @@ -31,16 +31,8 @@ import dpctl.utils as du import dpnp.tensor as dpt - -from ._copy_utils import _empty_like_orderK -from ._scalar_utils import ( - _get_dtype, - _get_queue_usm_type, - _get_shape, - _validate_dtype, -) -from ._tensor_elementwise_impl import _not_equal, _subtract -from ._tensor_impl import ( +from dpnp.libtensor._tensor_elementwise_impl import _not_equal, _subtract +from dpnp.libtensor._tensor_impl import ( _copy_usm_ndarray_into_usm_ndarray, _extract, _full_usm_ndarray, @@ -49,12 +41,20 @@ default_device_index_type, mask_positions, ) -from ._tensor_sorting_impl import ( +from dpnp.libtensor._tensor_sorting_impl import ( _argsort_ascending, _isin, _searchsorted_left, _sort_ascending, ) + +from ._copy_utils import _empty_like_orderK +from ._scalar_utils import ( + _get_dtype, + _get_queue_usm_type, + _get_shape, + _validate_dtype, +) from ._type_utils import ( _resolve_weak_types_all_py_ints, _to_device_supported_dtype, diff --git a/dpnp/tensor/_sorting.py b/dpnp/tensor/_sorting.py index 131bb358a2bf..b3aca251b048 100644 --- a/dpnp/tensor/_sorting.py +++ b/dpnp/tensor/_sorting.py @@ -31,11 +31,9 @@ import dpctl.utils as du +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti - -from ._numpy_helper import normalize_axis_index -from ._tensor_sorting_impl import ( +from dpnp.libtensor._tensor_sorting_impl import ( _argsort_ascending, _argsort_descending, _radix_argsort_ascending, @@ -48,6 +46,8 @@ _topk, ) +from ._numpy_helper import normalize_axis_index + __all__ = ["sort", "argsort", "top_k"] diff --git a/dpnp/tensor/_statistical_functions.py b/dpnp/tensor/_statistical_functions.py index a2015488aff2..078eab6be8bb 100644 --- a/dpnp/tensor/_statistical_functions.py +++ b/dpnp/tensor/_statistical_functions.py @@ -27,10 +27,10 @@ import dpctl.utils as du +import dpnp.libtensor._tensor_elementwise_impl as tei +import dpnp.libtensor._tensor_impl as ti +import dpnp.libtensor._tensor_reductions_impl as tri import dpnp.tensor as dpt -import dpnp.tensor._tensor_elementwise_impl as tei -import dpnp.tensor._tensor_impl as ti -import dpnp.tensor._tensor_reductions_impl as tri from ._numpy_helper import normalize_axis_tuple diff --git a/dpnp/tensor/_type_utils.py b/dpnp/tensor/_type_utils.py index b03ca1e1c79d..cbba43aa09c5 100644 --- a/dpnp/tensor/_type_utils.py +++ b/dpnp/tensor/_type_utils.py @@ -30,8 +30,8 @@ import numpy as np +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti def _all_data_types(_fp16, _fp64): diff --git a/dpnp/tensor/_usmarray.pyx b/dpnp/tensor/_usmarray.pyx index 2169c759abb4..2bef0b1cd730 100644 --- a/dpnp/tensor/_usmarray.pyx +++ b/dpnp/tensor/_usmarray.pyx @@ -54,9 +54,10 @@ from . cimport _dlpack as c_dlpack from enum import IntEnum +from dpnp.libtensor._tensor_impl import default_device_fp_type + from . import _flags from ._dlpack import get_build_dlpack_version -from ._tensor_impl import default_device_fp_type from ._slicing cimport _is_buffer diff --git a/dpnp/tensor/_utility_functions.py b/dpnp/tensor/_utility_functions.py index 53590c7da0d1..0dc2e33d6707 100644 --- a/dpnp/tensor/_utility_functions.py +++ b/dpnp/tensor/_utility_functions.py @@ -31,9 +31,9 @@ import dpctl.utils as du +import dpnp.libtensor._tensor_impl as ti +import dpnp.libtensor._tensor_reductions_impl as tri import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti -import dpnp.tensor._tensor_reductions_impl as tri from ._numpy_helper import normalize_axis_index, normalize_axis_tuple from ._scalar_utils import ( diff --git a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp b/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp deleted file mode 100644 index a3924c8d28a6..000000000000 --- a/dpnp/tensor/libtensor/source/elementwise_functions/elementwise_functions.hpp +++ /dev/null @@ -1,806 +0,0 @@ -//***************************************************************************** -// Copyright (c) 2026, Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// - Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// - Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -//***************************************************************************** -// -//===---------------------------------------------------------------------===// -/// -/// \file -/// This file defines functions of dpnp.tensor._tensor_elementwise_impl -/// extension, specifically functions for elementwise operations. -//===---------------------------------------------------------------------===// - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include - -#include "dpnp4pybind11.hpp" -#include -#include - -#include "elementwise_functions_type_utils.hpp" -#include "kernels/alignment.hpp" -#include "kernels/dpnp_tensor_types.hpp" -#include "simplify_iteration_space.hpp" -#include "utils/memory_overlap.hpp" -#include "utils/offset_utils.hpp" -#include "utils/output_validation.hpp" -#include "utils/sycl_alloc_utils.hpp" -#include "utils/type_dispatch.hpp" - -static_assert(std::is_same_v); - -namespace dpnp::tensor::py_internal -{ - -namespace py = pybind11; -namespace td_ns = dpnp::tensor::type_dispatch; - -using dpnp::tensor::kernels::alignment_utils::is_aligned; -using dpnp::tensor::kernels::alignment_utils::required_alignment; - -/*! @brief Template implementing Python API for unary elementwise functions */ -template -std::pair - py_unary_ufunc(const dpnp::tensor::usm_ndarray &src, - const dpnp::tensor::usm_ndarray &dst, - sycl::queue &q, - const std::vector &depends, - // - const output_typesT &output_type_vec, - const contig_dispatchT &contig_dispatch_vector, - const strided_dispatchT &strided_dispatch_vector) -{ - int src_typenum = src.get_typenum(); - int dst_typenum = dst.get_typenum(); - - const auto &array_types = td_ns::usm_ndarray_types(); - int src_typeid = array_types.typenum_to_lookup_id(src_typenum); - int dst_typeid = array_types.typenum_to_lookup_id(dst_typenum); - - int func_output_typeid = output_type_vec[src_typeid]; - - // check that types are supported - if (dst_typeid != func_output_typeid) { - throw py::value_error( - "Destination array has unexpected elemental data type."); - } - - // check that queues are compatible - if (!dpnp::utils::queues_are_compatible(q, {src, dst})) { - throw py::value_error( - "Execution queue is not compatible with allocation queues"); - } - - dpnp::tensor::validation::CheckWritable::throw_if_not_writable(dst); - - // check that dimensions are the same - int src_nd = src.get_ndim(); - if (src_nd != dst.get_ndim()) { - throw py::value_error("Array dimensions are not the same."); - } - - // check that shapes are the same - const py::ssize_t *src_shape = src.get_shape_raw(); - const py::ssize_t *dst_shape = dst.get_shape_raw(); - bool shapes_equal(true); - std::size_t src_nelems(1); - - for (int i = 0; i < src_nd; ++i) { - src_nelems *= static_cast(src_shape[i]); - shapes_equal = shapes_equal && (src_shape[i] == dst_shape[i]); - } - if (!shapes_equal) { - throw py::value_error("Array shapes are not the same."); - } - - // if nelems is zero, return - if (src_nelems == 0) { - return std::make_pair(sycl::event(), sycl::event()); - } - - dpnp::tensor::validation::AmpleMemory::throw_if_not_ample(dst, src_nelems); - - // check memory overlap - auto const &overlap = dpnp::tensor::overlap::MemoryOverlap(); - auto const &same_logical_tensors = - dpnp::tensor::overlap::SameLogicalTensors(); - if (overlap(src, dst) && !same_logical_tensors(src, dst)) { - throw py::value_error("Arrays index overlapping segments of memory"); - } - - const char *src_data = src.get_data(); - char *dst_data = dst.get_data(); - - // handle contiguous inputs - bool is_src_c_contig = src.is_c_contiguous(); - bool is_src_f_contig = src.is_f_contiguous(); - - bool is_dst_c_contig = dst.is_c_contiguous(); - bool is_dst_f_contig = dst.is_f_contiguous(); - - bool both_c_contig = (is_src_c_contig && is_dst_c_contig); - bool both_f_contig = (is_src_f_contig && is_dst_f_contig); - - if (both_c_contig || both_f_contig) { - auto contig_fn = contig_dispatch_vector[src_typeid]; - - if (contig_fn == nullptr) { - throw std::runtime_error( - "Contiguous implementation is missing for src_typeid=" + - std::to_string(src_typeid)); - } - - auto comp_ev = contig_fn(q, src_nelems, src_data, dst_data, depends); - sycl::event ht_ev = - dpnp::utils::keep_args_alive(q, {src, dst}, {comp_ev}); - - return std::make_pair(ht_ev, comp_ev); - } - - // simplify iteration space - // if 1d with strides 1 - input is contig - // dispatch to strided - - auto const &src_strides = src.get_strides_vector(); - auto const &dst_strides = dst.get_strides_vector(); - - using shT = std::vector; - shT simplified_shape; - shT simplified_src_strides; - shT simplified_dst_strides; - py::ssize_t src_offset(0); - py::ssize_t dst_offset(0); - - int nd = src_nd; - const py::ssize_t *shape = src_shape; - - 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) { - // Special case of contiguous data - auto contig_fn = contig_dispatch_vector[src_typeid]; - - if (contig_fn == nullptr) { - throw std::runtime_error( - "Contiguous implementation is missing for src_typeid=" + - std::to_string(src_typeid)); - } - - int src_elem_size = src.get_elemsize(); - int dst_elem_size = dst.get_elemsize(); - auto comp_ev = - contig_fn(q, src_nelems, src_data + src_elem_size * src_offset, - dst_data + dst_elem_size * dst_offset, depends); - - sycl::event ht_ev = - dpnp::utils::keep_args_alive(q, {src, dst}, {comp_ev}); - - return std::make_pair(ht_ev, comp_ev); - } - - // Strided implementation - auto strided_fn = strided_dispatch_vector[src_typeid]; - - if (strided_fn == nullptr) { - throw std::runtime_error( - "Strided implementation is missing for src_typeid=" + - std::to_string(src_typeid)); - } - - using dpnp::tensor::offset_utils::device_allocate_and_pack; - - std::vector host_tasks{}; - host_tasks.reserve(2); - - auto ptr_size_event_triple_ = device_allocate_and_pack( - q, host_tasks, simplified_shape, simplified_src_strides, - simplified_dst_strides); - auto shape_strides_owner = std::move(std::get<0>(ptr_size_event_triple_)); - const auto ©_shape_ev = std::get<2>(ptr_size_event_triple_); - const py::ssize_t *shape_strides = shape_strides_owner.get(); - - sycl::event strided_fn_ev = - strided_fn(q, src_nelems, nd, shape_strides, src_data, src_offset, - dst_data, dst_offset, depends, {copy_shape_ev}); - - // async free of shape_strides temporary - sycl::event tmp_cleanup_ev = dpnp::tensor::alloc_utils::async_smart_free( - q, {strided_fn_ev}, shape_strides_owner); - - host_tasks.push_back(tmp_cleanup_ev); - - return std::make_pair( - dpnp::utils::keep_args_alive(q, {src, dst}, host_tasks), strided_fn_ev); -} - -/*! @brief Template implementing Python API for querying of type support by - * unary elementwise functions */ -template -py::object py_unary_ufunc_result_type(const py::dtype &input_dtype, - const output_typesT &output_types) -{ - int tn = input_dtype.num(); // NumPy type numbers are the same as in dpnp - int src_typeid = -1; - - auto array_types = td_ns::usm_ndarray_types(); - - try { - src_typeid = array_types.typenum_to_lookup_id(tn); - } catch (const std::exception &e) { - throw py::value_error(e.what()); - } - - using type_utils::_result_typeid; - int dst_typeid = _result_typeid(src_typeid, output_types); - - if (dst_typeid < 0) { - auto res = py::none(); - return py::cast(res); - } - else { - using type_utils::_dtype_from_typenum; - - auto dst_typenum_t = static_cast(dst_typeid); - auto dt = _dtype_from_typenum(dst_typenum_t); - - return py::cast(dt); - } -} - -// ======================== Binary functions =========================== - -namespace -{ -template -bool isEqual(Container const &c, std::initializer_list const &l) -{ - return std::equal(std::begin(c), std::end(c), std::begin(l), std::end(l)); -} -} // namespace - -/*! @brief Template implementing Python API for binary elementwise - * functions */ -template -std::pair py_binary_ufunc( - const dpnp::tensor::usm_ndarray &src1, - const dpnp::tensor::usm_ndarray &src2, - const dpnp::tensor::usm_ndarray &dst, // dst = op(src1, src2), elementwise - sycl::queue &exec_q, - const std::vector depends, - // - const output_typesT &output_type_table, - const contig_dispatchT &contig_dispatch_table, - const strided_dispatchT &strided_dispatch_table, - const contig_matrix_row_dispatchT - &contig_matrix_row_broadcast_dispatch_table, - const contig_row_matrix_dispatchT - &contig_row_matrix_broadcast_dispatch_table) -{ - // check type_nums - int src1_typenum = src1.get_typenum(); - int src2_typenum = src2.get_typenum(); - int dst_typenum = dst.get_typenum(); - - auto array_types = td_ns::usm_ndarray_types(); - int src1_typeid = array_types.typenum_to_lookup_id(src1_typenum); - int src2_typeid = array_types.typenum_to_lookup_id(src2_typenum); - int dst_typeid = array_types.typenum_to_lookup_id(dst_typenum); - - int output_typeid = output_type_table[src1_typeid][src2_typeid]; - - if (output_typeid != dst_typeid) { - throw py::value_error( - "Destination array has unexpected elemental data type."); - } - - // check that queues are compatible - if (!dpnp::utils::queues_are_compatible(exec_q, {src1, src2, dst})) { - throw py::value_error( - "Execution queue is not compatible with allocation queues"); - } - - dpnp::tensor::validation::CheckWritable::throw_if_not_writable(dst); - - // check shapes, broadcasting is assumed done by caller - // check that dimensions are the same - int dst_nd = dst.get_ndim(); - if (dst_nd != src1.get_ndim() || dst_nd != src2.get_ndim()) { - throw py::value_error("Array dimensions are not the same."); - } - - // check that shapes are the same - const py::ssize_t *src1_shape = src1.get_shape_raw(); - const py::ssize_t *src2_shape = src2.get_shape_raw(); - const py::ssize_t *dst_shape = dst.get_shape_raw(); - bool shapes_equal(true); - std::size_t src_nelems(1); - - for (int i = 0; i < dst_nd; ++i) { - src_nelems *= static_cast(src1_shape[i]); - shapes_equal = shapes_equal && (src1_shape[i] == dst_shape[i] && - src2_shape[i] == dst_shape[i]); - } - if (!shapes_equal) { - throw py::value_error("Array shapes are not the same."); - } - - // if nelems is zero, return - if (src_nelems == 0) { - return std::make_pair(sycl::event(), sycl::event()); - } - - dpnp::tensor::validation::AmpleMemory::throw_if_not_ample(dst, src_nelems); - - auto const &overlap = dpnp::tensor::overlap::MemoryOverlap(); - auto const &same_logical_tensors = - dpnp::tensor::overlap::SameLogicalTensors(); - if ((overlap(src1, dst) && !same_logical_tensors(src1, dst)) || - (overlap(src2, dst) && !same_logical_tensors(src2, dst))) { - throw py::value_error("Arrays index overlapping segments of memory"); - } - // check memory overlap - const char *src1_data = src1.get_data(); - const char *src2_data = src2.get_data(); - char *dst_data = dst.get_data(); - - // handle contiguous inputs - bool is_src1_c_contig = src1.is_c_contiguous(); - bool is_src1_f_contig = src1.is_f_contiguous(); - - bool is_src2_c_contig = src2.is_c_contiguous(); - bool is_src2_f_contig = src2.is_f_contiguous(); - - bool is_dst_c_contig = dst.is_c_contiguous(); - bool is_dst_f_contig = dst.is_f_contiguous(); - - bool all_c_contig = - (is_src1_c_contig && is_src2_c_contig && is_dst_c_contig); - bool all_f_contig = - (is_src1_f_contig && is_src2_f_contig && is_dst_f_contig); - - // dispatch for contiguous inputs - if (all_c_contig || all_f_contig) { - auto contig_fn = contig_dispatch_table[src1_typeid][src2_typeid]; - - if (contig_fn != nullptr) { - auto comp_ev = contig_fn(exec_q, src_nelems, src1_data, 0, - src2_data, 0, dst_data, 0, depends); - sycl::event ht_ev = dpnp::utils::keep_args_alive( - exec_q, {src1, src2, dst}, {comp_ev}); - - return std::make_pair(ht_ev, comp_ev); - } - } - - // simplify strides - auto const &src1_strides = src1.get_strides_vector(); - auto const &src2_strides = src2.get_strides_vector(); - auto const &dst_strides = dst.get_strides_vector(); - - using shT = std::vector; - shT simplified_shape; - shT simplified_src1_strides; - shT simplified_src2_strides; - shT simplified_dst_strides; - py::ssize_t src1_offset(0); - py::ssize_t src2_offset(0); - py::ssize_t dst_offset(0); - - int nd = dst_nd; - const py::ssize_t *shape = src1_shape; - - simplify_iteration_space_3( - nd, shape, src1_strides, src2_strides, dst_strides, - // outputs - simplified_shape, simplified_src1_strides, simplified_src2_strides, - simplified_dst_strides, src1_offset, src2_offset, dst_offset); - - std::vector host_tasks{}; - if (nd < 3) { - static constexpr auto unit_stride = - std::initializer_list{1}; - - if ((nd == 1) && isEqual(simplified_src1_strides, unit_stride) && - isEqual(simplified_src2_strides, unit_stride) && - isEqual(simplified_dst_strides, unit_stride)) { - auto contig_fn = contig_dispatch_table[src1_typeid][src2_typeid]; - - if (contig_fn != nullptr) { - auto comp_ev = contig_fn(exec_q, src_nelems, src1_data, - src1_offset, src2_data, src2_offset, - dst_data, dst_offset, depends); - sycl::event ht_ev = dpnp::utils::keep_args_alive( - exec_q, {src1, src2, dst}, {comp_ev}); - - return std::make_pair(ht_ev, comp_ev); - } - } - if (nd == 2) { - static constexpr auto zero_one_strides = - std::initializer_list{0, 1}; - static constexpr auto one_zero_strides = - std::initializer_list{1, 0}; - static constexpr py::ssize_t one{1}; - // special case of C-contiguous matrix and a row - if (isEqual(simplified_src2_strides, zero_one_strides) && - isEqual(simplified_src1_strides, {simplified_shape[1], one}) && - isEqual(simplified_dst_strides, {simplified_shape[1], one})) { - auto matrix_row_broadcast_fn = - contig_matrix_row_broadcast_dispatch_table[src1_typeid] - [src2_typeid]; - if (matrix_row_broadcast_fn != nullptr) { - int src1_itemsize = src1.get_elemsize(); - int src2_itemsize = src2.get_elemsize(); - int dst_itemsize = dst.get_elemsize(); - - if (is_aligned( - src1_data + src1_offset * src1_itemsize) && - is_aligned( - src2_data + src2_offset * src2_itemsize) && - is_aligned( - dst_data + dst_offset * dst_itemsize)) { - std::size_t n0 = simplified_shape[0]; - std::size_t n1 = simplified_shape[1]; - sycl::event comp_ev = matrix_row_broadcast_fn( - exec_q, host_tasks, n0, n1, src1_data, src1_offset, - src2_data, src2_offset, dst_data, dst_offset, - depends); - - return std::make_pair( - dpnp::utils::keep_args_alive( - exec_q, {src1, src2, dst}, host_tasks), - comp_ev); - } - } - } - if (isEqual(simplified_src1_strides, one_zero_strides) && - isEqual(simplified_src2_strides, {one, simplified_shape[0]}) && - isEqual(simplified_dst_strides, {one, simplified_shape[0]})) { - auto row_matrix_broadcast_fn = - contig_row_matrix_broadcast_dispatch_table[src1_typeid] - [src2_typeid]; - if (row_matrix_broadcast_fn != nullptr) { - - int src1_itemsize = src1.get_elemsize(); - int src2_itemsize = src2.get_elemsize(); - int dst_itemsize = dst.get_elemsize(); - - if (is_aligned( - src1_data + src1_offset * src1_itemsize) && - is_aligned( - src2_data + src2_offset * src2_itemsize) && - is_aligned( - dst_data + dst_offset * dst_itemsize)) { - std::size_t n0 = simplified_shape[1]; - std::size_t n1 = simplified_shape[0]; - sycl::event comp_ev = row_matrix_broadcast_fn( - exec_q, host_tasks, n0, n1, src1_data, src1_offset, - src2_data, src2_offset, dst_data, dst_offset, - depends); - - return std::make_pair( - dpnp::utils::keep_args_alive( - exec_q, {src1, src2, dst}, host_tasks), - comp_ev); - } - } - } - } - } - - // dispatch to strided code - auto strided_fn = strided_dispatch_table[src1_typeid][src2_typeid]; - - if (strided_fn == nullptr) { - throw std::runtime_error( - "Strided implementation is missing for src1_typeid=" + - std::to_string(src1_typeid) + - " and src2_typeid=" + std::to_string(src2_typeid)); - } - - using dpnp::tensor::offset_utils::device_allocate_and_pack; - auto ptr_sz_event_triple_ = device_allocate_and_pack( - exec_q, host_tasks, simplified_shape, simplified_src1_strides, - simplified_src2_strides, simplified_dst_strides); - auto shape_strides_owner = std::move(std::get<0>(ptr_sz_event_triple_)); - auto ©_shape_ev = std::get<2>(ptr_sz_event_triple_); - - const py::ssize_t *shape_strides = shape_strides_owner.get(); - - sycl::event strided_fn_ev = strided_fn( - exec_q, src_nelems, nd, shape_strides, src1_data, src1_offset, - src2_data, src2_offset, dst_data, dst_offset, depends, {copy_shape_ev}); - - // async free of shape_strides temporary - sycl::event tmp_cleanup_ev = dpnp::tensor::alloc_utils::async_smart_free( - exec_q, {strided_fn_ev}, shape_strides_owner); - host_tasks.push_back(tmp_cleanup_ev); - - return std::make_pair( - dpnp::utils::keep_args_alive(exec_q, {src1, src2, dst}, host_tasks), - strided_fn_ev); -} - -/*! @brief Type querying for binary elementwise functions */ -template -py::object py_binary_ufunc_result_type(const py::dtype &input1_dtype, - const py::dtype &input2_dtype, - const output_typesT &output_types_table) -{ - int tn1 = input1_dtype.num(); // NumPy type numbers are the same as in dpnp - int tn2 = input2_dtype.num(); // NumPy type numbers are the same as in dpnp - int src1_typeid = -1; - int src2_typeid = -1; - - auto array_types = td_ns::usm_ndarray_types(); - - try { - src1_typeid = array_types.typenum_to_lookup_id(tn1); - src2_typeid = array_types.typenum_to_lookup_id(tn2); - } catch (const std::exception &e) { - throw py::value_error(e.what()); - } - - if (src1_typeid < 0 || src1_typeid >= td_ns::num_types || src2_typeid < 0 || - src2_typeid >= td_ns::num_types) { - throw std::runtime_error("binary output type lookup failed"); - } - int dst_typeid = output_types_table[src1_typeid][src2_typeid]; - - if (dst_typeid < 0) { - auto res = py::none(); - return py::cast(res); - } - else { - using type_utils::_dtype_from_typenum; - - auto dst_typenum_t = static_cast(dst_typeid); - auto dt = _dtype_from_typenum(dst_typenum_t); - - return py::cast(dt); - } -} - -// ==================== Inplace binary functions ======================= - -template -std::pair - py_binary_inplace_ufunc(const dpnp::tensor::usm_ndarray &lhs, - const dpnp::tensor::usm_ndarray &rhs, - sycl::queue &exec_q, - const std::vector depends, - // - const output_typesT &output_type_table, - const contig_dispatchT &contig_dispatch_table, - const strided_dispatchT &strided_dispatch_table, - const contig_row_matrix_dispatchT - &contig_row_matrix_broadcast_dispatch_table) -{ - dpnp::tensor::validation::CheckWritable::throw_if_not_writable(lhs); - - // check type_nums - int rhs_typenum = rhs.get_typenum(); - int lhs_typenum = lhs.get_typenum(); - - auto array_types = td_ns::usm_ndarray_types(); - int rhs_typeid = array_types.typenum_to_lookup_id(rhs_typenum); - int lhs_typeid = array_types.typenum_to_lookup_id(lhs_typenum); - - int output_typeid = output_type_table[rhs_typeid][lhs_typeid]; - - if (output_typeid != lhs_typeid) { - throw py::value_error( - "Left-hand side array has unexpected elemental data type."); - } - - // check that queues are compatible - if (!dpnp::utils::queues_are_compatible(exec_q, {rhs, lhs})) { - throw py::value_error( - "Execution queue is not compatible with allocation queues"); - } - - // check shapes, broadcasting is assumed done by caller - // check that dimensions are the same - int lhs_nd = lhs.get_ndim(); - if (lhs_nd != rhs.get_ndim()) { - throw py::value_error("Array dimensions are not the same."); - } - - // check that shapes are the same - const py::ssize_t *rhs_shape = rhs.get_shape_raw(); - const py::ssize_t *lhs_shape = lhs.get_shape_raw(); - bool shapes_equal(true); - std::size_t rhs_nelems(1); - - for (int i = 0; i < lhs_nd; ++i) { - rhs_nelems *= static_cast(rhs_shape[i]); - shapes_equal = shapes_equal && (rhs_shape[i] == lhs_shape[i]); - } - if (!shapes_equal) { - throw py::value_error("Array shapes are not the same."); - } - - // if nelems is zero, return - if (rhs_nelems == 0) { - return std::make_pair(sycl::event(), sycl::event()); - } - - dpnp::tensor::validation::AmpleMemory::throw_if_not_ample(lhs, rhs_nelems); - - // check memory overlap - auto const &same_logical_tensors = - dpnp::tensor::overlap::SameLogicalTensors(); - auto const &overlap = dpnp::tensor::overlap::MemoryOverlap(); - if (overlap(rhs, lhs) && !same_logical_tensors(rhs, lhs)) { - throw py::value_error("Arrays index overlapping segments of memory"); - } - // check memory overlap - const char *rhs_data = rhs.get_data(); - char *lhs_data = lhs.get_data(); - - // handle contiguous inputs - bool is_rhs_c_contig = rhs.is_c_contiguous(); - bool is_rhs_f_contig = rhs.is_f_contiguous(); - - bool is_lhs_c_contig = lhs.is_c_contiguous(); - bool is_lhs_f_contig = lhs.is_f_contiguous(); - - bool both_c_contig = (is_rhs_c_contig && is_lhs_c_contig); - bool both_f_contig = (is_rhs_f_contig && is_lhs_f_contig); - - // dispatch for contiguous inputs - if (both_c_contig || both_f_contig) { - auto contig_fn = contig_dispatch_table[rhs_typeid][lhs_typeid]; - - if (contig_fn != nullptr) { - auto comp_ev = contig_fn(exec_q, rhs_nelems, rhs_data, 0, lhs_data, - 0, depends); - sycl::event ht_ev = - dpnp::utils::keep_args_alive(exec_q, {rhs, lhs}, {comp_ev}); - - return std::make_pair(ht_ev, comp_ev); - } - } - - // simplify strides - auto const &rhs_strides = rhs.get_strides_vector(); - auto const &lhs_strides = lhs.get_strides_vector(); - - using shT = std::vector; - shT simplified_shape; - shT simplified_rhs_strides; - shT simplified_lhs_strides; - py::ssize_t rhs_offset(0); - py::ssize_t lhs_offset(0); - - int nd = lhs_nd; - const py::ssize_t *shape = rhs_shape; - - simplify_iteration_space(nd, shape, rhs_strides, lhs_strides, - // outputs - simplified_shape, simplified_rhs_strides, - simplified_lhs_strides, rhs_offset, lhs_offset); - - std::vector host_tasks{}; - if (nd < 3) { - static constexpr auto unit_stride = - std::initializer_list{1}; - - if ((nd == 1) && isEqual(simplified_rhs_strides, unit_stride) && - isEqual(simplified_lhs_strides, unit_stride)) { - auto contig_fn = contig_dispatch_table[rhs_typeid][lhs_typeid]; - - if (contig_fn != nullptr) { - auto comp_ev = - contig_fn(exec_q, rhs_nelems, rhs_data, rhs_offset, - lhs_data, lhs_offset, depends); - sycl::event ht_ev = - dpnp::utils::keep_args_alive(exec_q, {rhs, lhs}, {comp_ev}); - - return std::make_pair(ht_ev, comp_ev); - } - } - if (nd == 2) { - static constexpr auto one_zero_strides = - std::initializer_list{1, 0}; - static constexpr py::ssize_t one{1}; - // special case of C-contiguous matrix and a row - if (isEqual(simplified_rhs_strides, one_zero_strides) && - isEqual(simplified_lhs_strides, {one, simplified_shape[0]})) { - auto row_matrix_broadcast_fn = - contig_row_matrix_broadcast_dispatch_table[rhs_typeid] - [lhs_typeid]; - if (row_matrix_broadcast_fn != nullptr) { - std::size_t n0 = simplified_shape[1]; - std::size_t n1 = simplified_shape[0]; - sycl::event comp_ev = row_matrix_broadcast_fn( - exec_q, host_tasks, n0, n1, rhs_data, rhs_offset, - lhs_data, lhs_offset, depends); - - return std::make_pair(dpnp::utils::keep_args_alive( - exec_q, {lhs, rhs}, host_tasks), - comp_ev); - } - } - } - } - - // dispatch to strided code - auto strided_fn = strided_dispatch_table[rhs_typeid][lhs_typeid]; - - if (strided_fn == nullptr) { - throw std::runtime_error( - "Strided implementation is missing for rhs_typeid=" + - std::to_string(rhs_typeid) + - " and lhs_typeid=" + std::to_string(lhs_typeid)); - } - - using dpnp::tensor::offset_utils::device_allocate_and_pack; - auto ptr_sz_event_triple_ = device_allocate_and_pack( - exec_q, host_tasks, simplified_shape, simplified_rhs_strides, - simplified_lhs_strides); - auto shape_strides_owner = std::move(std::get<0>(ptr_sz_event_triple_)); - auto copy_shape_ev = std::get<2>(ptr_sz_event_triple_); - - const py::ssize_t *shape_strides = shape_strides_owner.get(); - - sycl::event strided_fn_ev = - strided_fn(exec_q, rhs_nelems, nd, shape_strides, rhs_data, rhs_offset, - lhs_data, lhs_offset, depends, {copy_shape_ev}); - - // async free of shape_strides temporary - sycl::event tmp_cleanup_ev = dpnp::tensor::alloc_utils::async_smart_free( - exec_q, {strided_fn_ev}, shape_strides_owner); - - host_tasks.push_back(tmp_cleanup_ev); - - return std::make_pair( - dpnp::utils::keep_args_alive(exec_q, {rhs, lhs}, host_tasks), - strided_fn_ev); -} - -} // namespace dpnp::tensor::py_internal diff --git a/dpnp/tests/tensor/elementwise/test_divide.py b/dpnp/tests/tensor/elementwise/test_divide.py index adedb8471169..52a6dbb27b82 100644 --- a/dpnp/tests/tensor/elementwise/test_divide.py +++ b/dpnp/tests/tensor/elementwise/test_divide.py @@ -33,7 +33,7 @@ from dpctl.utils import SequentialOrderManager import dpnp.tensor as dpt -from dpnp.tensor._tensor_elementwise_impl import _divide_by_scalar +from dpnp.libtensor._tensor_elementwise_impl import _divide_by_scalar from dpnp.tensor._type_utils import _can_cast from ..helper import ( diff --git a/dpnp/tests/tensor/test_tensor_array_api_inspection.py b/dpnp/tests/tensor/test_tensor_array_api_inspection.py index a04bccaf5dbe..3301faa1f792 100644 --- a/dpnp/tests/tensor/test_tensor_array_api_inspection.py +++ b/dpnp/tests/tensor/test_tensor_array_api_inspection.py @@ -30,7 +30,7 @@ import pytest import dpnp.tensor as dpt -from dpnp.tensor._tensor_impl import ( +from dpnp.libtensor._tensor_impl import ( default_device_complex_type, default_device_fp_type, default_device_index_type, diff --git a/dpnp/tests/tensor/test_tensor_statistical_functions.py b/dpnp/tests/tensor/test_tensor_statistical_functions.py index 7e444500d75f..67d3457630e9 100644 --- a/dpnp/tests/tensor/test_tensor_statistical_functions.py +++ b/dpnp/tests/tensor/test_tensor_statistical_functions.py @@ -29,7 +29,7 @@ import pytest import dpnp.tensor as dpt -from dpnp.tensor._tensor_impl import default_device_fp_type +from dpnp.libtensor._tensor_impl import default_device_fp_type from .helper import ( get_queue_or_skip, diff --git a/dpnp/tests/tensor/test_usm_ndarray_indexing.py b/dpnp/tests/tensor/test_usm_ndarray_indexing.py index 5f8d208764d7..ad412c9ea6d4 100644 --- a/dpnp/tests/tensor/test_usm_ndarray_indexing.py +++ b/dpnp/tests/tensor/test_usm_ndarray_indexing.py @@ -31,8 +31,8 @@ import pytest from numpy.testing import assert_array_equal +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from dpnp.tensor._copy_utils import _take_multi_index from .helper import ( diff --git a/dpnp/tests/tensor/test_usm_ndarray_manipulation.py b/dpnp/tests/tensor/test_usm_ndarray_manipulation.py index 6d82816b5453..591170fcd41b 100644 --- a/dpnp/tests/tensor/test_usm_ndarray_manipulation.py +++ b/dpnp/tests/tensor/test_usm_ndarray_manipulation.py @@ -33,8 +33,8 @@ import pytest from numpy.testing import assert_, assert_array_equal, assert_raises_regex +import dpnp.libtensor._tensor_impl as ti import dpnp.tensor as dpt -import dpnp.tensor._tensor_impl as ti from dpnp.tensor._numpy_helper import AxisError from .helper import get_queue_or_skip diff --git a/dpnp/tests/tensor/test_usm_ndarray_reductions.py b/dpnp/tests/tensor/test_usm_ndarray_reductions.py index 1334d7176892..bd56c96ce13c 100644 --- a/dpnp/tests/tensor/test_usm_ndarray_reductions.py +++ b/dpnp/tests/tensor/test_usm_ndarray_reductions.py @@ -33,7 +33,7 @@ from numpy.testing import assert_allclose import dpnp.tensor as dpt -from dpnp.tensor._tensor_impl import default_device_index_type +from dpnp.libtensor._tensor_impl import default_device_index_type from .helper import ( get_queue_or_skip, diff --git a/dpnp/tests/test_array_api_info.py b/dpnp/tests/test_array_api_info.py index 60f81c0eddd3..1b983c0131cd 100644 --- a/dpnp/tests/test_array_api_info.py +++ b/dpnp/tests/test_array_api_info.py @@ -3,7 +3,7 @@ import dpnp from dpnp.exceptions import SyclDeviceCreationError -from dpnp.tensor._tensor_impl import default_device_complex_type +from dpnp.libtensor._tensor_impl import default_device_complex_type from dpnp.tests.helper import ( has_support_aspect64, is_win_platform, diff --git a/dpnp/tests/test_scipy_sparse_linalg.py b/dpnp/tests/test_scipy_sparse_linalg.py index cd994ffe9853..26966a76851e 100644 --- a/dpnp/tests/test_scipy_sparse_linalg.py +++ b/dpnp/tests/test_scipy_sparse_linalg.py @@ -1673,7 +1673,7 @@ def test_spmv_compute_rejects_nontrivial_alpha_beta(self): # Single cached alpha/beta slot per handle: only 1.0/0.0 accepted. import dpctl.utils as dpu - from dpnp.backend.extensions.sparse import _sparse_impl as si + from dpnp.libtensor import _sparse_impl as si n = 4 dt = dpnp.default_float_type() diff --git a/dpnp/tests/test_umath.py b/dpnp/tests/test_umath.py index 3e4e928a4064..a8a5d3d3888d 100644 --- a/dpnp/tests/test_umath.py +++ b/dpnp/tests/test_umath.py @@ -9,7 +9,7 @@ ) import dpnp -import dpnp.backend.extensions.vm._vm_impl as vmi +import dpnp.libtensor._vm_impl as vmi from dpnp.dpnp_utils import map_dtype_to_device from .helper import ( diff --git a/scripts/gen_coverage.py b/scripts/gen_coverage.py index 7fc2cc89186f..ebd14955d016 100644 --- a/scripts/gen_coverage.py +++ b/scripts/gen_coverage.py @@ -49,6 +49,14 @@ _DPNP_PROFRAW = "dpnp_pytest.profraw" _TENSOR_PROFRAW = "dpnp_tensor_pytest.profraw" +# pybind11 modules of dpnp/libtensor holding libtensor functions only, unlike +# _tensor_impl and _tensor_elementwise_impl which hold dpnp functions too +_TENSOR_ONLY_OBJS = ( + "_tensor_accumulation_impl.", + "_tensor_linalg_impl.", + "_tensor_reductions_impl.", + "_tensor_sorting_impl.", +) def parse_args(): @@ -276,18 +284,17 @@ def find_objects(): search_path = os.path.join(setup_dir, "dpnp") for root, _, files in os.walk(search_path): for file in files: - is_backend_obj = file.endswith("_c.so") or ( - root.find("extensions") != -1 - and file.find("_impl.cpython") != -1 - ) - # tensor pybind11 extensions, e.g. _tensor_impl - is_tensor_obj = ( - args.tensor_cpp_coverage - and os.path.basename(root) == "tensor" - and file.startswith("_tensor_") + is_impl_obj = ( + os.path.basename(root) == "libtensor" and file.find("_impl.cpython") != -1 ) - if is_backend_obj or is_tensor_obj: + # modules with libtensor functions only are instrumented with + # --tensor-cpp-coverage only + is_tensor_obj = file.startswith(_TENSOR_ONLY_OBJS) + if file.endswith("_c.so") or ( + is_impl_obj + and (args.tensor_cpp_coverage or not is_tensor_obj) + ): objects.extend(["-object", os.path.join(root, file)]) return objects @@ -315,10 +322,7 @@ def find_objects(): "export", "-format=lcov", "-ignore-filename-regex=/tmp/icpx*", - r"-ignore-filename-regex=.*/backend/kernels/elementwise_functions/.*\.hpp$", - r"-ignore-filename-regex=.*/backend/kernels/indexing/.*\.hpp$", - r"-ignore-filename-regex=.*/backend/kernels/statistics/.*\.hpp$", - r"-ignore-filename-regex=.*/backend/kernels/window/.*\.hpp$", + r"-ignore-filename-regex=.*/libtensor/include/kernels/.*\.hpp$", "-instr-profile=" + instr_profile_fn, ] + objects diff --git a/setup.py b/setup.py index 23145fab0051..cdd12e66a98c 100644 --- a/setup.py +++ b/setup.py @@ -57,9 +57,11 @@ "dpnp_backend_c.lib", "dpnp_backend_c.dll", "resources/cmake/*.cmake", - "tensor/libtensor/include/kernels/*.h*", - "tensor/libtensor/include/kernels/*/*.h*", - "tensor/libtensor/include/utils/*.h*", + "libtensor/include/ext/*.h*", + "libtensor/include/ext/*/*.h*", + "libtensor/include/kernels/*.h*", + "libtensor/include/kernels/*/*.h*", + "libtensor/include/utils/*.h*", "tests/*.*", "tests/tensor/*.py", "tests/tensor/*/*.py", From d1635a7c7d4268d636671531ee163551938a4f5f Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Wed, 28 Oct 2026 20:14:02 -0700 Subject: [PATCH 2/3] Add #3131 to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4771ac5ae86..5cd08c26b95b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * Changed `dpnp.tensor.top_k` to select the `k` elements with a radix select instead of sorting every row, for all but complex data types. The order of the returned elements is now unspecified, where it was largest-first or smallest-first before [#3079](https://github.com/IntelPython/dpnp/pull/3079) +* Moved libtensor from `dpnp/tensor/libtensor` to `dpnp/libtensor`. All pybind11 extension modules are installed into `dpnp/libtensor` (e.g. `dpnp.libtensor._tensor_impl`, `dpnp.libtensor._blas_impl`), while `dpnp/backend` now contains only the legacy `dpnp_backend_c` library [#3131](https://github.com/IntelPython/dpnp/pull/3131) +* Merged the `ufunc` and `indexing` extensions into `dpnp.libtensor._tensor_elementwise_impl` and `dpnp.libtensor._tensor_impl`, while `statistics` and `window` extensions became part of libtensor [#3131](https://github.com/IntelPython/dpnp/pull/3131) +* Moved `blas`, `fft`, `lapack`, `sparse` and `vm` extensions into `dpnp/libtensor/extensions` [#3131](https://github.com/IntelPython/dpnp/pull/3131) ### Deprecated From ff6221b662d45423d12fd8af2f7e1f2a241549e1 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Wed, 28 Oct 2026 23:52:32 -0700 Subject: [PATCH 3/3] Fix small bugs and remove dead code in libtensor - 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 --- dpnp/CMakeLists.txt | 16 --- .../extensions/lapack/gesvd_common_utils.hpp | 4 +- dpnp/libtensor/extensions/lapack/syevd.cpp | 2 +- dpnp/libtensor/extensions/vm/common.hpp | 2 +- dpnp/libtensor/extensions/vm/fmax.cpp | 4 +- dpnp/libtensor/extensions/vm/fmin.cpp | 4 +- dpnp/libtensor/include/ext/common.hpp | 32 ------ .../ext/details/validation_utils_internal.hpp | 2 +- dpnp/libtensor/include/ext/dispatch_table.hpp | 10 -- dpnp/libtensor/include/utils/offset_utils.hpp | 107 ------------------ dpnp/libtensor/source/CMakeLists.txt | 25 +--- 11 files changed, 12 insertions(+), 196 deletions(-) diff --git a/dpnp/CMakeLists.txt b/dpnp/CMakeLists.txt index 61e0481d1390..6e952e356a98 100644 --- a/dpnp/CMakeLists.txt +++ b/dpnp/CMakeLists.txt @@ -28,7 +28,6 @@ # ***************************************************************************** function(build_dpnp_cython_ext _trgt _src _dest) - set(options SYCL) add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src) message(STATUS "Using ${_trgt}") @@ -37,10 +36,6 @@ function(build_dpnp_cython_ext _trgt _src _dest) add_custom_target(${_trgt_deps} DEPENDS ${_src}) add_dependencies(${_trgt} ${_trgt_deps}) - if(BUILD_DPNP_EXT_SYCL) - add_sycl_to_target(TARGET ${_trgt} SOURCES ${_generated_src}) - endif() - if(DPNP_GENERATE_COVERAGE) # Pass CYTHON_USE_SYS_MONITORING=0 to force Cython's legacy (settrace-based) # line tracing instead of the sys.monitoring path @@ -95,7 +90,6 @@ function(build_dpnp_tensor_ext _trgt _src _dest) set(options SYCL) cmake_parse_arguments(BUILD_DPNP_TENSOR "${options}" "RELATIVE_PATH" "" ${ARGN}) add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src) - set(_cythonize_trgt "${_trgt}_cythonize_pyx") python_add_library(${_trgt} MODULE WITH_SOABI ${_generated_src}) if(BUILD_DPNP_TENSOR_SYCL) add_sycl_to_target(TARGET ${_trgt} SOURCES ${_generated_src}) @@ -173,14 +167,6 @@ function(build_dpnp_tensor_ext _trgt _src _dest) file(RELATIVE_PATH _rel_dir ${CMAKE_SOURCE_DIR} ${_original_src_dir}) install(FILES ${_generated_src} DESTINATION ${CMAKE_INSTALL_PREFIX}/${_rel_dir}) endif() - - # Create target with headers only, because python is managing all the - # library imports at runtime - set(_trgt_headers ${_trgt}_headers) - add_library(${_trgt_headers} INTERFACE) - add_dependencies(${_trgt_headers} ${_trgt}) - get_target_property(_trgt_headers_dir ${_trgt} INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(${_trgt_headers} INTERFACE ${_trgt_headers_dir}) endfunction() function(build_dpnp_cython_ext_with_backend _trgt _src _dest) @@ -208,8 +194,6 @@ function(build_dpnp_pybind11_ext _trgt) target_link_options(${_trgt} PRIVATE ${_dpnp_sycl_target_link_options}) endif() - set_target_properties(${_trgt} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON) - target_include_directories( ${_trgt} PRIVATE diff --git a/dpnp/libtensor/extensions/lapack/gesvd_common_utils.hpp b/dpnp/libtensor/extensions/lapack/gesvd_common_utils.hpp index 8e2760a9bd4c..2ce9d6a102f6 100644 --- a/dpnp/libtensor/extensions/lapack/gesvd_common_utils.hpp +++ b/dpnp/libtensor/extensions/lapack/gesvd_common_utils.hpp @@ -172,7 +172,7 @@ inline void common_gesvd_checks(sycl::queue &exec_q, if (a_array_type_id != out_u_type_id || a_array_type_id != out_vt_type_id) { throw py::type_error( "Input array, output left singular vectors array, " - "and outpuy right singular vectors array must have " + "and output right singular vectors array must have " "the same data type"); } } @@ -231,7 +231,7 @@ inline void handle_lapack_exc(const std::int64_t scratchpad_size, } else { error_msg - << "Unexpected MKL exception caught during gesv() call:\nreason: " + << "Unexpected MKL exception caught during gesvd() call:\nreason: " << e.what() << "\ninfo: " << e.info(); } } diff --git a/dpnp/libtensor/extensions/lapack/syevd.cpp b/dpnp/libtensor/extensions/lapack/syevd.cpp index f2be6214f60a..e98882718240 100644 --- a/dpnp/libtensor/extensions/lapack/syevd.cpp +++ b/dpnp/libtensor/extensions/lapack/syevd.cpp @@ -61,7 +61,7 @@ static sycl::event syevd_impl(sycl::queue &exec_q, type_utils::validate_type_for_device(exec_q); T *a = reinterpret_cast(in_a); - RealT *w = reinterpret_cast(out_w); + RealT *w = reinterpret_cast(out_w); const std::int64_t lda = std::max(1UL, n); const std::int64_t scratchpad_size = diff --git a/dpnp/libtensor/extensions/vm/common.hpp b/dpnp/libtensor/extensions/vm/common.hpp index f2a46477d78c..a350013ff24b 100644 --- a/dpnp/libtensor/extensions/vm/common.hpp +++ b/dpnp/libtensor/extensions/vm/common.hpp @@ -352,7 +352,7 @@ bool need_to_call_binary_ufunc(sycl::queue &exec_q, } // MKL function is not defined for the type - if (contig_dispatch_table[src1_typeid] == nullptr) { + if (contig_dispatch_table[src1_typeid][src2_typeid] == nullptr) { return false; } return true; diff --git a/dpnp/libtensor/extensions/vm/fmax.cpp b/dpnp/libtensor/extensions/vm/fmax.cpp index a7093f0a95c3..71000e1392b7 100644 --- a/dpnp/libtensor/extensions/vm/fmax.cpp +++ b/dpnp/libtensor/extensions/vm/fmax.cpp @@ -149,8 +149,8 @@ void init_fmax(py::module_ m) }; m.def("_fmax", fmax_pyapi, "Call `fmax` function from OneMKL VM library to performs element " - "by element computation of the modulus function of vector `src1` " - "with respect to vector `src2` to resulting vector `dst`", + "by element computation of the maximum of vector `src1` and vector " + "`src2` to resulting vector `dst`", py::arg("sycl_queue"), py::arg("src1"), py::arg("src2"), py::arg("dst"), py::arg("depends") = py::list()); diff --git a/dpnp/libtensor/extensions/vm/fmin.cpp b/dpnp/libtensor/extensions/vm/fmin.cpp index 47cc154c91e4..1a8f331125d5 100644 --- a/dpnp/libtensor/extensions/vm/fmin.cpp +++ b/dpnp/libtensor/extensions/vm/fmin.cpp @@ -149,8 +149,8 @@ void init_fmin(py::module_ m) }; m.def("_fmin", fmin_pyapi, "Call `fmin` function from OneMKL VM library to performs element " - "by element computation of the modulus function of vector `src1` " - "with respect to vector `src2` to resulting vector `dst`", + "by element computation of the minimum of vector `src1` and vector " + "`src2` to resulting vector `dst`", py::arg("sycl_queue"), py::arg("src1"), py::arg("src2"), py::arg("dst"), py::arg("depends") = py::list()); diff --git a/dpnp/libtensor/include/ext/common.hpp b/dpnp/libtensor/include/ext/common.hpp index 6b9a42a87d8e..2184c0ec5090 100644 --- a/dpnp/libtensor/include/ext/common.hpp +++ b/dpnp/libtensor/include/ext/common.hpp @@ -145,53 +145,21 @@ inline size_t get_max_local_size(const sycl::queue &queue) return get_max_local_size(queue.get_device()); } -inline size_t get_max_local_size(const sycl::queue &queue, - int cpu_local_size_limit, - int gpu_local_size_limit) -{ - return get_max_local_size(queue.get_device(), cpu_local_size_limit, - gpu_local_size_limit); -} - size_t get_local_mem_size_in_bytes(const sycl::device &device); size_t get_local_mem_size_in_bytes(const sycl::device &device, size_t reserve); -inline size_t get_local_mem_size_in_bytes(const sycl::queue &queue) -{ - return get_local_mem_size_in_bytes(queue.get_device()); -} - -inline size_t get_local_mem_size_in_bytes(const sycl::queue &queue, - size_t reserve) -{ - return get_local_mem_size_in_bytes(queue.get_device(), reserve); -} - template size_t get_local_mem_size_in_items(const sycl::device &device) { return get_local_mem_size_in_bytes(device) / sizeof(T); } -template -size_t get_local_mem_size_in_items(const sycl::device &device, size_t reserve) -{ - return get_local_mem_size_in_bytes(device, sizeof(T) * reserve) / sizeof(T); -} - template inline size_t get_local_mem_size_in_items(const sycl::queue &queue) { return get_local_mem_size_in_items(queue.get_device()); } -template -inline size_t get_local_mem_size_in_items(const sycl::queue &queue, - size_t reserve) -{ - return get_local_mem_size_in_items(queue.get_device(), reserve); -} - template sycl::nd_range make_ndrange(const sycl::range &global_range, const sycl::range &local_range, diff --git a/dpnp/libtensor/include/ext/details/validation_utils_internal.hpp b/dpnp/libtensor/include/ext/details/validation_utils_internal.hpp index 6a46c97293f3..a514f72884bc 100644 --- a/dpnp/libtensor/include/ext/details/validation_utils_internal.hpp +++ b/dpnp/libtensor/include/ext/details/validation_utils_internal.hpp @@ -89,7 +89,7 @@ inline void check_c_contig(const std::vector &arrays, for (const auto &arr : arrays) { if (arr != nullptr && !arr->is_c_contiguous()) { throw py::value_error(name_of(arr, names) + - " parameter is not c-contiguos"); + " parameter is not c-contiguous"); } } } diff --git a/dpnp/libtensor/include/ext/dispatch_table.hpp b/dpnp/libtensor/include/ext/dispatch_table.hpp index 44437fb1a40f..abb1ec55a236 100644 --- a/dpnp/libtensor/include/ext/dispatch_table.hpp +++ b/dpnp/libtensor/include/ext/dispatch_table.hpp @@ -316,16 +316,6 @@ class DispatchTable2 return fn; } - const SupportedDTypeList &get_supported_first_type() const - { - return supported_first_type; - } - - const SupportedDTypeList &get_supported_second_type() const - { - return supported_second_type; - } - const SupportedDTypeList2 &get_all_supported_types() const { return all_supported_types; diff --git a/dpnp/libtensor/include/utils/offset_utils.hpp b/dpnp/libtensor/include/utils/offset_utils.hpp index e6e2179bdf8a..05ae82657168 100644 --- a/dpnp/libtensor/include/utils/offset_utils.hpp +++ b/dpnp/libtensor/include/utils/offset_utils.hpp @@ -602,18 +602,6 @@ struct FourOffsets_StridedIndexer static_assert(sycl::is_device_copyable_v); -struct FourZeroOffsets_Indexer -{ - constexpr FourZeroOffsets_Indexer() {} - - constexpr FourOffsets operator()(ssize_t) const - { - return FourOffsets(); - } -}; - -static_assert(sycl::is_device_copyable_v); - struct NthStrideOffset { NthStrideOffset(int common_nd, @@ -644,40 +632,6 @@ struct NthStrideOffset static_assert(sycl::is_device_copyable_v); -template -struct FixedDimStridedIndexer -{ - FixedDimStridedIndexer(const std::array &_shape, - const std::array &_strides, - ssize_t _offset) - : _ind(_shape), strides(_strides), starting_offset(_offset) - { - } - std::size_t operator()(std::size_t gid) const - { - dpnp::tensor::strides::CIndexer_array local_indexer( - std::move(_ind)); - local_indexer.set(gid); - auto mi = local_indexer.get(); - - ssize_t relative_offset = 0; - -#pragma unroll - for (int i = 0; i < nd; ++i) { - relative_offset += mi[i] * strides[i]; - } - return starting_offset + relative_offset; - } - -private: - dpnp::tensor::strides::CIndexer_array _ind; - - std::array strides; - ssize_t starting_offset; -}; - -static_assert(sycl::is_device_copyable_v>); - template struct TwoOffsets_FixedDimStridedIndexer { @@ -724,65 +678,4 @@ struct TwoOffsets_FixedDimStridedIndexer }; static_assert(sycl::is_device_copyable_v>); - -template -struct ThreeOffsets_FixedDimStridedIndexer -{ - ThreeOffsets_FixedDimStridedIndexer( - const std::array &_shape, - const std::array &_strides1, - const std::array &_strides2, - const std::array &_strides3, - ssize_t _offset1, - ssize_t _offset2, - ssize_t _offset3) - : _ind(_shape), strides1(_strides1), strides2(_strides2), - strides3(_strides3), starting_offset1(_offset1), - starting_offset2(_offset2), starting_offset3(_offset3) - { - } - - ThreeOffsets operator()(std::size_t gid) const - { - dpnp::tensor::strides::CIndexer_array local_indexer( - std::move(_ind)); - local_indexer.set(gid); - auto mi = local_indexer.get(); - - ssize_t relative_offset1 = 0; -#pragma unroll - for (int i = 0; i < nd; ++i) { - relative_offset1 += mi[i] * strides1[i]; - } - - ssize_t relative_offset2 = 0; -#pragma unroll - for (int i = 0; i < nd; ++i) { - relative_offset2 += mi[i] * strides2[i]; - } - - ssize_t relative_offset3 = 0; -#pragma unroll - for (int i = 0; i < nd; ++i) { - relative_offset3 += mi[i] * strides3[i]; - } - - return ThreeOffsets(starting_offset1 + relative_offset1, - starting_offset2 + relative_offset2, - starting_offset3 + relative_offset3); - } - -private: - dpnp::tensor::strides::CIndexer_array _ind; - - std::array strides1; - std::array strides2; - std::array strides3; - ssize_t starting_offset1; - ssize_t starting_offset2; - ssize_t starting_offset3; -}; - -static_assert( - sycl::is_device_copyable_v>); } // namespace dpnp::tensor::offset_utils diff --git a/dpnp/libtensor/source/CMakeLists.txt b/dpnp/libtensor/source/CMakeLists.txt index 7c8b4662ed67..a9ca27e14e12 100644 --- a/dpnp/libtensor/source/CMakeLists.txt +++ b/dpnp/libtensor/source/CMakeLists.txt @@ -244,13 +244,7 @@ set(_tensor_linalg_impl_sources set(_static_lib_trgt simplify_iteration_space) add_library(${_static_lib_trgt} STATIC ${_static_lib_sources}) -target_include_directories( - ${_static_lib_trgt} - PRIVATE - # ${Python_INCLUDE_DIRS} - # ${Dpctl_INCLUDE_DIR} - ${_libtensor_include_dir} -) +target_include_directories(${_static_lib_trgt} PRIVATE ${_libtensor_include_dir}) target_link_libraries(${_static_lib_trgt} PRIVATE pybind11::headers Python::Module) set_target_properties(${_static_lib_trgt} PROPERTIES POSITION_INDEPENDENT_CODE ON) @@ -322,6 +316,8 @@ list( ${_linalg_sources} ${_accumulator_sources} ) +# elementwise_functions_type_utils.cpp is in both the elementwise and linalg lists +list(REMOVE_DUPLICATES _no_fast_math_sources) foreach(_src_fn ${_no_fast_math_sources}) get_source_file_property(_cmpl_options_prop ${_src_fn} COMPILE_OPTIONS) @@ -353,21 +349,6 @@ foreach(_src_fn ${_dpnp_sources}) ) endforeach() -set(_compiler_definitions "") - -foreach(_src_fn ${_elementwise_sources}) - get_source_file_property(_cmpl_options_defs ${_src_fn} COMPILE_DEFINITIONS) - if(${_cmpl_options_defs}) - set(_combined_options_defs ${_cmpl_options_defs} "${_compiler_definitions}") - else() - set(_combined_options_defs "${_compiler_definitions}") - endif() - set_source_files_properties( - ${_src_fn} - PROPERTIES COMPILE_DEFINITIONS "${_combined_options_defs}" - ) -endforeach() - set(_linker_options "LINKER:${DPNP_LDFLAGS}") foreach(python_module_name ${_py_trgts}) target_compile_options(