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.
Structs§
- Batch
Size Calculator - Calculates optimal batch sizes for GPU index construction based on available GPU memory and vector dimensionality.
- Computed
Batch - A batch for which GPU distance computation has been (simulated as) completed.
- GpuBatch
Distance Computer - GPU-accelerated batch distance computation
- GpuHnsw
Index Builder - GPU-accelerated HNSW index builder
- GpuIndex
Build Stats - Build statistics for the GPU index builder
- GpuIndex
Builder Config - Configuration for GPU-accelerated HNSW index building
- GpuIndex
Optimizer - Optimises GPU memory usage during index construction by computing ideal batch sizes and checking memory feasibility.
- GpuMemory
Budget - GPU memory budget tracker for index construction.
- Hnsw
Graph - The assembled HNSW graph structure
- Hnsw
Node - A node in the HNSW graph
- Incremental
GpuIndex Builder - Incremental GPU index builder for streaming ingestion
- Indexed
Batch - A fully indexed batch: neighbor IDs have been selected and are ready to be merged into the final HNSW graph.
- Pipelined
Index Builder - Overlaps CPU preparation work with simulated GPU compute to build an index in a three-stage pipeline: prepare → compute → finalize.
- Prepared
Batch - A batch of vectors prepared (normalised / packed) on the CPU, ready to be dispatched to a GPU compute stage.
Enums§
- GpuDistance
Metric - Distance metric type for GPU kernels