Skip to main content

Module index_builder

Module index_builder 

Source
Expand description

GPU-accelerated HNSW index construction

This module implements GPU-based HNSW graph construction using CUDA kernels (feature-gated behind the cuda feature). When CUDA is not available, it falls back to an efficient CPU implementation.

§Architecture

The GPU index builder works in phases:

  1. Vector Upload: Transfer vectors to GPU memory in batches
  2. Distance Matrix Computation: Compute all-pairs distances via CUDA kernels
  3. Neighbor Selection: Apply heuristic neighbor selection on GPU
  4. Graph Assembly: Assemble the HNSW graph structure from GPU results

§Pure Rust Policy

All CUDA code is gated with #[cfg(feature = "cuda")] so the default build is 100% Pure Rust.

§Module Layout

Re-exports§

pub use crate::gpu::index_builder_phases::BatchSizeCalculator;
pub use crate::gpu::index_builder_phases::ComputedBatch;
pub use crate::gpu::index_builder_phases::GpuBatchDistanceComputer;
pub use crate::gpu::index_builder_phases::GpuHnswIndexBuilder;
pub use crate::gpu::index_builder_phases::GpuIndexOptimizer;
pub use crate::gpu::index_builder_phases::GpuMemoryBudget;
pub use crate::gpu::index_builder_phases::IncrementalGpuIndexBuilder;
pub use crate::gpu::index_builder_phases::IndexedBatch;
pub use crate::gpu::index_builder_phases::PipelinedIndexBuilder;
pub use crate::gpu::index_builder_phases::PreparedBatch;
pub use crate::gpu::index_builder_types::ComputationCache;
pub use crate::gpu::index_builder_types::GpuDistanceMetric;
pub use crate::gpu::index_builder_types::GpuIndexBuildStats;
pub use crate::gpu::index_builder_types::GpuIndexBuilderConfig;
pub use crate::gpu::index_builder_types::HnswGraph;
pub use crate::gpu::index_builder_types::HnswNode;