Skip to content

Commit

Permalink
Merge master into move_tests_folder
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-perevezentsev committed Nov 14, 2024
2 parents 5274a5e + 078d9a3 commit af3205d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
33 changes: 22 additions & 11 deletions dpnp/backend/kernels/dpnp_krnl_elemwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
using dpctl::tensor::kernels::alignment_utils::is_aligned;
using dpctl::tensor::kernels::alignment_utils::required_alignment;

using sycl::ext::oneapi::experimental::group_load;
using sycl::ext::oneapi::experimental::group_store;

template <typename T>
constexpr T dispatch_erf_op(T elem)
{
Expand Down Expand Up @@ -523,41 +526,49 @@ static void func_map_init_elemwise_1arg_1type(func_map_t &fmap)
_DataType_input2, \
_DataType_output>) \
{ \
sycl::vec<_DataType_input1, vec_sz> x1 = \
sg.load<vec_sz>(input1_multi_ptr); \
sycl::vec<_DataType_input2, vec_sz> x2 = \
sg.load<vec_sz>(input2_multi_ptr); \
sycl::vec<_DataType_input1, vec_sz> x1{}; \
sycl::vec<_DataType_input2, vec_sz> x2{}; \
\
group_load(sg, input1_multi_ptr, x1); \
group_load(sg, input2_multi_ptr, x2); \
\
res_vec = __vec_operation__; \
} \
else /* input types don't match result type, so \
explicit casting is required */ \
{ \
sycl::vec<_DataType_input1, vec_sz> tmp_x1{}; \
sycl::vec<_DataType_input2, vec_sz> tmp_x2{}; \
\
group_load(sg, input1_multi_ptr, tmp_x1); \
group_load(sg, input2_multi_ptr, tmp_x2); \
\
sycl::vec<_DataType_output, vec_sz> x1 = \
dpnp_vec_cast<_DataType_output, \
_DataType_input1, vec_sz>( \
sg.load<vec_sz>(input1_multi_ptr)); \
tmp_x1); \
sycl::vec<_DataType_output, vec_sz> x2 = \
dpnp_vec_cast<_DataType_output, \
_DataType_input2, vec_sz>( \
sg.load<vec_sz>(input2_multi_ptr)); \
tmp_x2); \
\
res_vec = __vec_operation__; \
} \
} \
else { \
sycl::vec<_DataType_input1, vec_sz> x1 = \
sg.load<vec_sz>(input1_multi_ptr); \
sycl::vec<_DataType_input2, vec_sz> x2 = \
sg.load<vec_sz>(input2_multi_ptr); \
sycl::vec<_DataType_input1, vec_sz> x1{}; \
sycl::vec<_DataType_input2, vec_sz> x2{}; \
\
group_load(sg, input1_multi_ptr, x1); \
group_load(sg, input2_multi_ptr, x2); \
\
for (size_t k = 0; k < vec_sz; ++k) { \
const _DataType_output input1_elem = x1[k]; \
const _DataType_output input2_elem = x2[k]; \
res_vec[k] = __operation__; \
} \
} \
sg.store<vec_sz>(result_multi_ptr, res_vec); \
group_store(sg, res_vec, result_multi_ptr); \
} \
else { \
for (size_t k = start + sg.get_local_id()[0]; \
Expand Down
4 changes: 2 additions & 2 deletions dpnp/dpnp_iface_histograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def bincount(x, weights=None, minlength=None):
-------
out : dpnp.ndarray of ints
The result of binning the input array.
The length of `out` is equal to ``np.amax(x) + 1``.
The length of `out` is equal to ``dpnp.max(x) + 1``.
See Also
--------
Expand Down Expand Up @@ -353,7 +353,7 @@ def bincount(x, weights=None, minlength=None):
...
TypeError: x must be an integer array
A possible use of ``bincount`` is to perform sums over
A possible use of :obj:`dpnp.bincount` is to perform sums over
variable-size chunks of an array, using the `weights` keyword.
>>> w = np.array([0.3, 0.5, 0.2, 0.7, 1., -0.6], dtype=np.float32) # weights
Expand Down

0 comments on commit af3205d

Please sign in to comment.