Skip to content

Commit 0560eea

Browse files
authored
Merge branch 'master' into impl-lib.as_strided
2 parents c3a0069 + b05c07a commit 0560eea

8 files changed

Lines changed: 39 additions & 73 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This release is compatible with NumPy 2.5.
3535
* Updated Python Array API specification version supported to `2025.12` [#2899](https://github.com/IntelPython/dpnp/pull/2899)
3636
* Replaced references to the `dpnp.amax`/`dpnp.amin` aliases with the canonical `dpnp.max`/`dpnp.min` in docstrings and code internally [#2990](https://github.com/IntelPython/dpnp/pull/2990)
3737
* Aligned the signature of `dpnp.tensor.expand_dims` with the Python array API by making `axis` a required argument [#2988](https://github.com/IntelPython/dpnp/pull/2988)
38+
* Removed dead code branches guarded by outdated oneMKL and DPC++ compiler version checks [#2999](https://github.com/IntelPython/dpnp/pull/2999)
3839

3940
### Deprecated
4041

@@ -67,6 +68,7 @@ This release is compatible with NumPy 2.5.
6768
* Fixed `dpnp.tensor.acosh` and `dpnp.tensor.acos` returning infinity for complex numbers with large negative real parts [#2928](https://github.com/IntelPython/dpnp/pull/2928)
6869
* Fixed `__array_namespace_info__().devices()` and `.default_device()` to return Python array API compatible device objects [#2979](https://github.com/IntelPython/dpnp/pull/2979)
6970
* Fixed `dpnp.interp` with an empty input array `x` to return an empty array with the correct dtype [#2985](https://github.com/IntelPython/dpnp/pull/2985)
71+
* Fixed `dpnp.interp` returning `nan` when querying at an exact knot point whose adjacent `fp` value is `inf` [#2986](https://github.com/IntelPython/dpnp/pull/2986)
7072

7173
### Security
7274

dpnp/backend/extensions/fft/common.hpp

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ class DescriptorWrapper
112112
const typename valT::value_type dim = get_dim();
113113

114114
valT fwd_strides(dim + 1);
115-
#if INTEL_MKL_VERSION >= 20250000
116-
descr_.get_value(mkl_dft::config_param::FWD_STRIDES, &fwd_strides);
117-
#else
115+
#if defined(USE_ONEMATH)
116+
// oneMath uses a C-style variadic API that expects a raw pointer
118117
descr_.get_value(mkl_dft::config_param::FWD_STRIDES,
119118
fwd_strides.data());
120-
#endif // INTEL_MKL_VERSION
119+
#else
120+
descr_.get_value(mkl_dft::config_param::FWD_STRIDES, &fwd_strides);
121+
#endif // USE_ONEMATH
121122
return fwd_strides;
122123
}
123124

@@ -130,11 +131,12 @@ class DescriptorWrapper
130131
throw py::value_error(
131132
"Strides length does not match descriptor's dimension");
132133
}
133-
#if INTEL_MKL_VERSION >= 20250000
134-
descr_.set_value(mkl_dft::config_param::FWD_STRIDES, strides);
135-
#else
134+
#if defined(USE_ONEMATH)
135+
// oneMath uses a C-style variadic API that expects a raw pointer
136136
descr_.set_value(mkl_dft::config_param::FWD_STRIDES, strides.data());
137-
#endif // INTEL_MKL_VERSION
137+
#else
138+
descr_.set_value(mkl_dft::config_param::FWD_STRIDES, strides);
139+
#endif // USE_ONEMATH
138140
}
139141

140142
// config_param::BWD_STRIDES
@@ -144,12 +146,13 @@ class DescriptorWrapper
144146
const typename valT::value_type dim = get_dim();
145147

146148
valT bwd_strides(dim + 1);
147-
#if INTEL_MKL_VERSION >= 20250000
148-
descr_.get_value(mkl_dft::config_param::BWD_STRIDES, &bwd_strides);
149-
#else
149+
#if defined(USE_ONEMATH)
150+
// oneMath uses a C-style variadic API that expects a raw pointer
150151
descr_.get_value(mkl_dft::config_param::BWD_STRIDES,
151152
bwd_strides.data());
152-
#endif // INTEL_MKL_VERSION
153+
#else
154+
descr_.get_value(mkl_dft::config_param::BWD_STRIDES, &bwd_strides);
155+
#endif // USE_ONEMATH
153156
return bwd_strides;
154157
}
155158

@@ -162,11 +165,12 @@ class DescriptorWrapper
162165
throw py::value_error(
163166
"Strides length does not match descriptor's dimension");
164167
}
165-
#if INTEL_MKL_VERSION >= 20250000
166-
descr_.set_value(mkl_dft::config_param::BWD_STRIDES, strides);
167-
#else
168+
#if defined(USE_ONEMATH)
169+
// oneMath uses a C-style variadic API that expects a raw pointer
168170
descr_.set_value(mkl_dft::config_param::BWD_STRIDES, strides.data());
169-
#endif // INTEL_MKL_VERSION
171+
#else
172+
descr_.set_value(mkl_dft::config_param::BWD_STRIDES, strides);
173+
#endif // USE_ONEMATH
170174
}
171175

172176
// config_param::FWD_DISTANCE
@@ -204,32 +208,17 @@ class DescriptorWrapper
204208
// config_param::PLACEMENT
205209
bool get_in_place()
206210
{
207-
#if defined(USE_ONEMATH) || INTEL_MKL_VERSION >= 20250000
208211
mkl_dft::config_value placement;
209212
descr_.get_value(mkl_dft::config_param::PLACEMENT, &placement);
210213
return (placement == mkl_dft::config_value::INPLACE);
211-
#else
212-
// TODO: remove branch when MKLD-10506 is implemented
213-
DFTI_CONFIG_VALUE placement;
214-
descr_.get_value(mkl_dft::config_param::PLACEMENT, &placement);
215-
return (placement == DFTI_CONFIG_VALUE::DFTI_INPLACE);
216-
#endif // USE_ONEMATH or INTEL_MKL_VERSION
217214
}
218215

219216
void set_in_place(const bool &in_place_request)
220217
{
221-
#if defined(USE_ONEMATH) || INTEL_MKL_VERSION >= 20250000
222218
descr_.set_value(mkl_dft::config_param::PLACEMENT,
223219
(in_place_request)
224220
? mkl_dft::config_value::INPLACE
225221
: mkl_dft::config_value::NOT_INPLACE);
226-
#else
227-
// TODO: remove branch when MKLD-10506 is implemented
228-
descr_.set_value(mkl_dft::config_param::PLACEMENT,
229-
(in_place_request)
230-
? DFTI_CONFIG_VALUE::DFTI_INPLACE
231-
: DFTI_CONFIG_VALUE::DFTI_NOT_INPLACE);
232-
#endif // USE_ONEMATH or INTEL_MKL_VERSION
233222
}
234223

235224
// config_param::PRECISION
@@ -244,16 +233,9 @@ class DescriptorWrapper
244233
// config_param::COMMIT_STATUS
245234
bool is_committed()
246235
{
247-
#if defined(USE_ONEMATH) || INTEL_MKL_VERSION >= 20250000
248236
mkl_dft::config_value committed;
249237
descr_.get_value(mkl_dft::config_param::COMMIT_STATUS, &committed);
250238
return (committed == mkl_dft::config_value::COMMITTED);
251-
#else
252-
// TODO: remove branch when MKLD-10506 is implemented
253-
DFTI_CONFIG_VALUE committed;
254-
descr_.get_value(mkl_dft::config_param::COMMIT_STATUS, &committed);
255-
return (committed == DFTI_CONFIG_VALUE::DFTI_COMMITTED);
256-
#endif // USE_ONEMATH or INTEL_MKL_VERSION
257239
}
258240

259241
private:

dpnp/backend/extensions/vm/common.hpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,6 @@
4646
#include "utils/memory_overlap.hpp"
4747
#include "utils/type_dispatch.hpp"
4848

49-
/**
50-
* Version of Intel MKL at which transition to OneMKL release 2023.2.0 occurs.
51-
*
52-
* @note with OneMKL=2023.1.0 the call of oneapi::mkl::vm::div() was dead
53-
* locked inside ~usm_wrapper_to_host()->{...; q_->wait_and_throw(); ...}
54-
*/
55-
#ifndef __INTEL_MKL_2023_2_0_VERSION_REQUIRED
56-
#define __INTEL_MKL_2023_2_0_VERSION_REQUIRED 20230002L
57-
#endif
58-
59-
static_assert(INTEL_MKL_VERSION >= __INTEL_MKL_2023_2_0_VERSION_REQUIRED,
60-
"OneMKL does not meet minimum version requirement");
61-
6249
namespace ext_ns = ext::common;
6350
namespace py = pybind11;
6451
namespace td_ns = dpnp::tensor::type_dispatch;

dpnp/backend/kernels/dpnp_krnl_random.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
#include "dpnpc_memory_adapter.hpp"
4242
#include "queue_sycl.hpp"
4343

44-
static_assert(INTEL_MKL_VERSION >= __INTEL_MKL_2023_0_0_VERSION_REQUIRED,
45-
"OneMKL does not meet minimum version requirement");
46-
4744
namespace mkl_blas = oneapi::mkl::blas;
4845
namespace mkl_rng = oneapi::mkl::rng;
4946
namespace mkl_vm = oneapi::mkl::vm;

dpnp/backend/kernels/elementwise_functions/i0.hpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@
3030

3131
#include <sycl/sycl.hpp>
3232

33-
/**
34-
* Version of SYCL DPC++ 2025.1 compiler where an issue with
35-
* sycl::ext::intel::math::cyl_bessel_i0(x) is fully resolved.
36-
*/
37-
#ifndef __SYCL_COMPILER_BESSEL_I0_SUPPORT
38-
#define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241208L
39-
#endif
40-
4133
/**
4234
* Include <sycl/ext/intel/math.hpp> only when targeting to Intel devices.
4335
* This header relies on intel-specific types like _iml_half_internal,
@@ -47,15 +39,13 @@
4739
#define __SYCL_EXT_INTEL_MATH_SUPPORT
4840
#endif
4941

50-
#if defined(__SYCL_EXT_INTEL_MATH_SUPPORT) && \
51-
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
42+
#if defined(__SYCL_EXT_INTEL_MATH_SUPPORT)
5243
#include <sycl/ext/intel/math.hpp>
5344
#endif
5445

5546
namespace dpnp::kernels::i0
5647
{
57-
#if defined(__SYCL_EXT_INTEL_MATH_SUPPORT) && \
58-
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
48+
#if defined(__SYCL_EXT_INTEL_MATH_SUPPORT)
5949
using sycl::ext::intel::math::cyl_bessel_i0;
6050

6151
#else

dpnp/backend/kernels/elementwise_functions/interpolate.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ class InterpolateFunctor
8888
else if (x_idx >= static_cast<TIdx>(xp_size - 1)) {
8989
out[id] = right_val;
9090
}
91+
else if (x_val == xp[x_idx]) {
92+
out[id] = fp[x_idx];
93+
}
9194
else {
9295
TValue slope =
9396
(fp[x_idx + 1] - fp[x_idx]) / (xp[x_idx + 1] - xp[x_idx]);

dpnp/backend/src/dpnp_utils.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@
4141

4242
#include <dpnp_iface_fptr.hpp>
4343

44-
/**
45-
* Version of Intel MKL at which transition to OneMKL release 2023.0.0 occurs.
46-
*/
47-
#ifndef __INTEL_MKL_2023_0_0_VERSION_REQUIRED
48-
#define __INTEL_MKL_2023_0_0_VERSION_REQUIRED 20230000
49-
#endif
50-
5144
/**
5245
* @defgroup BACKEND_UTILS Backend C++ library utilities
5346
* @{

dpnp/tests/third_party/cupy/math_tests/test_misc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,18 @@ def test_interp_inf_to_nan(self, xp, dtype_y, dtype_x):
626626
fy = xp.asarray([0, 10], dtype=dtype_y)
627627
return xp.interp(x, fx, fy)
628628

629+
@testing.for_float_dtypes(name="dtype_x")
630+
@testing.for_dtypes("efdFD", name="dtype_y")
631+
@testing.numpy_cupy_allclose(atol=1e-5, type_check=has_support_aspect64())
632+
def test_interp_inf_fy_at_knot(self, xp, dtype_y, dtype_x):
633+
# Regression test: querying at an exact knot point should return the
634+
# knot value, not nan, even when the adjacent fy value is inf.
635+
# See https://github.com/cupy/cupy/issues/9823
636+
x = xp.asarray([2.0], dtype=dtype_x)
637+
fx = xp.asarray([1.0, 2.0, 3.0, 4.0], dtype=dtype_x)
638+
fy = xp.asarray([1.0, 2.0, xp.inf, 4.0], dtype=dtype_y)
639+
return xp.interp(x, fx, fy)
640+
629641
@testing.for_all_dtypes(name="dtype_2", no_bool=True, no_complex=True)
630642
@testing.for_all_dtypes(name="dtype_1", no_bool=True, no_complex=True)
631643
@testing.numpy_cupy_array_equal(type_check=has_support_aspect64())

0 commit comments

Comments
 (0)