Skip to content

fix: prefetch native FP16 HNSW vectors - #94

Merged
zhenghaoz merged 1 commit into
mainfrom
fix/fp16-hnsw-prefetch
Sep 27, 2026
Merged

zhenghaoz merged 1 commit into
mainfrom
fix/fp16-hnsw-prefetch

Conversation

@zhangzhenghao

Copy link
Copy Markdown
Collaborator

Fixes #93.

Problem

Native VECTOR_FP16 HNSW indexes keep vectors in vectorsFP16, but query prefetch always read the FP32 vectors slice. Once graph traversal ran above the brute-force threshold, the empty FP32 slice caused an index-out-of-range panic.

Changes

  • dispatch HNSW prefetch to the active FP16 or FP32 storage
  • prefetch FP16 cache lines using 32 half-precision elements per 64-byte line
  • use storage-aware prefetch in normal, block-heap, and group-search traversal
  • add a collection-level regression covering the reported 1,682-vector, 64-dimensional cosine query

Verification

  • regression test fails on origin/main with the reported panic and passes with this fix
  • go test ./... -count=1
  • go vet ./...
  • git diff --check

Local golangci-lint could not run because the installed binary was built with Go 1.24 while this repository targets Go 1.27; GitHub CI uses its pinned compatible linter.

@codecov

codecov Bot commented Sep 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.39%. Comparing base (1a610c3) to head (5ea4bc6).

Files with missing lines Patch % Lines
internal/core/algorithm/hnsw_utility.go 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #94      +/-   ##
==========================================
- Coverage   81.64%   81.39%   -0.26%     
==========================================
  Files         150      150              
  Lines       30534    30551      +17     
==========================================
- Hits        24931    24867      -64     
- Misses       5601     5682      +81     
  Partials        2        2              

☔ 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.

@zhenghaoz
zhenghaoz merged commit 835305c into main Sep 27, 2026
8 of 9 checks passed
@zhenghaoz
zhenghaoz deleted the fix/fp16-hnsw-prefetch branch September 27, 2026 03:50
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.

HNSW query panics when prefetching native FP16 vectors

2 participants