Skip to content

Commit 49d4339

Browse files
authored
Merge branch 'master' into in-place-element-wise-func-casting
2 parents d3e0c45 + ea718e3 commit 49d4339

16 files changed

+95
-89
lines changed

.github/workflows/conda-package.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ jobs:
148148
149149
- name: Test conda channel
150150
run: |
151-
mamba search ${{ env.PACKAGE_NAME }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }}
151+
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }}
152152
cat ${{ env.ver-json-path }}
153153
154154
- name: Get package version
@@ -182,7 +182,7 @@ jobs:
182182
id: run_tests_linux
183183
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
184184
with:
185-
timeout_minutes: 10
185+
timeout_minutes: 12
186186
max_attempts: ${{ env.RUN_TESTS_MAX_ATTEMPTS }}
187187
retry_on: any
188188
command: |
@@ -264,7 +264,7 @@ jobs:
264264
- name: Test conda channel
265265
run: |
266266
@echo on
267-
mamba search ${{ env.PACKAGE_NAME }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }}
267+
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }}
268268
269269
- name: Dump version.json
270270
run: more ${{ env.ver-json-path }}

.github/workflows/openssf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ jobs:
6868

6969
# Upload the results to GitHub's code scanning dashboard.
7070
- name: "Upload to code-scanning"
71-
uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
71+
uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
7272
with:
7373
sarif_file: results.sarif

doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,10 @@ def _can_document_member(member, *args, **kwargs):
218218

219219
intersphinx_mapping = {
220220
"python": ("https://docs.python.org/3/", None),
221-
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
221+
"numpy": ("https://numpy.org/doc/stable/", None),
222222
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
223223
"dpctl": ("https://intelpython.github.io/dpctl/latest/", None),
224+
"cupy": ("https://docs.cupy.dev/en/stable/", None),
224225
}
225226

226227
# If true, `todo` and `todoList` produce output, else they produce nothing.

doc/known_words.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
al
22
ary
33
backend
4+
bandlimited
45
bitwise
56
boolean
67
broadcastable
78
broadcasted
89
byteorder
10+
cardinalis
911
Cholesky
1012
combinatorially
1113
conda
@@ -34,11 +36,16 @@ fs
3436
getter
3537
Golub
3638
Hadamard
39+
histogrammed
3740
Hypergeometric
41+
kwargs
42+
iaxis
3843
iinfo
3944
Infs
4045
intp
46+
ints
4147
iterable
48+
Lanczos
4249
Lomax
4350
Mersenne
4451
meshgrid
@@ -47,13 +54,17 @@ multinomial
4754
multivalued
4855
NaN
4956
NaT
57+
nd
5058
ndarray
5159
ndarrays
5260
ndim
5361
Nj
5462
Nk
5563
normed
5664
nuc
65+
numpy
66+
nx
67+
ny
5768
Nyquist
5869
oneAPI
5970
ord
@@ -62,12 +73,15 @@ Penrose
6273
Polyutils
6374
pre
6475
prepend
76+
prepended
6577
prepending
6678
representable
79+
resampling
6780
runtimes
6881
scikit
6982
signbit
7083
signum
84+
sinc
7185
subarray
7286
subarrays
7387
subclasses
@@ -84,7 +98,9 @@ ufunc
8498
ufuncs
8599
Unary
86100
unscaled
101+
unstacked
87102
unicode
103+
Upcasting
88104
usm
89105
Vandermonde
90106
vectorized

dpnp/backend/kernels/dpnp_krnl_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* sycl::ext::oneapi::experimental::properties was added.
4141
*/
4242
#ifndef __SYCL_COMPILER_REDUCTION_PROPERTIES_SUPPORT
43-
#define __SYCL_COMPILER_REDUCTION_PROPERTIES_SUPPORT 20241210L
43+
#define __SYCL_COMPILER_REDUCTION_PROPERTIES_SUPPORT 20241208L
4444
#endif
4545

4646
namespace mkl_blas = oneapi::mkl::blas;

dpnp/backend/kernels/dpnp_krnl_elemwise.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@
4141
using dpctl::tensor::kernels::alignment_utils::is_aligned;
4242
using dpctl::tensor::kernels::alignment_utils::required_alignment;
4343

44-
using sycl::ext::oneapi::experimental::group_load;
45-
using sycl::ext::oneapi::experimental::group_store;
44+
namespace syclex = sycl::ext::oneapi::experimental;
45+
using syclex::group_load;
46+
using syclex::group_store;
47+
48+
constexpr auto striped = syclex::properties{syclex::data_placement_striped};
4649

4750
template <typename T>
4851
constexpr T dispatch_erf_op(T elem)
@@ -529,8 +532,8 @@ static void func_map_init_elemwise_1arg_1type(func_map_t &fmap)
529532
sycl::vec<_DataType_input1, vec_sz> x1{}; \
530533
sycl::vec<_DataType_input2, vec_sz> x2{}; \
531534
\
532-
group_load(sg, input1_multi_ptr, x1); \
533-
group_load(sg, input2_multi_ptr, x2); \
535+
group_load(sg, input1_multi_ptr, x1, striped); \
536+
group_load(sg, input2_multi_ptr, x2, striped); \
534537
\
535538
res_vec = __vec_operation__; \
536539
} \
@@ -540,8 +543,10 @@ static void func_map_init_elemwise_1arg_1type(func_map_t &fmap)
540543
sycl::vec<_DataType_input1, vec_sz> tmp_x1{}; \
541544
sycl::vec<_DataType_input2, vec_sz> tmp_x2{}; \
542545
\
543-
group_load(sg, input1_multi_ptr, tmp_x1); \
544-
group_load(sg, input2_multi_ptr, tmp_x2); \
546+
group_load(sg, input1_multi_ptr, tmp_x1, \
547+
striped); \
548+
group_load(sg, input2_multi_ptr, tmp_x2, \
549+
striped); \
545550
\
546551
sycl::vec<_DataType_output, vec_sz> x1 = \
547552
dpnp_vec_cast<_DataType_output, \
@@ -559,16 +564,16 @@ static void func_map_init_elemwise_1arg_1type(func_map_t &fmap)
559564
sycl::vec<_DataType_input1, vec_sz> x1{}; \
560565
sycl::vec<_DataType_input2, vec_sz> x2{}; \
561566
\
562-
group_load(sg, input1_multi_ptr, x1); \
563-
group_load(sg, input2_multi_ptr, x2); \
567+
group_load(sg, input1_multi_ptr, x1, striped); \
568+
group_load(sg, input2_multi_ptr, x2, striped); \
564569
\
565570
for (size_t k = 0; k < vec_sz; ++k) { \
566571
const _DataType_output input1_elem = x1[k]; \
567572
const _DataType_output input2_elem = x2[k]; \
568573
res_vec[k] = __operation__; \
569574
} \
570575
} \
571-
group_store(sg, res_vec, result_multi_ptr); \
576+
group_store(sg, res_vec, result_multi_ptr, striped); \
572577
} \
573578
else { \
574579
for (size_t k = start + sg.get_local_id()[0]; \

dpnp/backend/kernels/elementwise_functions/i0.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* sycl::ext::intel::math::cyl_bessel_i0(x) is fully resolved.
3333
*/
3434
#ifndef __SYCL_COMPILER_BESSEL_I0_SUPPORT
35-
#define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241210L
35+
#define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241208L
3636
#endif
3737

3838
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT

dpnp/dpnp_iface_histograms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def bincount(x, weights=None, minlength=None):
321321
Parameters
322322
----------
323323
x : {dpnp.ndarray, usm_ndarray}
324-
Input 1-dimensional array with nonnegative integer values.
324+
Input 1-dimensional array with non-negative integer values.
325325
weights : {None, dpnp.ndarray, usm_ndarray}, optional
326326
Weights, array of the same shape as `x`.
327327
Default: ``None``

dpnp/dpnp_iface_mathematical.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _get_max_min(dtype):
152152
return f.max, f.min
153153

154154

155-
def _get_reduction_res_dt(a, dtype, _out):
155+
def _get_reduction_res_dt(a, dtype):
156156
"""Get a data type used by dpctl for result array in reduction function."""
157157

158158
if dtype is None:
@@ -1106,11 +1106,10 @@ def cumprod(a, axis=None, dtype=None, out=None):
11061106
usm_a = dpnp.get_usm_ndarray(a)
11071107

11081108
return dpnp_wrap_reduction_call(
1109-
a,
1109+
usm_a,
11101110
out,
11111111
dpt.cumulative_prod,
1112-
_get_reduction_res_dt,
1113-
usm_a,
1112+
_get_reduction_res_dt(a, dtype),
11141113
axis=axis,
11151114
dtype=dtype,
11161115
)
@@ -1196,11 +1195,10 @@ def cumsum(a, axis=None, dtype=None, out=None):
11961195
usm_a = dpnp.get_usm_ndarray(a)
11971196

11981197
return dpnp_wrap_reduction_call(
1199-
a,
1198+
usm_a,
12001199
out,
12011200
dpt.cumulative_sum,
1202-
_get_reduction_res_dt,
1203-
usm_a,
1201+
_get_reduction_res_dt(a, dtype),
12041202
axis=axis,
12051203
dtype=dtype,
12061204
)
@@ -1281,11 +1279,10 @@ def cumulative_prod(
12811279
"""
12821280

12831281
return dpnp_wrap_reduction_call(
1284-
x,
1282+
dpnp.get_usm_ndarray(x),
12851283
out,
12861284
dpt.cumulative_prod,
1287-
_get_reduction_res_dt,
1288-
dpnp.get_usm_ndarray(x),
1285+
_get_reduction_res_dt(x, dtype),
12891286
axis=axis,
12901287
dtype=dtype,
12911288
include_initial=include_initial,
@@ -1373,11 +1370,10 @@ def cumulative_sum(
13731370
"""
13741371

13751372
return dpnp_wrap_reduction_call(
1376-
x,
1373+
dpnp.get_usm_ndarray(x),
13771374
out,
13781375
dpt.cumulative_sum,
1379-
_get_reduction_res_dt,
1380-
dpnp.get_usm_ndarray(x),
1376+
_get_reduction_res_dt(x, dtype),
13811377
axis=axis,
13821378
dtype=dtype,
13831379
include_initial=include_initial,
@@ -3524,11 +3520,10 @@ def prod(
35243520
usm_a = dpnp.get_usm_ndarray(a)
35253521

35263522
return dpnp_wrap_reduction_call(
3527-
a,
3523+
usm_a,
35283524
out,
35293525
dpt.prod,
3530-
_get_reduction_res_dt,
3531-
usm_a,
3526+
_get_reduction_res_dt(a, dtype),
35323527
axis=axis,
35333528
dtype=dtype,
35343529
keepdims=keepdims,
@@ -4297,11 +4292,10 @@ def sum(
42974292

42984293
usm_a = dpnp.get_usm_ndarray(a)
42994294
return dpnp_wrap_reduction_call(
4300-
a,
4295+
usm_a,
43014296
out,
43024297
dpt.sum,
4303-
_get_reduction_res_dt,
4304-
usm_a,
4298+
_get_reduction_res_dt(a, dtype),
43054299
axis=axis,
43064300
dtype=dtype,
43074301
keepdims=keepdims,

dpnp/dpnp_iface_searching.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@
4848
__all__ = ["argmax", "argmin", "argwhere", "searchsorted", "where"]
4949

5050

51-
def _get_search_res_dt(a, _dtype, out):
51+
def _get_search_res_dt(a, out):
5252
"""Get a data type used by dpctl for result array in search function."""
5353

5454
# get a data type used by dpctl for result array in search function
5555
res_dt = dti.default_device_index_type(a.sycl_device)
5656

5757
# numpy raises TypeError if "out" data type mismatch default index type
58-
if not dpnp.can_cast(out.dtype, res_dt, casting="safe"):
58+
if out is not None and not dpnp.can_cast(out.dtype, res_dt, casting="safe"):
5959
raise TypeError(
6060
f"Cannot cast from {out.dtype} to {res_dt} "
6161
"according to the rule safe."
@@ -143,11 +143,10 @@ def argmax(a, axis=None, out=None, *, keepdims=False):
143143

144144
usm_a = dpnp.get_usm_ndarray(a)
145145
return dpnp_wrap_reduction_call(
146-
a,
146+
usm_a,
147147
out,
148148
dpt.argmax,
149-
_get_search_res_dt,
150-
usm_a,
149+
_get_search_res_dt(a, out),
151150
axis=axis,
152151
keepdims=keepdims,
153152
)
@@ -234,11 +233,10 @@ def argmin(a, axis=None, out=None, *, keepdims=False):
234233

235234
usm_a = dpnp.get_usm_ndarray(a)
236235
return dpnp_wrap_reduction_call(
237-
a,
236+
usm_a,
238237
out,
239238
dpt.argmin,
240-
_get_search_res_dt,
241-
usm_a,
239+
_get_search_res_dt(a, out),
242240
axis=axis,
243241
keepdims=keepdims,
244242
)

dpnp/dpnp_iface_statistics.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ def _count_reduce_items(arr, axis, where=True):
115115
return items
116116

117117

118-
def _get_comparison_res_dt(a, _dtype, _out):
119-
"""Get a data type used by dpctl for result array in comparison function."""
120-
121-
return a.dtype
122-
123-
124118
def amax(a, axis=None, out=None, keepdims=False, initial=None, where=True):
125119
"""
126120
Return the maximum of an array or maximum along an axis.
@@ -760,11 +754,10 @@ def max(a, axis=None, out=None, keepdims=False, initial=None, where=True):
760754
usm_a = dpnp.get_usm_ndarray(a)
761755

762756
return dpnp_wrap_reduction_call(
763-
a,
757+
usm_a,
764758
out,
765759
dpt.max,
766-
_get_comparison_res_dt,
767-
usm_a,
760+
a.dtype,
768761
axis=axis,
769762
keepdims=keepdims,
770763
)
@@ -1026,11 +1019,10 @@ def min(a, axis=None, out=None, keepdims=False, initial=None, where=True):
10261019
usm_a = dpnp.get_usm_ndarray(a)
10271020

10281021
return dpnp_wrap_reduction_call(
1029-
a,
1022+
usm_a,
10301023
out,
10311024
dpt.min,
1032-
_get_comparison_res_dt,
1033-
usm_a,
1025+
a.dtype,
10341026
axis=axis,
10351027
keepdims=keepdims,
10361028
)

0 commit comments

Comments
 (0)