You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[cudax][cuco] Migrate host and device insert_and_find APIs for fixed_capacity_set - #12382
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.
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.
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.
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
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
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.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cucocuCollectionscudaxFeature intended for the cudax experimental library
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #11128.
This PR migrates the host and device
insert_and_findAPIs from cuCollectionsstatic_settofixed_capacity_set, reusing the shared open-addressing implementation, and adds a benchmark.Checklist