Ensure cuda::std::complex is trivially copyable when possible#8356
Ensure cuda::std::complex is trivially copyable when possible#8356miscco merged 1 commit intoNVIDIA:mainfrom
cuda::std::complex is trivially copyable when possible#8356Conversation
| _CCCL_API constexpr complex(const value_type& __re = value_type(), | ||
| const value_type& __im = value_type()) noexcept(is_nothrow_default_constructible_v<_Tp>) | ||
| : __re_(__re) | ||
| , __im_(__im) | ||
| {} |
There was a problem hiding this comment.
I don't think the condition in noexcept is needed, see requirements on numeric types
There was a problem hiding this comment.
I want to be safe because users are users and may specialize accordingly
There was a problem hiding this comment.
But that's UB:
The behavior is unspecified (and may fail to compile) if T is not a cv-unqualified standard(until C++23) floating-point type and undefined if T is not NumericType.
There was a problem hiding this comment.
I don't have a strong opinion on that, but noexcept is what we expect by this type even if it is not strictly required
This comment has been minimized.
This comment has been minimized.
With C++23 `std::complex` has been changed to be trivially copyable Adopt those changes for our implementations. Unfortunately, we cannot make `__half` of `__nv_bfloat16` work because we do not controll those
9edf945 to
e9afc92
Compare
🥳 CI Workflow Results🟩 Finished in 1h 10m: Pass: 100%/108 | Total: 1d 11h | Max: 1h 01m | Hits: 93%/282032See results here. |
libcudacxx/test/libcudacxx/std/numerics/complex.number/complex/traits.pass.cpp
Show resolved
Hide resolved
| _CCCL_API constexpr complex(const value_type& __re = value_type(), | ||
| const value_type& __im = value_type()) noexcept(is_nothrow_default_constructible_v<_Tp>) | ||
| : __re_(__re) | ||
| , __im_(__im) | ||
| {} |
There was a problem hiding this comment.
I don't have a strong opinion on that, but noexcept is what we expect by this type even if it is not strictly required
With C++23
std::complexhas been changed to be trivially copyableAdopt those changes for our implementations.
Unfortunately, we cannot make
__halfof__nv_bfloat16work because we do not controll those