Skip to content

AriadneMounts: budget tests that don't depend on runner speed - #1605

Merged
transfix merged 1 commit into
masterfrom
ariadne/mount-budget-tests-deflake
Nov 28, 2026
Merged

transfix merged 1 commit into
masterfrom
ariadne/mount-budget-tests-deflake

Conversation

@transfix

Copy link
Copy Markdown
Owner

Two AriadneMounts tests from SH1 (#1566) failed package-linux / libcvc-debug on #1595, which changes only docs (run 46067080370, job 140734893768). ABusyMountIsHeldToItsBudgetWhileTheOthersRun failed 9 of 9 tries and TheShippedExamplesKeepWithinTheLocalBudget 2 of 9. Both depended on runner speed. This PR changes only the tests. The runtime's budget semantics and kPumpMaxSeconds are unchanged.

1. ABusyMountIsHeldToItsBudgetWhileTheOthersRun

Cause. The busy mount had a budget of 5000 steps a frame and no time limit. Each frame's pump (pump_frame → sync_run(kPumpMaxSteps, kPumpMaxSeconds)) also stops at its own 0.1 s backstop, whatever the mounts' budgets. The backstop is a time_budget: 50 ms of wall clock, then 50 ms of the thread's CPU time. When the backstop ends a pump before the mount spends its 5000 steps, the mount isn't parked, so frame_account::last_held is false for that frame. On #1595's runner a pump fit 4000 to 5064 of the busy loop's steps. So the mount was held some frames and not others:

  • not held after the 20 frames;
  • no notice, which needs 3 s held without a break;
  • no Quit button, because the Budgets window lists only mounts held at the time, and after Allow more the budget was 10000.

Confirmed locally. The MSVC Release build runs 5000 busy steps in about 0.65 ms, so the 0.1 s backstop never binds there. With kPumpMaxSeconds temporarily set to 0.0011 s (a scaled stand-in for the slow runner; not committed), a pump fit 2500 to 3300 steps. The old test then failed with #1595's exact set: b->held false, budget.held "0", no notice, empty on, and Quit never stopping the mount.

Fix. The budget is now kSteps = 250 (500 after Allow more), several times under what the slow runner fit in a pump. The checks scale with it: most is at most kSteps + 64 and at least kSteps * 4 / 5, max_steps matches, and Allow more makes it 2 * kSteps. The test still checks that the mount is held, not killed; that the other mount runs every frame; that the notice comes once; that Allow more doubles the budget; and that Quit stops it. Under the same 0.0011 s backstop the new test passed 5 of 5, held every frame.

2. TheShippedExamplesKeepWithinTheLocalBudget

Cause. Every example was held to the local default's 25 ms a frame, and a mount's seconds are steady-clock time per step. A loaded machine stretches a frame without bound while it runs something else. On #1595, nav_fleet_swarm.ari measured 9.5 to 28.6 ms in its busiest frame in the Debug coverage build. It was held at 28.6 ms in one try and at 11.9 ms in another, where the held frame was probably the one frame the test doesn't sample.

Choice: steps and memory checked strictly in every build; seconds checked in an optimized build only, on every frame but each example's 5 busiest.

  • Each entry's budget.time is 0, so a hold can only come from steps or memory. Those are still checked at the defaults in every build: EXPECT_FALSE(held), plus steps under a quarter of the default.
  • The seconds are judged by the test. In an optimized build (the one the default is settled for), the sixth-busiest of an example's 60 frames must be within 25 ms. The build is detected by the optimizer, not NDEBUG, and sanitizer builds are excluded, as in state_exec_async_calls_test. A Debug build prints its seconds but doesn't check them.
  • Why not "seconds in a release build only": I tried that first. Locally, with 44 CPU burners on 22 cores, the Release build failed it 2 of 20 times: frames that usually take 0.3 to 1.5 ms took 150 to 184 ms now and then. With the burners logged, those stretched frames were at most 2 of an example's 60.
  • Why not a margin on the budget: a stretched frame has no upper bound (255 ms was seen), even past the pump's 0.1 s, whose second half is CPU time.
  • The table gains a ms/usual column (all but the 5 busiest frames), and the summary line prints it next to the busiest.

Verification (CMPS-A91453, MSVC 14.44 Release, Windows 11)

  • Both tests, 20 times on an idle box: 20/20. With CVC_EXEC_SLICE_STEPS=256 and with CVC_EXEC_THREADS=auto: 10/10 each.
  • Under sustained load (44 CPU burners on 22 cores, running at the start and end of the run): 20/20. The busiest frames reached 59 to 255 ms; the ms/usual column stayed at or under 0.65 ms. Slice-256 and threads-auto passed 10/10 each with load for at least part of those runs.
  • Full ariadne_runtime_test: 380/380. Slice-256 whole binary: 380/380. CVC_EXEC_THREADS=auto, filter -AppLockManager.*: 373/373.
  • git-clang-format on the changed lines: clean.
  • Not run locally: a Linux Debug coverage build. This PR's own package-linux / libcvc-debug job is the check there.

ABusyMountIsHeldToItsBudgetWhileTheOthersRun gave the busy mount 5000
steps a frame. Each frame's pump stops at its own backstop
(kPumpMaxSeconds, 0.1 s, half of it CPU time) whatever the mounts'
budgets, and a mount the backstop cut short has not spent its budget,
so it is not held that frame. The loaded Debug coverage runner of
#1595 fit 4000 to 5000 of the busy loop's steps in a pump, so the
mount was held some frames and not others: not held at the end, no
notice, no Quit in the Budgets window. The budget is now 250 steps
(500 after Allow more), several times under that; the checks scale
with it.

TheShippedExamplesKeepWithinTheLocalBudget held every example to the
local default's 25 ms a frame, which is wall-clock time: a loaded
machine stretches a frame without bound while it runs something else.
Each entry's budget.time is now 0, so a hold is its steps' or its
memory's, still checked at the defaults in every build. The seconds
are checked in an optimized build only, on every frame but each
example's 5 busiest.
@transfix
transfix enabled auto-merge (squash) November 28, 2026 01:34
transfix added a commit that referenced this pull request Nov 28, 2026
package-linux / libcvc-debug failed on AriadneMounts.ABusyMountIsHeldToItsBudgetWhileTheOthersRun and on the runtime test's slice256 and threads_auto variants: the wall-clock budget checks that #1605 makes independent of runner speed. #1605 is a single commit (345d0be) to src/cvc/tests/ariadne_runtime_test.cpp. When it squash-merges, master gets the identical change, so this branch still merges clean and its own diff is unchanged.
@transfix
transfix merged commit 3f44685 into master Nov 28, 2026
30 checks passed
@transfix
transfix deleted the ariadne/mount-budget-tests-deflake branch November 28, 2026 06:30
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