Skip to content

Commit 1c13fd8

Browse files
authored
Merge branch 'master' into reduce-bloat-in-tensor-test-suite
2 parents b5f5800 + 8c1f794 commit 1c13fd8

14 files changed

Lines changed: 134 additions & 44 deletions

File tree

.github/workflows/conda-package.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ jobs:
9191
- name: Build conda package
9292
id: build_conda_pkg
9393
continue-on-error: true
94-
run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.channels-list }} conda-recipe
94+
run: conda-build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.channels-list }} conda-recipe
9595
env:
96-
MAX_BUILD_CMPL_MKL_VERSION: '2026.0a0'
96+
MAX_BUILD_CMPL_MKL_VERSION: '2027.0a0'
9797

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

104104
- name: Upload artifact
105105
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/cron-run-tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ jobs:
8181
python-version: ${{ matrix.python }}
8282
activate-environment: ${{ env.test-env-name }}
8383

84+
- name: Install OCL CPU RT from Intel channel
85+
run: mamba install intel-opencl-rt=*=intel_* ${{ env.channels-list }}
86+
8487
- name: Install dpnp
8588
id: install_dpnp
8689
continue-on-error: true
@@ -92,9 +95,6 @@ jobs:
9295
run: |
9396
mamba install ${{ env.package-name }}=${{ steps.find_latest_tag.outputs.tag }} ${{ env.test-packages }} ${{ env.channels-list }}
9497
95-
- name: Install OCL CPU RT from Intel channel
96-
run: mamba install intel-opencl-rt=*=intel_* ${{ env.channels-list }}
97-
9898
- name: List installed packages
9999
run: mamba list
100100

.github/workflows/generate_coverage.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,18 @@ jobs:
4646
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
4747
sudo apt update
4848
49-
- name: Install latest Intel OneAPI
49+
# Pinned to OneAPI 2025.3 due to known 2026.0 DPC++ compiler issue with Segfault during the sycl-post-link
50+
# TODO: renmove once CMPLRLLVM-75178 is resolved and released
51+
- name: Install Intel OneAPI
5052
if: env.oneapi-pkgs-env == ''
5153
run: |
52-
sudo apt install hwloc \
53-
intel-oneapi-mkl \
54-
intel-oneapi-umf \
55-
intel-oneapi-mkl-devel \
56-
intel-oneapi-tbb-devel \
57-
intel-oneapi-libdpstd-devel \
58-
intel-oneapi-compiler-dpcpp-cpp
54+
sudo apt install hwloc \
55+
intel-oneapi-mkl-2025.3 \
56+
intel-oneapi-umf-1.0 \
57+
intel-oneapi-mkl-devel-2025.3 \
58+
intel-oneapi-tbb-devel-2022.3 \
59+
intel-oneapi-libdpstd-devel-2022.10 \
60+
intel-oneapi-compiler-dpcpp-cpp-2025.3
5961
6062
- name: Checkout repo
6163
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -107,10 +109,14 @@ jobs:
107109
# with a newer version of the DPC++ compiler).
108110
# Installing dpctl via the pip manager has no such limitation, as the package has no
109111
# run dependency on the DPC++ RT pip package, so this is why the step is necessary here.
112+
# - name: Install dpctl
113+
# if: env.oneapi-pkgs-env == ''
114+
# run: |
115+
# pip install -r ${{ env.dpctl-pkg-txt }}
116+
# TODO: renmove pinning once CMPLRLLVM-75178 is resolved and released
110117
- name: Install dpctl
111-
if: env.oneapi-pkgs-env == ''
112118
run: |
113-
pip install -r ${{ env.dpctl-pkg-txt }}
119+
pip install dpctl>=0.23.0dev0 --index-url https://pypi.anaconda.org/dppy/label/coverage/simple
114120
115121
- name: Conda info
116122
run: |

.github/workflows/openssf-scorecard.yml

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

7373
# Upload the results to GitHub's code scanning dashboard.
7474
- name: "Upload to code-scanning"
75-
uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
75+
uses: github/codeql-action/upload-sarif@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
7676
with:
7777
sarif_file: results.sarif

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ repos:
6969
- id: black
7070
exclude: "dpnp/_version.py"
7171
- repo: https://github.com/pycqa/isort
72-
rev: 8.0.1
72+
rev: 9.0.0a3
7373
hooks:
7474
- id: isort
7575
name: isort (python)
@@ -89,7 +89,7 @@ repos:
8989
- flake8-docstrings==1.7.0
9090
- flake8-bugbear==24.12.12
9191
- repo: https://github.com/pre-commit/mirrors-clang-format
92-
rev: v22.1.3
92+
rev: v22.1.4
9393
hooks:
9494
- id: clang-format
9595
args: ["-i"]

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
### Fixed
1818

19+
* Fixed incorrect in-place advanced indexing for 4D arrays when using `range` or `list` as index keys [#2872](https://github.com/IntelPython/dpnp/pull/2872)
20+
* Fixed `conda build` command syntax in GitHub workflows and documentation to use `conda-build` [#2888](https://github.com/IntelPython/dpnp/pull/2888)
21+
1922
### Security
2023

2124

conda-recipe/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% set max_compiler_and_mkl_version = environ.get("MAX_BUILD_CMPL_MKL_VERSION", "2027.0a0") %}
2-
{% set required_compiler_and_mkl_version = "2025.0" %}
3-
{% set required_dpctl_version = "0.22.0*" %}
2+
{% set required_compiler_and_mkl_version = "2026.0" %}
3+
{% set required_dpctl_version = "0.22.0" %}
44

55
{% set pyproject = load_file_data('pyproject.toml') %}
66
{% set py_build_deps = pyproject.get('build-system', {}).get('requires', []) %}

doc/quick_start_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ And to build dpnp package from the sources:
7474

7575
.. code-block:: bash
7676
77-
conda build conda-recipe -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels
77+
conda-build conda-recipe -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels
7878
7979
Finally, to install the result package:
8080

dpnp/dpnp_array.py

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
import warnings
4040

41+
import numpy
42+
4143
import dpnp
4244
import dpnp.tensor as dpt
4345
import dpnp.tensor._type_utils as dtu
@@ -46,24 +48,45 @@
4648
from .exceptions import AxisError
4749

4850

51+
def _unwrap_index_element(x):
52+
"""
53+
Unwrap a single index element for the tensor indexing layer.
54+
55+
Converts dpnp arrays to usm_ndarray and array-like objects (range, list)
56+
to numpy arrays with intp dtype for NumPy-compatible advanced indexing.
57+
58+
"""
59+
60+
if isinstance(x, dpt.usm_ndarray):
61+
return x
62+
if isinstance(x, dpnp_array):
63+
return x.get_array()
64+
if isinstance(x, range):
65+
return numpy.asarray(x, dtype=numpy.intp)
66+
if isinstance(x, list):
67+
# keep boolean lists as boolean
68+
arr = numpy.asarray(x)
69+
# cast empty lists (float64 in NumPy) to intp
70+
# for correct tensor indexing
71+
if arr.size == 0:
72+
arr = arr.astype(numpy.intp)
73+
return arr
74+
return x
75+
76+
4977
def _get_unwrapped_index_key(key):
5078
"""
5179
Get an unwrapped index key.
5280
5381
Return a key where each nested instance of DPNP array is unwrapped into
54-
USM ndarray for further processing in DPCTL advanced indexing functions.
82+
USM ndarray, and array-like objects (range, list) are converted to numpy
83+
arrays for further processing in advanced indexing functions.
5584
5685
"""
5786

5887
if isinstance(key, tuple):
59-
if any(isinstance(x, dpnp_array) for x in key):
60-
# create a new tuple from the input key with unwrapped DPNP arrays
61-
return tuple(
62-
x.get_array() if isinstance(x, dpnp_array) else x for x in key
63-
)
64-
elif isinstance(key, dpnp_array):
65-
return key.get_array()
66-
return key
88+
return tuple(_unwrap_index_element(x) for x in key)
89+
return _unwrap_index_element(key)
6790

6891

6992
# pylint: disable=too-many-public-methods

dpnp/tensor/_slicing.pxi

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@ cdef bint _is_boolean(object x) except *:
104104
return f in "?"
105105
else:
106106
return False
107-
if callable(getattr(x, "__bool__", None)):
108-
try:
109-
x.__bool__()
110-
except (TypeError, ValueError):
111-
return False
112-
return True
113107
return False
114108

115109

0 commit comments

Comments
 (0)