From fc6d573584cbef77a476cc9c17138da9f99a8595 Mon Sep 17 00:00:00 2001 From: Jefferson Le Quellec Date: Tue, 25 Jul 2023 14:06:20 +0200 Subject: [PATCH] Revert "[SYCL] Adds complex Literals support to sycl::experimental::complex" (#10521) Reverts intel/llvm#9819 As mentioned in the PR https://github.com/intel/llvm/pull/9867, this introduction of literal operators creates some issues due to literal operators receiving arguments as `long double` which are not supported on device code (and only works on host side); and our worries that users will try to use it and will not understand why it does not work. Also, user-defined literal operators should be declared with a `_` prefix to not clash with the standard literal operators when `using namespace std::literals`. Reverting this PR will facilitate the merge of the previously mentioned PR and have a place where the issues from this introduction are listed. Regardless of this PR, we'd still like to have support for literal operators for complex, so if you (@abagusetty) could open up a new PR for re-introducing the literal operator if a solution can be found also to handle it in device code, that would be great! @gmlueck @abagusetty --- .../proposed/sycl_ext_oneapi_complex.asciidoc | 27 ------------------- .../ext/oneapi/experimental/sycl_complex.hpp | 21 --------------- sycl/test/extensions/test_complex.cpp | 12 --------- 3 files changed, 60 deletions(-) diff --git a/sycl/doc/extensions/proposed/sycl_ext_oneapi_complex.asciidoc b/sycl/doc/extensions/proposed/sycl_ext_oneapi_complex.asciidoc index c663a2c6d7d3d..1c53ccc9af70c 100644 --- a/sycl/doc/extensions/proposed/sycl_ext_oneapi_complex.asciidoc +++ b/sycl/doc/extensions/proposed/sycl_ext_oneapi_complex.asciidoc @@ -438,33 +438,6 @@ mathematical operation. |Compute the hyperbolic tangent of complex number x. |=== - -=== Suffixes for complex number literals - -This proposal describes literal suffixes for constructing complex number literals. -The suffixes `i` and `if` create complex numbers of the types `complex` and `complex` respectively, with their imaginary part denoted by the given literal number and the real part being zero. - -```C++ -namespace sycl { -namespace ext { -namespace oneapi { - -namespace literals { -namespace complex_literals { -constexpr complex operator""i(long double x); -constexpr complex operator""i(unsigned long long x); - -constexpr complex operator""if(long double x); -constexpr complex operator""if(unsigned long long x); -} // namespace complex_literals -} // namespace literals - -} // namespace oneapi -} // namespace ext -} // namespace sycl -``` - - == Implementation notes The complex mathematical operations can all be defined using SYCL built-ins. diff --git a/sycl/include/sycl/ext/oneapi/experimental/sycl_complex.hpp b/sycl/include/sycl/ext/oneapi/experimental/sycl_complex.hpp index 4f996321cddc4..cd5c26b0b933a 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/sycl_complex.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/sycl_complex.hpp @@ -978,27 +978,6 @@ tan(const complex<_Tp> &__x) { return complex<_Tp>(__z.imag(), -__z.real()); } -// Literal suffix for complex number literals [complex.literals] -inline namespace literals { -inline namespace complex_literals { -constexpr complex operator""i(long double __im) { - return {0.0, static_cast(__im)}; -} - -constexpr complex operator""i(unsigned long long __im) { - return {0.0, static_cast(__im)}; -} - -constexpr complex operator""if(long double __im) { - return {0.0f, static_cast(__im)}; -} - -constexpr complex operator""if(unsigned long long __im) { - return {0.0f, static_cast(__im)}; -} -} // namespace complex_literals -} // namespace literals - } // namespace experimental } // namespace oneapi } // namespace ext diff --git a/sycl/test/extensions/test_complex.cpp b/sycl/test/extensions/test_complex.cpp index 1aae7d5a0c790..60b466901e0d8 100644 --- a/sycl/test/extensions/test_complex.cpp +++ b/sycl/test/extensions/test_complex.cpp @@ -186,16 +186,6 @@ void check_sycl_constructor_from_std() { } } -// Check types for sycl complex constructed from literals -void check_sycl_complex_literals() { - static_assert( - std::is_same_v>); - static_assert( - std::is_same_v>); -} - int main() { check_math_function_types(); check_math_operator_types(); @@ -205,7 +195,5 @@ int main() { check_std_to_sycl_conversion(); check_sycl_constructor_from_std(); - check_sycl_complex_literals(); - return 0; }