Frame-line counters: the card's clock counts list-translation waits as the title's, and copystat's 'copied from' counts bytes looked at #366

Open
opened 2026-11-26 19:46:59 +00:00 by github-bot · 0 comments
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-26 19:44 UTC · original

Two frame-line counters point the wrong way when you look for what sets the frame.

  • The card's clock counts the time the line of submissions waits for list translation (VICTORY_THIN) as "while the title had not submitted".
  • copystat's "copied from" list counts the length of each refresh range, not the bytes copied.

Where

At 2de9980 (main).

1. crates/victory-gpu/src/host.rs card_clock_line. An idle stretch of the card is split only into two parts: "the submitting thread was working" (worked()) and "the rest".

"... {behind:.1} ms of that while the submitting thread was working (the card idle behind us), the rest while the title \
 had not submitted; ..."

With VICTORY_THIN=1 (a play.ps1 default), a submission goes into the line as a Job::Lists (queue/behind.rs). The line's thread cannot send it until every recording in it is translated. During that wait it is not "working", so the time lands in "the rest".

2. crates/victory-gpu/src/host.rs update → copystat::range(from, to - from, us, 0). This records to - from even though shadow.update returns the bytes it actually copied (copied, which goes to PREPARING[1]).

Why it matters

Run on an RTX 2070 SUPER 8 GB, Series S, before the own-bytes pool from #221. One gameplay second, per frame:

the card's clock per frame: nothing of ours queued 253.4 ms (the card about 45% busy by this count), 22.1 ms of that while the submitting thread was working (the card idle behind us), the rest while the title had not submitted
submissions prepared by a thread of ours, per frame (VICTORY_ASYNC_SUBMIT): ... that thread worked 93.3 ms; threads of the title waited ... 260.9 ms at presents
list calls translated by threads of ours per frame (VICTORY_THIN): 51322 in 5060.2 ms (all threads), 262.3 lists

Read as written, the first line says the card waits about 230 ms a frame for the title. But in the same second the title waited 261 ms at its presents, for the frame before to be sent. That frame was waiting for its lists' translation. The time was ours, not the title's.

The second counter reports one range as "copied ~9.8x a frame, 1.79 GB a frame", in 2.6 ms. That is bytes looked at. The bytes actually moved (the "preparing" line's copies) were about 43 MB a frame.

Suggestion

  • Clock: a third part, "while the line stood at lists still being translated". The line's thread marks when its only unmet heads are folded Lists jobs, and the clock takes the difference over each idle stretch, as it does for worked(). I have this locally (about 40 lines in host.rs and queue/behind.rs) and can open a PR once it has run.
  • copystat: pass copied to copystat::range, or keep both, "looked at" and "copied".

Not checked

  • The clock split has not run yet. The reading of the line above is from the code and the two neighbouring lines, not from a timeline.

AI use

Log reading, source reading and write-up with AI assistance (Claude Code). The runs are my own.

**@⁠Jesper-Andersson** on GitHub · 2026-11-26 19:44 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/366) Two frame-line counters point the wrong way when you look for what sets the frame. - The card's clock counts the time the line of submissions waits for list translation (`VICTORY_THIN`) as "while the title had not submitted". - copystat's "copied from" list counts the length of each refresh range, not the bytes copied. ## Where At `2de9980` (main). **1. `crates/victory-gpu/src/host.rs` `card_clock_line`.** An idle stretch of the card is split only into two parts: "the submitting thread was working" (`worked()`) and "the rest". ```rust "... {behind:.1} ms of that while the submitting thread was working (the card idle behind us), the rest while the title \ had not submitted; ..." ``` With `VICTORY_THIN=1` (a `play.ps1` default), a submission goes into the line as a `Job::Lists` (`queue/behind.rs`). The line's thread cannot send it until every recording in it is translated. During that wait it is not "working", so the time lands in "the rest". **2. `crates/victory-gpu/src/host.rs` `update` → `copystat::range(from, to - from, us, 0)`.** This records `to - from` even though `shadow.update` returns the bytes it actually copied (`copied`, which goes to `PREPARING[1]`). ## Why it matters Run on an RTX 2070 SUPER 8 GB, Series S, before the own-bytes pool from #221. One gameplay second, per frame: ``` the card's clock per frame: nothing of ours queued 253.4 ms (the card about 45% busy by this count), 22.1 ms of that while the submitting thread was working (the card idle behind us), the rest while the title had not submitted submissions prepared by a thread of ours, per frame (VICTORY_ASYNC_SUBMIT): ... that thread worked 93.3 ms; threads of the title waited ... 260.9 ms at presents list calls translated by threads of ours per frame (VICTORY_THIN): 51322 in 5060.2 ms (all threads), 262.3 lists ``` Read as written, the first line says the card waits about 230 ms a frame for the title. But in the same second the title waited 261 ms at its presents, for the frame before to be sent. That frame was waiting for its lists' translation. The time was ours, not the title's. The second counter reports one range as "copied ~9.8x a frame, 1.79 GB a frame", in 2.6 ms. That is bytes looked at. The bytes actually moved (the "preparing" line's copies) were about 43 MB a frame. ## Suggestion - **Clock:** a third part, "while the line stood at lists still being translated". The line's thread marks when its only unmet heads are folded `Lists` jobs, and the clock takes the difference over each idle stretch, as it does for `worked()`. I have this locally (about 40 lines in `host.rs` and `queue/behind.rs`) and can open a PR once it has run. - **copystat:** pass `copied` to `copystat::range`, or keep both, "looked at" and "copied". ## Not checked - The clock split has not run yet. The reading of the line above is from the code and the two neighbouring lines, not from a timeline. ## AI use Log reading, source reading and write-up with AI assistance (Claude Code). The runs are my own.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:46:59 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/avatarmanz--VIctory-7900XTX#366
No description provided.