Skip to content

Battery time: one scheduled graph (75 min to 9.2 min with the new driver); Sema checks the compiler once - #2408

Merged
ehartford merged 14 commits into
mainfrom
sched
Oct 14, 2026
Merged

ehartford merged 14 commits into
mainfrom
sched

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Build time is Eric's #1 priority. This stack takes the full battery (gate + uat + survey) from about 75 minutes to 554.5 s (9.2 min) cold, measured with this branch's driver. The driver is the pinned seed, so the scheduler and the build-library fixes reach the battery after the seed is cut from this merge and seed.lock is bumped (next PR).

measurement (18-core Mac) before after
gate wall 634 s 294 s (gate alone, new driver)
survey wall ~55 min 292 s (as a phase)
whole battery, one graph, cold store ~75 min 554.5 s
one compile of the compiler, Sema 70.7 s (two passes) 35.7 s (one)
d-acceptance-corpus 226–533 s 25 s

What each commit fixes, found by timing the runs, not by guessing:

  • Sema ran twice on the compiler (D93's second pass whenever any literal binding takes its type from uses). It now reruns only when a demanded type differs from the binding's first-check type; every demand in the compiler agrees. The 20 literal-typing fixtures pass.
  • The driver ran 80+ targets one after another: any non-allow_parallel target drained the worker pool. It now schedules by readiness over the whole graph, every Test, RunCorpusTest and Action target is a lane, finished lanes retire out of order, and the ready lane with the longest remaining path starts first (from the battery's time ledger, published to the green store).
  • Every lane's dispatch rehashed the 170 MB stage compiler (the fingerprint memo was cleared whenever a target finished). Regular files are now memoized by size and mtime.
  • Every compiler an action spawned was SHA-256'd in full for the effect record (tool_effect_tool_identity), serially, before par_run could start the next: 1.2 s per spawn. Now hashed once per process.
  • The battery is one graph run (build :battery: gate, battery-uat, survey), so no phase waits for the slowest lane of the last.
  • Graph and test fixes the parallel schedule exposed: out/lib producers run after the stage chain recreates it; a p7 test case directory per process (two lanes ran one fixture at once); whole-compiler checks get hang guards, not speed budgets (Correctness tests fail on wall-clock time: hang guards, not speed budgets #2371); the self-compile RSS budget is enforced per lane at 2 GiB (the 1 GiB one had been unenforced since Battery runner working set is 20–34GB; budget is 8GB #702, Compiler self-compile peaks at 1.46-1.54 GB; the 1 GiB regression budget went unenforced since #702 #2407).

Open for Eric: the SipHash brief on #2372 (about 15–20 s more per compile of the compiler). Battery evidence under the pinned seed follows.

Eric Hartford added 14 commits October 14, 2026 00:30
…binding (D93's second pass was the compiler's whole second Sema)

D93 checks a program twice when a literal's binding takes its type from
its uses: the first check hears the demands, the second retypes the
bindings. The compiler's own source records such demands, so every
compile of the compiler ran sema.bodies twice (WITH_PROFILE on main's
release compiler: 31.9 s + 32.1 s of a 70.7 s frontend.sema; on main's
stage1, 175.8 s). Every demand there names the type the binding already
has, so the second check reproduced the first exactly.

The frontend now runs the second check only when some demand's type
differs from the binding's first-check type (`typed_binding_types`);
two demands that disagree differ from the binding in at least one, so
the two-demand error is still reported by the second check. Measured on
stage1 of this tree: frontend.sema 85.6 s against 175.8 s for main's
stage1 on the same input, one sema.bodies pass, verdict `ok`. The 20
fixtures naming D93, D126, D128 or §4.3c pass.
…usTest and Action target is a lane; non-Action workers read the cached graph; inner test width by running lanes
…red per lane; the 1 GiB budget went unenforced from #702 on, #2407)
…-deps runs a corpus-test target (a lane's worker)
…size, mtime), not cleared per target: a lane's dispatch no longer rehashes the 170 MB stage compiler
…he effect record hashed a 170 MB compiler on every spawn)
…attery ledger, green-store fallback); battery: uat runs beside battery-checks and the ledger is published to the green store
… fixture at once); the --no-deps expectation names corpus-test targets
…rget) and the survey; whole-compiler checks under load get hang guards, not speed budgets (#2371)
…, so the battery names one target under any driver (#2330)
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery green on f7685cb under the pinned seed (with run tools/battery.w, which is now one build :battery run): rc=0, wall 2052 s (34 min), out/battery/status.txt free of reds. That is the old serial driver (the seed); the same graph under this branch's driver ran cold in 554.5 s, which the battery gets once the seed is cut from this merge and seed.lock is bumped (next PR).

@ehartford
ehartford marked this pull request as ready for review October 14, 2026 10:55
@ehartford
ehartford merged commit 7f81d1e into main Oct 14, 2026
@ehartford
ehartford deleted the sched branch October 14, 2026 10:56
@ehartford

Copy link
Copy Markdown
Contributor Author

Correction to the 554.5 s figure above: that run cleared target states and the build store but not the test runner's per-file verdict cache, which is keyed on the compiler binary; the compiler was the same as the run before it, so the big suites were cached (behavior-tests 6 s). A run where the compiler changed, which is what a source PR sees, took 728.6 s with the next layer's driver (behavior-tests 300 s, native-compile-error-tests 145 s, internals-tests 100 s). The remaining long pole is the big test suites: a lane gets its inner test window once, at spawn, so a suite started into a full pool runs about two files at a time to the end. The next layer adds a machine-wide test-process budget (a jobserver) so a long suite takes the slots others free.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant