Skip to content

Commit 088e8a6

Browse files
authored
Merge branch 'master' into impl_of_interp
2 parents d1b3615 + d75c842 commit 088e8a6

File tree

7 files changed

+31
-41
lines changed

7 files changed

+31
-41
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This release achieves 100% compliance with Python Array API specification (revis
2828
* Updated Python Array API specification version supported to `2024.12` [#2416](https://github.com/IntelPython/dpnp/pull/2416)
2929
* Removed `einsum_call` keyword from `dpnp.einsum_path` signature [#2421](https://github.com/IntelPython/dpnp/pull/2421)
3030
* Changed `"max dimensions"` to `None` in array API capabilities [#2432](https://github.com/IntelPython/dpnp/pull/2432)
31+
* Updated kernel header `i0.hpp` to expose `cyl_bessel_i0` function depending on build target [#2440](https://github.com/IntelPython/dpnp/pull/2440)
3132

3233
### Fixed
3334

conda-recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ requirements:
1313
- python
1414
- setuptools
1515
- numpy >=1.23
16-
- cython <3.1
16+
- cython
1717
- cmake >=3.21
1818
- ninja
1919
- git

dpnp/backend/extensions/window/kaiser.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,6 @@
3232

3333
#include <sycl/sycl.hpp>
3434

35-
/**
36-
* Version of SYCL DPC++ 2025.1 compiler where an issue with
37-
* sycl::ext::intel::math::cyl_bessel_i0(x) is fully resolved.
38-
*/
39-
#ifndef __SYCL_COMPILER_BESSEL_I0_SUPPORT
40-
#define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241208L
41-
#endif
42-
43-
// Include <sycl/ext/intel/math.hpp> only when targeting Intel devices.
44-
// This header relies on intel-specific types like _iml_half_internal,
45-
// which are not supported on non-intel backends (e.g., CUDA, AMD)
46-
#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \
47-
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
48-
#include <sycl/ext/intel/math.hpp>
49-
#endif
50-
5135
#include "../kernels/elementwise_functions/i0.hpp"
5236

5337
namespace dpnp::extensions::window
@@ -78,12 +62,7 @@ class KaiserFunctor
7862

7963
void operator()(sycl::id<1> id) const
8064
{
81-
#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \
82-
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
83-
using sycl::ext::intel::math::cyl_bessel_i0;
84-
#else
85-
using dpnp::kernels::i0::impl::cyl_bessel_i0;
86-
#endif
65+
using dpnp::kernels::i0::cyl_bessel_i0;
8766

8867
const auto i = id.get(0);
8968
const T alpha = (N - 1) / T(2);

dpnp/backend/kernels/elementwise_functions/i0.hpp

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,28 @@
3535
#define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241208L
3636
#endif
3737

38-
// Include <sycl/ext/intel/math.hpp> only when targeting Intel devices.
39-
// This header relies on intel-specific types like _iml_half_internal,
40-
// which are not supported on non-intel backends (e.g., CUDA, AMD)
41-
#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \
38+
/**
39+
* Include <sycl/ext/intel/math.hpp> only when targeting to Intel devices.
40+
* This header relies on intel-specific types like _iml_half_internal,
41+
* which are not suppose to work with other targets (e.g., CUDA, AMD).
42+
*/
43+
#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER)
44+
#define __SYCL_EXT_INTEL_MATH_SUPPORT
45+
#endif
46+
47+
#if defined(__SYCL_EXT_INTEL_MATH_SUPPORT) && \
4248
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
4349
#include <sycl/ext/intel/math.hpp>
4450
#endif
4551

4652
namespace dpnp::kernels::i0
4753
{
54+
#if defined(__SYCL_EXT_INTEL_MATH_SUPPORT) && \
55+
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
56+
using sycl::ext::intel::math::cyl_bessel_i0;
57+
58+
#else
59+
4860
/**
4961
* The below implementation of Bessel function of order 0
5062
* is based on the source code from https://github.com/gcc-mirror/gcc
@@ -243,6 +255,10 @@ inline Tp cyl_bessel_i0(Tp x)
243255
}
244256
} // namespace impl
245257

258+
using impl::cyl_bessel_i0;
259+
260+
#endif
261+
246262
template <typename argT, typename resT>
247263
struct I0Functor
248264
{
@@ -257,13 +273,6 @@ struct I0Functor
257273

258274
resT operator()(const argT &x) const
259275
{
260-
#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \
261-
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
262-
using sycl::ext::intel::math::cyl_bessel_i0;
263-
#else
264-
using impl::cyl_bessel_i0;
265-
#endif
266-
267276
if constexpr (std::is_same_v<resT, sycl::half>) {
268277
return static_cast<resT>(cyl_bessel_i0<float>(float(x)));
269278
}

dpnp/dpnp_algo/dpnp_arraycreation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
import numpy
3333

3434
import dpnp
35-
import dpnp.dpnp_utils as utils
3635
from dpnp.dpnp_array import dpnp_array
36+
from dpnp.dpnp_utils import get_usm_allocations, map_dtype_to_device
3737

3838
__all__ = [
3939
"dpnp_geomspace",
@@ -60,7 +60,7 @@ def dpnp_geomspace(
6060
endpoint=True,
6161
axis=0,
6262
):
63-
usm_type_alloc, sycl_queue_alloc = utils.get_usm_allocations([start, stop])
63+
usm_type_alloc, sycl_queue_alloc = get_usm_allocations([start, stop])
6464

6565
if sycl_queue is None and device is None:
6666
sycl_queue = sycl_queue_alloc
@@ -77,7 +77,7 @@ def dpnp_geomspace(
7777
stop = _as_usm_ndarray(stop, _usm_type, sycl_queue_normalized)
7878

7979
dt = numpy.result_type(start, stop, float(num))
80-
dt = utils.map_dtype_to_device(dt, sycl_queue_normalized.sycl_device)
80+
dt = map_dtype_to_device(dt, sycl_queue_normalized.sycl_device)
8181
if dtype is None:
8282
dtype = dt
8383

@@ -144,7 +144,7 @@ def dpnp_linspace(
144144
retstep=False,
145145
axis=0,
146146
):
147-
usm_type_alloc, sycl_queue_alloc = utils.get_usm_allocations([start, stop])
147+
usm_type_alloc, sycl_queue_alloc = get_usm_allocations([start, stop])
148148

149149
if sycl_queue is None and device is None:
150150
sycl_queue = sycl_queue_alloc
@@ -164,7 +164,7 @@ def dpnp_linspace(
164164
stop = _as_usm_ndarray(stop, _usm_type, sycl_queue_normalized)
165165

166166
dt = numpy.result_type(start, stop, float(num))
167-
dt = utils.map_dtype_to_device(dt, sycl_queue_normalized.sycl_device)
167+
dt = map_dtype_to_device(dt, sycl_queue_normalized.sycl_device)
168168
if dtype is None:
169169
dtype = dt
170170

@@ -251,7 +251,7 @@ def dpnp_logspace(
251251
axis=0,
252252
):
253253
if not dpnp.isscalar(base):
254-
usm_type_alloc, sycl_queue_alloc = utils.get_usm_allocations(
254+
usm_type_alloc, sycl_queue_alloc = get_usm_allocations(
255255
[start, stop, base]
256256
)
257257

dpnp/dpnp_utils/dpnp_algo_utils.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ cdef tuple get_common_usm_allocation(dpnp_descriptor x1, dpnp_descriptor x2):
449449
return (common_sycl_queue.sycl_device, common_usm_type, common_sycl_queue)
450450

451451

452+
@cython.linetrace(False)
452453
cdef (DPNPFuncType, void *) get_ret_type_and_func(DPNPFuncData kernel_data,
453454
cpp_bool has_aspect_fp64):
454455
"""

environments/build_with_oneapi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channels:
33
- conda-forge
44
dependencies:
55
- cmake
6-
- cython <3.1
6+
- cython
77
- ninja
88
- numpy
99
- pytest

0 commit comments

Comments
 (0)