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 retrieve_all API for fixed_capacity_set - #12637
Added a way to retrieve all keys stored in a fixed-capacity set into a caller-provided output range. The operation returns the position after the last key written and synchronizes the supplied stream. The output range must be large enough for every stored key; the order of returned keys is unspecified.
Adds retrieve_all to fixed_capacity_set. The method copies stored keys to a caller-provided output range, synchronizes the supplied stream, and returns the iterator past the last key. Tests cover non-empty, empty, full-capacity, and large sets.
Changes: Fixed-capacity set retrieval
Layer / File(s)
Summary
Retrieve all keys and validate results cudax/include/cuda/experimental/__cuco/fixed_capacity_set.cuh, cudax/test/cuco/fixed_capacity_set/test_insert_and_contains.cu
Adds the public retrieve_all method and tests the returned iterator and retrieved keys for regular, empty, full-capacity, and large sets. Updates the large-input test’s memory estimate.
Assessment against linked issues
Objective
Addressed
Explanation
Migrate the host retrieve_all API to fixed_capacity_set and add corresponding tests [#11138]
✅
Suggested reviewers:jacobfaib
Change: Feature
Merge Risk: Minimal · up to 43b63
This adds a bulk key-retrieval method to the fixed-capacity set, with tests for populated, empty, full and very large sets. No concrete merge-blocking risk was found. The test assertions could be tightened to compare against the exact expected keys, but that is optional.
Security architecture risk: Minimal · up to 43b63
The new operation reuses existing retrieval behavior and documents its output-capacity and synchronization requirements. Inspection found no introduced or worsened security, ownership, or failure-containment risk.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The inspected operation acts within the calling application's CUDA memory authority: it reads the selected set's storage and writes through a caller-provided iterator. Existing data() access already exposes the slot-storage pointer, so bulk retrieval does not establish a new privilege to read those keys.
Trust Boundaries and Controls
observed — Output bounds depend on the documented caller precondition, not a runtime output-length check. The existing class contract also requires ordering conflicting work across streams and exclusive access for clearing; retrieve_all does not introduce an atomic-snapshot guarantee.
Resilience and Maintainability Implications
observed — Each retrieval allocates its own RAII counter rather than sharing count state across calls. The buffer retains the creation stream, and its destructor delegates deallocation to that stream, supporting cleanup on normal return and exception unwinding without transferring set ownership.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
suggestion: Compare the retrieved keys with the complete expected range.
An output containing num_keys copies of zero passes both assertions. For signed keys, is_below also accepts the empty sentinel -1. The full-capacity and large-input checks have the same gap. (raw.githubusercontent.com)
Sort the retrieved range and compare it with the expected counting range. This checks missing keys, duplicates, and invalid values without assuming retrieval order.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.
This branch has not been deployed
No deployments
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 #11138.
This PR migrates the host
retrieve_allAPI from cuCollectionsstatic_settofixed_capacity_set, reusing the shared open-addressing implementation.Checklist