Repository navigation
build: cap per-link LTO parallelism at four partitions (ADR-1172) - #1290
Merged
Merged
Conversation
core/meson.build turns LTO on for every build, and GCC's plain -flto means -flto=auto: one ltrans job per core per link, with no jobserver under ninja. Three overlapping agent builds pushed the 32-core workstation to load 190. b_lto_threads=4 joins default_options (-flto=4 / -flto-jobs=4), bounding a build at 4 x ninja -j. docs/development/build-flags.md wrongly said b_lto defaults to false; corrected, and the new option documented with its override. docs/state.md: no bug row (build-experience change, no functional defect).
lusoris
marked this pull request as ready for review
September 5, 2026 14:23
lusoris
force-pushed
the
build/bound-lto-link-parallelism
branch
from
September 5, 2026 14:23
2871c3a to
69a9ff1
Compare
lusoris
added a commit
that referenced
this pull request
Sep 5, 2026
…lint debt `core/meson.build` sets `b_lto=true` + `b_lto_threads=4` (ADR-1172), so the lint job's gcc-14 `meson setup` wrote `-flto=4` into `compile_commands.json`. clang rejects the numeric form of the flag and reports it as a `clang-diagnostic-error`, which makes `clang-tidy` exit non-zero on every file — warning-free or not. `Tidy Changed` has therefore failed every C/C++ pull request since #1290 landed; this PR was the first one to hit it. Both clang-tidy build steps now configure with `-Db_lto=false`, matching what the SYCL lint lane already does. The diagnostic set is unchanged: replaying the same TUs against an `-flto=4`-injected copy of the same `compile_commands.json` gives identical counts (`core/src/output.cpp` 29 both ways; `core/src/predict.c` and `core/src/feature/feature_extractor.cpp` 0 both ways). The same flag also closes a blind spot in `Tidy Ratchet`, whose diagnostic parser only recognises `path:line:col:` entries and so never saw the location-less driver error its fail-closed check exists to catch. `core/src/feature/feature_extractor.h` was the last touched file on this branch still carrying clang-tidy debt (8 findings). clang-tidy has no compile command for a header and falls back to `feature_extractor.cpp`'s, so it parses this C header as C++ and proposes rewrites that would break the ~100 C translation units which include it. Discharged with one cited, file-scoped `NOLINTBEGIN` / `NOLINTEND` bracket — the shape ADR-1138 prescribes — covering `modernize-deprecated-headers`, `modernize-use-using`, `performance-enum-size` and the include-guard `bugprone-reserved-identifier` family. No declaration, type or guard was changed, so no includer is affected. Verification: all four CI-gated files (`feature_extractor.cpp`, `feature_extractor.h`, `libvmaf.c`, `test_feature_extractor.c`) report 0 warnings, 0 errors and exit 0 under clang-tidy 22.1.8 against a CPU-only build dir configured like the CI lane. `meson test --suite fast --no-suite gpu` 115/115, `test_feature_extractor` 18/18, Netflix golden gate 271 passed / 12 skipped / 0 failed, and the CUDA reproducer this PR exists for still scores 82.814059 with `--backend cuda --model version=vmaf_v1.0.16_3d0h`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
11 of 14 tasks
lusoris
added a commit
that referenced
this pull request
Sep 5, 2026
Two `Rules` gates caught the previous commit: - `docs/state.md Gate` (ADR-0334) rejects a placeholder PR reference in an inserted row. The `T-TIDY-CHANGED-LTO-FLAG-2026-09-05` row said "This PR was the first C/C++ PR after #1290"; it now names PR #1312. - `Release Script Contract` requires `CHANGELOG.md`'s Unreleased block to match `changelog.d/`. Re-rendered with `scripts/release/concat-changelog-fragments.sh --write`, which picks up `changelog.d/fixed/tidy-changed-lto-flag.md`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lusoris
added a commit
that referenced
this pull request
Sep 5, 2026
…at all (#1326) Since PR #1290 merged, the required Tidy Changed and Tidy Ratchet gates failed on every C/C++ pull request regardless of its diff. core/meson.build's default_options gained b_lto_threads=4 (ADR-1172) to cap link-time parallelism; meson renders that as GCC's -flto=4, the tidy lane's gcc-14 build writes it into compile_commands.json, and clang-tidy parses those entries with clang, which rejects the argument outright: clang: error: unsupported argument '4' to option '-flto=' so every translation unit ended in "1 error generated". Reproduced against a stock master build: 1257 -flto=4 entries, and clang-tidy on core/src/picture.c reports "Error while processing". Both tidy builds now configure with -Db_lto=false. They exist only to emit compile_commands.json and the generated headers, so LTO buys nothing there, and the SYCL tidy lane already configured that way for its own toolchain reason. After the change compile_commands.json holds zero -flto entries and the same file processes cleanly (459 suppressed, no error). docs/state.md: T-TIDY-CHANGED-LTO-FLAG-2026-09-05 (Recently closed). Co-authored-by: Lusoris <lusoris@pm.me>
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.
Summary
core/meson.buildenables LTO for every build (b_lto=true), and GCC's plain-fltomeans-flto=auto: onelto1-ltransjob per core per link, with no jobserver under Ninja.ninja -j 8overlaps several of the project's dozens of link targets, so each link spawned 32 partitions. Measured today while three agent builds linked at once: 1-minute load 190 on the 32-core workstation, ninelto1-ltransprocesses above 700 % CPU.ADR-1172: keep LTO on, add
b_lto_threads=4todefault_options→-flto=4(GCC) /-flto-jobs=4(Clang). A build is now bounded at 4 ×ninja -j. Overridable per build dir (-Db_lto_threads=0= compiler default).docs/development/build-flags.mdclaimedb_ltodefaults tofalse; corrected, and the new option is documented with its override.Verified:
meson setup core/build core -Denable_cuda=false -Denable_sycl=false→b_lto=True b_lto_threads=4;ninja -t commands | grep -o '\-flto[^ ]*' | sort | uniq -c→1278 -flto=4, nothing else.Type
build— Meson default optionChecklist
make format && make lintis green locally (pre-commit on every touched file).meson introspectin the reproducer.docs/development/build-flags.md.docs/adr/1172-bound-lto-link-parallelism.md+ index row.Bug-status hygiene (ADR-0165)
docs/state.md— no row: build-experience change, no functional defect.Netflix golden-data gate (ADR-0024)
assertAlmostEqual(...)score in the Netflix golden Python tests.Deep-dive deliverables (ADR-0108)
-flto=autodefault and Meson'sb_lto_threadsmapping, both quoted in the ADR.## Alternatives considered(LTO off / tell every agent / Ninja jobserver / chosen).AGENTS.mdinvariant note — no rebase-sensitive invariants: the rebase note below carries the one coupling (b_lto_threadsexists becauseb_ltois on).changelog.d/changed/bound-lto-link-parallelism.md.docs/rebase-notes.mdentry (fork-edited hunk of the upstream meson.build).Reproducer
🤖 Generated with Claude Code