Skip to content

Commit ed39ea7

Browse files
authored
Use SYCL experimental extension for reduction properties (#2211)
Recent changes in DPC++ 2025.1 compiler broke DPNP compilation. It seems the legacy DPC++ compiler behavior was affected by introducing SYCL experimental extension for reduction properties. Since the compilation issue occurred for a backend function which will be removed once #2183 is merged, that PR proposes to temporary w/a the issue and to reuse the extension for reduction properties, which seems working.
1 parent 0bac735 commit ed39ea7

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

dpnp/backend/kernels/dpnp_krnl_common.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,23 @@
3535
#include "queue_sycl.hpp"
3636
#include <dpnp_iface.hpp>
3737

38+
/**
39+
* Version of SYCL DPC++ 2025.1 compiler where support of
40+
* sycl::ext::oneapi::experimental::properties was added.
41+
*/
42+
#ifndef __SYCL_COMPILER_REDUCTION_PROPERTIES_SUPPORT
43+
#define __SYCL_COMPILER_REDUCTION_PROPERTIES_SUPPORT 20241129
44+
#endif
45+
3846
namespace mkl_blas = oneapi::mkl::blas;
3947
namespace mkl_blas_cm = oneapi::mkl::blas::column_major;
4048
namespace mkl_blas_rm = oneapi::mkl::blas::row_major;
4149
namespace mkl_lapack = oneapi::mkl::lapack;
4250

51+
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_REDUCTION_PROPERTIES_SUPPORT
52+
namespace syclex = sycl::ext::oneapi::experimental;
53+
#endif
54+
4355
template <typename _KernelNameSpecialization1,
4456
typename _KernelNameSpecialization2,
4557
typename _KernelNameSpecialization3>
@@ -78,8 +90,13 @@ sycl::event dot(sycl::queue &queue,
7890
cgh.parallel_for(
7991
sycl::range<1>{size},
8092
sycl::reduction(
81-
result_out, std::plus<_DataType_output>(),
82-
sycl::property::reduction::initialize_to_identity{}),
93+
result_out, sycl::plus<_DataType_output>(),
94+
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_REDUCTION_PROPERTIES_SUPPORT
95+
syclex::properties(syclex::initialize_to_identity)
96+
#else
97+
sycl::property::reduction::initialize_to_identity {}
98+
#endif
99+
),
83100
[=](sycl::id<1> idx, auto &sum) {
84101
sum += static_cast<_DataType_output>(
85102
input1_in[idx * input1_strides]) *

dpnp/tests/third_party/cupy/creation_tests/test_ranges.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def test_linspace_float_overflow(self, xp):
172172
dtype = cupy.default_float_type()
173173
return xp.linspace(0.0, xp.finfo(dtype).max / 5, 10, dtype=dtype)
174174

175-
@testing.numpy_cupy_allclose()
175+
@testing.numpy_cupy_allclose(rtol={numpy.float32: 1e-6, "default": 1e-7})
176176
def test_linspace_float_underflow(self, xp):
177177
# find minimum subnormal number
178178
dtype = cupy.default_float_type()

0 commit comments

Comments
 (0)