Revised inner product - #10
Merged
Harsha Simhadri (harsha-simhadri) merged 85 commits intoAug 11, 2021
Merged
Conversation
added 30 commits
May 27, 2021 20:40
added 15 commits
July 13, 2021 11:16
Harsha Simhadri (harsha-simhadri)
marked this pull request as ready for review
August 11, 2021 23:34
Shikhar Jaiswal (ShikharJ)
pushed a commit
that referenced
this pull request
Jan 4, 2023
* working towards inner product in memory indices * done with in-memory code * made the inner product distance function return std::float_max if negative * more changes for disk index support * on the way to disk index support for MIPS * works now, need to change the PQ generation for MIPS * now incorporated disk+memory search for inner product * support for mips and l2 * changed inner product to -IP rather than 1/IP * towards adding support for storing PQ vectors in disk index for very large data * towards adding support for storing PQ vectors in disk index for very large data * halfway through PQ-based disk search option * code compiles for disk index pq * fixed some bug * shards are written as and when necessary * sharding is now on demand * minor changes * fixed one malloc bug in parameters * added a vector analyzer util * added missing file * fixed a bug which used L2 instead of inner product in cached beam search * now setting up the normalizing approach * towards pre-processing data * working towards newer inner product * more changes to do MIPS by reducing to L2 with extra coordinate * cleaned up code a bit, need to test everything again * testing underway * added back saturate graph to create denser indices * now we dont sample a new test dataset every iteration for estimating sharding * now num_parts increases by 2 * cleaned up warnings in Debug mode compiler * working towards inner product in memory indices * done with in-memory code * made the inner product distance function return std::float_max if negative * more changes for disk index support * on the way to disk index support for MIPS * works now, need to change the PQ generation for MIPS * now incorporated disk+memory search for inner product * support for mips and l2 * changed inner product to -IP rather than 1/IP * towards adding support for storing PQ vectors in disk index for very large data * towards adding support for storing PQ vectors in disk index for very large data * halfway through PQ-based disk search option * code compiles for disk index pq * fixed some bug * shards are written as and when necessary * sharding is now on demand * minor changes * fixed one malloc bug in parameters * added a vector analyzer util * added missing file * fixed a bug which used L2 instead of inner product in cached beam search * now setting up the normalizing approach * towards pre-processing data * working towards newer inner product * more changes to do MIPS by reducing to L2 with extra coordinate * cleaned up code a bit, need to test everything again * testing underway * added back saturate graph to create denser indices * now we dont sample a new test dataset every iteration for estimating sharding * now num_parts increases by 2 * cleaned up warnings in Debug mode compiler * added a normalizer to vector analysis * fixed one bug for MIPS * addressed all comments of PR * fixed minor typos. now running unit tests * ran clang-format as it doesnt run by default due to LINUX flag not set anywhere * clang introduced a bug in distance.h, fixed itt * added unit tester partially * minor bugfix * finished unit tester * changed back training size to 100K for now, we can increase to 1M later if necessary * added comments for unit_tester.sh * added auto tuning parameters for unit tester * re-ran clang formatting * small change to unit tester * fixed minor bug in unit tester * fixed some formatting on unit tester * started code for range search support in pq_flash_index * added more code for range search in disk index * added range search support * tested range search on small dataset * Update memory_mapper.h * minor edits Co-authored-by: ravishankar <rakri@microsoft.com>
Danbaiwq
pushed a commit
to Danbaiwq/DiskANN
that referenced
this pull request
Sep 10, 2025
* working towards inner product in memory indices * done with in-memory code * made the inner product distance function return std::float_max if negative * more changes for disk index support * on the way to disk index support for MIPS * works now, need to change the PQ generation for MIPS * now incorporated disk+memory search for inner product * support for mips and l2 * changed inner product to -IP rather than 1/IP * towards adding support for storing PQ vectors in disk index for very large data * towards adding support for storing PQ vectors in disk index for very large data * halfway through PQ-based disk search option * code compiles for disk index pq * fixed some bug * shards are written as and when necessary * sharding is now on demand * minor changes * fixed one malloc bug in parameters * added a vector analyzer util * added missing file * fixed a bug which used L2 instead of inner product in cached beam search * now setting up the normalizing approach * towards pre-processing data * working towards newer inner product * more changes to do MIPS by reducing to L2 with extra coordinate * cleaned up code a bit, need to test everything again * testing underway * added back saturate graph to create denser indices * now we dont sample a new test dataset every iteration for estimating sharding * now num_parts increases by 2 * cleaned up warnings in Debug mode compiler * working towards inner product in memory indices * done with in-memory code * made the inner product distance function return std::float_max if negative * more changes for disk index support * on the way to disk index support for MIPS * works now, need to change the PQ generation for MIPS * now incorporated disk+memory search for inner product * support for mips and l2 * changed inner product to -IP rather than 1/IP * towards adding support for storing PQ vectors in disk index for very large data * towards adding support for storing PQ vectors in disk index for very large data * halfway through PQ-based disk search option * code compiles for disk index pq * fixed some bug * shards are written as and when necessary * sharding is now on demand * minor changes * fixed one malloc bug in parameters * added a vector analyzer util * added missing file * fixed a bug which used L2 instead of inner product in cached beam search * now setting up the normalizing approach * towards pre-processing data * working towards newer inner product * more changes to do MIPS by reducing to L2 with extra coordinate * cleaned up code a bit, need to test everything again * testing underway * added back saturate graph to create denser indices * now we dont sample a new test dataset every iteration for estimating sharding * now num_parts increases by 2 * cleaned up warnings in Debug mode compiler * added a normalizer to vector analysis * fixed one bug for MIPS * addressed all comments of PR * fixed minor typos. now running unit tests * ran clang-format as it doesnt run by default due to LINUX flag not set anywhere * clang introduced a bug in distance.h, fixed itt * added unit tester partially * minor bugfix * finished unit tester * changed back training size to 100K for now, we can increase to 1M later if necessary * added comments for unit_tester.sh * added auto tuning parameters for unit tester * re-ran clang formatting * small change to unit tester * fixed minor bug in unit tester * fixed some formatting on unit tester * started code for range search support in pq_flash_index * added more code for range search in disk index * added range search support * tested range search on small dataset * Update memory_mapper.h * minor edits Co-authored-by: ravishankar <rakri@microsoft.com>
weiyaoluo (SeliMeli)
added a commit
to SeliMeli/DiskANN
that referenced
this pull request
Jun 9, 2026
Lands the 9 highest-priority items from the multi-lens production-readiness review of diskann-pipnn: 1. find_prune_from_candidates: was pub but only used by deleted benches — demoted to pub(crate). The four broken benches (final_prune, leaf_build, partition, partition_bench, plus common.rs) referenced removed APIs (memmap2, once_cell, partition_v2) and abandoned `profile` module — all deleted. Only `pipnn_bench` remains. 2. AVX-512 sketch-hash (relative_hash_local): cfg-gated on `target_feature="avx512f"` was dead code under the workspace's x86-64-v3 baseline. Replaced with runtime tier dispatch matching find_hash_simd. Production binaries on AVX-512 hardware now actually use the AVX-512 path. 3. leaf_build CSR cursor: `bufs.group_starts[..n].to_vec()` allocated a fresh Vec per leaf (~9000 × 48 threads on BigANN 10M). Added `cursor: Vec<u32>` to LeafBuffers, reused via copy_from_slice. 4. find_medoid fold: per-iteration `vec![0.0f32; ndims]` alloc → moved to fold init so each thread owns one buf reused across its chunk. Saves ~10M small allocs on BigANN 10M. 5. AoSoA cold slabs eager-faulted via mimalloc's eager_commit: replaced `Vec<u16>` with a new `MmapSlab<T>` wrapper that allocates via `mmap(PROT_RW, MAP_PRIVATE|MAP_ANONYMOUS)` so the kernel keeps the range backed by its zero page until first write. Pages that are never written stay unallocated → reservoirs that don't fill past their avg never touch the high cold-slot bytes. Eliminates the +1.46 s "LSH sketches" tax pre-fix and trims peak RSS. 6. Default PiPNNConfig: was BigANN-tuned paper-defaults (c_max=1024, l_max=128, c_min=256, k=3, fanout=[10,3], num_hash_planes=12, final_prune=false). Changed to the production-measured config from CLAUDE.md (c_max=256, l_max=64, c_min=16, k=2, fanout=[8,3], num_hash_planes=14, final_prune=true). Halves HP RSS at equal recall. 7. extract_graph / extract_graph_for_prune: near-duplicate, each calling get_neighbors_saturated which allocated two heap Vecs per point on the 10M-point extract. Merged via a private `extract_into<R, F>` helper. get_neighbors_saturated now uses a stack [(u32, u16); L_MAX_MAX] scratch instead of two collect() chains. Saves ~20M short-lived heap allocs. 8. Partition STRIPE_BUFS release: thread-local GEMM buffers (~20 MB/thread × 48 threads ≈ 1 GB) used to live through leaf-build + HP-extract, making peak RSS sum-of-phases instead of max-of-phases. Added `release_thread_buffers()` mirroring leaf_build's equivalent, called immediately after partition finishes. 9. Doc rot: removed stale references to deleted `partition_v2`, "v3" version markers in field doccomments, the d=128 ns/dist microbench table at builder.rs, c4-48 PMU prose in partition.rs, and "lines around 460-492" stale-line-range comments. Production source now states invariants only; measured-perf history lives in CLAUDE.md memory. Skipped: microsoft#10 (visibility tightening) — separate semver concern. 85/85 pipnn lib tests pass. RSS / wall regression verified on c4-48 BigANN 10M in a follow-up bench.
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.
No description provided.