Accelerate quantization rescale search with SIMD interval pruning - #98
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and change
Extra-bit quantization spends substantial time processing rescale candidates through a priority queue. This change adds a float32 AVX2/AVX-512 interval search with conservative pruning and scalar fallback for ambiguous comparisons or work limits. The scalar sweep also replaces pop/push pairs with one heap repair, and successful warmed SIMD searches reuse thread-local scratch buffers.
Validation
Recorded branch validation:
GIST benchmark: 960 dimensions, 96 pinned workers, Intel Xeon Gold 6418H, GCC 14.3.0, portable build; median of five trials, each encoding 24,576 distinct rotated residuals four times. Timing includes code/factor emission and fallback, excluding preparation.
At eight total bits, throughput increased from 79,280 encodings/s to 184,433 with AVX2 (2.33×) and 372,528 with AVX-512 (4.70×). Across bits 2–9, all 196,608 input/bit cases matched baseline scales, code bytes, and normalization factors.
These results measure quantization throughput, not full index-build speed. Both backends ran on an AVX-512-capable host; AVX2-only emulation was unavailable.
Compatibility
No changes to public APIs, index formats, code layouts, dependencies, or distance-estimation formulas. The fixed-scale quantization path is unchanged.