Add int8 data type support to diskann-garnet/vectorset#1060
Conversation
- Add SB8 variant to VectorValueType for signed 8-bit input - Handle SB8 in interpret_vector (direct storage and f32 conversion) - Handle Q8 quant type in create_index to create index with i8 VectorRepr - Handle FP32 + Q8 path for converting f32 input to i8 storage - Add Int8 variant to vectorset DataType enum - Implement Element trait for i8 and wire up dispatch - Use SB8/Q8 protocol values in ingest and query commands - Update README to document SB8 and Q8 extensions Agent-Logs-Url: https://github.com/microsoft/DiskANN/sessions/7664c19b-7cdd-4a84-8249-951b2e2e040b Co-authored-by: harsha-simhadri <5590673+harsha-simhadri@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/DiskANN/sessions/9adc0f60-1eec-419c-ae00-3fbc815d2e5b Co-authored-by: harsha-simhadri <5590673+harsha-simhadri@users.noreply.github.com>
|
@copilot start reviewing this draft PR |
Here's a summary of this PR's changes: Rust FFI (
vectorset CLI (
Tests (
Garnet companion patch (
All 45 tests pass (including 5 new SB8 tests). Build is clean. |
There was a problem hiding this comment.
Pull request overview
Adds end-to-end int8 (SB8) vector support to the diskann-garnet FFI layer and the vectorset ingestion/query tool, parallel to the existing uint8 (XB8) path. A new VectorValueType::SB8 is wired through create_index/interpret_vector with a new VectorQuantType::Q8 storage path (i8 backing) and a SB8 → NoQuant conversion path (sign-extended to f32). The PR also includes a Markdown document describing the corresponding manual edits required in the external microsoft/garnet C# server, and an unrelated tweak to vectorset/config.toml.example.
Changes:
- Add
VectorValueType::SB8and aVectorQuantType::Q8branch indiskann-garnet, including FP32↔Q8 and SB8↔NoQuant conversions. - Add
Int8/SB8/Q8handling to thevectorsetCLI so it can ingest and query int8 datasets. - Add SB8 FFI unit tests and recall tests; add a Garnet-side patch instructions doc and update the README.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| diskann-garnet/src/lib.rs | New SB8 enum variant and Q8 storage / SB8 interpretation paths in create_index and interpret_vector. |
| diskann-garnet/src/ffi_tests.rs | Adds SB8 helpers and tests covering insert/remove/search, negative values, large external IDs, and bitmap filtering (all using a NoQuant index). |
| diskann-garnet/src/ffi_recall_tests.rs | Adds SB8 recall helpers and 1D–4D grid recall tests against an f32/NoQuant index. |
| diskann-garnet/README.md | Documents new SB8 value type and Q8 quantizer and recommended pairings. |
| vectorset/src/main.rs | Adds Int8 DataType, Element for i8, and SB8/Q8 arguments in ingest/query pipelines. |
| vectorset/config.toml.example | Replaces the commented scope placeholder with scope = "" (unrelated to int8 support). |
| garnet-sb8-support.patch.md | New document with manual edit instructions for the external microsoft/garnet repo to mirror the SB8/Q8 wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| VectorQuantType::Q8 => { | ||
| if let Ok(index) = create_index_impl::<i8>( | ||
| quant_type, | ||
| config, | ||
| dim as usize, | ||
| metric_type, | ||
| max_degree as usize, | ||
| callbacks, | ||
| context, | ||
| ) { | ||
| Arc::into_raw(index).cast::<c_void>() | ||
| } else { | ||
| ptr::null() | ||
| } | ||
| } |
Adds tests exercising the VectorQuantType::Q8 code path (native i8 index): - create_test_index_q8 helper in ffi_tests.rs - Q8 insert/remove, search, negative values, FP32→Q8 truncation tests - Parameterized run_sb8_recall_with_quant in ffi_recall_tests.rs - Q8 recall grid tests (1D–4D) Agent-Logs-Url: https://github.com/microsoft/DiskANN/sessions/163f33b7-e6d4-46ba-b54a-03c4f95f2d60 Co-authored-by: harsha-simhadri <5590673+harsha-simhadri@users.noreply.github.com>
VectorQuantType::NoQuant)create_test_index_q8helper inffi_tests.rsffi_tests.rsrun_sb8_recallinffi_recall_tests.rsto accept quant typeffi_recall_tests.rs