[diskann-garnet] FFI updates and additions - #1336
[diskann-garnet] FFI updates and additions#1336Jack Moffitt (metajack) wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the diskann-garnet FFI surface to support additional Garnet commands and to improve observability and efficiency (logging callback, read length hints, and attribute-based filtering keyed by internal IDs). It also introduces new FFI entrypoints for random member selection and neighbor listing, and bumps the package version to 5.0.0.
Changes:
- Extend FFI callbacks: add
logCallback, add alength_hintparameter toreadCallback, and changefilterCallbackto accept attribute bytes rather than internal IDs. - Add new FFI functions:
random_members()(VRANDMEMBER) andsearch_neighbors()(VLINKS), plus provider-side support (random_members,neighbors). - Change attribute storage to be keyed by internal ID (reducing reads during filtered search), and make
backfill_quant_vectors()return aboolstatus.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
diskann-garnet/src/lib.rs |
Adds new FFI entrypoints and extends the create_index ABI with a log callback. |
diskann-garnet/src/provider.rs |
Implements provider-side random member selection and neighbor extraction; updates attribute storage semantics. |
diskann-garnet/src/garnet.rs |
Updates callback type signatures (read length hint, filter data pointer/len, log callback) and threads hints through read helpers. |
diskann-garnet/src/test_utils.rs |
Updates test callback shims to match new ABI and captures log messages. |
diskann-garnet/src/dyn_index.rs |
Extends the dynamic index trait to include new FFI-backed operations. |
diskann-garnet/src/fsm.rs |
Updates FSM metadata existence checks to pass a read length hint. |
diskann-garnet/src/ffi_tests.rs |
Wires the new log callback into existing FFI tests. |
diskann-garnet/src/ffi_recall_tests.rs |
Wires the new log callback into recall tests. |
diskann-garnet/Cargo.toml |
Bumps crate version to 5.0.0. |
diskann-garnet/diskann-garnet.nuspec |
Bumps NuGet package version to 5.0.0. |
Cargo.lock |
Updates locked diskann-garnet version. |
kann-garnet |
New file added; appears to be an accidental terminal/help-text dump. |
╭───────────┬──────────────────────────────╮ |
New file added; appears to be an accidental terminal/help-text dump. |
Suppressed comments (2)
╭───────────┬──────────────────────────────╮:5
- This file name/content looks like an accidental terminal/UI capture (duplicate
lesshelp text) rather than a real project file. It should not be checked in as it can cause tooling issues (paths, packaging) and adds repository clutter.
diskann-garnet/src/garnet.rs:300 - Same truncation issue here:
length_hint as u32can wrap/truncate on 64-bit if the hint exceedsu32::MAX. Clamping tou32::MAXkeeps the "hint" semantics without changing behavior for normal sizes.
unsafe {
(self.read_callback)(
ctx.inner,
ids.len() as u32 / 2,
length_hint as u32,
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (76.36%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1336 +/- ##
==========================================
- Coverage 91.55% 91.50% -0.06%
==========================================
Files 522 522
Lines 99541 99991 +450
==========================================
+ Hits 91139 91500 +361
- Misses 8402 8491 +89
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
0e5a59e to
9e7189b
Compare
| return -1; | ||
| }; | ||
|
|
||
| for nbr in neighbors { |
There was a problem hiding this comment.
Could output.extend(neighbors) work?
This series of commits add several new FFI functions and makes a few FFI updates.
random_members()function.search_neighbors()function.logCallbackis now passed which is used to send log messages to Garnet, and several log messages were added.readCallback, which is allowed to be wrong but is better to overestimate.backfill_quant_vectors().filterCallbacknow takes a ptr and length to the attribute data instead of the internal id. Now diskann-garnet is responsible for looking up attributes, and attributes have moved to being key off the internal ID, reducing keys read during filtered search from 3 to 2 (old: extid map, attributes, vector data; new: attributes, vector data).Each commit is self contained, but the version is bumped in the first commit.