GPU tests: verify frame waits without scheduler assumptions #978
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!978
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-978"
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?
@avt0m4t48 on GitHub · 2026-11-25 14:34 UTC · original
avt0m4t48:test/frame-waits-clock→main· +23 −13 · 1 files · 1 commits · openThe frame-wait test can fail when the runner is descheduled. It expects a wait to finish within 50 ms of wall time and every flip to use an adjacent 5 ms tick. The frame clock can legitimately skip ticks when work is delayed. This was also reported in #970.
Keep checking the actual wait calls, timeouts, frame tokens, and strict increase in flip ticks. Move the exact timing assertions to a test of the existing next-tick calculation using fixed elapsed times. It covers phase, an early wake and a missed tick.
The original fixture failed with either a 65 ms pause at the upper wall-clock bound or 20 ms pauses before flip waits. The patched tests passed with both controls. A mutation that ignored the previous tick failed the new clock test. Both tests passed on native Windows in the default and legacy late-wait modes. The asset policy passed.
This covers the sequential tests. The concurrent title-wait behavior addressed by #325 is separate.
Windows verification
AI-assisted using Codex.
@HailLucifer666 on GitHub · 2026-11-25 15:20 UTC · original
Same flake, independently measured tonight on Windows 10: 1 failure in 12 whole-binary runs at four-way process load, 0 in 16 serial, 0 in 24 with the test run alone. Your reading is right, and I want to add one mechanism note plus an alternative I have ready but have not opened as a PR, so you are not asked to review two things at once.
Why it fails. The assertion is
before.elapsed() <= 50 mswrapped around two 2 ms waits, plus "every flip lands on the adjacent tick". Both are claims about the machine waking up on time. Nothing inframefails; the test measures the scheduler.What I did differently.
framenow gets its time and its sleeping from one swappableClockSource—Instant::nowandthread::sleepin the title, a hand-driven clock in tests — so the assertions become exact numbers about the arithmetic instead of wall clock:timeout_ms = 0poll after them costs none;The test then finishes in 0.00 s and never sleeps. Probes: make the next tick the current tick (
elapsed / interval + 1→elapsed / interval) → fails 16 ms vs 21 ms; sleep 1 us short of the tick → fails 3.999 ms vs 4 ms.The trade, plainly. Mine adds a seam to shipping code (
frame.rs, two functions and oneOnceLock); yours touches tests only. Yours removes the unsound assertion; mine replaces it with a stronger one. If the owner prefers test-only, take yours and I will not open mine — say the word either way and I'll follow your call rather than adding a second PR to the queue.One thing worth keeping from the current test whichever version lands:
assert!(LAST[0] >= 2)and the "a poll costs no time" check are the parts that catch a real regression. The 50 ms and tick-adjacency checks are the parts that cannot.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.