Skip to content

Commit

Permalink
Clean up legacy indexing implementation from the backend (#1908)
Browse files Browse the repository at this point in the history
* Clean up legacy indexing implementation from the backend

* fix pre-commit
  • Loading branch information
npolina4 authored Jul 4, 2024
1 parent 2fff1f1 commit 03b585b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1,019 deletions.
224 changes: 0 additions & 224 deletions dpnp/backend/include/dpnp_iface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,38 +205,6 @@ INP_DLLEXPORT void dpnp_nanvar_c(void *array,
const size_t result_size,
size_t size);

/**
* @ingroup BACKEND_API
* @brief Return the indices of the elements that are non-zero.
*
* @param [in] q_ref Reference to SYCL queue.
* @param [in] array1 Input array.
* @param [out] result1 Output array.
* @param [in] result_size Output array size.
* @param [in] shape Shape of input array.
* @param [in] ndim Number of elements in shape.
* @param [in] j Number input array.
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
*/
template <typename _DataType>
INP_DLLEXPORT DPCTLSyclEventRef
dpnp_nonzero_c(DPCTLSyclQueueRef q_ref,
const void *array1,
void *result1,
const size_t result_size,
const shape_elem_type *shape,
const size_t ndim,
const size_t j,
const DPCTLEventVectorRef dep_event_vec_ref);

template <typename _DataType>
INP_DLLEXPORT void dpnp_nonzero_c(const void *array1,
void *result1,
const size_t result_size,
const shape_elem_type *shape,
const size_t ndim,
const size_t j);

/**
* @ingroup BACKEND_API
* @brief Custom implementation of dot function
Expand Down Expand Up @@ -448,35 +416,6 @@ INP_DLLEXPORT void dpnp_partition_c(void *array,
const shape_elem_type *shape,
const size_t ndim);

/**
* @ingroup BACKEND_API
* @brief Place of array elements
*
* @param [in] q_ref Reference to SYCL queue.
* @param [in] arr Input array.
* @param [in] mask Mask array.
* @param [in] vals Vals array.
* @param [in] arr_size Number of input elements in `arr`.
* @param [in] vals_size Number of input elements in `vals`.
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
*/
template <typename _DataType>
INP_DLLEXPORT DPCTLSyclEventRef
dpnp_place_c(DPCTLSyclQueueRef q_ref,
void *arr,
long *mask,
void *vals,
const size_t arr_size,
const size_t vals_size,
const DPCTLEventVectorRef dep_event_vec_ref);

template <typename _DataType>
INP_DLLEXPORT void dpnp_place_c(void *arr,
long *mask,
void *vals,
const size_t arr_size,
const size_t vals_size);

/**
* @ingroup BACKEND_API
* @brief Compute Product of input array elements.
Expand Down Expand Up @@ -523,78 +462,6 @@ INP_DLLEXPORT void dpnp_prod_c(void *result_out,
const void *initial,
const long *where);

/**
* @ingroup BACKEND_API
* @brief Replaces specified elements of an array with given values.
*
* @param [in] q_ref Reference to SYCL queue.
* @param [in] array Input array.
* @param [in] ind Target indices, interpreted as integers.
* @param [in] v Values to place in array at target indices.
* @param [in] size Number of input elements in `array`.
* @param [in] size_ind Number of input elements in `ind`.
* @param [in] size_v Number of input elements in `v`.
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
*/
template <typename _DataType, typename _IndecesType, typename _ValueType>
INP_DLLEXPORT DPCTLSyclEventRef
dpnp_put_c(DPCTLSyclQueueRef q_ref,
void *array,
void *ind,
void *v,
const size_t size,
const size_t size_ind,
const size_t size_v,
const DPCTLEventVectorRef dep_event_vec_ref);

template <typename _DataType, typename _IndecesType, typename _ValueType>
INP_DLLEXPORT void dpnp_put_c(void *array,
void *ind,
void *v,
const size_t size,
const size_t size_ind,
const size_t size_v);

/**
* @ingroup BACKEND_API
* @brief Put values into the destination array by matching 1d index and data
* slices.
*
* @param [in] q_ref Reference to SYCL queue.
* @param [in] arr_in Input array.
* @param [in] indices_in Indices to change along each 1d slice of
* arr.
* @param [in] values_in Values to insert at those indices.
* @param [in] axis The axis to take 1d slices along.
* @param [in] shape Shape of input array.
* @param [in] ndim Number of input array dimensions.
* @param [in] size_indices Size of indices.
* @param [in] values_size Size of values.
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
*/
template <typename _DataType>
INP_DLLEXPORT DPCTLSyclEventRef
dpnp_put_along_axis_c(DPCTLSyclQueueRef q_ref,
void *arr_in,
long *indices_in,
void *values_in,
size_t axis,
const shape_elem_type *shape,
size_t ndim,
size_t size_indices,
size_t values_size,
const DPCTLEventVectorRef dep_event_vec_ref);

template <typename _DataType>
INP_DLLEXPORT void dpnp_put_along_axis_c(void *arr_in,
long *indices_in,
void *values_in,
size_t axis,
const shape_elem_type *shape,
size_t ndim,
size_t size_indices,
size_t values_size);

/**
* @ingroup BACKEND_API
Expand Down Expand Up @@ -776,42 +643,6 @@ INP_DLLEXPORT void dpnp_choose_c(void *result1,
size_t choices_size,
size_t choice_size);

/**
* @ingroup BACKEND_API
* @brief math library implementation of diagonal function
*
* @param [in] q_ref Reference to SYCL queue.
* @param [in] array1_in Input array with data.
* @param [in] input1_size Input1 data size.
* @param [out] result1 Output array.
* @param [in] offset Offset of the diagonal from the main
* diagonal.
* @param [in] shape Shape of input array.
* @param [in] res_shape Shape of output array.
* @param [in] res_ndim Number of elements in shape.
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
*/
template <typename _DataType>
INP_DLLEXPORT DPCTLSyclEventRef
dpnp_diagonal_c(DPCTLSyclQueueRef q_ref,
void *array1_in,
const size_t input1_size,
void *result1,
const size_t offset,
shape_elem_type *shape,
shape_elem_type *res_shape,
const size_t res_ndim,
const DPCTLEventVectorRef dep_event_vec_ref);

template <typename _DataType>
INP_DLLEXPORT void dpnp_diagonal_c(void *array1_in,
const size_t input1_size,
void *result1,
const size_t offset,
shape_elem_type *shape,
shape_elem_type *res_shape,
const size_t res_ndim);

/**
* @ingroup BACKEND_API
* @brief implementation of creating filled with value array function
Expand Down Expand Up @@ -1044,35 +875,6 @@ INP_DLLEXPORT void dpnp_std_c(void *array,
size_t naxis,
size_t ddof);

/**
* @ingroup BACKEND_API
* @brief math library implementation of take function
*
* @param [in] q_ref Reference to SYCL queue.
* @param [in] array Input array with data.
* @param [in] array1_size Input array size.
* @param [in] indices Input array with indices.
* @param [out] result Output array.
* @param [in] size Number of elements in the input array.
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
*/
template <typename _DataType, typename _IndecesType>
INP_DLLEXPORT DPCTLSyclEventRef
dpnp_take_c(DPCTLSyclQueueRef q_ref,
void *array,
const size_t array1_size,
void *indices,
void *result,
size_t size,
const DPCTLEventVectorRef dep_event_vec_ref);

template <typename _DataType, typename _IndecesType>
INP_DLLEXPORT void dpnp_take_c(void *array,
const size_t array1_size,
void *indices,
void *result,
size_t size);

/**
* @ingroup BACKEND_API
* @brief math library implementation of var function
Expand Down Expand Up @@ -1183,32 +985,6 @@ INP_DLLEXPORT void dpnp_var_c(void *array,

#include <dpnp_gen_2arg_3type_tbl.hpp>

/**
* @ingroup BACKEND_API
* @brief fill_diagonal function.
*
* @param [in] q_ref Reference to SYCL queue.
* @param [in] array1_in Input array.
* @param [in] val Value to write on the diagonal.
* @param [in] shape Input shape.
* @param [in] ndim Number of elements in shape.
* @param [in] dep_event_vec_ref Reference to vector of SYCL events.
*/
template <typename _DataType>
INP_DLLEXPORT DPCTLSyclEventRef
dpnp_fill_diagonal_c(DPCTLSyclQueueRef q_ref,
void *array1_in,
void *val,
shape_elem_type *shape,
const size_t ndim,
const DPCTLEventVectorRef dep_event_vec_ref);

template <typename _DataType>
INP_DLLEXPORT void dpnp_fill_diagonal_c(void *array1_in,
void *val,
shape_elem_type *shape,
const size_t ndim);

/**
* @ingroup BACKEND_API
* @brief modf function.
Expand Down
49 changes: 21 additions & 28 deletions dpnp/backend/include/dpnp_iface_fptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,20 @@ enum class DPNPFuncName : size_t
DPNP_FN_DEGREES, /**< Used in numpy.degrees() impl */
DPNP_FN_DEGREES_EXT, /**< Used in numpy.degrees() impl, requires extra
parameters */
DPNP_FN_DIAGONAL, /**< Used in numpy.diagonal() impl */
DPNP_FN_DOT, /**< Used in numpy.dot() impl */
DPNP_FN_DOT_EXT, /**< Used in numpy.dot() impl, requires extra parameters */
DPNP_FN_EDIFF1D, /**< Used in numpy.ediff1d() impl */
DPNP_FN_EDIFF1D_EXT, /**< Used in numpy.ediff1d() impl, requires extra
parameters */
DPNP_FN_ERF, /**< Used in scipy.special.erf impl */
DPNP_FN_ERF_EXT, /**< Used in scipy.special.erf impl, requires extra
parameters */
DPNP_FN_FFT_FFT, /**< Used in numpy.fft.fft() impl */
DPNP_FN_FFT_FFT_EXT, /**< Used in numpy.fft.fft() impl, requires extra
parameters */
DPNP_FN_FFT_RFFT, /**< Used in numpy.fft.rfft() impl */
DPNP_FN_FFT_RFFT_EXT, /**< Used in numpy.fft.rfft() impl, requires extra
parameters */
DPNP_FN_FILL_DIAGONAL, /**< Used in numpy.fill_diagonal() impl */
DPNP_FN_EDIFF1D_EXT, /**< Used in numpy.ediff1d() impl, requires extra
parameters */
DPNP_FN_ERF, /**< Used in scipy.special.erf impl */
DPNP_FN_ERF_EXT, /**< Used in scipy.special.erf impl, requires extra
parameters */
DPNP_FN_FFT_FFT, /**< Used in numpy.fft.fft() impl */
DPNP_FN_FFT_FFT_EXT, /**< Used in numpy.fft.fft() impl, requires extra
parameters */
DPNP_FN_FFT_RFFT, /**< Used in numpy.fft.rfft() impl */
DPNP_FN_FFT_RFFT_EXT, /**< Used in numpy.fft.rfft() impl, requires extra
parameters */
DPNP_FN_INITVAL, /**< Used in numpy ones, ones_like, zeros, zeros_like impls
*/
DPNP_FN_INITVAL_EXT, /**< Used in numpy ones, ones_like, zeros, zeros_like
Expand All @@ -116,23 +114,19 @@ enum class DPNPFuncName : size_t
*/
DPNP_FN_MULTIPLY, /**< Used in numpy.multiply() impl */
DPNP_FN_NANVAR, /**< Used in numpy.nanvar() impl */
DPNP_FN_NONZERO, /**< Used in numpy.nonzero() impl */
DPNP_FN_ONES, /**< Used in numpy.ones() impl */
DPNP_FN_ONES_LIKE, /**< Used in numpy.ones_like() impl */
DPNP_FN_PARTITION, /**< Used in numpy.partition() impl */
DPNP_FN_PARTITION_EXT, /**< Used in numpy.partition() impl, requires extra
parameters */
DPNP_FN_PLACE, /**< Used in numpy.place() impl */
DPNP_FN_PROD, /**< Used in numpy.prod() impl */
DPNP_FN_PUT, /**< Used in numpy.put() impl */
DPNP_FN_PUT_ALONG_AXIS, /**< Used in numpy.put_along_axis() impl */
DPNP_FN_RADIANS, /**< Used in numpy.radians() impl */
DPNP_FN_RADIANS_EXT, /**< Used in numpy.radians() impl, requires extra
parameters */
DPNP_FN_RNG_BETA, /**< Used in numpy.random.beta() impl */
DPNP_FN_RNG_BETA_EXT, /**< Used in numpy.random.beta() impl, requires extra
parameters */
DPNP_FN_RNG_BINOMIAL, /**< Used in numpy.random.binomial() impl */
DPNP_FN_PARTITION_EXT, /**< Used in numpy.partition() impl, requires extra
parameters */
DPNP_FN_PROD, /**< Used in numpy.prod() impl */
DPNP_FN_RADIANS, /**< Used in numpy.radians() impl */
DPNP_FN_RADIANS_EXT, /**< Used in numpy.radians() impl, requires extra
parameters */
DPNP_FN_RNG_BETA, /**< Used in numpy.random.beta() impl */
DPNP_FN_RNG_BETA_EXT, /**< Used in numpy.random.beta() impl, requires extra
parameters */
DPNP_FN_RNG_BINOMIAL, /**< Used in numpy.random.binomial() impl */
DPNP_FN_RNG_BINOMIAL_EXT, /**< Used in numpy.random.binomial() impl,
requires extra parameters */
DPNP_FN_RNG_CHISQUARE, /**< Used in numpy.random.chisquare() impl */
Expand Down Expand Up @@ -253,7 +247,6 @@ enum class DPNPFuncName : size_t
*/
DPNP_FN_STD, /**< Used in numpy.std() impl */
DPNP_FN_SUM, /**< Used in numpy.sum() impl */
DPNP_FN_TAKE, /**< Used in numpy.take() impl */
DPNP_FN_VAR, /**< Used in numpy.var() impl */
DPNP_FN_ZEROS, /**< Used in numpy.zeros() impl */
DPNP_FN_ZEROS_LIKE, /**< Used in numpy.zeros_like() impl */
Expand Down
Loading

0 comments on commit 03b585b

Please sign in to comment.