Skip to content

Use uniform type names for init values throughout CUB#9267

Merged
gonidelis merged 3 commits into
NVIDIA:mainfrom
gonidelis:init_values_names
Jun 5, 2026
Merged

Use uniform type names for init values throughout CUB#9267
gonidelis merged 3 commits into
NVIDIA:mainfrom
gonidelis:init_values_names

Conversation

@gonidelis
Copy link
Copy Markdown
Member

@gonidelis gonidelis commented Jun 5, 2026

fixes #7974

enforces existing CUB naming convention:

  • InitValueT: template parameters use PascalCase + T suffix (e.g. InputIteratorT, ReductionOpT, AccumT). These are part of the public/dispatch interface.
  • init_value_t: local using aliases inside function bodies use snake_case + _t suffix.

@gonidelis gonidelis requested review from a team as code owners June 5, 2026 01:09
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Jun 5, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jun 5, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

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: 5bcacb88-be8a-4d59-9b6c-b7df0fd5f98c

📥 Commits

Reviewing files that changed from the base of the PR and between d237898 and ecf7187.

📒 Files selected for processing (1)
  • cub/cub/device/dispatch/dispatch_streaming_reduce.cuh
💤 Files with no reviewable changes (1)
  • cub/cub/device/dispatch/dispatch_streaming_reduce.cuh

Note: CodeRabbit is enabled on this repository as a convenience for maintainers
and contributors. Use your best judgment when considering its review comments and
suggestions — a suggested change may be inadequate, unnecessary, or safe to ignore.
Contributors are not expected to address every comment. Human reviews are what
ultimately matter for merging.

Summary

Standardizes the naming of "initial-value" types across CUB to follow the project convention:

  • Template parameters: PascalCase with trailing T → InitValueT
  • Local using/type-aliases: snake_case with _t suffix → init_value_t

This is a mechanical rename/propagation: identifiers and local aliases were changed and the new names were propagated through dispatch templates, kernel templates, internal helpers, benchmarks, and tests. No algorithmic, behavioral, or functional changes were introduced.

Scope of changes

  • Files touched: ~28 files including benchmarks, core device headers, dispatch plumbing, kernel templates, and tests.
  • Key areas:
    • Benchmarks: renamed local aliases (init_t → init_value_t) and updated usages.
    • Device APIs/headers: internal template parameter renames (InitT → InitValueT) and local alias renames.
    • Dispatch plumbing: propagated InitValueT through Dispatch* templates, defaults, and stored init members/parameters.
    • Kernels: kernel template parameters and init parameter types renamed to InitValueT; added/adjusted unwrap/finalize helpers for empty_problem_init_t.
    • Tests: Catch2 tests and reference helpers updated to use init_value_t / InitValueT.

Impact assessment

  • Public API: No semantic changes to runtime behavior. The edits are identifier renames (template parameter/alias names) and do not alter algorithmic behavior or dispatch logic.
  • Source-level compatibility: Code that relied on the literal identifier name InitT in manual instantiations or documentation may need small updates; typical user code should be unaffected.
  • Tests/benchmarks: Updated accordingly; no test behavior changes expected.

Notes for reviewers

  • Verify all instances of InitT/init_t (and similar variants) were consistently replaced with InitValueT/init_value_t.
  • Check accumulator-default computations and all places where AccumT is derived from the init-type default to ensure they now derive from InitValueT.
  • Confirm empty_problem_init_t handling and unwrap/finalize helpers were updated to accept the new InitValueT-based overloads where appropriate.
  • Watch for missed occurrences in documentation comments or rare instantiation sites that might still reference the old names.

suggestion: ## Walkthrough

This PR uniformly renames initial-value type identifiers from InitT/init_t to InitValueT/init_value_t across dispatch templates, kernel signatures, device API callsites, benchmarks, and tests.

suggestion: ## Changes

Initial value type naming consolidation

Layer / File(s) Summary
Dispatch type contracts
cub/cub/device/dispatch/dispatch_reduce.cuh, cub/cub/device/dispatch/dispatch_reduce_deterministic.cuh, cub/cub/device/dispatch/dispatch_reduce_nondeterministic.cuh, cub/cub/device/dispatch/dispatch_segmented_reduce.cuh, cub/cub/device/dispatch/dispatch_streaming_reduce.cuh
Template parameter InitT renamed to InitValueT throughout dispatch signatures, accumulator selection, and detail::reduce/detail::segmented_reduce dispatch entrypoints.
Kernel parameter adaptation
cub/cub/device/dispatch/kernels/kernel_reduce.cuh, cub/cub/device/dispatch/kernels/kernel_reduce_deterministic.cuh, cub/cub/device/dispatch/kernels/kernel_segmented_reduce.cuh
Kernel template parameters and signatures renamed from InitT to InitValueT; helpers unwrap_empty_problem_init and finalize_and_store_aggregate updated to handle empty_problem_init_t<InitValueT>.
Device public APIs (internal aliases)
cub/cub/device/device_reduce.cuh, cub/cub/device/device_scan.cuh, cub/cub/device/device_segmented_reduce.cuh
Internal aliases renamed to init_value_t/InitValueT in convenience overloads (Sum, Min, Max, ArgMin, ArgMax) and dispatch call sites; public API signatures unchanged.
Benchmarks
cub/benchmarks/bench/reduce/*, cub/benchmarks/bench/scan/exclusive/*, cub/benchmarks/bench/segmented_reduce/*, cub/benchmarks/bench/transform_reduce/sum.cu
Local aliases and tuned policy accumulator template arguments updated to use init_value_t and initializers constructed as init_value_t{}.
Test helpers and tests
cub/test/*
Reference helper templates, test callsites, FutureValue/test buffers, and environment kernel-instantiation checks updated to use InitValueT/init_value_t and to pass init_value_t{} into device APIs.

suggestion: ## Assessment against linked issues

Objective Addressed Explanation
Consolidate initial value type naming to a single uniform name [#7974]
Use InitValueT/init_value_t consistently across device headers [#7974]
Update dispatch, kernel, and device API implementations to use unified naming [#7974]

suggestion: ## Suggested reviewers

  • bernhardmgruber
  • oleksandr-pavlyk
  • srinivasyadav18

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

@github-actions

This comment has been minimized.

Comment thread cub/cub/device/dispatch/dispatch_streaming_reduce.cuh Outdated
@gonidelis gonidelis enabled auto-merge (squash) June 5, 2026 18:08
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

🥳 CI Workflow Results

🟩 Finished in 2h 24m: Pass: 100%/284 | Total: 11d 02h | Max: 2h 23m | Hits: 21%/923333

See results here.

@gonidelis gonidelis merged commit 1615269 into NVIDIA:main Jun 5, 2026
305 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Jun 5, 2026
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.

InitValueT, init_value_t and init_t in CUB device

4 participants