Skip to content

Commit b15a4cc

Browse files
Avoid using sycl/ext/intel/math.hpp on non-Intel devices (#2439)
This PR suggests updating `dpnp.i0()` and `dpnp.kaiser()` to avoid including `<sycl/ext/intel/math.hpp>` due to its incompatibility with non-Intel backend (CUDA, AMD). Instead of using `sycl::ext::intel::math::cyl_bessel_i0`, `dpnp::kernels::i0::impl::cyl_bessel_i0` is now used when building on non-Intel targets.
1 parent 2b30bab commit b15a4cc

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ This release achieves 100% compliance with Python Array API specification (revis
3434
* Resolved an issue with an incorrect result returned due to missing dependency from the strided kernel on a copy event in `dpnp.erf` [#2378](https://github.com/IntelPython/dpnp/pull/2378)
3535
* Updated `conda create` commands build and install instructions of `Quick start guide` to avoid a compilation error [#2395](https://github.com/IntelPython/dpnp/pull/2395)
3636
* Added handling of empty string passed to a test env variable defining data type scope as a `False` value [#2415](https://github.com/IntelPython/dpnp/pull/2415)
37+
* Resolved build issues on non-Intel targets in `dpnp.i0` and `dpnp.kaiser` [#2439](https://github.com/IntelPython/dpnp/pull/2439)
3738

3839

3940
## [0.17.0] - 02/26/2025

dpnp/backend/extensions/window/kaiser.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040
#define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241208L
4141
#endif
4242

43-
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT
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)
4448
#include <sycl/ext/intel/math.hpp>
4549
#endif
4650

@@ -74,7 +78,8 @@ class KaiserFunctor
7478

7579
void operator()(sycl::id<1> id) const
7680
{
77-
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT
81+
#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \
82+
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
7883
using sycl::ext::intel::math::cyl_bessel_i0;
7984
#else
8085
using dpnp::kernels::i0::impl::cyl_bessel_i0;

dpnp/backend/kernels/elementwise_functions/i0.hpp

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

38-
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT
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) && \
42+
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
3943
#include <sycl/ext/intel/math.hpp>
4044
#endif
4145

@@ -253,7 +257,8 @@ struct I0Functor
253257

254258
resT operator()(const argT &x) const
255259
{
256-
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT
260+
#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \
261+
(__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT)
257262
using sycl::ext::intel::math::cyl_bessel_i0;
258263
#else
259264
using impl::cyl_bessel_i0;

0 commit comments

Comments
 (0)