Skip to content

[Backport to 3.4] Remove most _CCCL_GRID_CONSTANT annotations, including merge sort - #9864

Merged
wmaxey merged 2 commits into
NVIDIA:branch/3.4.xfrom
bernhardmgruber:backport_grid_const_removal
Jul 14, 2026
Merged

[Backport to 3.4] Remove most _CCCL_GRID_CONSTANT annotations, including merge sort#9864
wmaxey merged 2 commits into
NVIDIA:branch/3.4.xfrom
bernhardmgruber:backport_grid_const_removal

Conversation

@bernhardmgruber

@bernhardmgruber bernhardmgruber commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

This PR backports the following two PRs:

bernhardmgruber and others added 2 commits July 14, 2026 22:30
QA reported several regressions caused by the introduction of `_CCCL_GRID_CONSTANT` in NVIDIA#6642. The regressions include:

- NVIDIA#9763
- NVIDIA#9765
- NVIDIA#9766
- NVIDIA#9768
- NVIDIA#9822

The cause of the regression is probably a compiler bug, reported in NVBug 6448961. This PR mainly reverts NVIDIA#6642, but since a lot of time has passed, I needed to do a lot of manual editing as well.

Fixes: NVIDIA#9768
Fixes: NVIDIA#9822
Fixes: NVIDIA#9851
(cherry picked from commit d8fd76b)
…9829)

Co-authored-by: Paul Grosse-Bley <pauleonix-dev@pm.me>
@bernhardmgruber
bernhardmgruber requested a review from a team as a code owner July 14, 2026 20:33
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Jul 14, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jul 14, 2026
@bernhardmgruber bernhardmgruber changed the title Backport grid const removal [Backport to 3.4] Remove most _CCCL_GRID_CONSTANT annotations, including merge sort Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 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: edbc1696-0285-4862-a3e4-dbaa75d9b719

📥 Commits

Reviewing files that changed from the base of the PR and between bf8e9d2 and 314504a.

📒 Files selected for processing (21)
  • cub/cub/device/dispatch/dispatch_adjacent_difference.cuh
  • cub/cub/device/dispatch/dispatch_batch_memcpy.cuh
  • cub/cub/device/dispatch/dispatch_merge.cuh
  • cub/cub/device/dispatch/dispatch_reduce_by_key.cuh
  • cub/cub/device/dispatch/dispatch_rle.cuh
  • cub/cub/device/dispatch/dispatch_scan_by_key.cuh
  • cub/cub/device/dispatch/dispatch_segmented_sort.cuh
  • cub/cub/device/dispatch/dispatch_topk.cuh
  • cub/cub/device/dispatch/kernels/kernel_for_each.cuh
  • cub/cub/device/dispatch/kernels/kernel_histogram.cuh
  • cub/cub/device/dispatch/kernels/kernel_merge_sort.cuh
  • cub/cub/device/dispatch/kernels/kernel_radix_sort.cuh
  • cub/cub/device/dispatch/kernels/kernel_reduce.cuh
  • cub/cub/device/dispatch/kernels/kernel_scan.cuh
  • cub/cub/device/dispatch/kernels/kernel_segmented_radix_sort.cuh
  • cub/cub/device/dispatch/kernels/kernel_segmented_reduce.cuh
  • cub/cub/device/dispatch/kernels/kernel_segmented_scan.cuh
  • cub/cub/device/dispatch/kernels/kernel_segmented_sort.cuh
  • cub/cub/device/dispatch/kernels/kernel_three_way_partition.cuh
  • cub/cub/device/dispatch/kernels/kernel_transform.cuh
  • cub/cub/device/dispatch/kernels/kernel_unique_by_key.cuh

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Updated internal GPU kernel interfaces across sorting, scanning, reduction, histogram, transform, and partition operations.
    • Simplified parameter declarations while preserving existing processing logic and runtime behavior.
    • No user-facing functionality or API behavior changes are expected.

Walkthrough

Changes

The PR removes _CCCL_GRID_CONSTANT from CUDA kernel parameter declarations across CUB device dispatch, sorting, reduction, scan, partition, histogram, transform, and related kernels. Existing parameter types, const semantics, call sites, and kernel bodies remain unchanged.

CUB kernel signature updates

Layer / File(s) Summary
Dispatch entry-point signatures
cub/cub/device/dispatch/dispatch_*.cuh
Adjacent-difference, batch-memcpy, merge, reduce-by-key, RLE, scan-by-key, segmented-sort, and TopK kernel parameters no longer use _CCCL_GRID_CONSTANT.
General algorithm kernel signatures
cub/cub/device/dispatch/kernels/kernel_for_each.cuh, kernel_histogram.cuh, kernel_reduce.cuh, kernel_scan.cuh, kernel_transform.cuh, kernel_unique_by_key.cuh
For-each, histogram, reduction, scan, transform, and unique-by-key kernel declarations use plain parameter qualifiers.
Sort kernel signatures
cub/cub/device/dispatch/kernels/kernel_merge_sort.cuh, kernel_radix_sort.cuh
Merge-sort and radix-sort stage kernel declarations remove _CCCL_GRID_CONSTANT without changing kernel logic.
Segmented algorithm signatures
cub/cub/device/dispatch/kernels/kernel_segmented_*.cuh
Segmented radix sort, reduction, scan, and sort kernels retain their existing types while removing the grid-constant qualifier.
Partition kernel signatures
cub/cub/device/dispatch/kernels/kernel_three_way_partition.cuh
Three-way partition kernel parameters remove _CCCL_GRID_CONSTANT from iterator, output, scalar, and streaming-context arguments.

Possibly related PRs

  • NVIDIA/cccl#9858: Updates the same CUB dispatch kernel parameter declarations by removing _CCCL_GRID_CONSTANT.

Suggested labels: backport branch/3.4.x

Suggested reviewers: davebayer, gevtushenko


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

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 2h 24m: Pass: 100%/283 | Total: 11d 22h | Max: 2h 24m | Hits: 15%/1080970

See results here.

@wmaxey
wmaxey merged commit 6e3ed1e into NVIDIA:branch/3.4.x Jul 14, 2026
304 of 307 checks passed
@bernhardmgruber
bernhardmgruber deleted the backport_grid_const_removal branch July 15, 2026 10:08
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.

4 participants