Vectorize RaBitQ fast-scan handler adjustment (1 bit, no filter)#5385
Draft
lyang24 wants to merge 2 commits into
Draft
Vectorize RaBitQ fast-scan handler adjustment (1 bit, no filter)#5385lyang24 wants to merge 2 commits into
lyang24 wants to merge 2 commits into
Conversation
71c4a2c to
4d6b2b4
Compare
Contributor
|
Please refer to https://github.com/facebookresearch/faiss/blob/main/faiss/docs/simd_dynamic_dispatch_migration.md on how to integrate SIMD code in Faiss. |
Contributor
Author
Thanks will read and get back later |
Contributor
Author
fixed but would like to wait for #5396 and then run benchmark again |
93c6e94 to
577c483
Compare
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.
This patch adds an AVX512 fast path for the 1-bit IndexIVFRaBitQFastScan result handler.
The PQ4 fast-scan kernel already computes distances for 32 candidates at a time, but the RaBitQ handler was converting those 32 uint16 distances back into a scalar per-candidate loop to apply the 1-bit distance correction and heap threshold check.
For the common 1-bit, non-centered, no-selector, full-block path, this patch keeps the correction step vectorized:
The scalar fallback is unchanged for multibit, selectors, partial blocks, centered mode, and non-AVX512 builds.
Validation
Tested on AWS Sapphire Rapids with a 1M Cohere IVF_RABITQ_FASTSCAN index.
Config:
Results:
baseline 312.87
patched 322.61
This is about a 3% end-to-end QPS improvement with unchanged results.