fix(core): re-enable usearch fp16lib to unbreak Windows MSVC build (#94)

The v2.1.26 pin set `default-features = false` on usearch to drop SimSIMD's
AVX2/Haswell dispatch (the illegal-instruction crash on older x86_64 CPUs,
#71). But usearch's defaults are ["simsimd", "fp16lib"], so disabling all
defaults also dropped the unrelated `fp16lib` feature.

With both off, usearch's build.rs sets USEARCH_USE_FP16LIB=0 and
USEARCH_USE_SIMSIMD=0, selecting the bare `#else` half-precision branch in
include/usearch/index_plugins.hpp, which carries a `#warning` directive. MSVC's
cl.exe treats `#warning` as fatal error C1021, so the Windows build aborts:

  index_plugins.hpp(404): fatal error C1021: invalid preprocessor command 'warning'

GCC/Clang only warn, so Linux/macOS never caught it. `/Zc:preprocessor` does
not change MSVC's behavior here.

Fix: re-enable `fp16lib` only, keeping SimSIMD disabled. fp16lib is a scalar,
self-contained fp16<->fp32 conversion library with no SIMD intrinsics, so this
sets USEARCH_USE_FP16LIB=1 (taking the non-warning branch) without
reintroducing the #71 illegal-instruction risk. Restores v2.1.25 behavior on
the half-precision path while keeping the #71 portability fix. usearch stays
pinned at =2.23.0; Cargo.lock is unchanged.

Verified on macOS (aarch64): cargo build -p vestige-core and -p vestige-mcp
green, 9/9 vector-search tests pass, clippy clean. cargo tree confirms only the
`fp16lib` usearch feature is active and `simsimd` is not. The MSVC repro is
Windows-only and cannot be exercised on this host.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sam Valladares 2026-06-22 01:19:40 -05:00 committed by GitHub
parent 5c2db045f6
commit 9e1c386d39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -130,8 +130,19 @@ candle-core = { version = "0.10.2", optional = true }
#
# Disable default features so release binaries do not include SimSIMD's
# Haswell+/AVX2/FMA dispatch targets. Those kernels can trigger illegal
# instructions on older x86_64 CPUs that Vestige otherwise supports.
usearch = { version = "=2.23.0", default-features = false, optional = true }
# instructions on older x86_64 CPUs that Vestige otherwise supports (#71).
#
# But re-enable `fp16lib` explicitly. usearch's defaults are
# ["simsimd", "fp16lib"]; with BOTH off, build.rs sets USEARCH_USE_FP16LIB=0
# and USEARCH_USE_SIMSIMD=0, which selects the bare half-precision `#else`
# branch in include/usearch/index_plugins.hpp. That branch carries a
# `#warning` directive, which MSVC's cl.exe treats as fatal error C1021,
# breaking the Windows build (GCC/Clang only warn). `fp16lib` is a scalar,
# self-contained fp16<->fp32 conversion library with NO SIMD intrinsics, so
# re-enabling it sets USEARCH_USE_FP16LIB=1 (taking the non-warning branch)
# WITHOUT reintroducing the SimSIMD illegal-instruction risk from #71. Do not
# drop this feature.
usearch = { version = "=2.23.0", default-features = false, features = ["fp16lib"], optional = true }
# LRU cache for query embeddings
lru = "0.16"