Skip to content

[cudax][cuco] Broadcast one slot index in cooperative insert_and_find - #12385

Merged
PointKernel merged 3 commits into
NVIDIA:mainfrom
PointKernel:cuco-cg-insert-and-find-codegen
Nov 4, 2026
Merged

PointKernel merged 3 commits into
NVIDIA:mainfrom
PointKernel:cuco-cg-insert-and-find-codegen

Conversation

@PointKernel

@PointKernel PointKernel commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Description

Related to #12382.

This PR improves the cooperative insert_and_find codegen shared by fixed_capacity_map and fixed_capacity_set. The bucket scan no longer breaks out of the loop, and the winning lane's slot index is broadcast with one shuffle instead of two, with the slot pointer formed from the storage base so it stays in global address space.

The cooperative device insert_and_find is now on par with cuCollections, e.g. 357 → 308 SASS instructions on sm_120 and 362 → 332 on sm_90 for int32 keys with CG size 4.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Scan the bucket without break, take the expected slot from the bucket,
and broadcast a single combined slot index instead of separate bucket
and intra-bucket indices. Forming the slot pointer from the storage base
after the shuffle keeps it in global address space.
@PointKernel PointKernel added cudax Feature intended for the cudax experimental library cuco cuCollections labels Nov 2, 2026
@PointKernel PointKernel added cudax Feature intended for the cudax experimental library cuco cuCollections labels Nov 2, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 2, 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.

@github-project-automation github-project-automation Bot moved this to Todo in CCCL Nov 2, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Nov 2, 2026
Assume slot addresses are not in local memory before the CAS so the
atomic_ref local-memory fallback folds early and the expected value no
longer spills on sm_90. The assumption is skipped for nvcc and NVRTC
before 13.1, which miscompile __isLocal.
@PointKernel PointKernel changed the title [cudax][cuco] Broadcast one slot index in cooperative insert_and_find [cudax][cuco] Close the cooperative insert_and_find codegen gap Nov 2, 2026
@PointKernel PointKernel changed the title [cudax][cuco] Close the cooperative insert_and_find codegen gap [cudax][cuco] Broadcast one slot index in cooperative insert_and_find Nov 2, 2026
@PointKernel

Copy link
Copy Markdown
Member Author

/ok to test

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 1h 14m: Pass: 100%/75 | Total: 15h 41m | Max: 1h 10m | Hits: 74%/65573

See results here.

@PointKernel
PointKernel marked this pull request as ready for review November 2, 2026 22:30
@PointKernel
PointKernel requested a review from a team as a code owner November 2, 2026 22:30
@cccl-authenticator-app cccl-authenticator-app Bot moved this from In Progress to In Review in CCCL Nov 2, 2026
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 852f506
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 315da328-ef3a-40ab-a974-ec707d90f6df
Commits

Reviewing files that changed from the base of the PR and between 852f506 and 4cc1c6f.

Files selected for processing: 1
  • cudax/include/cuda/experimental/__cuco/detail/open_addressing/open_addressing_ref_impl.cuh

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

Summary

Summary by CodeRabbit

  • Performance
    • Insert-and-find operations now avoid checking additional bucket slots after finding an available slot or a matching key, reducing unnecessary work during these operations. No changes to public interfaces are included.

The cooperative insert_and_find scan now tracks a qualifying slot without breaking from the scan. It shuffles the combined probing and intra-bucket index to form slot pointers for matching slots and available-slot insertion.

Changes: Cooperative insert-and-find

Layer / File(s) Summary
Scan and pointer selection
cudax/include/cuda/experimental/__cuco/detail/open_addressing/open_addressing_ref_impl.cuh
The scan initializes its candidate from bucket slot zero and uses intra-bucket index zero as the default. It records the first qualifying slot, then shuffles the combined index to form pointers for matching slots and insertion.

Possibly related PRs

  • NVIDIA/cccl#12355: It applies the combined-slot-index and post-shuffle pointer pattern to cooperative find in the shared implementation.
  • NVIDIA/cccl#11869: It added cooperative insertion to the shared open-addressing implementation changed here.

Suggested reviewers: srinivasyadav18, sleeepyjack, gevtushenko

Change: Refactor

Merge Risk: Minimal · up to 4cc1c

No actionable issue is established for the changed insert-and-find behavior; the PR is mergeable after normal checks.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@PointKernel PointKernel self-assigned this Nov 3, 2026
@PointKernel
PointKernel merged commit e0f9724 into NVIDIA:main Nov 4, 2026
97 checks passed
@PointKernel
PointKernel deleted the cuco-cg-insert-and-find-codegen branch November 4, 2026 17:31
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuco cuCollections cudax Feature intended for the cudax experimental library

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants