Tests: allow the frame clock to skip ticks after a late frame #2265
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2265
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2265"
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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 09:22 UTC · original
andrewpozdnakov7-jpg:test/frame-pacing-skipped-ticks→main· +61 −31 · 1 files · 3 commits · openThe frame-pacing fixture failed during parallel Windows tests when a thread was scheduled more than 50 ms late or a flip missed a tick. The frame clock reserves a distinct tick for each successful flip. It can skip one when the caller arrives late.
The fixture now keeps the consecutive frame-token assertion and checks that every flip takes a later tick. A delay of three intervals before one flip exercises a missed tick on every run.
On
940d32fwith the same delay and the old assertions, all 10 runs failed, for example with flip ticks [4, 5, 9, 10]. With the new assertions, both frame tests passed in all 50 runs. Full victory-gpu on WARP: 146 passed, 0 failed, 2 ignored. Strict Clippy with and without diagnostics and the staged policy check passed.303be14 also covers the origin poll from the #2729 CI failure. The test now controls elapsed time on its own thread while calling the normal frame API. With the same delayed poll on
013f797(98578eacombined with main13f91ca), the old TIMEOUT assertion received S_OK in all 10 attempts. The revised test checks that the late poll consumes the elapsed tick, the next poll times out without changing its token, and the flag still starts an early frame. The flip cases use the same controlled time.Both frame tests passed in 50 parallel repetitions. The full GPU suite on WARP passed 198 tests with one ignored under each debug setting. Strict Clippy in both feature configurations and asset policy passed.
Please preserve the Git author when reapplying the test. If you fold it into your own commit, please add:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted. Synthetic tests only.
@cloph-dsp on GitHub · 2026-11-25 10:29 UTC · original
Independent local verification (Windows, Rust 1.100.0/MSVC, head
98578ea, no game data):cargo test -p victory-gpu --lib frame::tests --locked-> 2 tests passed (waits_begun_together_take_different_ticks,waits_end_on_ticks_and_count_frames), exit 0. Only twofetch_updatedeprecation warnings, unrelated to this change. I did not run the flaky assertion in a loop or on a loaded machine, so the anti-flake claim is not independently stress-tested here. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only unit tests). No game data, assets or extracted content used.@Marvisak on GitHub · 2026-11-25 13:31 UTC · original · edited 2026-11-25 20:21 UTC
Automated triage for the maintainers.
Merge candidate (test-only). The head moved to
303be14(main merged in, plus a new test commit). The frame tests incrates/victory-gpu/src/frame.rsno longer depend on scheduling:next_tickgets a#[cfg(test)]hook (tests::elapsed) that lets a test set the elapsed time on its own thread, and both frame tests take a sharedCLOCK_TESTlock. I traced the new exact assertions againstnext_tickonmain: the late origin poll at 6 ms takes the passed tick, the next zero-timeout poll times out without a token, the flips at 5/10/20/25 ms land on ticks +0/+1/+3/+4, and the late flip at 40 ms takes the latest passed tick, with the next one 5 ms out. These are the behaviours the doc comment onnext_tickdescribes, so the tests check the intended contract, not just the current output. The release build is unaffected. CIcheckpasses on this head and the branch merges cleanly.Reply to the author: the controlled-time version is an improvement over the earlier sleep-based one, and it covers the origin-poll failure from the linked CI run. The verdict stays merge-candidate.
Generated by Claude Code
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 19:37 UTC · original
303be14 also covers the origin poll from the #2729 CI failure. The test now controls elapsed time on its own thread while calling the normal frame API. With the same delayed poll on
013f797(98578eacombined with main13f91ca), the old TIMEOUT assertion received S_OK in all 10 attempts. The revised test checks that the late poll consumes the elapsed tick, the next poll times out without changing its token, and the flag still starts an early frame. The flip cases use the same controlled time.Both frame tests passed in 50 parallel repetitions. The full GPU suite on WARP passed 198 tests with one ignored under each debug setting. Strict Clippy in both feature configurations and asset policy passed.
Please retain the Git author if you reapply the test. If you fold it into another commit, please add Co-authored-by: andrewpozdnakov7-jpg [email protected].
@catminou4 on GitHub · 2026-11-25 09:35 UTC · original · reviewed
Tests: frame clock may skip ticks after a late wake; deterministic assertions replace wall-clock bounds. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Test-only flake fix, good.
@fuzeofficlal on GitHub · 2026-11-26 19:24 UTC · original · approved these changes
Verified locally merged onto
origin/main(63bcca43, Windows 11 x64, Rust 1.98.1 MSVC):cargo test --locked -p victory-gpu --lib frame::(10 consecutive runs) — 10/10 passed (2 passed, 0 failed per run,0.01s)cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features) — 0 warningscargo xtask policy— ok (191 files ok)Review notes
#[cfg(not(test))]production timing innext_tickis unchanged (c.start.elapsed().as_nanos()), and the#[cfg(test)]ELAPSEDoverride +CLOCK_TESTmutex removes scheduling flakiness across both tests while explicitly covering the skipped-tick late-wake behavior.ELAPSEDisthread_local!andwaits_begun_together_take_different_tickscallsnext_ticksequentially on one thread (andwaits_end_on_ticks_and_count_framesno longer checks wall-clock sleep duration), realInstantprogress and multi-thread contention are not directly timed here.frame.rs:306-308still mentions(two threads), the loop comment atframe.rs:271-273describes a timed-out origin poll while the mocked timestamps returnS_OK, and twoassert_eq!lines aroundframe.rs:296exceedrustfmtline width.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.