Skip to content

Commit 74ce2de

Browse files
committed
Merge branch 'add_cfd_keyword_in_random' of https://github.com/antonwolfy/dpnp into add_cfd_keyword_in_random
2 parents b747c13 + 98171f7 commit 74ce2de

13 files changed

+539
-127
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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

dpnp/backend/include/dpnp_iface.hpp

+23
Original file line numberDiff line numberDiff line change
@@ -1806,6 +1806,29 @@ INP_DLLEXPORT void dpnp_invert_c(void* array1_in, void* result, size_t size);
18061806

18071807
#include <dpnp_gen_1arg_2type_tbl.hpp>
18081808

1809+
#define MACRO_2ARG_2TYPES_LOGIC_OP(__name__, __operation__) \
1810+
template <typename _DataType_output, typename _DataType_input1, typename _DataType_input2> \
1811+
INP_DLLEXPORT DPCTLSyclEventRef __name__(DPCTLSyclQueueRef q_ref, \
1812+
void* result_out, \
1813+
const size_t result_size, \
1814+
const size_t result_ndim, \
1815+
const shape_elem_type* result_shape, \
1816+
const shape_elem_type* result_strides, \
1817+
const void* input1_in, \
1818+
const size_t input1_size, \
1819+
const size_t input1_ndim, \
1820+
const shape_elem_type* input1_shape, \
1821+
const shape_elem_type* input1_strides, \
1822+
const void* input2_in, \
1823+
const size_t input2_size, \
1824+
const size_t input2_ndim, \
1825+
const shape_elem_type* input2_shape, \
1826+
const shape_elem_type* input2_strides, \
1827+
const size_t* where, \
1828+
const DPCTLEventVectorRef dep_event_vec_ref);
1829+
1830+
#include <dpnp_gen_2arg_2type_tbl.hpp>
1831+
18091832
#define MACRO_2ARG_3TYPES_OP(__name__, __operation1__, __operation2__) \
18101833
template <typename _DataType_output, typename _DataType_input1, typename _DataType_input2> \
18111834
INP_DLLEXPORT DPCTLSyclEventRef __name__(DPCTLSyclQueueRef q_ref, \

dpnp/backend/include/dpnp_iface_fptr.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ enum class DPNPFuncName : size_t
193193
DPNP_FN_KRON_EXT, /**< Used in numpy.kron() impl, requires extra parameters */
194194
DPNP_FN_LEFT_SHIFT, /**< Used in numpy.left_shift() impl */
195195
DPNP_FN_LEFT_SHIFT_EXT, /**< Used in numpy.left_shift() impl, requires extra parameters */
196+
DPNP_FN_LESS_EQUAL_EXT, /**< Used in numpy.less_equal() impl, requires extra parameters */
196197
DPNP_FN_LOG, /**< Used in numpy.log() impl */
197198
DPNP_FN_LOG_EXT, /**< Used in numpy.log() impl, requires extra parameters */
198199
DPNP_FN_LOG10, /**< Used in numpy.log10() impl */

0 commit comments

Comments
 (0)