Skip to content

Refactor(diskann-benchmark): consolidate disk search config under DiskSearchMode#1232

Open
dyhyfu wants to merge 6 commits into
mainfrom
u/yaohongdeng/fixDiskModeBenchmarkCfg
Open

Refactor(diskann-benchmark): consolidate disk search config under DiskSearchMode#1232
dyhyfu wants to merge 6 commits into
mainfrom
u/yaohongdeng/fixDiskModeBenchmarkCfg

Conversation

@dyhyfu

@dyhyfu dyhyfu commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Consolidates disk-index search configuration under DiskSearchMode and decouples the benchmark's JSON input schema from the optional diskann-disk backend.

Previously, the input schema both defined the config and constructed diskann_disk::SearchMode, forcing several #[cfg(feature = "disk-index")] gates and scattering related fields (vector_filters_file, post_processor) across DiskSearchPhase. This PR moves the backend-specific construction into the search execution path and groups the search-mode fields together.

Changes

  • Move SearchMode construction to the backend. The match logic that builds diskann_disk::SearchMode now lives in a build_search_mode helper in the search execution module, so the input schema is pure config data with no dependency on the disk backend's SearchMode type.
  • Consolidate fields into DiskSearchMode. vector_filters_file and post_processor are nested inside DiskSearchMode alongside is_flat_search and adaptive_l. Validation and Display moved accordingly.
  • Remove unnecessary feature gates. DiskSearchMode and its fields no longer need #[cfg(feature = "disk-index")]. The only remaining gates are for QuantizationType, which is a diskann-disk type (intentionally left as-is — see below).
  • Migrate JSON fixtures (examples and perf test inputs) to the nested search_mode format.

@dyhyfu
dyhyfu requested review from a team and Copilot July 7, 2026 09:09

Copilot AI 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.

Pull request overview

This PR refactors the diskann-benchmark disk-index benchmark input schema to consolidate disk search configuration under DiskSearchMode, and moves diskann_disk::SearchMode construction out of the JSON schema layer into the disk search execution path.

Changes:

  • Nested vector_filters_file and post_processor under DiskSearchMode, alongside is_flat_search and adaptive_l, and moved validation accordingly.
  • Added a build_search_mode helper in disk_index/search.rs to construct backend SearchMode at execution time.
  • Updated benchmark JSON fixtures (examples + perf inputs) to the new nested search_mode format.

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-benchmark/src/inputs/disk.rs Refactors disk-index JSON schema to centralize mode-specific config/validation in DiskSearchMode.
diskann-benchmark/src/disk_index/search.rs Builds backend SearchMode during execution using new helper; updates access paths to nested config.
diskann-benchmark/perf_test_inputs/wikipedia-100K-disk-index.json Migrates perf input to nested search_mode object.
diskann-benchmark/perf_test_inputs/openai-100K-disk-index.json Migrates perf input to nested search_mode object.
diskann-benchmark/example/disk-index.json Migrates example input to nested search_mode object.
diskann-benchmark/example/disk-index-filter.json Migrates filter example to nested search_mode.vector_filters_file.
diskann-benchmark/example/disk-index-determinant-diversity.json Migrates post-processor example to nested search_mode.post_processor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread diskann-benchmark/src/inputs/disk.rs
Comment thread diskann-benchmark/src/inputs/disk.rs
Comment thread diskann-benchmark/src/disk_index/search.rs Outdated
@codecov-commenter

codecov-commenter commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.94118% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.15%. Comparing base (3c8728c) to head (ca59956).

Files with missing lines Patch % Lines
diskann-benchmark/src/inputs/disk.rs 77.94% 15 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1232      +/-   ##
==========================================
- Coverage   91.16%   90.15%   -1.01%     
==========================================
  Files         509      509              
  Lines       97093    97160      +67     
==========================================
- Hits        88510    87598     -912     
- Misses       8583     9562     +979     
Flag Coverage Δ
miri 90.15% <77.94%> (-1.01%) ⬇️
unittests 89.82% <77.94%> (-1.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-benchmark/src/main.rs 91.64% <ø> (ø)
diskann-benchmark/src/inputs/disk.rs 20.36% <77.94%> (+18.92%) ⬆️

... and 40 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread diskann-benchmark/src/inputs/disk.rs
Comment thread diskann-benchmark/src/disk_index/search.rs Outdated
Comment thread diskann-benchmark/src/disk_index/search.rs Outdated
Comment on lines 66 to 75
#[derive(Debug, Serialize, Deserialize, Default)]
pub(crate) struct DiskSearchMode {
pub(crate) is_flat_search: bool,
#[serde(default)]
pub(crate) adaptive_l: Option<AdaptiveL>,
#[serde(default)]
pub(crate) vector_filters_file: Option<InputFile>,
#[serde(default)]
pub(crate) post_processor: Option<TopkPostProcessor>,
}

@suri-kumkaran suri-kumkaran Jul 14, 2026

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.

Can we use a enum here to avoid impossible combinations? Something similar and in spirit of:

pub enum SearchMode<'a> {
    FlatScan {
        filter: Option<SearchPredicate<'a>>,
    },

    Graph {
        filter: Option<SearchPredicate<'a>>,
    },

    InlineFilter {
        filter: Box<dyn QueryLabelProvider<u32> + 'a>,
        adaptive_l: Option<AdaptiveL>,
    },

    DiverseGraph {
        filter: Option<SearchPredicate<'a>>,
        params: DeterminantDiversityParams,
    },
}

I understand SearchMode is per query and has relevant types, but can we have something similiar on the benchmark input level eliminating the impossible scenarios?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants