Skip to content

[MOD-14958] Account for frontend blocks in tiered HNSW size estimates - #1050

Merged
dor-forer merged 2 commits into
mainfrom
dor-mod14958-tiered-element-estimate
Sep 15, 2026
Merged

dor-forer merged 2 commits into
mainfrom
dor-mod14958-tiered-element-estimate

Conversation

@dor-forer

@dor-forer dor-forer commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Describe the changes in the pull request

Tiered HNSW's element-size estimate currently covers only the backend. With SQ8 and wide vectors, the full-precision frontend needs more memory per vector, so callers sizing blocks from this estimate can exceed their intended per-block memory budget.

Return the larger of the frontend and backend estimates, reusing the frontend parameter factory. Document that this estimate sizes growth of either tier, rather than their combined memory. This lets RediSearch #11330 remove its duplicate frontend estimation after adopting the fix.

Which issues this PR fixes

  1. Supports MOD-14958.

Main objects this PR modified

  1. Tiered HNSW element estimator and its public API documentation.
  2. SQ8 unit coverage: measure frontend block growth for FLOAT32/FLOAT16, L2/IP/cosine, and training enabled/disabled. Existing backend-dominant size-estimation tests remain in place.

Validation

Formatting and git diff --check pass. The frontend tests explicitly allow the 64-to-65-vector insertion to grow the buffer. Unit tests and sanitizer validation are running in CI for commit 0b29db72.

Mark if applicable

  • This PR introduces API changes (the tiered HNSW estimate can increase; signatures are unchanged)
  • This PR introduces serialization changes

Note

Medium Risk
Behavior change to memory/block budgeting for tiered HNSW callers; reported per-vector estimates can increase (safer for limits) without API signature changes.

Overview
Tiered HNSW per-vector block sizing now uses the larger of the SQ8 HNSW backend estimate and the full-precision brute-force frontend estimate (via existing NewBFParams), instead of backend-only. That keeps VecSimIndex_EstimateElementSize aligned when wide vectors make the flat buffer’s resize block bigger than the quantized graph.

VecSimIndex_EstimateElementSize docs clarify this is the max of either tier’s growth for shared block sizing—not combined tier memory or total index size.

Tests: SQ8 tiered HNSW adds frontend block-growth checks (dim 1024, L2/IP/cosine, training on/off) with backend migration deferred so growth is measured on the flat buffer; tiered SetUp accepts flatBufferLimit.

Reviewed by Cursor Bugbot for commit 0b29db7. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b69aff9. Configure here.

Comment thread tests/unit/test_hnsw_sq8.cpp
@dor-forer
dor-forer requested a review from alonre24 September 15, 2026 15:28
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.54%. Comparing base (ec835be) to head (0b29db7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1050   +/-   ##
=======================================
  Coverage   97.54%   97.54%           
=======================================
  Files         141      141           
  Lines        9009     9011    +2     
=======================================
+ Hits         8788     8790    +2     
  Misses        221      221           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dor-forer
dor-forer added this pull request to the merge queue Sep 15, 2026
Merged via the queue into main with commit b1f01bf Sep 15, 2026
16 checks passed
@dor-forer
dor-forer deleted the dor-mod14958-tiered-element-estimate branch September 15, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants