|
| 1 | +//***************************************************************************** |
| 2 | +// Copyright (c) 2023, Intel Corporation |
| 3 | +// All rights reserved. |
| 4 | +// |
| 5 | +// Redistribution and use in source and binary forms, with or without |
| 6 | +// modification, are permitted provided that the following conditions are met: |
| 7 | +// - Redistributions of source code must retain the above copyright notice, |
| 8 | +// this list of conditions and the following disclaimer. |
| 9 | +// - Redistributions in binary form must reproduce the above copyright notice, |
| 10 | +// this list of conditions and the following disclaimer in the documentation |
| 11 | +// and/or other materials provided with the distribution. |
| 12 | +// |
| 13 | +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 14 | +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 16 | +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 17 | +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 18 | +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 19 | +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 20 | +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 21 | +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 | +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 | +// THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | +//***************************************************************************** |
| 25 | + |
| 26 | +/* |
| 27 | + * This header file contains single argument element wise functions definitions |
| 28 | + * |
| 29 | + * Macro `MACRO_2ARG_2TYPES_LOGIC_OP` must be defined before usage |
| 30 | + * |
| 31 | + * Parameters: |
| 32 | + * - public name of the function and kernel name |
| 33 | + * - operation used to calculate the result |
| 34 | + * |
| 35 | + */ |
| 36 | + |
| 37 | +#ifndef MACRO_2ARG_2TYPES_LOGIC_OP |
| 38 | +#error "MACRO_2ARG_2TYPES_LOGIC_OP is not defined" |
| 39 | +#endif |
| 40 | + |
| 41 | +#ifdef _SECTION_DOCUMENTATION_GENERATION_ |
| 42 | + |
| 43 | +#define MACRO_2ARG_2TYPES_LOGIC_OP(__name__, __operation__) \ |
| 44 | + /** @ingroup BACKEND_API */ \ |
| 45 | + /** @brief Per element operation function __name__ */ \ |
| 46 | + /** */ \ |
| 47 | + /** Function "__name__" executes operator "__operation__" over corresponding elements of input arrays */ \ |
| 48 | + /** */ \ |
| 49 | + /** @param[in] q_ref Reference to SYCL queue. */ \ |
| 50 | + /** @param[out] result_out Output array. */ \ |
| 51 | + /** @param[in] result_size Output array size. */ \ |
| 52 | + /** @param[in] result_ndim Number of output array dimensions. */ \ |
| 53 | + /** @param[in] result_shape Output array shape. */ \ |
| 54 | + /** @param[in] result_strides Output array strides. */ \ |
| 55 | + /** @param[in] input1_in Input array 1. */ \ |
| 56 | + /** @param[in] input1_size Input array 1 size. */ \ |
| 57 | + /** @param[in] input1_ndim Number of input array 1 dimensions. */ \ |
| 58 | + /** @param[in] input1_shape Input array 1 shape. */ \ |
| 59 | + /** @param[in] input1_strides Input array 1 strides. */ \ |
| 60 | + /** @param[in] input2_in Input array 2. */ \ |
| 61 | + /** @param[in] input2_size Input array 2 size. */ \ |
| 62 | + /** @param[in] input2_ndim Number of input array 2 dimensions. */ \ |
| 63 | + /** @param[in] input2_shape Input array 2 shape. */ \ |
| 64 | + /** @param[in] input2_strides Input array 2 strides. */ \ |
| 65 | + /** @param[in] where Where condition. */ \ |
| 66 | + /** @param[in] dep_event_vec_ref Reference to vector of SYCL events. */ \ |
| 67 | + template <typename _DataType_output, typename _DataType_input1, typename _DataType_input2> \ |
| 68 | + DPCTLSyclEventRef __name__(DPCTLSyclQueueRef q_ref, \ |
| 69 | + void* result_out, \ |
| 70 | + const size_t result_size, \ |
| 71 | + const size_t result_ndim, \ |
| 72 | + const shape_elem_type* result_shape, \ |
| 73 | + const shape_elem_type* result_strides, \ |
| 74 | + const void* input1_in, \ |
| 75 | + const size_t input1_size, \ |
| 76 | + const size_t input1_ndim, \ |
| 77 | + const shape_elem_type* input1_shape, \ |
| 78 | + const shape_elem_type* input1_strides, \ |
| 79 | + const void* input2_in, \ |
| 80 | + const size_t input2_size, \ |
| 81 | + const size_t input2_ndim, \ |
| 82 | + const shape_elem_type* input2_shape, \ |
| 83 | + const shape_elem_type* input2_strides, \ |
| 84 | + const size_t* where, \ |
| 85 | + const DPCTLEventVectorRef dep_event_vec_ref); |
| 86 | + |
| 87 | +#endif |
| 88 | + |
| 89 | +MACRO_2ARG_2TYPES_LOGIC_OP(dpnp_less_equal_c, input1_elem <= input2_elem) |
| 90 | + |
| 91 | +#undef MACRO_2ARG_2TYPES_LOGIC_OP |
0 commit comments