Skip to content

build: compile build-script C in parallel; forbid pinned codegen-units = 1 (#3253) - #3255

Merged
zackees merged 3 commits into
masterfrom
build/3253-cc-parallel
Oct 31, 2026
Merged

zackees merged 3 commits into
masterfrom
build/3253-cc-parallel

Conversation

@zackees

@zackees zackees commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

What

  • cc compiles build-script C in parallel. obs-c-oracle, obs-data and obs-util now enable cc's parallel feature on their build-dependency, so their build scripts compile C files concurrently through the cargo jobserver. Workspace dependencies carry no features (ci/test_workspace_dependencies.py), so each crate enables it itself. Before, only obs-build enabled it, and feature unification never reached the oracle's graph (cargo tree -i cc showed only default), so obs-c-oracle's 225+ translation units compiled one at a time on every cold rebuild.
  • Guard: no pinned codegen-units = 1. ci/test_cargo_release_profile.py now fails if any profile in the root, rust/* or dylints/* manifests pins codegen-units = 1. A pin works around a bug instead of fixing it, so cargo chooses the unit count. That is the maintainer's decision; the soldr side is Remove pinned codegen-units = 1 (zccache amalgamation, release): fix the fan-out bug, select codegen units automatically forge-ci/soldr#4014. I checked the rustc command line of a release build: soldr injects no codegen-units, so we get cargo's default.

RED → GREEN

  • RED: fdffb62 ci/test_cc_parallel.py fails on master with rust/obs-c-oracle/Cargo.toml [build-dependencies] cc lacks the parallel feature, and the same for obs-data and obs-util.
  • GREEN: the three crate manifests enable parallel, and the test passes. ./lint passes, including test_workspace_dependencies.py, which failed CI on the first push.

Measurement

A cold soldr cargo build -p obs-c-oracle (debug), with a fresh CARGO_TARGET_DIR and ZCCACHE_DISABLE=1 so nothing comes from cache, on a 16-thread Ryzen 7 3700X with load average 14-22 from other workers:

wall
before (serial cc) 22.6 s
after (parallel) 7.4 s (3.0x)

Cargo.lock is unchanged, since jobserver and libc were already locked through obs-build.

Test cost: two ci/ Python checks that read TOML, about 1 ms each.

Fixes #3253. Refs #3249.

@zackees
zackees force-pushed the build/3253-cc-parallel branch from 7ca5b10 to 8494568 Compare October 31, 2026 20:00

@zackees zackees left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review: cc's parallel feature uses cargo's jobserver, so the C compiles stay within -j. That keeps them within the shared-machine limits in docs/ci-tooling.md, with no extra oversubscription. Both ratchets walk every workspace manifest, including nested profile.*.package.* tables and cc under all three dependency tables, so a later codegen-units = 1 or a serial cc can't slip back in. The PR body should include a before/after cold-build time for obs-c-oracle, since the docstring claims it took tens of minutes. No blocking findings.

@zackees
zackees added this pull request to the merge queue Oct 31, 2026
@zackees

zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

More evidence from a normal worker build: soldr cargo bench -p obs-c-oracle (release) after a rebase that touched libobs/. The oracle build script compiled its 225 objects in series over 1679 s (28 min), with one zccache compile process at a time; one of them had been running 57 s on a single translation unit. The .o timestamps in target/release/build/obs-c-oracle-*/out span 1679 s. With parallel, cc runs those through the jobserver on all 16 threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

build(obs-c-oracle): compile the oracle's C in parallel (cc 'parallel' feature is off)

1 participant