Skip to content

Commit 035e9d6

Browse files
committed
Add a proper math include based on compiler version
1 parent ce48549 commit 035e9d6

File tree

1 file changed

+13
-6
lines changed
  • dpnp/backend/kernels/elementwise_functions

1 file changed

+13
-6
lines changed

dpnp/backend/kernels/elementwise_functions/i0.hpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
#pragma once
2727

28-
#include <sycl/ext/intel/math.hpp>
2928
#include <sycl/sycl.hpp>
3029

3130
/**
@@ -37,6 +36,10 @@
3736
#define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241030L
3837
#endif
3938

39+
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT
40+
#include <sycl/ext/intel/math.hpp>
41+
#endif
42+
4043
namespace dpnp::kernels::i0
4144
{
4245
/**
@@ -215,7 +218,7 @@ inline Tp bessel_ik_0(Tp x)
215218
* @return The output regular modified Bessel function.
216219
*/
217220
template <typename Tp>
218-
inline Tp cyl_bessel_0(Tp x)
221+
inline Tp cyl_bessel_i0(Tp x)
219222
{
220223
if (sycl::isnan(x)) {
221224
return std::numeric_limits<Tp>::quiet_NaN();
@@ -252,13 +255,17 @@ struct I0Functor
252255
resT operator()(const argT &x) const
253256
{
254257
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT
255-
return sycl::ext::intel::math::cyl_bessel_i0(x);
258+
using sycl::ext::intel::math::cyl_bessel_i0;
256259
#else
260+
using impl::cyl_bessel_i0;
261+
#endif
262+
257263
if constexpr (std::is_same_v<resT, sycl::half>) {
258-
return static_cast<resT>(impl::cyl_bessel_0<float>(float(x)));
264+
return static_cast<resT>(cyl_bessel_i0<float>(float(x)));
265+
}
266+
else {
267+
return cyl_bessel_i0(x);
259268
}
260-
return impl::cyl_bessel_0(x);
261-
#endif
262269
}
263270
};
264271
} // namespace dpnp::kernels::i0

0 commit comments

Comments
 (0)