frame_pacer: cancel a wait that spans suspend and re-registration #1237
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1237"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by titoreinaldo on 2026-11-24T20:41:09Z.
Claimed in the coordination issue as: RT-PACER-SUSPEND-EPOCH
Claim in #14
What and why
A wait could enter before suspend, wake after resume and re-registration, then consume the first tick of the new registration. A pre-suspend origin wait could even issue the resumed frame’s token. The pacer now records each suspend under its existing mutex. When a waiter regains the lock it can tell that its registration ended, even if the new one is already armed.
The regression drives that ordering through the existing injected clock. It checks origin, vblank and flip events, verifies the old wait returns
invalid_statewithout changing the caller’s token, and verifies a fresh wait can still take the first resumed tick. This concerns the project’s modeled pacing contract. #1042 touches the same header for a different wakeup case. The two commits merge cleanly.Tested
frame_pacer_testfirst. It passed. Adding the new ordering against the pre-fix header failed at the expected old-wait assertion.ctest --test-dir <build> -R frame_pacer --repeat until-fail:10 --output-on-failure.58be9cdf, 6,168 translator tests in 470 files had zero failing files. Verified a clean merge withmainat705ea091and the head of #1042.GPUs tested: CPU-only frame pacing, Windows 11 Pro 26H2 build 26300.9974, LLVM-MinGW 23.1.6.
AI-assisted: yes, OpenAI Codex. Synthetic clock and inputs.
Imported from ubiquitarianism/leonida. Originally posted by Snooozs on 2026-11-24T20:58:02Z.
Read the whole diff and tested
9a5ba38d8merged on main66d4f5aa3(clean), Windows 10 Pro 19045, VS 2022 RelWithDebInfo (MSVC), CPU only:frame_pacer.h: 3 of 3 runs fail at line 389 (the old wait'sinvalid_state)The generation is read and written only under the pacer mutex, and it is taken at the start of
wait_locked, so a wait entered afterresumesees the new value. Nothing to change from my side. The retail title was not run.AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by titoreinaldo on 2026-11-25T00:16:21Z.
Linux cross-check on x86-64 with g++ 14.2 (
-O2 -std=c++20 -pthread, CPU-only). I merged9a5ba38dlocally with main1154976dwithout conflicts and built the standaloneframe_pacer_testfrom the merged tree. The regression with the same test and the main-only header failed 4/4 at line 389 (pre-suspend wait returned something other thaninvalid_state); the patched tree passed 4/4. No game files; AI-assisted.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T20:19:03Z.
Red/green: On main frame_pacer_test fails at line 536 (a wait that spans suspend and re-registration does not return invalid_state), and with the PR ctest -R ^frame_pacer$ passes on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main
c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:48:00Z.
Verified by OreoFR
c1ecf04ed+ PR head9a5ba38d8; green run in a merge package of 2 PRs, no new ctest failure vs mainctest -R ^frame_pacer$AI-assisted (Claude Code, Claude Opus 5.5).