Skip to content

[CUB] Deprecate cub::Log2 - #12672

Merged
davebayer merged 1 commit into
NVIDIA:mainfrom
fbusato:deprecate-cub-log2
Nov 18, 2026
Merged

davebayer merged 1 commit into
NVIDIA:mainfrom
fbusato:deprecate-cub-log2

Conversation

@fbusato

@fbusato fbusato commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

Replace cub::Log2 with cuda::ilog2. No SASS changes involved

Also, updated #3701

@fbusato fbusato self-assigned this Nov 17, 2026
@fbusato
fbusato requested a review from a team as a code owner November 17, 2026 22:34
@fbusato
fbusato requested a review from pauleonix November 17, 2026 22:34
@fbusato fbusato added this to CCCL Nov 17, 2026
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Nov 17, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: bb4ff6d
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: fa87ebc4-ccc7-4fca-a146-6884133bd1b8
Commits

Reviewing files that changed from the base of the PR and between d454ead and 786e6d3.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Refactor
    • Updated compile-time logarithm calculations across scan, sort, reduction, and decoding operations to use CUDA math utilities.
  • Deprecation
    • The legacy logarithm helper is deprecated; CUDA math logarithm utilities are the recommended alternative.

CUB agent, block, and warp headers replace cub::Log2 calculations with CUDA integer logarithm functions. The cub::Log2 template and its zero specialization are marked deprecated in favor of cuda::ceil_ilog2.

Changes: CUB Logarithm Utility Migration

Layer / File(s) Summary
Migrate agent and block calculations
cub/cub/agent/*, cub/cub/block/*
Agent and block algorithms now use cuda::ilog2 or cuda::ceil_ilog2 for their compile-time logarithm calculations. The counter sizing and packing expressions are otherwise unchanged.
Migrate warp calculations
cub/cub/warp/specializations/*
Warp reduction and scan specializations now use cuda::ilog2 or cuda::ceil_ilog2 to compute their step counts.
Deprecate CUB Log2
cub/cub/detail/log2.cuh
Log2 and its zero specialization now carry deprecation attributes that direct callers to cuda::ceil_ilog2. The Doxygen guard now excludes both declarations.

Suggested reviewers: miscco, bernhardmgruber, jacobfaib

Change: Refactor

Merge Risk: Minimal · previous review d454e

This change replaces the internal Log2 utility with CUDA integer log functions and deprecates the old template. The replacements appear to preserve sizing values, so the merge risk is minimal.

Architecture risk: Low · up to d454e

The change affects 1 system.

Changed systems: cub

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — cub (service) was modified; 9 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in cub/cub/agent/agent_batch_memcpy.cuh: The header replaces the cub/detail/log2.cuh include with cuda/__cmath/ilog.h; the uninitialized.cuh, util_ptx.cuh, and ceil_div.h includes remain.
  • observed — Modified behavior in cub/cub/agent/agent_batch_memcpy.cuh: bit_packed_counter now computes the nonzero maximum’s minimum bit width as cuda::ilog2(MaxItemValue) + 1 rather than cub::Log2(MaxItemValue + 1). For power-of-two sizing, it uses cuda::ceil_ilog2 to round that minimum width up to a power of two instead of using cub::Log2.
  • observed — Modified behavior in cub/cub/agent/agent_radix_sort_upsweep.cuh: The include list removes cub/detail/log2.cuh and adds cuda/__cmath/ilog.h; the existing uninitialized-storage, iterator, and thread-load includes remain.
  • observed — Modified behavior in cub/cub/agent/agent_radix_sort_upsweep.cuh: OG_BYTES_PER_COUNTER and LOG_PACKING_RATIO now use ::cuda::ilog2 instead of Log2<...>::VALUE; the PACKING_RATIO calculation is unchanged.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: bb4ff6d
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 0447e379-809b-404c-b8af-562cdd61c770
Commits

Reviewing files that changed from the base of the PR and between bb4ff6d and d454ead.

Files selected for processing: 9

  • cub/cub/agent/agent_batch_memcpy.cuh
  • cub/cub/agent/agent_radix_sort_upsweep.cuh
  • cub/cub/agent/single_pass_scan_operators.cuh
  • cub/cub/block/block_radix_rank.cuh
  • cub/cub/block/block_run_length_decode.cuh
  • cub/cub/detail/log2.cuh
  • cub/cub/warp/specializations/warp_reduce_smem.cuh
  • cub/cub/warp/specializations/warp_scan_shfl.cuh
  • cub/cub/warp/specializations/warp_scan_smem.cuh

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 2h 53m: Pass: 100%/214 | Total: 7d 00h | Max: 2h 52m | Hits: 39%/763474

See results here.

@davebayer
davebayer merged commit 43ee3f1 into NVIDIA:main Nov 18, 2026
244 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants