Skip to content

Commit

Permalink
Revert "[SYCL] Adds complex Literals support to sycl::experimental::c…
Browse files Browse the repository at this point in the history
…omplex" (intel#10521)

Reverts intel#9819

As mentioned in the PR intel#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
  • Loading branch information
jle-quel authored Jul 25, 2023
1 parent 23a6f38 commit fc6d573
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 60 deletions.
27 changes: 0 additions & 27 deletions sycl/doc/extensions/proposed/sycl_ext_oneapi_complex.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>` and `complex<float>` 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<double> operator""i(long double x);
constexpr complex<double> operator""i(unsigned long long x);

constexpr complex<float> operator""if(long double x);
constexpr complex<float> 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.
Expand Down
21 changes: 0 additions & 21 deletions sycl/include/sycl/ext/oneapi/experimental/sycl_complex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double> operator""i(long double __im) {
return {0.0, static_cast<double>(__im)};
}

constexpr complex<double> operator""i(unsigned long long __im) {
return {0.0, static_cast<double>(__im)};
}

constexpr complex<float> operator""if(long double __im) {
return {0.0f, static_cast<float>(__im)};
}

constexpr complex<float> operator""if(unsigned long long __im) {
return {0.0f, static_cast<float>(__im)};
}
} // namespace complex_literals
} // namespace literals

} // namespace experimental
} // namespace oneapi
} // namespace ext
Expand Down
12 changes: 0 additions & 12 deletions sycl/test/extensions/test_complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<decltype(0.3if),
sycl::ext::oneapi::experimental::complex<float>>);
static_assert(
std::is_same_v<decltype(0.3i),
sycl::ext::oneapi::experimental::complex<double>>);
}

int main() {
check_math_function_types();
check_math_operator_types();
Expand All @@ -205,7 +195,5 @@ int main() {
check_std_to_sycl_conversion();
check_sycl_constructor_from_std();

check_sycl_complex_literals();

return 0;
}

0 comments on commit fc6d573

Please sign in to comment.