Skip to content

Commit 3d6bee4

Browse files
Merge branch 'master' into convolve
2 parents 58e859a + 6ff4e02 commit 3d6bee4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1557
-1273
lines changed

.github/workflows/array-api-skips.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ array_api_tests/test_operators_and_elementwise_functions.py::test_clip
66
# unexpected result is returned - unmute when dpctl-1986 is resolved
77
array_api_tests/test_operators_and_elementwise_functions.py::test_asin
88
array_api_tests/test_operators_and_elementwise_functions.py::test_asinh
9+
10+
# advanced indexing relating issues (waiting a fix from dpctl)
11+
array_api_tests/test_array_object.py::test_getitem_arrays_and_ints_1[1]
12+
array_api_tests/test_array_object.py::test_getitem_arrays_and_ints_1[None]
13+
array_api_tests/test_array_object.py::test_getitem_arrays_and_ints_2[1]
14+
array_api_tests/test_array_object.py::test_getitem_arrays_and_ints_2[None]

.github/workflows/check-mkl-interfaces.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848

4949
- name: Merge conda env files
5050
run: |
51-
conda-merge ${{ env.build-with-oneapi-env }} ${{ env.dpctl-pkg-env }} ${{ env.oneapi-pkgs-env }} > ${{ env.environment-file }}
51+
conda-merge ${{ env.dpctl-pkg-env }} ${{ env.oneapi-pkgs-env }} ${{ env.build-with-oneapi-env }} > ${{ env.environment-file }}
5252
cat ${{ env.environment-file }}
5353
5454
- name: Upload artifact

.github/workflows/conda-package.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ jobs:
9393
continue-on-error: true
9494
run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.channels-list }} conda-recipe
9595
env:
96-
MAX_BUILD_CMPL_MKL_VERSION: '2025.1a0'
96+
MAX_BUILD_CMPL_MKL_VERSION: '2025.2a0'
9797

9898
- name: ReBuild conda package
9999
if: steps.build_conda_pkg.outcome == 'failure'
100100
run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.channels-list }} conda-recipe
101101
env:
102-
MAX_BUILD_CMPL_MKL_VERSION: '2025.1a0'
102+
MAX_BUILD_CMPL_MKL_VERSION: '2025.2a0'
103103

104104
- name: Upload artifact
105105
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -625,6 +625,7 @@ jobs:
625625
python -m pytest --json-report --json-report-file=${{ env.json-report-file }} --disable-deadline --skips-file ${{ env.array-api-skips-file }} array_api_tests || true
626626
env:
627627
ARRAY_API_TESTS_MODULE: 'dpnp'
628+
ARRAY_API_TESTS_VERSION: '2024.12'
628629
SYCL_CACHE_PERSISTENT: 1
629630
working-directory: ${{ env.array-api-tests-path }}
630631

.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@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12
71+
uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
7272
with:
7373
sarif_file: results.sarif

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3030

3131
- name: Set up python
32-
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
32+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
3333
with:
3434
python-version: '3.13'
3535

.pre-commit-config.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/PyCQA/bandit
5-
rev: '1.7.9'
5+
rev: '1.8.3'
66
hooks:
77
- id: bandit
88
pass_filenames: false
99
args: ["-r", "dpnp", "-lll"]
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.6.0
11+
rev: v5.0.0
1212
hooks:
1313
- id: check-ast
1414
- id: check-builtin-literals
@@ -44,17 +44,18 @@ repos:
4444
- id: rst-inline-touching-normal
4545
- id: text-unicode-replacement-char
4646
- repo: https://github.com/codespell-project/codespell
47-
rev: v2.3.0
47+
rev: v2.4.1
4848
hooks:
4949
- id: codespell
50+
args: ["-L", "abd"] # ignore "abd" used in einsum tests
5051
additional_dependencies:
5152
- tomli
5253
- repo: https://github.com/psf/black
53-
rev: 24.4.2
54+
rev: 25.1.0
5455
hooks:
5556
- id: black
5657
- repo: https://github.com/pycqa/isort
57-
rev: 5.13.2
58+
rev: 6.0.1
5859
hooks:
5960
- id: isort
6061
name: isort (python)
@@ -65,20 +66,20 @@ repos:
6566
name: isort (pyi)
6667
types: [pyi]
6768
- repo: https://github.com/pycqa/flake8
68-
rev: 7.1.0
69+
rev: 7.1.2
6970
hooks:
7071
- id: flake8
7172
args: ["--config=.flake8"]
7273
additional_dependencies:
7374
- flake8-docstrings==1.7.0
74-
- flake8-bugbear==24.4.26
75+
- flake8-bugbear==24.12.12
7576
- repo: https://github.com/pocc/pre-commit-hooks
7677
rev: v1.3.5
7778
hooks:
7879
- id: clang-format
7980
args: ["-i"]
8081
- repo: https://github.com/gitleaks/gitleaks
81-
rev: v8.18.4
82+
rev: v8.24.0
8283
hooks:
8384
- id: gitleaks
8485
- repo: https://github.com/jumanjihouse/pre-commit-hooks
@@ -102,3 +103,8 @@ repos:
102103
"--disable=unused-wildcard-import"
103104
]
104105
files: '^dpnp/(dpnp_iface.*|fft|linalg)'
106+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
107+
rev: v2.14.0
108+
hooks:
109+
- id: pretty-format-toml
110+
args: [--autofix]

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
* Added implementation of `dpnp.blackman` [#2363](https://github.com/IntelPython/dpnp/pull/2363)
1414
* Added implementation of `dpnp.bartlett` [#2366](https://github.com/IntelPython/dpnp/pull/2366)
1515
* Added implementation of `dpnp.convolve` [#2205](https://github.com/IntelPython/dpnp/pull/2205)
16+
* Added implementation of `dpnp.kaiser` [#2387](https://github.com/IntelPython/dpnp/pull/2387)
1617

1718
### Changed
1819

19-
* Extended `dpnp.fft.fftfreq` and `dpnp.fft.rfftfreq` functions to support `dtype` keyword per Python Array API spec 2024.12 [#2384](https://github.com/IntelPython/dpnp/pull/2384)
20+
* Improved performance of `dpnp.nansum`, `dpnp.nanprod`, `dpnp.nancumsum`, and `dpnp.nancumprod` by reusing `dpnp.nan_to_num` function in implementation of the functions [#2339](https://github.com/IntelPython/dpnp/pull/2339)
2021
* Allowed input array of `uint64` dtype in `dpnp.bincount` [#2361](https://github.com/IntelPython/dpnp/pull/2361)
2122
* The vector norms `ord={None, 1, 2, inf}` and the matrix norms `ord={None, 1, 2, inf, "fro", "nuc"}` now consistently return zero for empty arrays, which are arrays with at least one axis of size zero. This change affects `dpnp.linalg.norm`, `dpnp.linalg.vector_norm`, and `dpnp.linalg.matrix_norm`. Previously, dpnp would either raise errors or return zero depending on the parameters provided [#2371](https://github.com/IntelPython/dpnp/pull/2371)
23+
* Extended `dpnp.fft.fftfreq` and `dpnp.fft.rfftfreq` functions to support `dtype` keyword per Python Array API spec 2024.12 [#2384](https://github.com/IntelPython/dpnp/pull/2384)
24+
* Updated `dpnp.fix` to return output with the same data-type of input [#2392](https://github.com/IntelPython/dpnp/pull/2392)
2225

2326
### Fixed
2427

2528
* Resolved an issue with an incorrect result returned due to missing dependency from the strided kernel on a copy event in `dpnp.erf` [#2378](https://github.com/IntelPython/dpnp/pull/2378)
29+
* Updated `conda create` commands build and install instructions of `Quick start guide` to avoid a compilation error [#2395](https://github.com/IntelPython/dpnp/pull/2395)
2630

2731

2832
## [0.17.0] - 02/26/2025

doc/quick_start_guide.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,18 @@ On Linux:
8888

8989
.. code-block:: bash
9090
91-
conda create -n build-env dpctl cython dpcpp_linux-64 mkl-devel-dpcpp tbb-devel onedpl-devel cmake scikit-build ninja pytest -c https://software.repos.intel.com/python/conda/ -c conda-forge
91+
conda create -n build-env dpctl cython dpcpp_linux-64 mkl-devel-dpcpp tbb-devel \
92+
onedpl-devel cmake scikit-build ninja pytest intel-gpu-ocl-icd-system \
93+
-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge
9294
conda activate build-env
9395
9496
On Windows:
9597

9698
.. code-block:: bash
9799
98-
conda create -n build-env dpctl cython dpcpp_win-64 mkl-devel-dpcpp tbb-devel onedpl-devel cmake scikit-build ninja pytest -c https://software.repos.intel.com/python/conda/ -c conda-forge
100+
conda create -n build-env dpctl cython dpcpp_win-64 mkl-devel-dpcpp tbb-devel \
101+
onedpl-devel cmake scikit-build ninja pytest intel-gpu-ocl-icd-system \
102+
-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge
99103
conda activate build-env
100104
101105
To build and install the package on Linux OS, run:

dpnp/backend/extensions/blas/blas_py.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ PYBIND11_MODULE(_blas_impl, m)
6262
using event_vecT = std::vector<sycl::event>;
6363

6464
{
65-
dot_ns::init_dot_dispatch_vector<dot_impl_fn_ptr_t,
66-
blas_ns::DotContigFactory>(
65+
dot_ns::init_dot_dispatch_vector<blas_ns::DotContigFactory>(
6766
dot_dispatch_vector);
6867

6968
auto dot_pyapi = [&](sycl::queue &exec_q, const arrayT &src1,
@@ -81,8 +80,7 @@ PYBIND11_MODULE(_blas_impl, m)
8180
}
8281

8382
{
84-
dot_ns::init_dot_dispatch_vector<dot_impl_fn_ptr_t,
85-
blas_ns::DotcContigFactory>(
83+
dot_ns::init_dot_dispatch_vector<blas_ns::DotcContigFactory>(
8684
dotc_dispatch_vector);
8785

8886
auto dotc_pyapi = [&](sycl::queue &exec_q, const arrayT &src1,
@@ -101,8 +99,7 @@ PYBIND11_MODULE(_blas_impl, m)
10199
}
102100

103101
{
104-
dot_ns::init_dot_dispatch_vector<dot_impl_fn_ptr_t,
105-
blas_ns::DotuContigFactory>(
102+
dot_ns::init_dot_dispatch_vector<blas_ns::DotuContigFactory>(
106103
dotu_dispatch_vector);
107104

108105
auto dotu_pyapi = [&](sycl::queue &exec_q, const arrayT &src1,

dpnp/backend/extensions/blas/dot_common.hpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ typedef sycl::event (*dot_impl_fn_ptr_t)(sycl::queue &,
5050
namespace dpctl_td_ns = dpctl::tensor::type_dispatch;
5151
namespace py = pybind11;
5252

53-
template <typename dispatchT>
5453
std::pair<sycl::event, sycl::event>
5554
dot_func(sycl::queue &exec_q,
5655
const dpctl::tensor::usm_ndarray &vectorX,
5756
const dpctl::tensor::usm_ndarray &vectorY,
5857
const dpctl::tensor::usm_ndarray &result,
5958
const std::vector<sycl::event> &depends,
60-
const dispatchT &dot_dispatch_vector)
59+
const dot_impl_fn_ptr_t *dot_dispatch_vector)
6160
{
6261
const int vectorX_nd = vectorX.get_ndim();
6362
const int vectorY_nd = vectorY.get_ndim();
@@ -166,12 +165,10 @@ std::pair<sycl::event, sycl::event>
166165
return std::make_pair(args_ev, dot_ev);
167166
}
168167

169-
template <typename dispatchT,
170-
template <typename fnT, typename T>
171-
typename factoryT>
172-
void init_dot_dispatch_vector(dispatchT dot_dispatch_vector[])
168+
template <template <typename fnT, typename T> typename factoryT>
169+
void init_dot_dispatch_vector(dot_impl_fn_ptr_t dot_dispatch_vector[])
173170
{
174-
dpctl_td_ns::DispatchVectorBuilder<dispatchT, factoryT,
171+
dpctl_td_ns::DispatchVectorBuilder<dot_impl_fn_ptr_t, factoryT,
175172
dpctl_td_ns::num_types>
176173
contig;
177174
contig.populate_dispatch_vector(dot_dispatch_vector);

dpnp/backend/extensions/window/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
set(python_module_name _window_impl)
2828
set(_module_src
29+
${CMAKE_CURRENT_SOURCE_DIR}/kaiser.cpp
2930
${CMAKE_CURRENT_SOURCE_DIR}/window_py.cpp
3031
)
3132

dpnp/backend/extensions/window/common.hpp

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@ sycl::event window_impl(sycl::queue &q,
6767
return window_ev;
6868
}
6969

70-
template <typename dispatchT>
71-
std::pair<sycl::event, sycl::event>
72-
py_window(sycl::queue &exec_q,
70+
template <typename funcPtrT>
71+
std::tuple<size_t, char *, funcPtrT>
72+
window_fn(sycl::queue &exec_q,
7373
const dpctl::tensor::usm_ndarray &result,
74-
const std::vector<sycl::event> &depends,
75-
const dispatchT &window_dispatch_vector)
74+
const funcPtrT *window_dispatch_vector)
7675
{
7776
dpctl::tensor::validation::CheckWritable::throw_if_not_writable(result);
7877

@@ -93,30 +92,48 @@ std::pair<sycl::event, sycl::event>
9392

9493
size_t nelems = result.get_size();
9594
if (nelems == 0) {
96-
return std::make_pair(sycl::event{}, sycl::event{});
95+
return std::make_tuple(nelems, nullptr, nullptr);
9796
}
9897

9998
int result_typenum = result.get_typenum();
10099
auto array_types = dpctl_td_ns::usm_ndarray_types();
101100
int result_type_id = array_types.typenum_to_lookup_id(result_typenum);
102-
auto fn = window_dispatch_vector[result_type_id];
101+
funcPtrT fn = window_dispatch_vector[result_type_id];
103102

104103
if (fn == nullptr) {
105104
throw std::runtime_error("Type of given array is not supported");
106105
}
107106

108107
char *result_typeless_ptr = result.get_data();
108+
return std::make_tuple(nelems, result_typeless_ptr, fn);
109+
}
110+
111+
inline std::pair<sycl::event, sycl::event>
112+
py_window(sycl::queue &exec_q,
113+
const dpctl::tensor::usm_ndarray &result,
114+
const std::vector<sycl::event> &depends,
115+
const window_fn_ptr_t *window_dispatch_vector)
116+
{
117+
auto [nelems, result_typeless_ptr, fn] =
118+
window_fn<window_fn_ptr_t>(exec_q, result, window_dispatch_vector);
119+
120+
if (nelems == 0) {
121+
return std::make_pair(sycl::event{}, sycl::event{});
122+
}
123+
109124
sycl::event window_ev = fn(exec_q, result_typeless_ptr, nelems, depends);
110125
sycl::event args_ev =
111126
dpctl::utils::keep_args_alive(exec_q, {result}, {window_ev});
112127

113128
return std::make_pair(args_ev, window_ev);
114129
}
115130

116-
template <template <typename fnT, typename T> typename factoryT>
117-
void init_window_dispatch_vectors(window_fn_ptr_t window_dispatch_vector[])
131+
template <typename funcPtrT,
132+
template <typename fnT, typename T>
133+
typename factoryT>
134+
void init_window_dispatch_vectors(funcPtrT window_dispatch_vector[])
118135
{
119-
dpctl_td_ns::DispatchVectorBuilder<window_fn_ptr_t, factoryT,
136+
dpctl_td_ns::DispatchVectorBuilder<funcPtrT, factoryT,
120137
dpctl_td_ns::num_types>
121138
contig;
122139
contig.populate_dispatch_vector(window_dispatch_vector);

0 commit comments

Comments
 (0)