Skip to content

Commit 27d6e80

Browse files
committed
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 e3b8c3f commit 27d6e80

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
@@ -33,11 +33,23 @@
3333
#include "queue_sycl.hpp"
3434
#include <dpnp_iface.hpp>
3535

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

49+
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_REDUCTION_PROPERTIES_SUPPORT
50+
namespace syclex = sycl::ext::oneapi::experimental;
51+
#endif
52+
4153
template <typename _KernelNameSpecialization1,
4254
typename _KernelNameSpecialization2,
4355
typename _KernelNameSpecialization3>
@@ -76,8 +88,13 @@ sycl::event dot(sycl::queue &queue,
7688
cgh.parallel_for(
7789
sycl::range<1>{size},
7890
sycl::reduction(
79-
result_out, std::plus<_DataType_output>(),
80-
sycl::property::reduction::initialize_to_identity{}),
91+
result_out, sycl::plus<_DataType_output>(),
92+
#if __SYCL_COMPILER_VERSION >= __SYCL_COMPILER_REDUCTION_PROPERTIES_SUPPORT
93+
syclex::properties(syclex::initialize_to_identity)
94+
#else
95+
sycl::property::reduction::initialize_to_identity {}
96+
#endif
97+
),
8198
[=](sycl::id<1> idx, auto &sum) {
8299
sum += static_cast<_DataType_output>(
83100
input1_in[idx * input1_strides]) *

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)