PiPNN 4/6: integrate disk build pipeline - #1291
Conversation
There was a problem hiding this comment.
Pull request overview
This PR integrates PiPNN graph construction into the DiskANN disk-index build pipeline and exposes it through the benchmark CLI inputs, including automated fixture-based tests to validate the new JSON configuration and execution paths.
Changes:
- Add a
BuildAlgorithmselector (Vamana vs PiPNN) with JSON-facing PiPNN parameters, plus memory-estimate-based fallback to Vamana for disk builds. - Implement PiPNN graph building adapters for disk builds and in-memory benchmark builds, including vector-store “flat prefix” access for dense layouts.
- Add a shared cached CLI fixture runner and new PiPNN benchmark fixtures (disk + in-memory) to validate end-to-end CLI wiring.
Reviewed changes
Copilot reviewed 33 out of 37 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| diskann-providers/src/utils/rayon_util.rs | Exposes underlying Rayon pool reference for APIs that need &rayon::ThreadPool. |
| diskann-providers/src/storage/mod.rs | Re-exports new adjacency-graph save helper. |
| diskann-providers/src/storage/bin.rs | Adds save_adjacency_graph for canonical adjacency graph serialization. |
| diskann-providers/src/model/graph/provider/async_/fast_memory_vector_provider.rs | Exposes unsafe dense-prefix slice access to support PiPNN build path. |
| diskann-providers/src/model/graph/provider/async_/common.rs | Implements AlignedMemoryVectorStore::flat_prefix and adds a contiguous-prefix test. |
| diskann-disk/src/lib.rs | Re-exports PiPNN parameters (feature-gated) and exposes build-algorithm selection. |
| diskann-disk/src/build/mod.rs | Re-exports BuildAlgorithm and (feature-gated) PiPNN parameters. |
| diskann-disk/src/build/configuration/mod.rs | Introduces build-algorithm configuration module and re-exports its types. |
| diskann-disk/src/build/configuration/disk_index_build_parameter.rs | Adds build_algorithm, PiPNN constructor, PiPNN config conversion, and memory-estimate-based fallback. |
| diskann-disk/src/build/configuration/build_algorithm.rs | New: serde-driven BuildAlgorithm enum and PiPNN JSON parameter struct. |
| diskann-disk/src/build/builder/build/pipnn.rs | New: PiPNN graph build adapter producing a canonical on-disk adjacency graph. |
| diskann-disk/src/build/builder/build/pipnn/tests.rs | New: disk-build integration tests for PiPNN selection, fallback, and header correctness. |
| diskann-disk/src/build/builder/build.rs | Routes graph construction to PiPNN (when selected) while keeping existing Vamana pipeline as default. |
| diskann-disk/Cargo.toml | Adds optional diskann-pipnn dependency + feature, plus test deps for new tests. |
| diskann-benchmark/src/main.rs | Refactors registry creation and adds PiPNN fixture test hook (feature-gated). |
| diskann-benchmark/src/inputs/graph_index.rs | Adds PiPNN build-algorithm selection for graph-index build inputs (feature-gated). |
| diskann-benchmark/src/inputs/disk.rs | Adds alpha, makes quantization_type optional, and adds disk build-algorithm selection + validation. |
| diskann-benchmark/src/index/build.rs | Adds PiPNN in-memory build path leveraging dense flat-prefix when possible. |
| diskann-benchmark/src/index/benchmarks.rs | Wires PiPNN build path selection into benchmark build flow. |
| diskann-benchmark/src/disk_index/build.rs | Wires disk BuildAlgorithm into disk-index build parameter construction. |
| diskann-benchmark/Cargo.toml | Adds optional PiPNN dependency/feature and enables fixture runner for dev-tests. |
| diskann-benchmark/tests/pipnn/inmemory/stdout.txt | New: expected output for in-memory PiPNN CLI fixture. |
| diskann-benchmark/tests/pipnn/inmemory/stdin.txt | New: commands for in-memory PiPNN CLI fixture. |
| diskann-benchmark/tests/pipnn/inmemory/input.json | New: PiPNN in-memory input JSON fixture. |
| diskann-benchmark/tests/pipnn/disk/stdout.txt | New: expected output for disk PiPNN CLI fixture. |
| diskann-benchmark/tests/pipnn/disk/stdin.txt | New: commands for disk PiPNN CLI fixture. |
| diskann-benchmark/tests/pipnn/disk/input.json | New: PiPNN disk input JSON fixture. |
| diskann-benchmark-runner/src/lib.rs | Exposes new fixture runner module for tests/downstream crates (feature-gated). |
| diskann-benchmark-runner/src/fixture.rs | New: shared cached CLI fixture runner implementation. |
| diskann-benchmark-runner/src/fixture/tests.rs | New: unit tests for fixture runner behavior. |
| diskann-benchmark-runner/src/app.rs | Updates integration-test documentation and switches tests to the shared fixture runner. |
| diskann-benchmark-runner/Cargo.toml | Adds test-fixtures feature + optional tempfile dep for downstream fixture usage. |
| Cargo.lock | Adds/records diskann-pipnn and serde_json dependency changes. |
| .cargo/mutants.toml | Excludes new fixture overwrite behavior from mutation testing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #[cfg(feature = "pipnn")] | ||
| let frozen_points = match self.build_algorithm { | ||
| diskann_disk::BuildAlgorithm::PiPNN(_) => NonZero::new(1).unwrap(), | ||
| _ => NonZero::new(self.start_point_strategy.count()).unwrap(), | ||
| }; |
| use std::num::NonZeroUsize; | ||
|
|
||
| use diskann::ANNError; | ||
| #[cfg(feature = "pipnn")] | ||
| use diskann::ANNResult; |
8134eb3 to
ce5f054
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
diskann-disk/src/build/configuration/disk_index_build_parameter.rs:17
estimate_pipnn_peak_memoryusessize_of::<...>()unqualified, but this module doesn’t importstd::mem::size_of. This will fail to compile under the repo’s Rust toolchain.
use std::num::NonZeroUsize;
use diskann::ANNError;
#[cfg(feature = "pipnn")]
use diskann::ANNResult;
use thiserror::Error;
#[cfg(feature = "pipnn")]
use super::PiPNNParameters;
use super::{BuildAlgorithm, QuantizationType};
diskann-disk/src/build/configuration/disk_index_build_parameter.rs:113
DiskIndexBuildParametersis publicly re-exported (viadiskann-disk’s public API) and this change removesCopyfrom its derives. That is a breaking API change for downstream users that relied on implicit copies; if this is intentional, it should be called out explicitly (and potentially gated or versioned accordingly).
/// Parameters specific for disk index construction.
#[derive(Clone, PartialEq, Debug)]
pub struct DiskIndexBuildParameters {
ce5f054 to
3893460
Compare
|
@SeliMeli please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
| /// Save real-point adjacency lists in the canonical graph layout. | ||
| pub fn save_adjacency_graph<P>( | ||
| adjacency: &[AdjacencyList<u32>], | ||
| max_degree: u32, | ||
| provider: &P, | ||
| start_point: u32, | ||
| path: &str, | ||
| ) -> ANNResult<usize> | ||
| where | ||
| P: StorageWriteProvider, | ||
| { | ||
| save_graph( | ||
| &AdjacencyGraph { | ||
| adjacency, | ||
| max_degree, | ||
| }, | ||
| provider, | ||
| start_point, | ||
| path, | ||
| ) | ||
| } |
Integrates PiPNN graph output into the production disk-index build and serialization pipeline.
Review key points
Stack 4/6: #1290 → #1294