Skip to content

Fix Float16 vector query execution#42

Merged
1yefuwang1 merged 2 commits intoquantizationfrom
copilot/sub-pr-41
Feb 10, 2026
Merged

Fix Float16 vector query execution#42
1yefuwang1 merged 2 commits intoquantizationfrom
copilot/sub-pr-41

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

The QueryExecutor::Execute() method was missing Float16 vector type handling, causing queries with float16 vectors to fail with "Unknown vector type: 2" error.

Changes

  • Added Float16 case to constraint.cpp:QueryExecutor::Execute() following the BFloat16 pattern:
    • Quantize query vector using QuantizeToF16()
    • Handle both normalized and non-normalized query paths
    • Pass quantized vector to HNSW index search
} else if (space_.vector_type == VectorType::Float16) {
  F16Vector quantized_vector = QuantizeToF16(knn_param->query_vector);
  
  if (!space_.normalize) {
    return index_.searchKnnCloserFirst(quantized_vector.data().data(),
                                       knn_param->k, rowid_filter.get());
  }
  
  VECTORLITE_ASSERT(space_.normalize);
  F16Vector normalized_vector = quantized_vector.Normalize();
  return index_.searchKnnCloserFirst(normalized_vector.data().data(), 
                                     knn_param->k, rowid_filter.get());
}

This completes Float16 support across the query execution path.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 10, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • sqlite.org
    • Triggering command: /usr/bin/curl curl --fail --retry 3 -L REDACTED --create-dirs --output sqlite-autoconf-3510200.tar.gz.8815.part -H User-Agent: vcpkg/2025-12-16-44bb3ce006467fc13ba37ca099f64077b8bbf84d (curl) as rc/8�� k/vectorlite/vecx86_64-linux-gnu x/include torlite/vcpkg/vcCMakeFiles/re2.dir/re2/perl_groups.cc.d ontrib.dir/hwy/cas /hwy_list_target-I hwy/tests/list_t/home/REDACTED/work/vectorlite/vectorlite/vcpkg/buildtrees/re2/src/86bb745f55-648eCMakeFiles/re2.dir/re2/simplify.cc.o torlite/vcpkg/vc--64 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Support float16 quantization and performance improvements Fix Float16 vector query execution Feb 10, 2026
@1yefuwang1 1yefuwang1 marked this pull request as ready for review February 10, 2026 08:39
@1yefuwang1 1yefuwang1 merged commit edee9fc into quantization Feb 10, 2026
Copilot AI requested a review from 1yefuwang1 February 10, 2026 08:39
@1yefuwang1 1yefuwang1 deleted the copilot/sub-pr-41 branch February 10, 2026 08:39
1yefuwang1 added a commit that referenced this pull request Feb 10, 2026
…vements (#41)

* Add quantization benchmarks and optimize HalfFloatToF32 with 2x loop unroll

Add benchmark suites for QuantizeF32ToF16, QuantizeF32ToBF16, F16ToF32,
and BF16ToF32. Unroll the HalfFloatToF32 main loop to process 2*NF
elements per iteration, improving instruction-level parallelism and
yielding a 1.6-2x speedup on F16/BF16 to F32 dequantization.

Co-Authored-By: Claude <noreply@anthropic.com>

* Optimize F32 Normalize with 4x loop unroll and fix benchmarks

Replace hn::Transform with a manually 4x-unrolled multiply loop in F32
NormalizeImpl for ~1.3x speedup at dim >= 512. Fix BF16 InnerProduct
benchmark that was incorrectly measuring F32 overload. Add
ClobberMemory to normalize benchmarks.

Co-Authored-By: Claude <noreply@anthropic.com>

* Add CLAUDE.md

* Guard F16 SIMD specializations with #if !HWY_HAVE_FLOAT16 (#40)

* Initial plan

* Add float16 quantization support: SIMD ops, distance spaces, vector types, quantization, virtual table support, tests, and benchmarks

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

* Fix test bug: use correct loop variable j instead of i in Normalize_F32ToF16 test

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

* Final: float16 quantization support complete

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

* Remove CodeQL artifact from tracking and add to gitignore

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

* Remove CodeQL artifact symlink from repository

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

* Guard F16-specific SIMD ops with #if !HWY_HAVE_FLOAT16 to use native ops when available

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

* Guard F16-specific SIMD ops with #if !HWY_HAVE_FLOAT16 to use native ops when available

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

* Remove CodeQL artifact from tracking

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

* Fix Float16 vector query execution (#42)

* Initial plan

* Add Float16 vector type handling in query executor

Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: 1yefuwang1 <18023393+1yefuwang1@users.noreply.github.com>
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