Skip to content

vector-store: log the SIMD kernel usearch picked - #632

Merged
swasik merged 1 commit into
scylladb:masterfrom
swasik:VECTOR-1027-usearch-isa-log
Oct 9, 2026
Merged

swasik merged 1 commit into
scylladb:masterfrom
swasik:VECTOR-1027-usearch-isa-log

Conversation

@swasik

@swasik swasik commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

VECTOR-1027: a CPU profile of a Vector Store node on Graviton4 (r8g.4xlarge) showed simsimd_cos_f32_neon at 67% although the SVE cosine kernel is built into the binary. Nothing in the log says which kernel usearch picked, so a profile cannot be read against it and the question "is SVE selected on this CPU?" needs a probe.

What it does

At index creation, logs Index::hardware_acceleration() (usearch's name for the SIMD kernel family: neon, sve, haswell, serial, …) together with the quantization and metric:

INFO usearch hardware acceleration: neon (F32 Cos)

Once per (quantization, metric) pair in the process: the kernel choice depends on the build, the CPU and those two options (simsimd picks per metric and data type), not on the dimensions, and a local index with many partitions must not repeat the line.

Testing

  • cargo fmt --all --check, cargo clippy -p vector-store --all-targets -- -Dwarnings clean.

  • On an r8g.4xlarge (Graviton4, Neoverse V2, SVE2 with a 128-bit vector length) the line printed at index creation,
    for this commit and for the same commit with simsimd's SVE detection fixed:

    10:12:39Z INFO usearch{vsb_keyspace.vsb_idx_20261008101056}: usearch hardware acceleration: neon (F32 Cos 768 dims)  [earlier revision of the line]
    10:25:09Z INFO usearch{vsb_keyspace.vsb_idx_20261008101056}: usearch hardware acceleration: sve (F32 Cos 768 dims)
    

    The first line is what the investigation (VECTOR-1027) needed: usearch 2.22.0 bundles simsimd 6.5.12, whose Linux ARM
    capability probe is gated on _POSIX_VERSION without including <unistd.h>, so it reports NEON-only on every Linux ARM
    machine. The fix (upstream NumKong 7.0.0, pulled by usearch 2.25.3+) is tracked on the issue; this line makes the
    chosen kernel visible either way.

Fixes: VECTOR-1042
Refs: VECTOR-1027

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: be2d3ff0-27ce-4393-8d3e-1b024a03f555

📥 Commits

Reviewing files that changed from the base of the PR and between 315f61d and ee87b4b.


📒 Files selected for processing (1)
  • crates/vector-store/src/vs_index/usearch.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

ThreadedUsearchIndex::new now logs the selected usearch hardware acceleration once per quantization and metric pair. Index creation errors still propagate.

Suggested reviewers: ewienik


Priority: ⬇️ Low

Change: Feature

Merge Risk: ⚪ Minimal · up to ee87b

The change adds deduplicated acceleration logging without an identified material regression; it is ready for normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the main change: logging the SIMD kernel selected by usearch.
Description check Passed The description directly explains the motivation, logging behavior, scope, and testing for the changeset.


  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

A profile of a Vector Store node on Graviton4 shows the NEON cosine
kernel although the SVE one is built in, and nothing in the log says
which kernel usearch chose (VECTOR-1027). Log `Index::hardware_acceleration()`
with the quantization and metric at index creation, once per
(quantization, metric) pair in the process: the choice depends on the
build, the CPU and those two options, and a local index with many
partitions must not repeat the line.

Refs: VECTOR-1027

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@swasik
swasik force-pushed the VECTOR-1027-usearch-isa-log branch from d939a71 to ee87b4b Compare October 8, 2026 12:57
@swasik
swasik marked this pull request as ready for review October 9, 2026 11:48
@swasik
swasik requested a review from ewienik October 9, 2026 11:48
@swasik
swasik added this pull request to the merge queue Oct 9, 2026
Merged via the queue into scylladb:master with commit 264bffe Oct 9, 2026
49 checks passed
@swasik
swasik deleted the VECTOR-1027-usearch-isa-log branch October 9, 2026 13:41
ewienik pushed a commit to ewienik/vector-store that referenced this pull request Oct 9, 2026
…cylladb#633)

## Motivation

VECTOR-1027: on Graviton4 a CPU profile shows `simsimd_cos_f32_neon`
although the SVE kernels are built into the binary. The cause is in
simsimd 6.5.12, which usearch 2.22.0 bundles: its Linux ARM capability
probe is gated on `_POSIX_VERSION` (`simsimd.h` l.124) but the header
never includes `<unistd.h>`, which defines that macro, so
`_simsimd_capabilities_arm()` returns NEON-only before it reads a single
ID register — on every Linux ARM machine. The bug came in with simsimd
v6.5.4 (2025-10-15) and is in every 6.5.x; NumKong 7.0.0 (the renamed
upstream, pulled by usearch 2.25.3+) includes the header.

## What it does

usearch compiles simsimd's `lib.c` through the C++ driver and cc-rs
reads the `CXXFLAGS` family, so one cargo `[env]` entry in
`.cargo/config.toml` passes `-include unistd.h` for the aarch64 target.
The stock crate then detects SVE. x86 builds are untouched; the entry
goes away with the usearch upgrade to a NumKong-based version,
VECTOR-720 (which has the measurements of why that upgrade is not a
drop-in today).

## Testing

On an r8g.4xlarge (Graviton4, Neoverse V2, SVE2 with a 128-bit vector
length), cohere-1m, concurrency 64 — details and the probe evidence on
VECTOR-1027:

| build | log line (PR scylladb#632) | kernel in `perf` | HTTP QPS | p99 | index
build (1M rows) |
|---|---|---|---|---|---|
| master (`275d0e3`) | `neon` | `simsimd_cos_f32_neon` 68% | 21.1k | 5.4
ms | 86.3 s |
| this change | `sve` | `simsimd_cos_f32_sve` | 21.5k | 5.2 ms | 86.3 s
|

The same probe hides `neon_f16`, `neon_bf16` and `neon_i8`, so without
this change usearch 2.22.0 runs the **serial** kernels for every non-f32
quantization on Linux ARM. Measured on an F16 index of cohere-1m
(VECTOR-720, 2026-10-08, HTTP c64, 150 s warm-up):

| build | F16 QPS | server mean | kernel in `perf` | F16 index build |
|---|---|---|---|---|
| master as shipped | 3310–3340 | 18.1 ms | `simsimd_f16_to_f32` 78% +
`simsimd_cos_f16_serial` 15% | 696.5 s |
| this change | 28232–28522 | 1.7 ms | `simsimd_cos_f16_sve` 62% | 59.2
s |

Recall on that F16 index is 92.5% (CQL c64) against 93.4–93.8% on F32:
simsimd 6.5's f16 kernel accumulates in f16. That is a property of the
kernel the release already selects on x86; this change only makes ARM
select it too.

On Graviton4 SVE and NEON are equivalent for this kernel (same 4 floats
per step at a 128-bit VL); the change matters on Graviton3 (2 × 256-bit
SVE), where it is untested so far.

`cargo fmt --all --check`, `cargo clippy --workspace --all-targets --
-Dwarnings` unaffected (no Rust change).

Refs: VECTOR-1027
Refs: VECTOR-720

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants