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:
- Vector Upload: Transfer vectors to GPU memory in batches
- Distance Matrix Computation: Compute all-pairs distances via CUDA kernels
- Neighbor Selection: Apply heuristic neighbor selection on GPU
- 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
crate::gpu::index_builder_types: Config types, distance metrics, graph structurescrate::gpu::index_builder_phases: Builder implementations and pipeline stages
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;