Repository navigation
Fix parallel index execution and zero-range quantization - #142
Merged
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.
Summary
Fix parallel HNSW centroid construction and routing, and define zero-range scalar quantization consistently across backends. Also retain the reviewed HNSW worker reuse and PiPNN scheduling/local-neighbor changes.
efper search instead of changing shared state under a whole-search mutex.(distance, ID)ordering.delta == 0in scalar, generic, AVX2, AVX-512, and NEON quantization. Add regressions for reused LUTs, backend/tail parity, concurrent routing, insertion RNG state, persistence, and PiPNN reference results.No public API, saved-index format, or dependency changes. Formatting follows clang-format 23; vendored files retain their existing style.
Testing
Linux x86-64, Intel Xeon Gold 6418H, Clang 23.1.4, portable builds (
RABITQ_ENABLE_NATIVE_OPTIMIZATION=OFF), existing Python 3.13 environment:OpenMPBindingtest passes. Additional bound-mode initializer/PiPNN/thread tests: 23 passed, 1 expected affinity-test skip.git diff --checkpass.detect_deadlocks=0; the unchanged baseline reproduces a data race. Default TSan separately reports a vendored hnswlib lock-order warning on both baseline and this branch, so this is not a clean unrestricted TSan result.AVX512/GemmKernel.h:815. All 12 failing tests that exist on unchanged main reproduce there with identical sanitizer flags; the remaining failure is the new PiPNN reference test reaching that same kernel. No vendor patch or sanitizer suppression is included.The initial clang-tidy invocation also included tests/examples, which CI excludes; it reported existing negative-test diagnostics. The new concurrency test's thread-vector reservation was fixed, and the changed-test analysis subsequently passes.
Matched performance checks
These are bounded shared-host measurements, not a general performance guarantee. Baseline is
4c1dfdb. Both variants use Clang 23 Release, portable runtime dispatch (AVX-512 available), CPU affinity 16–23, eight workers, and alternating baseline/current run order. Input loading is excluded. Exact Recall@10 uses exhaustive float64 L2 ground truth.HNSW uses one shared persisted 4-bit index over 4,096 SIFT centroids (128 dimensions),
M=16, construction/searchef=64, and the same queries. Median batch latency over ten samples, each averaging 30 searches:ID checksums match across variants/thread counts, and repeated searches compare IDs and distances exactly within each run. Single-thread medians were 270.8/272.9 us, 1216.8/1350.7 us, and 4394.5/4504.3 us (baseline/current); no single-thread speedup is claimed.
For raw SymphonyQG with PiPNN initialization, 4,096 real centroids, degree 32, build
ef=64, seed 42, eight build threads and 128 queries, six measured builds per variant after warmup:Build timings include the complete QG construction; query timings use one thread. Recall matches in every measured repetition; query timings do not improve uniformly.
An additional synthetic routing check (8,192 centroids, d=128, 256 queries, nprobe=16, ef=768) measures 123.83 ms -> 16.13 ms at eight threads, with matching candidate ID checksums and no serial/parallel mismatches.