Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse logical operations from dpctl.tensor #1464

Merged
merged 5 commits into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 2 additions & 56 deletions dpnp/backend/include/dpnp_gen_1arg_1type_tbl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,60 +104,6 @@ MACRO_1ARG_1TYPE_OP(dpnp_square_c,

#undef MACRO_1ARG_1TYPE_OP

#elif defined(MACRO_1ARG_1TYPE_LOGIC_OP)

/*
* This header file contains single argument element wise functions definitions
*
* Macro `MACRO_1ARG_1TYPE_LOGIC_OP` must be defined before usage
*
* Parameters:
* - public name of the function and kernel name
* - operation used to calculate the result
*
*/

#ifdef _SECTION_DOCUMENTATION_GENERATION_

#define MACRO_1ARG_1TYPE_LOGIC_OP(__name__, __operation__) \
/** @ingroup BACKEND_API */ \
/** @brief Per element operation function __name__ */ \
/** */ \
/** Function "__name__" executes operator "__operation__" over \
* corresponding elements of input array */ \
/** */ \
/** @param[in] q_ref Reference to SYCL queue. */ \
/** @param[out] result_out Output array. */ \
/** @param[in] result_size Output array size. */ \
/** @param[in] result_ndim Number of output array \
* dimensions. */ \
/** @param[in] result_shape Output array shape. */ \
/** @param[in] result_strides Output array strides. */ \
/** @param[in] input1_in Input array 1. */ \
/** @param[in] input1_size Input array 1 size. */ \
/** @param[in] input1_ndim Number of input array 1 \
* dimensions. */ \
/** @param[in] input1_shape Input array 1 shape. */ \
/** @param[in] input1_strides Input array 1 strides. */ \
/** @param[in] where Where condition. */ \
/** @param[in] dep_event_vec_ref Reference to vector of SYCL \
* events. */ \
template <typename _DataType_input1> \
DPCTLSyclEventRef __name__( \
DPCTLSyclQueueRef q_ref, void *result_out, const size_t result_size, \
const size_t result_ndim, const shape_elem_type *result_shape, \
const shape_elem_type *result_strides, const void *input1_in, \
const size_t input1_size, const size_t input1_ndim, \
const shape_elem_type *input1_shape, \
const shape_elem_type *input1_strides, const size_t *where, \
const DPCTLEventVectorRef dep_event_vec_ref);

#endif // _SECTION_DOCUMENTATION_GENERATION_

MACRO_1ARG_1TYPE_LOGIC_OP(dpnp_logical_not_c, !input1_elem)

#undef MACRO_1ARG_1TYPE_LOGIC_OP

#else
#error "MACRO_1ARG_1TYPE_OP or MACRO_1ARG_1TYPE_LOGIC_OP is not defined"
#endif // MACRO_1ARG_1TYPE_OP || MACRO_1ARG_1TYPE_LOGIC_OP
#error "MACRO_1ARG_1TYPE_OP is not defined"
#endif // MACRO_1ARG_1TYPE_OP
4 changes: 0 additions & 4 deletions dpnp/backend/include/dpnp_gen_2arg_2type_tbl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ MACRO_2ARG_2TYPES_LOGIC_OP(dpnp_greater_c, input1_elem > input2_elem)
MACRO_2ARG_2TYPES_LOGIC_OP(dpnp_greater_equal_c, input1_elem >= input2_elem)
MACRO_2ARG_2TYPES_LOGIC_OP(dpnp_less_c, input1_elem < input2_elem)
MACRO_2ARG_2TYPES_LOGIC_OP(dpnp_less_equal_c, input1_elem <= input2_elem)
MACRO_2ARG_2TYPES_LOGIC_OP(dpnp_logical_and_c, input1_elem &&input2_elem)
MACRO_2ARG_2TYPES_LOGIC_OP(dpnp_logical_or_c, input1_elem || input2_elem)
MACRO_2ARG_2TYPES_LOGIC_OP(dpnp_logical_xor_c,
(!!input1_elem) != (!!input2_elem))
MACRO_2ARG_2TYPES_LOGIC_OP(dpnp_not_equal_c, input1_elem != input2_elem)

#undef MACRO_2ARG_2TYPES_LOGIC_OP
10 changes: 1 addition & 9 deletions dpnp/backend/include/dpnp_iface_fptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,7 @@ enum class DPNPFuncName : size_t
DPNP_FN_LOG1P, /**< Used in numpy.log1p() impl */
DPNP_FN_LOG1P_EXT, /**< Used in numpy.log1p() impl, requires extra
parameters */
DPNP_FN_LOGICAL_AND_EXT, /**< Used in numpy.logical_and() impl, requires
extra parameters */
DPNP_FN_LOGICAL_NOT_EXT, /**< Used in numpy.logical_not() impl, requires
extra parameters */
DPNP_FN_LOGICAL_OR_EXT, /**< Used in numpy.logical_or() impl, requires extra
parameters */
DPNP_FN_LOGICAL_XOR_EXT, /**< Used in numpy.logical_xor() impl, requires
extra parameters */
DPNP_FN_MATMUL, /**< Used in numpy.matmul() impl */
DPNP_FN_MATMUL, /**< Used in numpy.matmul() impl */
DPNP_FN_MATMUL_EXT, /**< Used in numpy.matmul() impl, requires extra
parameters */
DPNP_FN_MATRIX_RANK, /**< Used in numpy.linalg.matrix_rank() impl */
Expand Down
Loading