Skip to content

Commit b204f05

Browse files
committed
Move all logic with cyl_bessel_i0 support in i0.hpp
1 parent e429dfa commit b204f05

File tree

2 files changed

+21
-33
lines changed

2 files changed

+21
-33
lines changed

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-
// The <sycl/ext/intel/math.hpp> header and related types like
44-
// _iml_half_internal are not compatible with NVIDIA GPUs and cause compilation
45-
// errors when building with -fsycl-targets=nvptx64-nvidia-cuda.
46-
#if !defined(__NVPTX__) && \
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(__NVPTX__) && \
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-
// The <sycl/ext/intel/math.hpp> header and related types like
39-
// _iml_half_internal are not compatible with NVIDIA GPUs and cause compilation
40-
// errors when building with -fsycl-targets=nvptx64-nvidia-cuda.
41-
#if !defined(__NVPTX__) && \
38+
/**
39+
* The <sycl/ext/intel/math.hpp> header and related types like
40+
* _iml_half_internal are not compatible with NVIDIA GPUs and cause compilation
41+
* errors when building with -fsycl-targets=nvptx64-nvidia-cuda.
42+
*/
43+
#if !defined(__NVPTX__)
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(__NVPTX__) && \
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
}

0 commit comments

Comments
 (0)