From e429dfaa270f7a5a1a738622db06af364cfea751 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 8 May 2025 05:21:17 -0700 Subject: [PATCH 1/5] Avoid using sycl::ext::intel::math::cyl_bessel_i0 on CUDA --- dpnp/backend/extensions/window/kaiser.cpp | 9 +++++++-- dpnp/backend/kernels/elementwise_functions/i0.hpp | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dpnp/backend/extensions/window/kaiser.cpp b/dpnp/backend/extensions/window/kaiser.cpp index 2bc4bbafee96..08c5f364e2f9 100644 --- a/dpnp/backend/extensions/window/kaiser.cpp +++ b/dpnp/backend/extensions/window/kaiser.cpp @@ -40,7 +40,11 @@ #define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241208L #endif -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT +// The header and related types like +// _iml_half_internal are not compatible with NVIDIA GPUs and cause compilation +// errors when building with -fsycl-targets=nvptx64-nvidia-cuda. +#if !defined(__NVPTX__) && \ + (__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT) #include #endif @@ -74,7 +78,8 @@ class KaiserFunctor void operator()(sycl::id<1> id) const { -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT +#if !defined(__NVPTX__) && \ + (__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT) using sycl::ext::intel::math::cyl_bessel_i0; #else using dpnp::kernels::i0::impl::cyl_bessel_i0; diff --git a/dpnp/backend/kernels/elementwise_functions/i0.hpp b/dpnp/backend/kernels/elementwise_functions/i0.hpp index bfc09d4959c1..667222d27c27 100644 --- a/dpnp/backend/kernels/elementwise_functions/i0.hpp +++ b/dpnp/backend/kernels/elementwise_functions/i0.hpp @@ -35,7 +35,11 @@ #define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241208L #endif -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT +// The header and related types like +// _iml_half_internal are not compatible with NVIDIA GPUs and cause compilation +// errors when building with -fsycl-targets=nvptx64-nvidia-cuda. +#if !defined(__NVPTX__) && \ + (__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT) #include #endif @@ -253,7 +257,8 @@ struct I0Functor resT operator()(const argT &x) const { -#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT +#if !defined(__NVPTX__) && \ + (__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT) using sycl::ext::intel::math::cyl_bessel_i0; #else using impl::cyl_bessel_i0; From c34a4985e19d1cc11b36412def326ca0f33cbbe5 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 8 May 2025 07:36:54 -0700 Subject: [PATCH 2/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8709f82b0765..9d2a17b12965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This release achieves 100% compliance with Python Array API specification (revis * Updated Python Array API specification version supported to `2024.12` [#2416](https://github.com/IntelPython/dpnp/pull/2416) * Removed `einsum_call` keyword from `dpnp.einsum_path` signature [#2421](https://github.com/IntelPython/dpnp/pull/2421) * Changed `"max dimensions"` to `None` in array API capabilities [#2432](https://github.com/IntelPython/dpnp/pull/2432) +* Added CUDA compatibility for `dpnp.i0` and `dpnp.kaiser` functions [#2439](https://github.com/IntelPython/dpnp/pull/2439) ### Fixed From a9032cce6d8e66114fe2a7d64795911fd07e5251 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 8 May 2025 08:14:07 -0700 Subject: [PATCH 3/5] Use sycl::ext::intel::math only for Intel devices --- dpnp/backend/extensions/window/kaiser.cpp | 10 +++++----- dpnp/backend/kernels/elementwise_functions/i0.hpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dpnp/backend/extensions/window/kaiser.cpp b/dpnp/backend/extensions/window/kaiser.cpp index 08c5f364e2f9..fd86d3dda773 100644 --- a/dpnp/backend/extensions/window/kaiser.cpp +++ b/dpnp/backend/extensions/window/kaiser.cpp @@ -40,10 +40,10 @@ #define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241208L #endif -// The header and related types like -// _iml_half_internal are not compatible with NVIDIA GPUs and cause compilation -// errors when building with -fsycl-targets=nvptx64-nvidia-cuda. -#if !defined(__NVPTX__) && \ +// Include only when targeting Intel devices. +// This header relies on intel-specific types like _iml_half_internal, +// which are not supported on non-intel backends (e.g., CUDA, AMD) +#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \ (__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT) #include #endif @@ -78,7 +78,7 @@ class KaiserFunctor void operator()(sycl::id<1> id) const { -#if !defined(__NVPTX__) && \ +#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \ (__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT) using sycl::ext::intel::math::cyl_bessel_i0; #else diff --git a/dpnp/backend/kernels/elementwise_functions/i0.hpp b/dpnp/backend/kernels/elementwise_functions/i0.hpp index 667222d27c27..e474bcb41f00 100644 --- a/dpnp/backend/kernels/elementwise_functions/i0.hpp +++ b/dpnp/backend/kernels/elementwise_functions/i0.hpp @@ -35,10 +35,10 @@ #define __SYCL_COMPILER_BESSEL_I0_SUPPORT 20241208L #endif -// The header and related types like -// _iml_half_internal are not compatible with NVIDIA GPUs and cause compilation -// errors when building with -fsycl-targets=nvptx64-nvidia-cuda. -#if !defined(__NVPTX__) && \ +// Include only when targeting Intel devices. +// This header relies on intel-specific types like _iml_half_internal, +// which are not supported on non-intel backends (e.g., CUDA, AMD) +#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \ (__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT) #include #endif @@ -257,7 +257,7 @@ struct I0Functor resT operator()(const argT &x) const { -#if !defined(__NVPTX__) && \ +#if defined(__SPIR__) && defined(__INTEL_LLVM_COMPILER) && \ (__SYCL_COMPILER_VERSION >= __SYCL_COMPILER_BESSEL_I0_SUPPORT) using sycl::ext::intel::math::cyl_bessel_i0; #else From 94fdd5bd0c39a50f46df13bf3006bdb91ac72985 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 8 May 2025 08:23:54 -0700 Subject: [PATCH 4/5] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d2a17b12965..156f7559bb36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ This release achieves 100% compliance with Python Array API specification (revis * Updated Python Array API specification version supported to `2024.12` [#2416](https://github.com/IntelPython/dpnp/pull/2416) * Removed `einsum_call` keyword from `dpnp.einsum_path` signature [#2421](https://github.com/IntelPython/dpnp/pull/2421) * Changed `"max dimensions"` to `None` in array API capabilities [#2432](https://github.com/IntelPython/dpnp/pull/2432) -* Added CUDA compatibility for `dpnp.i0` and `dpnp.kaiser` functions [#2439](https://github.com/IntelPython/dpnp/pull/2439) +* Added `dpnp.i0` and `dpnp.kaiser` compatibility with non-Intel devices [#2439](https://github.com/IntelPython/dpnp/pull/2439) ### Fixed From a4d540962433ef10235a9e840ba624fc86e7b06a Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 8 May 2025 08:37:22 -0700 Subject: [PATCH 5/5] Address remark --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 156f7559bb36..c501ef7e5003 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,13 +28,13 @@ This release achieves 100% compliance with Python Array API specification (revis * Updated Python Array API specification version supported to `2024.12` [#2416](https://github.com/IntelPython/dpnp/pull/2416) * Removed `einsum_call` keyword from `dpnp.einsum_path` signature [#2421](https://github.com/IntelPython/dpnp/pull/2421) * Changed `"max dimensions"` to `None` in array API capabilities [#2432](https://github.com/IntelPython/dpnp/pull/2432) -* Added `dpnp.i0` and `dpnp.kaiser` compatibility with non-Intel devices [#2439](https://github.com/IntelPython/dpnp/pull/2439) ### Fixed * 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) * 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) * 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) +* Resolved build issues on non-Intel targets in `dpnp.i0` and `dpnp.kaiser` [#2439](https://github.com/IntelPython/dpnp/pull/2439) ## [0.17.0] - 02/26/2025