[codex] libcudacxx: relax bit_cast fallback construction check#9099
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
It looks like a hallucination. Tested locally with |
The memcpy fallback in cuda::std::bit_cast only needs to default-construct a temporary destination object before copying bytes into it. Requiring default_initializable is stricter and rejects some compiler extended floating-point types, including __float128, even though they are default constructible. Use is_default_constructible_v for the fallback assertion and add a __float128/__uint128_t regression to the bit_cast coverage. Signed-off-by: Trent Nelson <trent@trent.me>
b8c4630 to
1eb080f
Compare
|
Thanks for checking. The original signal came from an internal NVIDIA DVS/NVBugs report, so I do not want to paste the internal links/log URLs into a public PR. I did reproduce the relevant condition locally on the public checkout:
You are also right that ordinary |
Summary
cuda::std::bit_castmemcpy fallback assertion fromdefault_initializable<_To>tois_default_constructible_v<_To>__float128/__uint128_tcoverage to the existingbit_castroundtrip testRoot Cause
The memcpy fallback only needs to default-construct a temporary destination object before copying bytes into it.
default_initializableis stricter than that and can reject compiler extended floating-point types such as__float128, causing the fallback path to fail even though the destination type is default constructible.Validation
g++ -std=gnu++20 -Ilibcudacxx/include -Ilibcudacxx/test/support libcudacxx/test/libcudacxx/std/numerics/bit/bit.cast/bit_cast.pass.cpp -o /tmp/cccl-bit-cast-pass-gcc && /tmp/cccl-bit-cast-pass-gccclang++ -std=gnu++20 -Ilibcudacxx/include -Ilibcudacxx/test/support libcudacxx/test/libcudacxx/std/numerics/bit/bit.cast/bit_cast.pass.cpp -o /tmp/cccl-bit-cast-pass-clang && /tmp/cccl-bit-cast-pass-clangnvcc -std=c++20 -Ilibcudacxx/include -Ilibcudacxx/test/support -x cu libcudacxx/test/libcudacxx/std/numerics/bit/bit.cast/bit_cast.pass.cpp -o /tmp/cccl-bit-cast-pass-nvcc && /tmp/cccl-bit-cast-pass-nvccclang-formatandcodespell