From 9e1c386d3911fdb6dcff4e346c0693dd0945317f Mon Sep 17 00:00:00 2001 From: Sam Valladares <143034159+samvallad33@users.noreply.github.com> Date: Mon, 22 Jun 2026 01:19:40 -0500 Subject: [PATCH] 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) --- crates/vestige-core/Cargo.toml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/vestige-core/Cargo.toml b/crates/vestige-core/Cargo.toml index 36936b6..d95fc2d 100644 --- a/crates/vestige-core/Cargo.toml +++ b/crates/vestige-core/Cargo.toml @@ -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"