Skip to content

[cudax][cuco] Migrate rebind APIs for fixed_capacity_set_ref - #12638

Open
PointKernel wants to merge 1 commit into
NVIDIA:mainfrom
PointKernel:cuco-set-rebind
Open

PointKernel wants to merge 1 commit into
NVIDIA:mainfrom
PointKernel:cuco-set-rebind

Conversation

@PointKernel

Copy link
Copy Markdown
Member

Description

Closes #11139.

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.

@PointKernel PointKernel added cudax Feature intended for the cudax experimental library cuco cuCollections labels Nov 13, 2026
@PointKernel PointKernel self-assigned this Nov 13, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 13, 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 13, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Nov 13, 2026
@PointKernel

Copy link
Copy Markdown
Member Author

/ok to test 09000e9

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 1h 14m: Pass: 100%/75 | Total: 19h 26m | Max: 1h 12m | Hits: 66%/93497

See results here.

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

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Summary

Summary by CodeRabbit

  • New Features
    • 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.

Changes: Fixed-capacity set reference rebinding

Layer / File(s) Summary
Add reference rebinding methods
cudax/include/cuda/experimental/__cuco/fixed_capacity_set_ref.cuh
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

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

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: ae772fa
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 9fc1f92a-9ce7-48f8-ae55-2f68d069f43f
Commits

Reviewing files that changed from the base of the PR and between ae772fa and 09000e9.

Files selected for processing: 2

  • cudax/include/cuda/experimental/__cuco/fixed_capacity_set_ref.cuh
  • 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; 9 remain after this review.


//! @brief Returns a copy of this ref that hashes keys with `__hash`.
//!
//! The copy references the same slot storage and keeps the probing scheme kind and CG size.

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.

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.”

Source: Path instructions

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 rebind APIs for fixed_capacity_set_ref

2 participants