Files
Andrey VasnetsovandClaude Fable 5.1 173f9d3ed6 Split HNSWIndex::build into phase modules (#10709)
* Split additional links phase out of HNSWIndex::build

Move the per-payload-block subgraph phase, together with its existing
helpers condition_points and build_filtered_graph, from HNSWIndex::build
into hnsw/build/additional_links.rs. The phase body is moved verbatim;
the borrowed locals become explicit parameters, and the function returns
the number of vectors indexed through the subgraphs.

GPU insert context creation moves to gpu_build.rs next to the other GPU
setup helpers, so build.rs no longer needs feature-gated GPU imports.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Split main graph CPU phase out of HNSWIndex::build

Move old-index healing, the single-threaded warm-up and the parallel
point insertion into hnsw/build/main_graph.rs as build_main_graph_on_cpu,
mirroring build_main_graph_on_gpu. Level assignment and the GPU attempt
stay in the orchestrator, since the GPU result decides whether the CPU
path runs at all.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Extract config derivation, field subtasks and thread pool from HNSWIndex::build

Share the kilobytes-to-vectors full scan threshold conversion between
load_or_derive_config and build as derive_config, with the vector count
as an explicit argument so both call sites keep their existing divisor.

Move the per-field progress subtasks into additional_links_fields next
to the phase that consumes them, and the rayon pool with its low-priority
spawn handler into build_thread_pool.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Extract GPU attempt, graph saving and the deleted-points check from build

upload_and_build_main_graph in gpu_build.rs owns the "any graph will be
built" gate, the upload, the main graph attempt and its timing log, so
build.rs keeps one cfg pair and adopts the GPU graph with an if-let.

save_graph builds the links format param and calls into_graph_layers in
one place, since the param borrows the inline vectors.

The debug-only walk over deleted points becomes a predicate over
links_empty under debug_assert!.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 08:22:47 +02:00
..
2026-07-30 20:59:31 +00:00
2026-07-30 20:59:31 +00:00
2026-07-30 20:59:31 +00:00
2026-07-30 20:59:31 +00:00