Repository navigation
refactor!: rename query factor accessors with the g_ prefix - #201
Merged
Merged
Conversation
Query correction factors now share the g_ prefix already used by g_add() and g_error(): - k1xsumq() -> g_k1xsumq() on SplitSingleQuery, BatchQuery, SplitBatchQuery and symqg::QuantizedQuery - kbxsumq() -> g_kbxsumq() on SplitSingleQuery and SplitBatchQuery - kbase_sumq() -> g_kbase_sumq() on SplitSingleQuery The old names are removed. Parameters, locals and private members that carry the same value are renamed to match. The stable core API v1 is unchanged; only a private member of its prepared query is renamed. Factor values and numerical behavior are unchanged.
The estimator page now names data factors after the f_ layout accessors and query factors after the g_ query accessors instead of F_/G_ labels that do not exist in the code. Examples use estimated_distance, error_bound, lower_bound and upper_bound (with an _ex suffix for the full-code refinement). Cluster-ID arrays in the IVF page and indexing samples are named cluster_ids instead of gt_type/cids, the unused gt_type alias in the SymphonyQG indexing sample is removed, the Python IVF example passes max_elements, and the naming table drops node_id, which the code does not use.
HNSW does not guarantee connectivity. In 500 local builds of this test's data with 8 threads, about half left 1-2 of the 512 points unreachable, while 1- and 2-thread builds left none. The test required each of the first 16 points to find itself, so it failed whenever an unreachable point fell in that range, as in an ASan CI run. Query every point instead, check that each result is a valid ID with a finite distance, and require at least 99% self-recall (at most 5 misses; the local worst case was 2).
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
Breaking C++ API change. The query correction-factor accessors now use the
g_prefix, the same asg_add()andg_error(). The old names are removed, with no deprecated aliases.k1xsumq()g_k1xsumq()SplitSingleQuery,BatchQuery,SplitBatchQuery,symqg::QuantizedQuerykbxsumq()g_kbxsumq()SplitSingleQuery,SplitBatchQuerykbase_sumq()g_kbase_sumq()SplitSingleQueryk1xsumqpointer argument ofBatchQueryand the SymphonyQG search entry points, which is nowg_k1xsumq. Argument order and types are unchanged.core/api.hpp): unchanged. Only a private member of its prepared query is renamed.tests/core/algorithm/ivf_rabitq/ivf_rabitq_streamer_test.cccallskbxsumq(). It needs a one-line change tog_kbxsumq()when zvec updates its RaBitQ submodule. A code search finds no zvec use ofk1xsumqorkbase_sumq.The second commit fixes documentation naming found in a review of identifiers in the docs:
estimator.md: usedF_add,F_rescale,F_error,G_kBxSumq, … which do not exist in the code. It now uses the public names:f_add/f_rescale/f_error/f_add_ex/f_rescale_exandg_add/g_error/g_kbxsumq/g_k1xsumq.estimator.mdandquantizer.mdnow useestimated_distance,error_bound,lower_boundandupper_bound, with_exfor the full-code refinement. They previously mixedlb_dist,est_dist_ex,low_dist_exandex_*.cluster_idsinstead ofgt_type/cids. The unusedgt_typealias insample/cpp/symqg_indexing.cppis removed.max_elements, the Python parameter name, instead ofnum_points.docs/development.md: the naming table dropsnode_id, which no code uses.The third commit fixes a flaky test that failed in the first ASan/UBSan run of this PR.
HnswConstructionTest.ParallelConstructionProducesSearchableIndexrequired each of the first 16 points to find itself after an 8-thread build. HNSW does not guarantee connectivity: in 500 local 8-thread builds of the same data, about half left 1–2 of the 512 points unreachable, while 1- and 2-thread builds left none. The test now queries every point, checks that each result is a valid ID with a finite distance, and requires at least 99% self-recall (at most 5 misses; the local worst case was 2). That unreachable points appear in about half of the parallel builds may itself be worth tracking separately.Testing
ctest --no-tests=error441 passed, 1 conditional skip (ThreadCount.BoundParallelForUsesRuntimePlacementAndPropagatesErrors).-Warray-bounds,-Wunused-result), all on lines this change does not touch. I did not build an untouched baseline to compare against../scripts/check-tidy.sh(clang-tidy 23, full configured set): pass../scripts/check-isa-symbols.shon the portable build: pass, 42 translation units../scripts/check-format.sh,git diff --check, andpython -m mkdocs build --strict --config-file docs/mkdocs.yml: pass.