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 rebind APIs for fixed_capacity_set_ref - #12638
This PR migrates the rebind_key_eq and rebind_hash_function APIs from cuCollections static_set_ref to fixed_capacity_set_ref. As with fixed_capacity_map_ref, rebind_operators is not migrated because cudax refs carry no operator tags.
Checklist
New or existing tests cover these changes.
The documentation is up to date with these changes.
Added the ability to create set references that reuse existing storage with a different key-equality predicate or hash function, while retaining the probing configuration.
Added coverage verifying that rebound references can find stored keys using alternate query values.
The change adds rebind_key_eq and rebind_hash_function to fixed_capacity_set_ref. Both methods return a reference over existing storage with a substituted predicate or hash function. Tests cover linear probing and double hashing.
Adds methods to replace the key-equality predicate or hash function while retaining the reference's storage and other configuration.
Test rebinding with two probing schemes cudax/test/cuco/fixed_capacity_set/test_ref.cu
Adds offset-aware predicates and tests that rebind references using linear probing and double hashing. The tests check the rebound types, preserved storage properties, and lookup results.
Assessment against linked issues
Objective
Addressed
Explanation
Migrate rebind_operators, rebind_key_eq, and rebind_hash_function APIs and add tests [#11139]
❌
rebind_operators and its corresponding tests are not included.
Change: Feature
Merge Risk: Low · up to 09000
This adds the ability to swap the key-equality predicate or hash function on a fixed-capacity set reference. The code looks sound, but the documentation should state that the replacement hash and predicate must stay compatible with how the keys were inserted. Otherwise lookups can silently miss stored keys. This is a low-risk, documentation-level follow-up.
Security architecture risk: Minimal · up to 09000
The new operations create differently configured views over storage the caller already references. They do not migrate data or transfer ownership. No introduced security or failure-containment risk was established.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The demonstrated exposure is a library caller changing lookup behavior for storage it already references. The routed test helpers receive generated keys, fixed offsets, and a locally created set; they do not establish a new externally controlled service entrypoint or access to another storage allocation.
Trust Boundaries and Controls
observed — The existing public reference constructor already accepts caller-selected equality, probing configuration, and initialized storage. It documents capacity, alignment, padding, and stored-key configuration preconditions. The new rebinding methods reuse that constructor rather than introducing a privileged configuration path.
Hardening Proposals
proposed — Clarify that replacement equality and hashing must preserve compatibility between queries and existing stored-key placement. Explain that rebinding does not rehash storage or make arbitrary configurations safe for mutation through shared aliases.
- [ ] 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; 9 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
important: Document the storage-compatibility preconditions.
State that rebinding does not rehash existing keys. If the new hash starts a lookup at an empty bucket before reaching the stored key, contains returns false. The lookup implementation stops at that empty bucket. (raw.githubusercontent.com)
Document that the rebound predicate and hash must remain compatible with the original insertion configuration. Apply this requirement to both rebind methods and to both hashes for double hashing. The probing scheme uses those hashes to select the initial bucket and step size. (raw.githubusercontent.com)
As per path instructions, focus on “experimental API clarity.”
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 #11139.
This PR migrates the
rebind_key_eqandrebind_hash_functionAPIs from cuCollectionsstatic_set_reftofixed_capacity_set_ref. As withfixed_capacity_map_ref,rebind_operatorsis not migrated because cudax refs carry no operator tags.Checklist