Skip to content

Commit

Permalink
[test] Fix exception `Required aspect fp64 is not supported on the de…
Browse files Browse the repository at this point in the history
…vice` in tests of `std::complex` (#2047)
  • Loading branch information
SergeyKopienko authored Feb 5, 2025
1 parent a045eac commit 3fc6568
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 2 deletions.
5 changes: 3 additions & 2 deletions documentation/library_guide/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ Known Limitations
* ``std::array::at`` member function cannot be used in kernels because it may throw an exception;
use ``std::array::operator[]`` instead.
* Due to specifics of Microsoft* Visual C++, some standard floating-point math functions
(including ``std::ldexp``, ``std::frexp``, ``std::sqrt(std::complex<float>)``) require device support
for double precision.
(including: ``std::ldexp``, ``std::frexp``), and the following functions when used with ``std::complex<float>``
as argument(s): ``std::acosh``, ``std::asin``, ``std::asinh``, ``std::asoc``, ``std::log10``, ``std::log``, ``std::pow``,
``std::sqrt`` require device support for double precision.
* ``exclusive_scan``, ``inclusive_scan``, ``exclusive_scan_by_segment``,
``inclusive_scan_by_segment``, ``transform_exclusive_scan``, ``transform_inclusive_scan``,
when used with C++ standard aligned policies, impose limitations on the initial value type if an
Expand Down
9 changes: 9 additions & 0 deletions test/support/test_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@
#define _PSTL_TEST_COMPLEX_SINH_BROKEN _PSTL_TEST_COMPLEX_OP_BROKEN
#define _PSTL_TEST_COMPLEX_TANH_BROKEN _PSTL_TEST_COMPLEX_OP_BROKEN

#define _PSTL_TEST_COMPLEX_OP_USING_DOUBLE (_MSVC_STL_VERSION && _MSVC_STL_VERSION <= _PSTL_TEST_LATEST_MSVC_STL_VERSION)
#define _PSTL_TEST_COMPLEX_OP_ACOS_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
#define _PSTL_TEST_COMPLEX_OP_ACOSH_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
#define _PSTL_TEST_COMPLEX_OP_ASIN_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
#define _PSTL_TEST_COMPLEX_OP_ASINH_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
#define _PSTL_TEST_COMPLEX_OP_LOG_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
#define _PSTL_TEST_COMPLEX_OP_LOG10_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE
#define _PSTL_TEST_COMPLEX_OP_POW_SCALAR_COMPLEX_USING_DOUBLE _PSTL_TEST_COMPLEX_OP_USING_DOUBLE

// oneAPI DPC++ compiler 2025.0.0 and earlier is unable to eliminate a "dead" function call to an undefined function
// within a sycl kernel which MSVC uses to allow comparisons with literal zero without warning
#define _PSTL_TEST_COMPARISON_BROKEN \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ void test_edges()

ONEDPL_TEST_NUM_MAIN
{
#if !_PSTL_TEST_COMPLEX_OP_ACOS_USING_DOUBLE
test<float>();
#else
IF_DOUBLE_SUPPORT(test<float>())
#endif

IF_DOUBLE_SUPPORT(test<double>())
IF_LONG_DOUBLE_SUPPORT(test<long double>())
IF_DOUBLE_SUPPORT(test_edges())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ void test_edges()

ONEDPL_TEST_NUM_MAIN
{
#if !_PSTL_TEST_COMPLEX_OP_ACOSH_USING_DOUBLE
test<float>();
#else
IF_DOUBLE_SUPPORT(test<float>())
#endif

IF_DOUBLE_SUPPORT(test<double>())
IF_LONG_DOUBLE_SUPPORT(test<long double>())
IF_DOUBLE_SUPPORT(test_edges())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ void test_edges()

ONEDPL_TEST_NUM_MAIN
{
#if !_PSTL_TEST_COMPLEX_OP_ASIN_USING_DOUBLE
test<float>();
#else
IF_DOUBLE_SUPPORT(test<float>())
#endif

IF_DOUBLE_SUPPORT(test<double>())
IF_LONG_DOUBLE_SUPPORT(test<long double>())
IF_DOUBLE_SUPPORT(test_edges())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ void test_edges()

ONEDPL_TEST_NUM_MAIN
{
#if !_PSTL_TEST_COMPLEX_OP_ASINH_USING_DOUBLE
test<float>();
#else
IF_DOUBLE_SUPPORT(test<float>())
#endif

IF_DOUBLE_SUPPORT(test<double>())
IF_LONG_DOUBLE_SUPPORT(test<long double>())
IF_DOUBLE_SUPPORT(test_edges())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ void test_edges()

ONEDPL_TEST_NUM_MAIN
{
#if !_PSTL_TEST_COMPLEX_OP_LOG_USING_DOUBLE
test<float>();
#else
IF_DOUBLE_SUPPORT(test<float>())
#endif

IF_DOUBLE_SUPPORT(test<double>())
IF_LONG_DOUBLE_SUPPORT(test<long double>())
IF_DOUBLE_SUPPORT(test_edges())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ void test_edges()

ONEDPL_TEST_NUM_MAIN
{
#if !_PSTL_TEST_COMPLEX_OP_LOG10_USING_DOUBLE
test<float>();
#else
IF_DOUBLE_SUPPORT(test<float>())
#endif

IF_DOUBLE_SUPPORT(test<double>())
IF_LONG_DOUBLE_SUPPORT(test<long double>())
IF_DOUBLE_SUPPORT(test_edges())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ void test_edges()

ONEDPL_TEST_NUM_MAIN
{
#if !_PSTL_TEST_COMPLEX_OP_POW_SCALAR_COMPLEX_USING_DOUBLE
test<float>();
#else
IF_DOUBLE_SUPPORT(test<float>())
#endif

IF_DOUBLE_SUPPORT(test<double>())
IF_LONG_DOUBLE_SUPPORT(test<long double>())
IF_DOUBLE_SUPPORT(test_edges())
Expand Down

0 comments on commit 3fc6568

Please sign in to comment.