Skip to content

Refactor enum to string functions#9752

Draft
bernhardmgruber wants to merge 8 commits into
NVIDIA:mainfrom
bernhardmgruber:ref_to_string
Draft

Refactor enum to string functions#9752
bernhardmgruber wants to merge 8 commits into
NVIDIA:mainfrom
bernhardmgruber:ref_to_string

Conversation

@bernhardmgruber

Copy link
Copy Markdown
Contributor

As suggested by @Jacobfaib on #9745, this PR:

  • Move default cases in to_string functions out of switches
  • Fully qualifies std::formatter specializations
  • Adds the missing _CCCL_API

@copy-pr-bot

copy-pr-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Jul 8, 2026

@Jacobfaib Jacobfaib left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the quick PR!

#if __cpp_lib_format >= 201907L && !defined(_CCCL_DOXYGEN_INVOKED)
template <::cuda::std::same_as<char> CharT>
struct std::formatter<CUB_NS_QUALIFIER::BlockHistogramMemoryPreference, CharT> : formatter<const CharT*, CharT>
struct ::std::formatter<CUB_NS_QUALIFIER::BlockHistogramMemoryPreference, CharT> : formatter<const CharT*, CharT>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatter as well? Or is that in the cub namespace?

@davebayer davebayer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't fully qualify the formatter specializations, because there is a bug in gcc that makes it refuse to compile the code :D

namespace detail
{
[[nodiscard]] constexpr const char* to_string(BlockReduceAlgorithm algo) noexcept
_CCCL_API [[nodiscard]] constexpr const char* to_string(BlockReduceAlgorithm algo) noexcept

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_CCCL_API [[nodiscard]] constexpr const char* to_string(BlockReduceAlgorithm algo) noexcept
[[nodiscard]] _CCCL_API constexpr const char* to_string(BlockReduceAlgorithm algo) noexcept

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants