|
1 | 1 | //*****************************************************************************
|
2 |
| -// Copyright (c) 2016-2020, Intel Corporation |
| 2 | +// Copyright (c) 2016-2023, Intel Corporation |
3 | 3 | // All rights reserved.
|
4 | 4 | //
|
5 | 5 | // Redistribution and use in source and binary forms, with or without
|
|
31 | 31 | * Parameters:
|
32 | 32 | * - public name of the function and kernel name
|
33 | 33 | * - operation used to calculate the result
|
| 34 | + * - vector operation over SYCL group used to calculate the result |
| 35 | + * - list of types vector operation accepts |
34 | 36 | * - mkl operation used to calculate the result
|
| 37 | + * - list of types mkl operation accepts |
35 | 38 | *
|
36 | 39 | */
|
37 | 40 |
|
|
41 | 44 |
|
42 | 45 | #ifdef _SECTION_DOCUMENTATION_GENERATION_
|
43 | 46 |
|
44 |
| -#define MACRO_2ARG_3TYPES_OP(__name__, __operation1__, __operation2__) \ |
| 47 | +#define MACRO_2ARG_3TYPES_OP( \ |
| 48 | + __name__, __operation__, __vec_operation__, __vec_types__, __mkl_operation__, __mkl_types__) \ |
45 | 49 | /** @ingroup BACKEND_API */ \
|
46 | 50 | /** @brief Per element operation function __name__ */ \
|
47 | 51 | /** */ \
|
48 |
| - /** Function "__name__" executes operator "__operation1__" over corresponding elements of input arrays */ \ |
| 52 | + /** Function "__name__" executes operator "__operation__" over corresponding elements of input arrays */ \ |
49 | 53 | /** */ \
|
50 | 54 | /** @param[in] q_ref Reference to SYCL queue. */ \
|
51 | 55 | /** @param[out] result_out Output array. */ \
|
|
105 | 109 |
|
106 | 110 | #endif
|
107 | 111 |
|
108 |
| -MACRO_2ARG_3TYPES_OP(dpnp_add_c, input1_elem + input2_elem, oneapi::mkl::vm::add) |
109 |
| -MACRO_2ARG_3TYPES_OP(dpnp_arctan2_c, sycl::atan2((double)input1_elem, (double)input2_elem), oneapi::mkl::vm::atan2) |
| 112 | +MACRO_2ARG_3TYPES_OP(dpnp_add_c, |
| 113 | + input1_elem + input2_elem, |
| 114 | + sycl::add_sat(x1, x2), |
| 115 | + MACRO_UNPACK_TYPES(int, long), |
| 116 | + oneapi::mkl::vm::add, |
| 117 | + MACRO_UNPACK_TYPES(float, double, std::complex<float>, std::complex<double>)) |
| 118 | + |
| 119 | +MACRO_2ARG_3TYPES_OP(dpnp_arctan2_c, |
| 120 | + sycl::atan2((double)input1_elem, (double)input2_elem), |
| 121 | + nullptr, |
| 122 | + std::false_type, |
| 123 | + oneapi::mkl::vm::atan2, |
| 124 | + MACRO_UNPACK_TYPES(float, double)) |
| 125 | + |
110 | 126 | MACRO_2ARG_3TYPES_OP(dpnp_copysign_c,
|
111 | 127 | sycl::copysign((double)input1_elem, (double)input2_elem),
|
112 |
| - oneapi::mkl::vm::copysign) |
113 |
| -MACRO_2ARG_3TYPES_OP(dpnp_divide_c, input1_elem / input2_elem, oneapi::mkl::vm::div) |
114 |
| -MACRO_2ARG_3TYPES_OP(dpnp_fmod_c, sycl::fmod((double)input1_elem, (double)input2_elem), oneapi::mkl::vm::fmod) |
115 |
| -MACRO_2ARG_3TYPES_OP(dpnp_hypot_c, sycl::hypot((double)input1_elem, (double)input2_elem), oneapi::mkl::vm::hypot) |
116 |
| -MACRO_2ARG_3TYPES_OP(dpnp_maximum_c, sycl::max(input1_elem, input2_elem), oneapi::mkl::vm::fmax) |
117 |
| -MACRO_2ARG_3TYPES_OP(dpnp_minimum_c, sycl::min(input1_elem, input2_elem), oneapi::mkl::vm::fmin) |
| 128 | + nullptr, |
| 129 | + std::false_type, |
| 130 | + oneapi::mkl::vm::copysign, |
| 131 | + MACRO_UNPACK_TYPES(float, double)) |
| 132 | + |
| 133 | +MACRO_2ARG_3TYPES_OP(dpnp_divide_c, |
| 134 | + input1_elem / input2_elem, |
| 135 | + nullptr, |
| 136 | + std::false_type, |
| 137 | + oneapi::mkl::vm::div, |
| 138 | + MACRO_UNPACK_TYPES(float, double)) |
| 139 | + |
| 140 | +MACRO_2ARG_3TYPES_OP(dpnp_fmod_c, |
| 141 | + sycl::fmod((double)input1_elem, (double)input2_elem), |
| 142 | + nullptr, |
| 143 | + std::false_type, |
| 144 | + oneapi::mkl::vm::fmod, |
| 145 | + MACRO_UNPACK_TYPES(float, double)) |
| 146 | + |
| 147 | +MACRO_2ARG_3TYPES_OP(dpnp_hypot_c, |
| 148 | + sycl::hypot((double)input1_elem, (double)input2_elem), |
| 149 | + nullptr, |
| 150 | + std::false_type, |
| 151 | + oneapi::mkl::vm::hypot, |
| 152 | + MACRO_UNPACK_TYPES(float, double)) |
| 153 | + |
| 154 | +MACRO_2ARG_3TYPES_OP(dpnp_maximum_c, |
| 155 | + sycl::max(input1_elem, input2_elem), |
| 156 | + nullptr, |
| 157 | + std::false_type, |
| 158 | + oneapi::mkl::vm::fmax, |
| 159 | + MACRO_UNPACK_TYPES(float, double)) |
| 160 | + |
| 161 | +MACRO_2ARG_3TYPES_OP(dpnp_minimum_c, |
| 162 | + sycl::min(input1_elem, input2_elem), |
| 163 | + nullptr, |
| 164 | + std::false_type, |
| 165 | + oneapi::mkl::vm::fmin, |
| 166 | + MACRO_UNPACK_TYPES(float, double)) |
118 | 167 |
|
119 | 168 | // "multiply" needs to be standalone kernel (not autogenerated) due to complex algorithm. This is not an element wise.
|
120 | 169 | // pytest "tests/third_party/cupy/creation_tests/test_ranges.py::TestMgrid::test_mgrid3"
|
121 | 170 | // requires multiplication shape1[10] with shape2[10,1] and result expected as shape[10,10]
|
122 |
| -MACRO_2ARG_3TYPES_OP(dpnp_multiply_c, input1_elem* input2_elem, oneapi::mkl::vm::mul) |
| 171 | +MACRO_2ARG_3TYPES_OP(dpnp_multiply_c, |
| 172 | + input1_elem* input2_elem, |
| 173 | + nullptr, |
| 174 | + std::false_type, |
| 175 | + oneapi::mkl::vm::mul, |
| 176 | + MACRO_UNPACK_TYPES(float, double, std::complex<float>, std::complex<double>)) |
| 177 | + |
| 178 | +MACRO_2ARG_3TYPES_OP(dpnp_power_c, |
| 179 | + sycl::pow((double)input1_elem, (double)input2_elem), |
| 180 | + nullptr, |
| 181 | + std::false_type, |
| 182 | + oneapi::mkl::vm::pow, |
| 183 | + MACRO_UNPACK_TYPES(float, double)) |
123 | 184 |
|
124 |
| -MACRO_2ARG_3TYPES_OP(dpnp_power_c, sycl::pow((double)input1_elem, (double)input2_elem), oneapi::mkl::vm::pow) |
125 |
| -MACRO_2ARG_3TYPES_OP(dpnp_subtract_c, input1_elem - input2_elem, oneapi::mkl::vm::sub) |
| 185 | +MACRO_2ARG_3TYPES_OP(dpnp_subtract_c, |
| 186 | + input1_elem - input2_elem, |
| 187 | + nullptr, |
| 188 | + std::false_type, |
| 189 | + oneapi::mkl::vm::sub, |
| 190 | + MACRO_UNPACK_TYPES(float, double)) |
126 | 191 |
|
127 | 192 | #undef MACRO_2ARG_3TYPES_OP
|
0 commit comments