Skip to content

Refactor enum to string functions - #9752

Merged
bernhardmgruber merged 7 commits into
NVIDIA:mainfrom
bernhardmgruber:ref_to_string
Jul 13, 2026
Merged

Refactor enum to string functions#9752
bernhardmgruber merged 7 commits into
NVIDIA:mainfrom
bernhardmgruber:ref_to_string

Conversation

@bernhardmgruber

@bernhardmgruber bernhardmgruber commented Jul 8, 2026

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!

Comment thread cub/cub/agent/agent_histogram.cuh Outdated
#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

Comment thread cub/cub/block/block_reduce.cuh Outdated
@bernhardmgruber
bernhardmgruber marked this pull request as ready for review July 13, 2026 13:56
@bernhardmgruber
bernhardmgruber requested review from a team as code owners July 13, 2026 13:56
@cccl-authenticator-app cccl-authenticator-app Bot moved this from In Progress to In Review in CCCL Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e05dd7ce-21c6-41c5-a7ba-0496306f1eec

📥 Commits

Reviewing files that changed from the base of the PR and between afd6b18 and 5617f1d.

📒 Files selected for processing (10)
  • cub/cub/agent/agent_radix_sort_onesweep.cuh
  • cub/cub/block/block_load.cuh
  • cub/cub/block/block_radix_rank.cuh
  • cub/cub/block/block_scan.cuh
  • cub/cub/block/block_store.cuh
  • cub/cub/device/dispatch/tuning/tuning_radix_sort.cuh
  • cub/cub/device/dispatch/tuning/tuning_scan.cuh
  • cub/cub/thread/thread_load.cuh
  • cub/cub/warp/warp_load.cuh
  • cub/cub/warp/warp_store.cuh
🚧 Files skipped from review as they are similar to previous changes (10)
  • cub/cub/warp/warp_load.cuh
  • cub/cub/agent/agent_radix_sort_onesweep.cuh
  • cub/cub/device/dispatch/tuning/tuning_scan.cuh
  • cub/cub/warp/warp_store.cuh
  • cub/cub/block/block_store.cuh
  • cub/cub/block/block_scan.cuh
  • cub/cub/thread/thread_load.cuh
  • cub/cub/block/block_load.cuh
  • cub/cub/device/dispatch/tuning/tuning_radix_sort.cuh
  • cub/cub/block/block_radix_rank.cuh

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency of algorithm-description string generation: unrecognized values now reliably return clear “<unknown …>” fallback text across histogram, radix sort, scan, transform, load, store, and reduction paths.
  • Compatibility
    • Improved visibility/export of algorithm-description utilities by marking the relevant enum-to-string helpers as externally available (_CCCL_API) for broader integration and build scenarios.

Walkthrough

Changes

CUB enum-to-string helpers add _CCCL_API where applicable and move unknown-value fallbacks after their switch statements.

CUB stringification helpers

Layer / File(s) Summary
Agent and block helpers
cub/cub/agent/*, cub/cub/block/*
Enum conversion declarations gain _CCCL_API; unknown-value returns move after the switch.
Device tuning helpers
cub/cub/device/dispatch/tuning/*.cuh
Tuning enum conversion helpers update annotations where applicable and use trailing unknown-value returns.
Thread and warp helpers
cub/cub/thread/thread_load.cuh, cub/cub/warp/*
Thread and warp enum conversion helpers gain _CCCL_API and trailing unknown-value fallbacks.

Possibly related PRs

  • NVIDIA/cccl#9745: Touches the same LookbackDelayAlgorithm string conversion and unknown-value fallback in common.cuh.

Suggested reviewers: ericniebler, pauleonix


Comment @coderabbitai help to get the list of available commands.

@bernhardmgruber
bernhardmgruber enabled auto-merge (squash) July 13, 2026 14:28
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 2h 38m: Pass: 100%/287 | Total: 6d 15h | Max: 2h 38m | Hits: 48%/403232

See results here.

@bernhardmgruber
bernhardmgruber merged commit 53718f3 into NVIDIA:main Jul 13, 2026
306 of 307 checks passed
@bernhardmgruber
bernhardmgruber deleted the ref_to_string branch July 14, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants