perf(gpu/queue): let the title's present go once the frame ahead has at most n submissions left (VICTORY_PRESENT_RELEASE, 2 in play) #330
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/330"
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 Androtim/MiniVI. Originally posted by PiloteCode on 2026-12-02T12:27:55Z.
Summary
With the submission line (
VICTORY_ASYNC_SUBMIT/VICTORY_THIN), a title thread presenting frame N waits until present N-1 has been done by our thread. Our line and the card then run dry while the title has not started frame N+1 (4.2-6.6 ms a frame of an empty queue in a new game's street, nearly all of it while the title had not submitted).VICTORY_PRESENT_RELEASE=<n>lets the title go on once present N-1 is being done or has at mostnsubmissions in front of it in the line (0: when we take it). It is less thanVICTORY_SUBMIT_FRAMES=2(a whole frame more in the line), and never lets the title run with two presents ahead of its own. Unset in the layer (unchanged behaviour);2inplay's settings and inverify-world.ps1's PlayParity block. Diagnostics builds can switch it inside a run (VICTORY_AB; on = the variable'sn, else 0). The lane's frame line now says how many presents a frame were let go early.In our fork's play defaults since 30 Nov.
Changes
crates/victory-gpu/src/queue/behind.rs:Lane::wait_presents_aheadandLane::released(same lane state, no new locks);release_ahead();present()uses it; frame-line counter; unit testthe_title_is_let_go_as_the_present_ahead_comes_near.apps/victory/src/play.rs,scripts/verify-world.ps1:VICTORY_PRESENT_RELEASE=2(parity kept).Rig Specs Tested On (our fork, not this tree)
Run Settings & Profile
VICTORY_AB(4-8 switches, 10 s phases in a mixed order, 56 phases at the busiest place of a saved game), drift fitted;n= 2Measurements & Verification
main3230974; offline,--locked, toolchain 1.98.1-msvc):cargo clippy --workspace --all-targets --locked -- -D warningscargo clippy --workspace --all-targets --all-features --locked -- -D warningscargo test(not run by us on this tree)cargo xtask policy(not run;host.rsuntouched)Limits
behind.rsis an older form of ours); MiniVI's folded entries count as submissions in front of a present, as ours do.VICTORY_SUBMIT_FRAMES=2, the bigger version of the same idea, was measured and rejected in our fork (median -1.4 ms but p90 +9.3 +- 1.2 ms, run big-fg-1).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T12:49:02Z.
Read-only security & triage review on
097d2c45(external authorPiloteCode— awaiting manual owner approval per repository security allowlist policy; not built/executed locally and not auto-merged):apps/victory/src/play.rs,crates/victory-gpu/src/queue/behind.rs); flags 1-line script edit inscripts/verify-world.ps1(VICTORY_PRESENT_RELEASE = '2') for owner review. NoCargo.toml,build.rs,.github/workflows/, binaries, or clean-room violations.VICTORY_PRESENT_RELEASE=2). Needs manual owner approval to run CI + plain---releaseA/B verification (including frame-pacing & VRAM headroom check).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T13:03:28Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Clean, well-scoped change to async submission pacing in
crates/victory-gpu/src/queue/behind.rs, with default enablement (VICTORY_PRESENT_RELEASE=2) mirrored inapps/victory/src/play.rsandscripts/verify-world.ps1. CI is passing.Code & Correctness Checks
Lane::wait_presents_ahead&Lane::released(crates/victory-gpu/src/queue/behind.rs):VICTORY_PRESENT_RELEASEis unset (Nonedelegates directly toLane::wait_presents).most + 1(if state.presents > most + 1 { return false; }), so with the defaultVICTORY_SUBMIT_FRAMES=1the title never gets two presents ahead of its own.lined < state.presents, whenLane::stephas popped the oldestPresentto executego()before decrementingstate.presents) as well as countinge.what.runs()ahead of the oldest queuedPresent.Lane::stepcallsself.moved.notify_all()after every unfolded/completed entry andLane::servenotifies after eachlook(), sowait_presents_aheadwakes reliably.release_ahead()cleanly integrates withcrate::ab::pick("VICTORY_PRESENT_RELEASE")under#[cfg(feature = "diagnostics")], andline()reports early releases viaRELEASED_AHEAD.the_title_is_let_go_as_the_present_ahead_comes_nearcovers the threshold boundaries, popped-present state, immediate return, andmost + 1cap.apps/victory/src/play.rs,scripts/verify-world.ps1):VICTORY_PRESENT_RELEASE=2toSETTINGSinplay.rsand to$envVarsinverify-world.ps1(no other changes toverify-world.ps1).Why
needs-gpu-testThis changes GPU submission/present pacing and enables
VICTORY_PRESENT_RELEASE=2by default in the launcher (play.rs), and the PR measurements were collected on a fork rather than on MiniVImain. A local real-GPU smoke/regression test on MiniVI is warranted before merging to verify frame pacing, stability, and absence of latency regressions or visual glitches.Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T13:18:17Z.
Allowlist & Architect Deep Review (
PiloteCodeis now on the trusted allowlist; CI46881360834is GREEN):Code audit (
crates/victory-gpu/src/queue/behind.rs,apps/victory/src/play.rs,scripts/verify-world.ps1):wait_presents_ahead,released,self.moved.notify_all()instep/serve) are clean and deadlock-free; caps in-flight presents strictly atmost + 1.VICTORY_PRESENT_RELEASE=0parses vianumber()asSome(0)(meaning early release with0submissions ahead of the present, not disabled), whereasplay.rs/verify-world.ps1setVICTORY_PRESENT_RELEASE=2. Because every otherVICTORY_*override uses=0to disable, passingVICTORY_PRESENT_RELEASE=0silently keeps early release active (only a non-numeric string likeoffdisables it). Consider documentingoffexplicitly or makingoff/disabled unambiguous alongside a default-on runtime path if the A/B wins.Next step (
triage: needs gpu test): Ready for plain--release(no--features diagnostics) A/B onmain(b0842d93+) checking median/p90 FPS,preparing/copybackms, WS/VRAM, and 0 crashes/DRED.