Skip to content

Commit fc6d573

Browse files
authored
Revert "[SYCL] Adds complex Literals support to sycl::experimental::complex" (#10521)
Reverts #9819 As mentioned in the PR #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
1 parent 23a6f38 commit fc6d573

File tree

3 files changed

+0
-60
lines changed

3 files changed

+0
-60
lines changed

sycl/doc/extensions/proposed/sycl_ext_oneapi_complex.asciidoc

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -438,33 +438,6 @@ mathematical operation.
438438
|Compute the hyperbolic tangent of complex number x.
439439
|===
440440

441-
442-
=== Suffixes for complex number literals
443-
444-
This proposal describes literal suffixes for constructing complex number literals.
445-
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.
446-
447-
```C++
448-
namespace sycl {
449-
namespace ext {
450-
namespace oneapi {
451-
452-
namespace literals {
453-
namespace complex_literals {
454-
constexpr complex<double> operator""i(long double x);
455-
constexpr complex<double> operator""i(unsigned long long x);
456-
457-
constexpr complex<float> operator""if(long double x);
458-
constexpr complex<float> operator""if(unsigned long long x);
459-
} // namespace complex_literals
460-
} // namespace literals
461-
462-
} // namespace oneapi
463-
} // namespace ext
464-
} // namespace sycl
465-
```
466-
467-
468441
== Implementation notes
469442

470443
The complex mathematical operations can all be defined using SYCL built-ins.

sycl/include/sycl/ext/oneapi/experimental/sycl_complex.hpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -978,27 +978,6 @@ tan(const complex<_Tp> &__x) {
978978
return complex<_Tp>(__z.imag(), -__z.real());
979979
}
980980

981-
// Literal suffix for complex number literals [complex.literals]
982-
inline namespace literals {
983-
inline namespace complex_literals {
984-
constexpr complex<double> operator""i(long double __im) {
985-
return {0.0, static_cast<double>(__im)};
986-
}
987-
988-
constexpr complex<double> operator""i(unsigned long long __im) {
989-
return {0.0, static_cast<double>(__im)};
990-
}
991-
992-
constexpr complex<float> operator""if(long double __im) {
993-
return {0.0f, static_cast<float>(__im)};
994-
}
995-
996-
constexpr complex<float> operator""if(unsigned long long __im) {
997-
return {0.0f, static_cast<float>(__im)};
998-
}
999-
} // namespace complex_literals
1000-
} // namespace literals
1001-
1002981
} // namespace experimental
1003982
} // namespace oneapi
1004983
} // namespace ext

sycl/test/extensions/test_complex.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,6 @@ void check_sycl_constructor_from_std() {
186186
}
187187
}
188188

189-
// Check types for sycl complex constructed from literals
190-
void check_sycl_complex_literals() {
191-
static_assert(
192-
std::is_same_v<decltype(0.3if),
193-
sycl::ext::oneapi::experimental::complex<float>>);
194-
static_assert(
195-
std::is_same_v<decltype(0.3i),
196-
sycl::ext::oneapi::experimental::complex<double>>);
197-
}
198-
199189
int main() {
200190
check_math_function_types();
201191
check_math_operator_types();
@@ -205,7 +195,5 @@ int main() {
205195
check_std_to_sycl_conversion();
206196
check_sycl_constructor_from_std();
207197

208-
check_sycl_complex_literals();
209-
210198
return 0;
211199
}

0 commit comments

Comments
 (0)