refactor: clean up include dependencies in src/ based on IWYU analysis#2145
refactor: clean up include dependencies in src/ based on IWYU analysis#2145LHT129 wants to merge 1 commit into
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Require kind labelWonderful, this rule succeeded.
🟢 Require version labelWonderful, this rule succeeded.
|
There was a problem hiding this comment.
Code Review
This pull request replaces the inclusion of <fmt/format.h> with <fmt/core.h> across numerous source and header files to optimize compilation times and minimize dependencies. As there are no review comments, I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR updates src/ to prefer the lighter-weight {fmt} header by replacing #include <fmt/format.h> with #include <fmt/core.h> (per IWYU findings), reducing preprocessing overhead without changing runtime behavior.
Changes:
- Replaced
{fmt}includes across 56src/files:<fmt/format.h>→<fmt/core.h>. - No functional logic changes; includes-only refactor intended to improve compile times.
Reviewed changes
Copilot reviewed 56 out of 56 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/storage/stream_reader.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/storage/footer.h | Switch {fmt} include to <fmt/core.h>. |
| src/reader.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/quantization/transform_quantization/transform_quantizer_parameter_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/quantization/rabitq_quantization/rabitq_quantizer_parameter_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/quantization/quantizer_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/options.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/io/reader_io.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/io/mmap_io_parameter_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/io/buffer_io_parameter_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/io/basic_io.h | Switch {fmt} include to <fmt/core.h>. |
| src/io/async_io_parameter_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/index/hnsw.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/index/hnsw_zparameters.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/index/diskann_zparameters.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/index_feature_list.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/index_common_param.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/impl/transform/vector_transformer_parameter_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/impl/transform/random_orthogonal_transformer.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/impl/transform/pca_transformer.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/impl/odescent/odescent_graph_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/impl/logger/logger.h | Switch {fmt} include to <fmt/core.h>. |
| src/impl/label_table/label_table.h | Switch {fmt} include to <fmt/core.h>. |
| src/impl/allocator/default_allocator.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/factory/index_creators.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/sparse_vector_datacell_parameter.h | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/sparse_graph_datacell_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/multi_vector_datacell_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/multi_vector_datacell_parameter.h | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/graph_datacell_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/graph_datacell_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/flatten_datacell_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/extra_info_interface.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/extra_info_datacell_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/compressed_graph_datacell_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/bucket_interface.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/datacell/bucket_datacell_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/attr/expression_visitor.h | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/warp/warp_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/sindi/term_id_mapper.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/ivf/ivf_partition_strategy_parameter.h | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/ivf/ivf_partition_strategy_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/ivf/ivf_parameter.h | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/ivf/ivf_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/ivf/ivf_nearest_partition.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/ivf/gno_imi_partition.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/ivf/gno_imi_parameter.h | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/ivf/gno_imi_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/inner_index_interface.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/hgraph/hgraph.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/hgraph/hgraph_serialize.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/hgraph/hgraph_search.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/hgraph/hgraph_parameter_test.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/hgraph/hgraph_param_mapping.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/hgraph/hgraph_build.cpp | Switch {fmt} include to <fmt/core.h>. |
| src/algorithm/bruteforce/bruteforce_parameter.cpp | Switch {fmt} include to <fmt/core.h>. |
| #include "reader_io.h" | ||
|
|
||
| #include <fmt/format.h> | ||
| #include <fmt/core.h> | ||
|
|
||
| #include <future> |
There was a problem hiding this comment.
This file no longer includes fmt/core.h in the latest push — the unused include was already removed.
787bbae to
6ff0a2b
Compare
6ff0a2b to
296f33d
Compare
| #include <bits/types/struct_tm.h> | ||
| #include <cxxabi.h> | ||
| #include <unistd.h> | ||
|
|
||
| #include <chrono> |
There was a problem hiding this comment.
Fixed: removed <bits/types/struct_tm.h> (redundant with ), removed unused <cxxabi.h>, added for std::ostringstream.
| #include <bits/std_abs.h> | ||
|
|
||
| #include <algorithm> | ||
| #include <cstdint> | ||
| #include <unordered_map> |
There was a problem hiding this comment.
Fixed: replaced <bits/std_abs.h> with across all affected files.
|
|
||
| #include "lock_strategy.h" | ||
|
|
||
| #include <ext/alloc_traits.h> |
There was a problem hiding this comment.
Fixed: removed <ext/alloc_traits.h> from all files — it is unused and libstdc++-specific.
|
|
||
| #include <datacell/compressed_graph_datacell_parameter.h> | ||
| #include <fmt/format.h> | ||
| #include <bits/std_abs.h> |
There was a problem hiding this comment.
Fixed: removed <bits/std_abs.h>, ensured is present instead.
| #include <atomic> | ||
| #include <cmath> | ||
| #include <cstdint> | ||
| #include <ext/alloc_traits.h> |
There was a problem hiding this comment.
Fixed: removed <ext/alloc_traits.h>.
| #include <cblas.h> | ||
| #include <lapack.h> | ||
| #include <lapacke.h> | ||
| #include <omp.h> |
There was a problem hiding this comment.
Fixed: restored blas_compat.h and removed direct <cblas.h>/<lapack.h>/<lapacke.h> includes.
| #include "timer.h" | ||
|
|
||
| #include <numeric> | ||
| #include <ratio> |
There was a problem hiding this comment.
Fixed: replaced with for std::numeric_limits usage.
| #include "default_thread_pool.h" | ||
|
|
||
| #include "vsag/options.h" | ||
| #include <cxxabi.h> |
There was a problem hiding this comment.
Fixed: removed unused <cxxabi.h>.
| #include <chrono> | ||
| #include <cstring> | ||
| #include <cstdint> | ||
| #include <ext/alloc_traits.h> |
There was a problem hiding this comment.
Fixed: removed <ext/alloc_traits.h>.
296f33d to
c28363a
Compare
- Replace fmt/format.h with fmt/core.h (56 files) - Split aggregate headers (common.h, filter_headers.h, etc.) into specific headers - Add missing explicit includes for symbols used - Remove unused includes - 148 files changed, +1424 -117 lines Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
c28363a to
ebba4f6
Compare
| #include <cstdint> | ||
| #include <fstream> | ||
| #include <iostream> | ||
| #include <limits> | ||
| #include <utility> |
| #include <initializer_list> | ||
| #include <map> | ||
| #include <nlohmann/json.hpp> | ||
|
|
||
| #include "nlohmann/detail/json_pointer.hpp" | ||
| #include "nlohmann/json_fwd.hpp" |
| #include "async_io_parameter.h" | ||
| #include "buffer_io_parameter.h" | ||
| #include "impl/logger/logger.h" | ||
| #include "inner_string_params.h" |
| #include "default_thread_pool.h" | ||
|
|
||
| #include "vsag/options.h" | ||
| #include "ThreadPool.h" |
Closes #2144
What
Clean up include dependencies across 148 implementation files (
.cpp) insrc/based on IWYU (include-what-you-use) analysis.Why
IWYU analysis identified the following issues in
src/:<fmt/format.h>but only need<fmt/core.h>common.h,filter_headers.h,io_headers.h,quantizer_headers.h, etc. pull in far more dependencies than neededChanges
Commit 1: Replace fmt headers (56 files)
<fmt/format.h>→<fmt/core.h>fmt/core.his a strict subset offmt/format.hCommit 2: IWYU include cleanup (148 files)
Verification
make releasebuild passesmake fmtformat check passesAffected Directories
algorithm/,analyzer/,attr/,datacell/,factory/,impl/,index/,io/,quantization/,simd/,storage/,utils/,src/root