Fix max_codes=0 (unlimited) in the binary IVF count scanner - #5583
Open
rioyu123 wants to merge 1 commit into
Open
Fix max_codes=0 (unlimited) in the binary IVF count scanner#5583rioyu123 wants to merge 1 commit into
rioyu123 wants to merge 1 commit into
Conversation
rioyu123
marked this pull request as ready for review
September 5, 2026 14:35
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.
Related to #5555, reported by @leemeii.
Summary
With
IndexBinaryIVF.use_heap=false,max_codes=0currently stops the countscanner before it examines any codes. Searches using the default unlimited
budget therefore return only missing-result placeholders.
This patch gives the count scanner the same zero-budget normalization as the
heap scanner. Index-level defaults and per-search zero overrides now
mean unlimited scanning; positive budgets retain their existing behavior.
Coordination
I asked in #5555 whether the original reporter already has a patch in progress.
I'm sharing this small implementation for review, without
assuming that coordination is settled. If there is work underway, I'm happy
to coordinate and avoid overlapping submissions.
Validation
compares the count and heap scanners with
IndexBinaryFlatfor the defaultzero budget and an explicit zero override, and checks that a positive budget
still limits the results.
test_lowlevel_ivf.cppand the existingTPOB.IVFparameter-override test pass against the CPU-only source build.
git diff --checkand the changed-linesgit clang-formatcheck pass.The full low-level IVF test file reached a 60-second time limit in the existing
IVFRQtest, after the first eight tests passed. Full-suite, GPU, and Pythonbinding validation were not completed.