mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
Enable Faiss dynamic dispatch for OVIS and VeST fbpkgs (#5515)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5515 Enable `faiss.dynamic_dispatch=true` on the three `vector_search` fbpkgs that link Faiss, and add a probe that logs which SIMD kernels each process actually dispatched to. Also adds some logs in VeST. **fbpkgs covered** - `ovis_cli` (`cli/BUCK`) - `vector_search_offline_knn` (`offline_knn/BUCK`) - `vector_search_index_trainer` (`training/BUCK`) — the VeST trainer Without the flag, Faiss is compiled with static AVX2 SIMD selection. With it, all compiled-in SIMD variants (AVX2, AVX512, AVX512-SPR) are built and the best supported one is selected at runtime via CPUID. **This is not a speedup, and is not intended as one.** These workloads *build* indexes rather than search them, and the AVX-512 win for SQ4 lives on the scan path, not the encode path. Measured end-to-end as perf-neutral — see the test plan. The reasons to land it are consistency across the `vector_search` fbpkgs, unlocking AVX-512 for any future search-side work in these binaries, and the observability below. **SIMD probe.** `log_faiss_simd_level()` in `training/utils.py` logs `level`, `dispatched_level`, `has_dynamic_dispatch` and `compile_options`. It is called from `assignment_worker.py` (datasink worker) and from `datasinks/common.py::_build_merged_file_blocking` (the spawned leaf-build children are separate processes and do not inherit parent Faiss state, so each reports its own; guarded to log once per process rather than once per cluster). This probe is load-bearing: Faiss logs nothing about its own dispatch state, so the earlier VeST DD A/B could not distinguish "DD did not help" from "DD never engaged". With the probe, that ambiguity is resolved — DD demonstrably engages, and the null result is real. Reviewed By: bshethmeta Differential Revision: D107286701 fbshipit-source-id: 48cada6220c2b379f9774514edd48f2f5858f39a
This commit is contained in:
committed by
meta-codesync[bot]
parent
e2f9ccaccc
commit
80a16564f8
@@ -3057,6 +3057,36 @@ class CodePacker:
|
||||
class CodePackerFlat(CodePacker):
|
||||
def __init__(self, code_size: int) -> None: ...
|
||||
|
||||
# SIMD dispatch (faiss/utils/simd_levels.h). SWIG exposes the scoped enum
|
||||
# SIMDLevel as module-level int constants (EnumName_Value convention).
|
||||
SIMDLevel_NONE: int
|
||||
SIMDLevel_AVX2: int
|
||||
SIMDLevel_AVX512: int
|
||||
SIMDLevel_AVX512_SPR: int
|
||||
SIMDLevel_ARM_NEON: int
|
||||
SIMDLevel_ARM_SVE: int
|
||||
SIMDLevel_RISCV_RVV: int
|
||||
SIMDLevel_COUNT: int
|
||||
|
||||
class SIMDConfig:
|
||||
level: int
|
||||
supported_simd_levels: int
|
||||
avx512_split: bool
|
||||
@staticmethod
|
||||
def auto_detect_simd_level() -> int: ...
|
||||
@staticmethod
|
||||
def has_dynamic_dispatch() -> bool: ...
|
||||
@staticmethod
|
||||
def set_level(level: int) -> None: ...
|
||||
@staticmethod
|
||||
def get_level() -> int: ...
|
||||
@staticmethod
|
||||
def get_level_name() -> str: ...
|
||||
@staticmethod
|
||||
def is_simd_level_available(level: int) -> bool: ...
|
||||
@staticmethod
|
||||
def get_dispatched_level() -> int: ...
|
||||
|
||||
# Utility functions
|
||||
def get_mem_usage_kb() -> int: ...
|
||||
def get_compile_options() -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user