Diagnostics: where the presenting thread and the workers spent a frame (VICTORY_FRAME_WHY2, off by default) #1275
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!1275
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1275"
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?
@CuteBooty on GitHub · 2026-11-26 09:08 UTC · original
CuteBooty:frame-timelines→main· +378 −1 · 7 files · 2 commits · openVICTORY_FRAME_WHY2=1writes two lines beginningwhy2every five seconds, one for the mean frame of the window and one for its longest frame. Off by default; it changes no behaviour.Each line is a set of exclusive timelines that add up to the frame: the presenting thread (recording, waits by cause, the present's drain, the display copy, the remainder), the title's other callers (in thread-ms, because several record at once), the submit worker (preparing, waiting, idle) and the relay (waiting for the card's fence, landing, idle). Waits that are still open at a present are sampled there, so time is booked to the frame in which it passed.
How it fits with what is here. The frame log gives aggregate timings;
0672327dmeasures the gaps of the card's direct queue on the card's clock; the corner box shows the machine's load. These lines add the CPU side as timelines, so one can see which waits overlap and where a saved wait reappears.What one run showed on my tree (fuller version of the same counters; Ryzen 5 3600, RTX 3070 8 GB, Series S, town, about 212 ms a frame; one run):
So on that machine the "present wait" is the presenting thread waiting for the rest of the frame, not a cost of its own.
What changed. New
frame_why.rs(span,sample,frame). Hooks inqueue.rs(present,execute_now,worker),list.rs(with_state),frame.rs(wait) and inhost.rsaround preparation, fence waits and relay landing. Two tests: waits that cross a present, and overlapping callers.Left out against the version in my tree, because this tip's code differs there: the query, culling and descriptor counters, native waits, the drain overlap, flight latency and per-phase maxima.
Cost. When on, reading clocks and taking the counters' lock can affect very short calls. When off, one flag load per hook.
State. Ported by hand onto this tip.
cargo clippy --workspace --all-targets -- -D warningsis clean,cargo test --workspacepasses (617), the asset policy passes. Not yet run in the game on this tip.🤖 Generated with Claude Code
@Garu667 on GitHub · 2026-11-26 09:25 UTC · original
Thanks, this was useful right away. Merged on top of
f6a09d3with no conflict, run on an RTX 3080 10 GB (Series X, boat mission, standing, README set +CARD_SYNC_BATCH=1 CARD_HASH_WIDE=1):Together with the existing
a submission's preparing by partline (list steps 29.4, write-watch 11.8, refresh flush 11.7, card_before 6.3 ms a frame), it tells us where to look on a machine where the card is no longer the wall. No behaviour change seen with the switch on, no device loss.@CuteBooty on GitHub · 2026-11-26 10:17 UTC · original
Thank you for trying it so quickly, and for the numbers. A submit worker that is idle for about 150 ms inside the longest frames is the case these lines were written to show.
One small addition exists on my side, if it is wanted here later: a lane for the texture-pass worker of PR 1007 (
why2 heap worker), which appears only while that worker runs.@Garu667 on GitHub · 2026-11-26 10:35 UTC · original
That heap-worker lane would be useful here: on the RTX 3080,
VICTORY_HEAP_WORKER=1gave no fps gain, darkened the picture and cost 8-9 fps in cutscenes (f6a09d3comment), so seeing where that worker's time goes next to the submit worker would help explain it. Happy to run it if you push it.@CuteBooty on GitHub · 2026-11-26 13:50 UTC · original
@Garu667 the lane you asked for is pushed (
7cf4e095). WithVICTORY_FRAME_WHY2=1andVICTORY_HEAP_WORKER=1, eachwhy2 meanandwhy2 longestline is now followed by one more:prepareis the worker's texture pass (including its wait for the pass lock),idleis waiting for a heap to be handed over,otheris the rest of the frame. The line appears only while the worker thread exists; nothing else changes. Counters only, two files, lint and the workspace tests pass. I have not yet run this version in the game on the fork's own code, only its sibling in my tree.On the darker picture with the worker on: I cannot say it is the same thing, but there is one path I read where a slot may never get its host view with the worker running (a placed view of memory the host writes itself); the note is on #1007. A sampled null would read as zero, which could look like darkening. It is a reading of the code, not something I have seen.
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.