| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| if constexpr (sizeof(_Integer) > 1) | ||
| { | ||
| #if defined(_CCCL_BUILTIN_BSWAPG) | ||
| return static_cast<_Integer>(_CCCL_BUILTIN_BSWAPG(::cuda::std::__to_unsigned_like(__val))); |
There was a problem hiding this comment.
__builtin_bswapg is supposed to support any integer, do we still need the cast to unsigned?
Also on this note, we should add support for the sized builtins as well, __builtin_bswapg was only added in clang 22 (not sure if gcc even has it to begin with). Before that, __builtin_bswap{16, 32, 64} and possibly __builtin_bswap128 have existed for longer.
Sorry, something went wrong.
|
/ok to test |
Sorry, something went wrong.
@Jacobfaib, there was an error processing your request: E1 See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/ |
Sorry, something went wrong.
|
Will do — I'll verify the unsigned cast is redundant and add the sized builtin fallback. Thanks for the review. |
Sorry, something went wrong.
| #if defined(_CCCL_BUILTIN_BSWAPG) | ||
| return static_cast<_Integer>(_CCCL_BUILTIN_BSWAPG(__val)); | ||
| #else // ^^^ _CCCL_BUILTIN_BSWAPG ^^^ / vvv !_CCCL_BUILTIN_BSWAPG vvv | ||
| if constexpr (sizeof(_Integer) == 2) |
There was a problem hiding this comment.
Don't hardcode the size here, I would say sizeof(_Integer) == sizeof(::cuda::std::uint16_t) since that is what we ultimately care about in the end.
Sorry, something went wrong.
| if constexpr (sizeof(_Integer) == 2) | ||
| { | ||
| # if defined(_CCCL_BUILTIN_BSWAP16) | ||
| return static_cast<_Integer>(_CCCL_BUILTIN_BSWAP16(static_cast<uint16_t>(__val))); |
There was a problem hiding this comment.
| return static_cast<_Integer>(_CCCL_BUILTIN_BSWAP16(static_cast<uint16_t>(__val))); | |
| return static_cast<_Integer>(_CCCL_BUILTIN_BSWAP16(static_cast<::cuda::std::uint16_t>(__val))); |
Unfortunately we must fully qualify all types and calls like this. It's not so strictly required for types, but better safe than sorry
Sorry, something went wrong.
|
Addressed both follow-up comments in 708003e: replaced the hardcoded size checks with comparisons against the corresponding fully qualified fixed-width types, and fully qualified the cast types in all three sized-builtin branches. Local pre-commit and the targeted std/numerics/bit/byteswap.pass.cpp lit test both pass. |
Sorry, something went wrong.
Signed-off-by: Yuchen Fan <functionhx@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 59b56197-3676-4122-a9bd-67e8adccaaa8 📥 CommitsReviewing files that changed from the base of the PR and between 0fa6cea and 98b083b. 📒 Files selected for processing (1)
📝 Walkthrough Summary by CodeRabbit
Walkthroughcuda::std::byteswap detects builtin_bswapg, disables it for NVCC device compilation, and uses it for integral types larger than one byte when available. ChangesByteswap builtin integration
Assessment against linked issues
Comment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
🥳 CI Workflow Results🟩 Finished in 1h 52m: Pass: 100%/120 | Total: 1d 21h | Max: 1h 19m | Hits: 100%/356615See results here. |
Sorry, something went wrong.
|
Thanks for the patch! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #7778.