Repository navigation
exec_pool: a group the deadline cuts short goes first next call - #1395
Merged
Merged
Conversation
A group counted as skipped only when it started past the deadline. One
queued behind a group that takes just under the frame (exec_pump_frame:
100 ms deadline) started every frame with a few ms left, was never
skipped and never went first, so it got only that sliver every frame:
state_exec_bench's mt.ariadne_docs, docs=2 t=0, on a slow build ("ticked
0 times in 4 frames", seen on package-linux / libcvc-debug).
A pump is now short-changed when it started with less than half the
call left (pump_all's entry to its deadline), and the deadline ended it:
a process still runnable (pump_result::runnable, new), steps to spare,
and the deadline, not the group's own seconds budget, was the limit.
finish_group stamps it as skipped, so it goes first next call at threads
0, for host-affinity groups, and ahead of the LPT order in the threaded
list. It counts in pool_stats::short_changed. A group started with half
the call or more is never short-changed, so k groups that each fill a
frame still take turns; host_first's N1 rule and deterministic mode are
unchanged.
ExecPool.AGroupTheDeadlineCutsShortGoesFirstNextTime reproduces it at
threads 0, threads 2 host, and threads 2 LPT; it fails without the fix.
transfix
added a commit
that referenced
this pull request
Nov 22, 2026
Brings in master through aa158cc, among it #1395 (the pool's short-changed rule) and #1418 (state_exec_groups_test gives the oracle's pumps no wall-clock budget). Conflicts: - exec_group.h, pump_result: both sides added fields. Kept master's `runnable` and S2a's next_deadline / deadline_precise / best_runnable / awaiting_frame, with one doc comment covering both. - exec_group.cpp, exec_group::pump: `runnable` is read from the scheduler (has_runnable(), O(1)), not from S2a's run report. The report is recomputed only while a wake notifier is installed, and a fork-join group has none, so left.runnable would be stale there, and #1395's short-changed rule reads pump_result::runnable in fork-join pump_entry. The other four fields still come from the report. - exec_pool.h, pool_stats: master's short_changed goes after effective_threads, before S2a's continuous-mode counters. - docs/STATE_EXEC_THREADED.md: the pump_result and pool_stats sketches list both sides' fields. - ci.yml: both sides kept. The clang leg's cxx_tests lists state_exec_coordinator_test and state_exec_stackless_evaluator_test; the env keeps SAN_REQUIRED_S2A and SAN_REQUIRED_NET, and SAN_REQUIRED names both. exec_pool.cpp merged without conflict: #1395's half_span, pumped::short_changed, the pump_entry rule and finish_group's skipped stamp sit beside S2a's give_long_step_default.
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.
Problem
exec_pool::pump_allcounted a group as skipped, which sends it first next call, only when the group started after the deadline. If a group queues behind one that takes just under the frame (app::exec_pump_frame: 100 ms deadline), it starts every frame with a few ms left. It is never skipped and never goes first, so every frame it gets only that last sliver. The rule that "with k of them that each fill a frame, each starts at least once in k frames" didn't cover this case.This is what fails
state_exec_bench_smoke'smt.ariadne_docspoint on a slow build:t=0 docs=2 frame=heavy ... FAIL: bench.ari.d1 ticked 0 times in 4 frames. CI hit it on package-linux / libcvc-debug while landing #1378. The bug was already on master, not caused by #1378.Fix
A pump is short-changed when all of these hold:
pump_all's entry to its deadline)pump_result::runnable), the step budget wasn't used up, and the deadline, not the group's own seconds budget, set the time limitfinish_groupstamps such a group as skipped, so it goes first next call:It is counted in the new
pool_stats::short_changed.A group that started with half the call or more left is never short-changed, so k groups that each fill a frame still take turns. host_first's N1 rule and deterministic mode are unchanged.
Tests
ExecPool.AGroupTheDeadlineCutsShortGoesFirstNextTimeruns at threads 0, at threads 2 with host affinity, and at threads 2 on the LPT list. One group's test hook spins until a quarter of the call is left, then the other group's endless loop is cut by the deadline. The test checks that the cut group goes first next call. With the fix turned off, it fails in all three configurations.LocksThreads.LT03b_PostRacesDestructionran out of its 90 s budget: about 200 of 10000 runs. That test is about yield throughput and doesn't touch exec_pool or exec_group. The box was running about 27 compiler processes from other builds at the time. Not checked against master.state_exec_bench --smoke: passes, allmt.ariadne_docspoints ok.kFrame{50000000, 0.1}, heavy tick 48000 iterations), not committed:t=0 docs=2 frame=heavypassed 3/3 with the fix. Under the same load it also passed with the fix turned off, because the ticks ran past 100 ms and the existing skipped rule covered them. So the new unit test is what proves the fix, not this repro.Docs:
docs/STATE_EXEC_THREADED.md(Stage 1 order, per-frame deadline, struct listings) and the comments inexec_pool.h.