Skip to content

Commit 3fc6568

Browse files
[test] Fix exception Required aspect fp64 is not supported on the device in tests of std::complex (#2047)
1 parent a045eac commit 3fc6568

File tree

9 files changed

+47
-2
lines changed

9 files changed

+47
-2
lines changed

documentation/library_guide/introduction.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ Known Limitations
142142
* ``std::array::at`` member function cannot be used in kernels because it may throw an exception;
143143
use ``std::array::operator[]`` instead.
144144
* Due to specifics of Microsoft* Visual C++, some standard floating-point math functions
145-
(including ``std::ldexp``, ``std::frexp``, ``std::sqrt(std::complex<float>)``) require device support
146-
for double precision.
145+
(including: ``std::ldexp``, ``std::frexp``), and the following functions when used with ``std::complex<float>``
146+
as argument(s): ``std::acosh``, ``std::asin``, ``std::asinh``, ``std::asoc``, ``std::log10``, ``std::log``, ``std::pow``,
147+
``std::sqrt`` require device support for double precision.
147148
* ``exclusive_scan``, ``inclusive_scan``, ``exclusive_scan_by_segment``,
148149
``inclusive_scan_by_segment``, ``transform_exclusive_scan``, ``transform_inclusive_scan``,
149150
when used with C++ standard aligned policies, impose limitations on the initial value type if an

test/support/test_config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,15 @@
206206
#define _PSTL_TEST_COMPLEX_SINH_BROKEN _PSTL_TEST_COMPLEX_OP_BROKEN
207207
#define _PSTL_TEST_COMPLEX_TANH_BROKEN _PSTL_TEST_COMPLEX_OP_BROKEN
208208

209+
#define _PSTL_TEST_COMPLEX_OP_USING_DOUBLE (_MSVC_STL_VERSION && _MSVC_STL_VERSION <= _PSTL_TEST_LATEST_MSVC_STL_VERSION)
210+
#define _PSTL_TEST_COMPLEX_OP_ACOS_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
211+
#define _PSTL_TEST_COMPLEX_OP_ACOSH_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
212+
#define _PSTL_TEST_COMPLEX_OP_ASIN_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
213+
#define _PSTL_TEST_COMPLEX_OP_ASINH_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
214+
#define _PSTL_TEST_COMPLEX_OP_LOG_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
215+
#define _PSTL_TEST_COMPLEX_OP_LOG10_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
216+
#define _PSTL_TEST_COMPLEX_OP_POW_SCALAR_COMPLEX_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
217+
209218
// oneAPI DPC++ compiler 2025.0.0 and earlier is unable to eliminate a "dead" function call to an undefined function
210219
// within a sycl kernel which MSVC uses to allow comparisons with literal zero without warning
211220
#define _PSTL_TEST_COMPARISON_BROKEN \

test/xpu_api/numerics/complex.number/complex.transcendentals/acos.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,12 @@ void test_edges()
140140

141141
ONEDPL_TEST_NUM_MAIN
142142
{
143+
#if !_PSTL_TEST_COMPLEX_OP_ACOS_USING_DOUBLE
143144
test<float>();
145+
#else
146+
IF_DOUBLE_SUPPORT(test<float>())
147+
#endif
148+
144149
IF_DOUBLE_SUPPORT(test<double>())
145150
IF_LONG_DOUBLE_SUPPORT(test<long double>())
146151
IF_DOUBLE_SUPPORT(test_edges())

test/xpu_api/numerics/complex.number/complex.transcendentals/acosh.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,12 @@ void test_edges()
149149

150150
ONEDPL_TEST_NUM_MAIN
151151
{
152+
#if !_PSTL_TEST_COMPLEX_OP_ACOSH_USING_DOUBLE
152153
test<float>();
154+
#else
155+
IF_DOUBLE_SUPPORT(test<float>())
156+
#endif
157+
153158
IF_DOUBLE_SUPPORT(test<double>())
154159
IF_LONG_DOUBLE_SUPPORT(test<long double>())
155160
IF_DOUBLE_SUPPORT(test_edges())

test/xpu_api/numerics/complex.number/complex.transcendentals/asin.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,12 @@ void test_edges()
119119

120120
ONEDPL_TEST_NUM_MAIN
121121
{
122+
#if !_PSTL_TEST_COMPLEX_OP_ASIN_USING_DOUBLE
122123
test<float>();
124+
#else
125+
IF_DOUBLE_SUPPORT(test<float>())
126+
#endif
127+
123128
IF_DOUBLE_SUPPORT(test<double>())
124129
IF_LONG_DOUBLE_SUPPORT(test<long double>())
125130
IF_DOUBLE_SUPPORT(test_edges())

test/xpu_api/numerics/complex.number/complex.transcendentals/asinh.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ void test_edges()
126126

127127
ONEDPL_TEST_NUM_MAIN
128128
{
129+
#if !_PSTL_TEST_COMPLEX_OP_ASINH_USING_DOUBLE
129130
test<float>();
131+
#else
132+
IF_DOUBLE_SUPPORT(test<float>())
133+
#endif
134+
130135
IF_DOUBLE_SUPPORT(test<double>())
131136
IF_LONG_DOUBLE_SUPPORT(test<long double>())
132137
IF_DOUBLE_SUPPORT(test_edges())

test/xpu_api/numerics/complex.number/complex.transcendentals/log.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ void test_edges()
124124

125125
ONEDPL_TEST_NUM_MAIN
126126
{
127+
#if !_PSTL_TEST_COMPLEX_OP_LOG_USING_DOUBLE
127128
test<float>();
129+
#else
130+
IF_DOUBLE_SUPPORT(test<float>())
131+
#endif
132+
128133
IF_DOUBLE_SUPPORT(test<double>())
129134
IF_LONG_DOUBLE_SUPPORT(test<long double>())
130135
IF_DOUBLE_SUPPORT(test_edges())

test/xpu_api/numerics/complex.number/complex.transcendentals/log10.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ void test_edges()
6262

6363
ONEDPL_TEST_NUM_MAIN
6464
{
65+
#if !_PSTL_TEST_COMPLEX_OP_LOG10_USING_DOUBLE
6566
test<float>();
67+
#else
68+
IF_DOUBLE_SUPPORT(test<float>())
69+
#endif
70+
6671
IF_DOUBLE_SUPPORT(test<double>())
6772
IF_LONG_DOUBLE_SUPPORT(test<long double>())
6873
IF_DOUBLE_SUPPORT(test_edges())

test/xpu_api/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ void test_edges()
7373

7474
ONEDPL_TEST_NUM_MAIN
7575
{
76+
#if !_PSTL_TEST_COMPLEX_OP_POW_SCALAR_COMPLEX_USING_DOUBLE
7677
test<float>();
78+
#else
79+
IF_DOUBLE_SUPPORT(test<float>())
80+
#endif
81+
7782
IF_DOUBLE_SUPPORT(test<double>())
7883
IF_LONG_DOUBLE_SUPPORT(test<long double>())
7984
IF_DOUBLE_SUPPORT(test_edges())

0 commit comments

Comments
 (0)