feat(rust): add IVF-SQ bindings#2229
Open
jamie8johnson wants to merge 2 commits into
Open
Conversation
Wraps the IVF-SQ C API (added in v26.06) in the Rust crate, mirroring the cagra module structure: IndexParams and SearchParams builders, Index with build / search / search_with_filter (cuvsFilter bitset) / extend / serialize / deserialize, and the NLists/Dim/Size getters. cuvsIvfSqIndexGetCenters is deliberately not wrapped, matching cagra and ivf_pq. rust/cuvs-sys/src/bindings.rs regenerated (additive). 9 GPU tests: params builders, build + self-neighbor search, repeated search, getters, extend from an empty index, bitset-filtered search (verifies exclusion), serialize/deserialize round-trip (re-verifies search on the loaded index), interior-NUL path rejection.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds Rust FFI bindings and safe Rust wrappers for an IVF‑SQ approximate nearest‑neighbor index: parameter types, search parameters, Index wrapper (build/search/extend/serialize/deserialize), module exports, and unit tests. ChangesIVF-SQ Approximate Neighbor Index
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This was referenced Jun 9, 2026
Open
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds Rust bindings for the IVF-SQ index, wrapping the C API introduced in v26.06 ("IVF-SQ C API"). Follow-up to the CAGRA serialize/deserialize and
search_with_filterwrappers (#2019 lineage).What
rust/cuvs/src/ivf_sq/module mirroring thecagramodule structure:IndexParams/SearchParamsbuilders,Indexwithbuild,search,search_with_filter(cuvsFilterbitset),extend,serialize/deserialize, and then_lists/dim/sizegetters.rust/cuvs-sys/src/bindings.rsregenerated viarust/scripts/generate-bindings.sh— purely additive (cuvsIvfSq*block).Notes for reviewers
cuvsIvfSqIndexGetCentersis deliberately not wrapped, matching the cagra and ivf_pq modules — it fills a caller-allocatedDLManagedTensor, which has no ergonomic safe-Rust shape yet (commented inindex.rs).extendwhere the ivf_pq Rust module currently doesn't; the C API supports them for both, so this module simply wraps the full practical surface. Happy to trim for symmetry if preferred.Testing
9 GPU tests (single-process): params builders, build + self-neighbor search, repeated search, getters, extend-from-empty (NULL indices path), bitset-filtered search asserting exclusion, serialize/deserialize round-trip re-verifying search on the loaded index, interior-NUL path rejection.
cargo fmt/ clippy clean. Validated against both the v26.06.00 tag (conda libcuvs 26.06) and currentmain— theivf_sq.hheader is byte-identical between the two.