[FEA] IVF-PQ to Write Flat PQ Codes#1607
[FEA] IVF-PQ to Write Flat PQ Codes#1607rapids-bot[bot] merged 47 commits intorapidsai:release/26.02from
Conversation
|
/ok to test dc99bfb |
…with strat pattern
…into ivfpq-flat-codes
3bf9018 to
b5cfc7e
Compare
|
/ok to test b5cfc7e |
cjnolet
left a comment
There was a problem hiding this comment.
LGTM, pending addressing @robertmaynard's feedback. LanceDB is chomping at the bit to try this out, so we can continue to improve over time if we need to (and also use the upcoming preprocessing API directly in IVFPQ in the future).
| * - INTERLEAVED: Codes are interleaved for optimized search performance. | ||
| * This is the default and recommended for search workloads. | ||
| */ | ||
| enum list_layout codes_layout; |
There was a problem hiding this comment.
Just making a note here that this is going to break the C ABI. No action needed, but we will need to track these things in the future. I'll share the POR with you (and the team) for more info.
| virtual size_type get_size() const noexcept = 0; | ||
|
|
||
| /** Set the current size (number of records). */ | ||
| virtual void set_size(size_type new_size) noexcept = 0; |
There was a problem hiding this comment.
I suppose as long as users are never direclty mutating this object then we shouldn't have to be too vigilent. Would be nice if we could make this internal, though, so that only cuVS funcitons are capable of changing it. Just concerned for users shooting themselves in the foot.
|
/ok to test b0ff258 |
|
/ok to test 36339c8 |
|
/merge |
|
/ok to test 4f761fb |
|
/ok to test 400d234 |
|
/ok to test cb3fec1 |
|
/merge |
This PR brings new params to ivf_pq: an option for the user to choose the layout of the ivf lists. The lists can be flat (no interleaving) or interleaved (current default). Flat codes allows building the index in a CPU-compatible format. [UPDATE as of 12/19/2025]: After rapidsai#1278 is merged, we can unify IVF-PQ and PQ API codepaths. [UPDATE 01/08/2026]: This PR can be merged before rapidsai#1278. The flat code-writing can potentially be reverted once rapidsai#1278 is merged (so we can later use the PQ preprocessing API directly). However that will come naturally as a part if a broader unification of IVF-PQ and PQ codepaths. [Benchmarks 01/15/2026]: ## IVF-PQ Layout Benchmark Results **Dataset**: 1,000,000 vectors × 128 dimensions | **pq_dim**: 32 pq_bits | Code Size | Direct FLAT Build (ms) | INTERLEAVED Build (ms) | Convert INTERLEAVED to FLAT with Codepacker (ms) | Total time for INTERLEAVED build + Conversion to FLAT with Codepacker (unpack) (ms) | Overhead | |:-------:|:---------:|:---------------:|:----------------------:|:-------------------:|:----------------------:|:--------:| | 8 | 32 bytes | 372.46 | 385.86 | 985.28 | 1371.13 | 3.68× | | 6 | 24 bytes | 298.83 | 300.99 | 961.82 | 1262.82 | 4.23× | | 5 | 20 bytes | 283.25 | 281.95 | 795.43 | 1077.38 | 3.80× | | 4 | 16 bytes | 270.63 | 271.01 | 489.73 | 760.75 | 2.81× | Authors: - Tarang Jain (https://github.com/tarang-jain) Approvers: - Corey J. Nolet (https://github.com/cjnolet) - Robert Maynard (https://github.com/robertmaynard) URL: rapidsai#1607
This PR brings new params to ivf_pq: an option for the user to choose the layout of the ivf lists. The lists can be flat (no interleaving) or interleaved (current default). Flat codes allows building the index in a CPU-compatible format.
[UPDATE as of 12/19/2025]:
After #1278 is merged, we can unify IVF-PQ and PQ API codepaths.
[UPDATE 01/08/2026]:
This PR can be merged before #1278. The flat code-writing can potentially be reverted once #1278 is merged (so we can later use the PQ preprocessing API directly). However that will come naturally as a part if a broader unification of IVF-PQ and PQ codepaths.
[Benchmarks 01/15/2026]:
IVF-PQ Layout Benchmark Results
Dataset: 1,000,000 vectors × 128 dimensions | pq_dim: 32