Skip to content

[cudax][cuco] Migrate host and device insert_and_find APIs for fixed_capacity_set - #12382

Open
PointKernel wants to merge 7 commits into
NVIDIA:mainfrom
PointKernel:cuco-set-insert-and-find
Open

PointKernel wants to merge 7 commits into
NVIDIA:mainfrom
PointKernel:cuco-set-insert-and-find

Conversation

@PointKernel

Copy link
Copy Markdown
Member

Description

Closes #11128.

This PR migrates the host and device insert_and_find APIs from cuCollections static_set to fixed_capacity_set, reusing the shared open-addressing implementation, and adds a benchmark.

Checklist

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

Add synchronous and asynchronous host insert_and_find, which write the
stored key and the insertion status for each input key, and scalar and
cooperative-group device insert_and_find returning a const iterator to
the stored key and whether the key was inserted.

Cover new and existing keys, duplicates within one input, equivalent
keys returning the stored key, and a full set in the existing tests, and
add an insert_and_find benchmark.
@PointKernel PointKernel added cudax Feature intended for the cudax experimental library cuco cuCollections labels Nov 2, 2026
@github-project-automation github-project-automation Bot moved this to Todo in CCCL 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.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Nov 2, 2026
@PointKernel

Copy link
Copy Markdown
Member Author

/ok to test

@github-actions

This comment has been minimized.

@PointKernel

Copy link
Copy Markdown
Member Author

/ok to test bbed6f2

@github-actions

This comment has been minimized.

@PointKernel
PointKernel marked this pull request as ready for review November 3, 2026 00:34
@PointKernel
PointKernel requested review from a team as code owners November 3, 2026 00:34
@cccl-authenticator-app cccl-authenticator-app Bot moved this from In Progress to In Review in CCCL Nov 3, 2026
@PointKernel PointKernel self-assigned this Nov 3, 2026
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Added fixed-capacity set operations that insert a key and return the stored key, along with an indication of whether insertion occurred.
    • Added synchronous and asynchronous options, with support for individual threads and cooperative groups.
    • If an equivalent key is already present, the existing key is returned. If the set is full, the result indicates that no insertion occurred.
  • Benchmarks
    • Added benchmarks for insertion and lookup across varying input sizes, set occupancies, and duplicate-key rates.

The change adds synchronous and asynchronous insert_and_find operations for fixed_capacity_set, device reference overloads, tests for returned keys and insertion status, and benchmarks that vary input count, occupancy, and key multiplicity.

Changes: fixed_capacity_set insert-and-find

Layer / File(s) Summary
Insert-and-find APIs
cudax/include/cuda/experimental/__cuco/fixed_capacity_set.cuh, cudax/include/cuda/experimental/__cuco/fixed_capacity_set_ref.cuh
The set gains synchronous and asynchronous operations that provide stored keys and insertion status. Device reference overloads return an iterator to the stored key and the insertion status.
Insert-and-find behavior tests
cudax/test/cuco/fixed_capacity_set/test_insert_and_contains.cu, cudax/test/cuco/fixed_capacity_set/test_ref.cu
Tests cover duplicate, existing, new, heterogeneous, empty, and full-set inputs through the set operations and device reference overloads.
Insert-and-find benchmark
cudax/benchmarks/bench/cuco/fixed_capacity_set/insert_and_find.cu
Adds benchmarks that vary input count, occupancy, or key multiplicity while timing asynchronous insertion and lookup.

Assessment against linked issues

Objective Addressed Explanation
Migrate host and device insert_and_find APIs to fixed_capacity_set [#11128] ✅
Add corresponding tests and benchmarks [#11128] ✅

Possibly related issues

Possibly related PRs

  • NVIDIA/cccl#11869: Adds the fixed_capacity_set and fixed_capacity_set_ref definitions used by the new APIs.

Suggested reviewers: gevtushenko

Change: Feature

Merge Risk: Minimal · up to 516f5

This change adds new host and device insert_and_find operations for fixed_capacity_set, with tests and a benchmark. No actionable merge-blocking risk was identified, and existing behavior is not altered.

Security architecture risk: Minimal · up to 516f5

The new operations preserve existing storage ownership, concurrency restrictions, and caller-access rules. No introduced or materially worsened security risk was identified in the reviewed API paths.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The reviewed operation's direct effects are bounded to the referenced set's slot storage and caller-supplied output ranges. Its parameters do not select another tenant, service, credential, or environment. Whether downstream applications share this storage across trust boundaries is not established.

Trust Boundaries and Controls

  • inferred — Returning a stored equivalent key does not establish a new authorization bypass in this library surface: callers already held references exposing the same slot storage before this PR. The new device result is a const iterator, and the host result is a copied key rather than a borrowed iterator.

Resilience and Maintainability Implications

  • inferred — Atomicity is per key, not an all-or-nothing bulk transaction. Repetition finds already-inserted keys and reports false; full-capacity failure does not add a key. Callers must not infer rollback or valid completed outputs after a launch or synchronization exception, and asynchronous buffers must remain valid through completion.
- [ ] 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: d0d9d68
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 6c67b2d8-694b-4c2f-9e97-1096918db6e4
Commits

Reviewing files that changed from the base of the PR and between d732375 and 516f5aa.

Files selected for processing: 1

  • cudax/test/cuco/fixed_capacity_set/test_insert_and_contains.cu

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

@coderabbitai coderabbitai Bot 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.

Follow-up Comments

Nitpick suggestion: cover distinct equivalent keys in the reference test.

82-92: Trivial · Functional Correctness · Quick win

suggestion: cover distinct equivalent keys in the reference test.

The scalar and cooperative fixed_capacity_set_ref tests reuse the same key and only assert equivalence. Add distinct equivalent input and stored values, then assert that *found remains the originally stored value. The existing owning-container test covers the shared implementation, but it does not test this direct external-storage reference path.

Open the source location


Review info
Run configuration
  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: ae82152
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 4c5d46d8-fc2a-415e-94f7-285524689738
Commits

Reviewing files that changed from the base of the PR and between ae82152 and bbed6f2.

Files selected for processing: 5
  • cudax/benchmarks/bench/cuco/fixed_capacity_set/insert_and_find.cu
  • cudax/include/cuda/experimental/__cuco/fixed_capacity_set.cuh
  • cudax/include/cuda/experimental/__cuco/fixed_capacity_set_ref.cuh
  • cudax/test/cuco/fixed_capacity_set/test_insert_and_contains.cu
  • cudax/test/cuco/fixed_capacity_set/test_ref.cu

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

This comment has been minimized.

@github-actions

This comment has been minimized.

…-find

# Conflicts:
#	cudax/test/cuco/fixed_capacity_set/test_insert_and_contains.cu
@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 1h 19m: Pass: 100%/75 | Total: 14h 38m | Max: 1h 19m | Hits: 90%/54017

See results here.

This branch has not been deployed

No deployments
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: In Review

Development

Successfully merging this pull request may close these issues.

[CUCO][FEA]: Migrate host and device insert_and_find APIs for fixed_capacity_set

2 participants