Repository navigation
vector-store: log the SIMD kernel usearch picked - #632
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
Suggested reviewers: Priority: ⬇️ Low Change: Feature Merge Risk: ⚪ Minimal · up to 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)✅ Passed checks (4 passed)
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. Comment |
275d0e3 to
d939a71
Compare
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]>
d939a71 to
ee87b4b
Compare
…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)
Motivation
VECTOR-1027: a CPU profile of a Vector Store node on Graviton4 (r8g.4xlarge) showed
simsimd_cos_f32_neonat 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: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 -- -Dwarningsclean.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:
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_VERSIONwithout including<unistd.h>, so it reports NEON-only on every Linux ARMmachine. 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