Restructure benchmarks: add C++/Python/GPU suites, relocate legacy#5425
Open
mulugetam wants to merge 2 commits into
Open
Restructure benchmarks: add C++/Python/GPU suites, relocate legacy#5425mulugetam wants to merge 2 commits into
mulugetam wants to merge 2 commits into
Conversation
Add three new benchmark suites under benchs/ with a consistent three-layer naming taxonomy (kern_, codec_, index_): - cpp/ (35 benchmarks, Google Benchmark): kernel-level (distances, hamming, heap, partitioning, sorting, FWHT, fp16, visited-table, result-handlers) and codec/index-level (PQ, SQ, RQ, k-means, flat, IVF, fastscan, graph, binary, composite, RaBitQ, Panorama, polysemous, big-batch, IO, RCQ) with CLI-overridable parameter sweeps via bench_cli_utils.h and optional SIFT1M real-data cases via bench_dataset_utils.h. - python/ (18 benchmarks, pytest-benchmark): mirrors the C++ coverage through the public Python API with the same overridable parameter model via conftest.py/bench_utils.py. - gpu/ (5 benchmarks, Google Benchmark): GPU index benchmarks (flat+IVFPQ, IVF 1-billion, hybrid CPU/GPU, cuVS IVFFlat/IVFPQ), built only when FAISS_ENABLE_GPU=ON. Move the bench_fw end-to-end evaluation framework into python/bench_fw/ with relative imports and four driver scripts (codecs, ivf, optimize, range), excluded from pytest collection. Relocate all original benchs/ scripts and perf_tests/ to benchs/legacy/, preserving their CMake gating and updating the CI perf_tests path. Signed-off-by: Mulugeta Mammo <mulugeta.mammo@intel.com>
Signed-off-by: Mulugeta Mammo <mulugeta.mammo@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the standalone benchmark scripts in
benchs/andperf_tests/with three structured suites (C++, Python, and GPU) organized under a consistentkern_/codec_/index_naming taxonomy. Nearly all existing benchmarks are covered by the new suites, and the default parameter values from the legacy benchmarks are preserved (with a few exceptions). Every executable and pytest suite supports--helpfor discovering available parameters and usage (bench_fw drivers are the exception; they use positional arguments documented in their README).All changes are contained within the
benchs/directory, with the exception ofCMakeLists.txt,INSTALL.md, andREADME.md.I wasn't sure whether to open this as an issue, a discussion, or a PR. I went with a PR so the code can be reviewed.
Motivation
The existing benchmarks were a flat directory of ~50 scripts with inconsistent naming, no shared parameter infrastructure, and no machine-readable output (some with hardcoded parameters). This made regression tracking difficult (e.g. when benchmarking across different platforms/microarchitectures). The new suites provide:
bench_{kern,codec,index}_<feature>) across C++ and Pythonbenchmarks) to build the entire C++ + GPU suiteBenchmark suites
benchs/cpp/— 35 Google Benchmark executables registering 5,146 benchmark cases, covering kernel-level operations (distances, hamming, heap, partitioning, sorting, FWHT, fp16, visited-table, result-handlers), codec-level operations (PQ, SQ, RQ, k-means, SA decode, PQ ADC/fastscan), and index-level operations (flat, IVF, fastscan, graph, binary, composite, RaBitQ, Panorama, polysemous, big-batch, IO, RCQ, IVF factory with autotune). CLI-overridable parameter sweeps viabench_cli_utils.h. Index benchmarks optionally load SIFT1M (or any.fvecs/.bvecsdataset) viabench_dataset_utils.hand report recall. Seebenchs/README.mdfor more details.benchs/python/— 18 pytest-benchmark files registering 4,209 benchmark cases, mirroring the C++ coverage through the public Python API with the same overridable parameter model (conftest.py/bench_utils.py). Includes abench_fw/subdirectory housing the end-to-end evaluation framework (moved from the repo root) with relative imports and four driver scripts (codecs, IVF, optimize, range), excluded from pytest collection. Seebenchs/python/README.mdfor more details.benchs/gpu/— 5 Google Benchmark executables for GPU indexes (flat+IVFPQ, IVF 1-billion, hybrid CPU/GPU, cuVS IVFFlat/IVFPQ), built only whenFAISS_ENABLE_GPU=ON.benchs/legacy/— all originalbenchs/scripts andperf_tests/moved here, preserving their CMake gating and CI paths.All index-level benchmarks (C++ and Python) run on synthetic data by default and additionally register real-data cases (SIFT1M or any
.fvecs/.bvecsdataset pointed to by--data_dir) that report recall and skip automatically when the dataset is absent. Kernel and codec benchmarks (e.g.bench_kern_distances,bench_kern_heap,bench_codec_pq) use only synthetic data, since their throughput characteristics are data-distribution-independent.Tested the following
cmake -B build -DFAISS_BUILD_BENCHMARKS=ON && cmake --build build --target benchmarkscompiles all 35 C++ executables (GPU skipped withFAISS_ENABLE_GPU=OFF)build/benchs/cpp/bench_*runs with--benchmark_list_tests=truecd benchs/python && pytest --collect-onlydiscovers all 18 Python benchmark modules and excludesbench_fw/cd benchs/python && pytest bench_index_flat.pypassesbenchs/legacy/build viaFAISS_ENABLE_EXTRAS=ON(individual targets,EXCLUDE_FROM_ALL)benchs/legacy/perf_tests/) resolves correctly in.github/actions/build_cmake/action.yml