You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add explicit template specialization declarations for MSVC linking (facebookresearch#4992)
Summary:
Add explicit specialization declarations for all SIMD-templated distance
functions in `distances.h`.
C++ [temp.expl.spec]/7 requires that explicit specialization declarations
appear before any translation unit that might implicitly instantiate the
primary template. GCC/Clang are lenient about this ordering, but MSVC
strictly enforces it — without these declarations, the linker emits
LNK2001 (unresolved external symbol) for the specializations defined in
the `_avx2` translation units.
The macro `FAISS_DECLARE_DISTANCES_SPECIALIZATIONS(SL)` declares all 17
distance function specializations for a given `SIMDLevel`, and is expanded
for `SIMDLevel::NONE` and `SIMDLevel::AVX2`.
This is a no-op on GCC/Clang (declarations are redundant but harmless).
Differential Revision: D98232371
0 commit comments