perf(ivfpq): eliminate PQ8 LUT bounds checks - #76
Draft
jerry-024 wants to merge 6 commits into
Draft
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.
Summary
Speed up the transposed 8-bit IVF-PQ scan by exposing each 256-entry PQ lookup table as a fixed-size array, allowing the compiler to eliminate bounds checks in the hot loop. The sparse/dense crossover remains unchanged at divisor 8 (12.5%), and search results are unchanged.
Depends on #75. After #75 merges, the effective diff for this PR starts at
1357928.Changes
[f32; 256]fast path for transposed PQ8 distance accumulation.TRANSPOSED_SPARSE_SCAN_DIVISOR = 8.nq=64,nprobe=64) and deterministic randomized filtering.Testing
cargo fmt --all -- --checkcargo test -p paimon-vindex-core --lib(450 passed)cargo clippy -p paimon-vindex-core --lib --benches -- -D warningsHistorical scalar results from the same host and shape were 1890.700 ms at 50% and 1849.500 ms at 100%, corresponding to directional improvements of 43.3% and 42.3%. These runs were not interleaved A/B measurements; production impact still requires a Spark run on the target AMD executor.
Notes