GPU: time commands by pipeline in VICTORY_GPU_TIMING #1735

Open
github-bot wants to merge 1 commit from github-bot/gh-1735 into main AGit
Owner

@⁠Nixitov on GitHub · 2026-11-24 21:34 UTC · original
Nixitov:prof/gpu-cost → main · +203 −26 · 4 files · 1 commits · open

What it did

VICTORY_GPU_TIMING=1 logged commands=0 and named nothing. A list only kept command notes, and their timestamps, when VICTORY_D3D12_DRED was on: the notes existed for the device-removed report alone. So the timing report could only ever show the slowest commands of a list that happened to also have DRED data.

What it does now

  • A command is noted whenever the timing is on too (noting()), and end-of-command markers are kept to the DRED case that reads them. The timestamps are the notes.
  • Each 5 s report gains GPU cost by pipeline, one line per pipeline: ms/frame, share of the noted time, ms per command, commands/frame. Labels drop per-draw addresses and keep the pipeline hashes, so one pass adds up across the frame, e.g.
    INFO victory_gpu::host::costs: GPU cost by pipeline: 318.46 ms/frame over 4 lists (12 commands/frame)
    INFO victory_gpu::host::costs: 318.46 ms/frame (67% of noted, 79.6 ms each, 4.0/frame): indirect dispatch 480x270x1 [compute c7feccae4e01e454]
    
  • An indirect dispatch's note carries its group counts, read from the argument buffer through the guarded title-memory read (dispatch_dims), so a slow indirect pass is named with what it launched.
  • A list still runs and is waited for on its own under VICTORY_GPU_TIMING, as it does now, so its command timestamps are its own and the report reads them as soon as its submission finished.
  • translate grows VICTORY_NAME_SHADERS=<file>, which appends <hash>\t<source> for every shader container, so a pipeline the runtime names by a 16-digit hash can be named by the RPF source it came from.

Measured

RTX 5070, Windows 11 26200.9974, driver 617.14, diagnostics build, title run with VICTORY_GPU_TIMING=1:

  • Before: commands=0 in every report, no pipeline named.
  • After: the table above, which is what identified the despatch that the placed-copy fix addresses.
  • The report costs one timestamp per noted command; no frame-rate claim is made for it.

Tested

Base main ffe310e:

  • cargo build --release -p victory: clean.
  • cargo build --profile diag -p victory --features diagnostics: clean.
  • cargo test --workspace --locked --no-fail-fast: all suites pass (0 failed).
  • cargo test --release -p victory-gpu: 50 passed, 1 ignored.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean.

The timing report itself is only exercised by a diagnostics run with a GPU and a title; it has no unit test.

No game data.

AI-assisted (DeepSeek V4.1 Flash coding agent).

**@⁠Nixitov** on GitHub · 2026-11-24 21:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1735) `Nixitov:prof/gpu-cost` → `main` · +203 −26 · 4 files · 1 commits · open ## What it did `VICTORY_GPU_TIMING=1` logged `commands=0` and named nothing. A list only kept command notes, and their timestamps, when `VICTORY_D3D12_DRED` was on: the notes existed for the device-removed report alone. So the timing report could only ever show the slowest commands of a list that happened to also have DRED data. ## What it does now - A command is noted whenever the timing is on too (`noting()`), and end-of-command markers are kept to the DRED case that reads them. The timestamps are the notes. - Each 5 s report gains `GPU cost by pipeline`, one line per pipeline: ms/frame, share of the noted time, ms per command, commands/frame. Labels drop per-draw addresses and keep the pipeline hashes, so one pass adds up across the frame, e.g. ``` INFO victory_gpu::host::costs: GPU cost by pipeline: 318.46 ms/frame over 4 lists (12 commands/frame) INFO victory_gpu::host::costs: 318.46 ms/frame (67% of noted, 79.6 ms each, 4.0/frame): indirect dispatch 480x270x1 [compute c7feccae4e01e454] ``` - An indirect dispatch's note carries its group counts, read from the argument buffer through the guarded title-memory read (`dispatch_dims`), so a slow indirect pass is named with what it launched. - A list still runs and is waited for on its own under `VICTORY_GPU_TIMING`, as it does now, so its command timestamps are its own and the report reads them as soon as its submission finished. - `translate` grows `VICTORY_NAME_SHADERS=<file>`, which appends `<hash>\t<source>` for every shader container, so a pipeline the runtime names by a 16-digit hash can be named by the RPF source it came from. ## Measured RTX 5070, Windows 11 26200.9974, driver 617.14, diagnostics build, title run with `VICTORY_GPU_TIMING=1`: - Before: `commands=0` in every report, no pipeline named. - After: the table above, which is what identified the despatch that the placed-copy fix addresses. - The report costs one timestamp per noted command; no frame-rate claim is made for it. ## Tested Base `main` `ffe310e`: - `cargo build --release -p victory`: clean. - `cargo build --profile diag -p victory --features diagnostics`: clean. - `cargo test --workspace --locked --no-fail-fast`: all suites pass (0 failed). - `cargo test --release -p victory-gpu`: 50 passed, 1 ignored. - `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features`: clean. The timing report itself is only exercised by a diagnostics run with a GPU and a title; it has no unit test. No game data. AI-assisted (DeepSeek V4.1 Flash coding agent).
VICTORY_GPU_TIMING logged 'commands=0' because a list only kept command
notes (and their timestamps) when VICTORY_D3D12_DRED was on: the notes
existed for the device-removed report alone. Note a command whenever the
timing is on too, keep the markers to the DRED case they are read by, and
add the notes' GPU times up per pipeline, so a report names the passes a
frame spends its time in rather than only the slowest command of a list.

- Each 5 s report gains 'GPU cost by pipeline' and one line per pipeline:
  ms/frame, share of the noted time, ms per command, commands/frame.
- A list still runs and is waited for on its own under VICTORY_GPU_TIMING,
  as before, so its command timestamps are its own and are read as soon as
  its submission finished.
- An indirect dispatch's note carries its group counts, read from the
  argument buffer through the guarded title-memory read.
- translate grows VICTORY_NAME_SHADERS=<file>, which maps the hash a
  runtime log names a pipeline by to the RPF source it came from.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:43:17 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:35 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: README.md, apps/victory/src/translate.rs, crates/victory-gpu/src/host.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1735#issuecomment-7149722655) <!-- victory-triage v1 head=8ec5de1ac765a0cbba082529020c30057626b7ff verdict=needs-rebase at=2026-11-25T01:35:24Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `README.md`, `apps/victory/src/translate.rs`, `crates/victory-gpu/src/host.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 20:52 UTC · original

@⁠Nixitov, thanks for this. The per-pipeline report found where our GPU time goes in one run. One problem in how it divides, though: the per-frame figures come out several times too high when the frame rate is low.

In Meter::frame (host.rs), costs::log(frames) gets frames from the 1-second meter: the frames since self.since, which the same call has just reset. But the cost tally covers everything since the last 5-second log, the same span copystat::log uses, and that one divides by copy_stats_frames. At ~1.2 fps the 1-second window holds about 2 frames, while about 6 fall in the 5-second span, so every "ms/frame" and "/frame" figure in the report is about 3× too high. "ms each" is unaffected.

What we saw that gave it away, in our play build with this PR merged (RTX 5070, about 1.2 fps): every per-frame command count in the report was a multiple of 3, and the noted total came to about 993 ms/frame against 374 ms "on the GPU" in the fps line of the same frames. Divided by 3, it's about 331.

A fix that keeps both reports on the same frames:

#[cfg(feature = "diagnostics")]
{
    let window = std::mem::take(&mut self.copy_stats_frames) as f64;
    crate::copystat::log(window);
    // ... drops loop unchanged (take_drops is per 1 s window, so /frames is right there) ...
    costs::log(window);
}

Local title data was used for that run; only counts and timings from the log are given here.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 20:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1735#issuecomment-7174304614) @⁠Nixitov, thanks for this. The per-pipeline report found where our GPU time goes in one run. One problem in how it divides, though: the per-frame figures come out several times too high when the frame rate is low. In `Meter::frame` (`host.rs`), `costs::log(frames)` gets `frames` from the 1-second meter: the frames since `self.since`, which the same call has just reset. But the cost tally covers everything since the last 5-second log, the same span `copystat::log` uses, and that one divides by `copy_stats_frames`. At ~1.2 fps the 1-second window holds about 2 frames, while about 6 fall in the 5-second span, so every "ms/frame" and "/frame" figure in the report is about 3× too high. "ms each" is unaffected. What we saw that gave it away, in our play build with this PR merged (RTX 5070, about 1.2 fps): every per-frame command count in the report was a multiple of 3, and the noted total came to about 993 ms/frame against 374 ms "on the GPU" in the fps line of the same frames. Divided by 3, it's about 331. A fix that keeps both reports on the same frames: ```rust #[cfg(feature = "diagnostics")] { let window = std::mem::take(&mut self.copy_stats_frames) as f64; crate::copystat::log(window); // ... drops loop unchanged (take_drops is per 1 s window, so /frames is right there) ... costs::log(window); } ``` Local title data was used for that run; only counts and timings from the log are given here. AI-assisted
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 07:34 UTC · original

VICTORY_GPU_TIMING regression results

I ran the same synthetic D3D12 WARP fixture on upstream main (63bcca43c6a00a758510398fa43096ce7e4f7df0) and a local adaptation of the timing changes from this PR (853bdf540238707d066bc366ccf6eb95fdc5660e). Each list contained two CopyBufferRegion commands. The copied values were verified in all cases.

Submission main, DRED off main, DRED on Local patch, DRED off Local patch, DRED on
One list 0 0 2 2
Two distinct lists 0 4 4 4
The same list twice 0 4 4 4

main emitted no report for a single list in either mode. With DRED off, the same submission on the patch emitted the following lines.

GPU timing: lists 1.5 ms/frame of wall time, their commands 0.3 ms/frame (2 commands in 1 frames, 2.00 commands/frame)
  GPU 0.28 ms/frame in 1.00 commands/frame: copy [fixture a-0]

The low-FPS regression used two consecutive report windows. The first produced 20 ms/frame and 2 commands/frame from 120 ms, 12 commands and 6 presents. The second produced 4 ms/frame and 1 command/frame from 12 ms, 3 commands and 3 presents. Closing the report takes the guest-present count and the completed-list samples together.

Queue wait is included in the list wall time, measured around submission through the fence wait. GPU command time comes from intervals between timestamps recorded within the list.

The diagnostics suite on app-local Agility SDK and WARP passed 247 tests, with two ignored by default. The ignored timing fixture passed when run explicitly in both DRED modes. Three texture and pipeline tests failed in the full diagnostics run on system WARP and passed with the app-local runtime. The default suite passed 231 tests and strict Clippy passed in both feature configurations.

The local adaptation retains the original Git author from #1735. If these regression tests or the frame-window fix are folded into another commit, please retain their credit with Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

AI-assisted.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 07:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1735#issuecomment-7185608741) ### `VICTORY_GPU_TIMING` regression results I ran the same synthetic D3D12 WARP fixture on upstream `main` (`63bcca43c6a00a758510398fa43096ce7e4f7df0`) and a local adaptation of the timing changes from this PR (`853bdf540238707d066bc366ccf6eb95fdc5660e`). Each list contained two `CopyBufferRegion` commands. The copied values were verified in all cases. | Submission | `main`, DRED off | `main`, DRED on | Local patch, DRED off | Local patch, DRED on | | --- | ---: | ---: | ---: | ---: | | One list | 0 | 0 | 2 | 2 | | Two distinct lists | 0 | 4 | 4 | 4 | | The same list twice | 0 | 4 | 4 | 4 | `main` emitted no report for a single list in either mode. With DRED off, the same submission on the patch emitted the following lines. ```text GPU timing: lists 1.5 ms/frame of wall time, their commands 0.3 ms/frame (2 commands in 1 frames, 2.00 commands/frame) GPU 0.28 ms/frame in 1.00 commands/frame: copy [fixture a-0] ``` The low-FPS regression used two consecutive report windows. The first produced **20 ms/frame and 2 commands/frame** from 120 ms, 12 commands and 6 presents. The second produced **4 ms/frame and 1 command/frame** from 12 ms, 3 commands and 3 presents. Closing the report takes the guest-present count and the completed-list samples together. Queue wait is included in the list wall time, measured around submission through the fence wait. GPU command time comes from intervals between timestamps recorded within the list. The diagnostics suite on app-local Agility SDK and WARP passed 247 tests, with two ignored by default. The ignored timing fixture passed when run explicitly in both DRED modes. Three texture and pipeline tests failed in the full diagnostics run on system WARP and passed with the app-local runtime. The default suite passed 231 tests and strict Clippy passed in both feature configurations. The local adaptation retains the original Git author from #1735. If these regression tests or the frame-window fix are folded into another commit, please retain their credit with `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 07:38 UTC · original

@⁠Nixitov The timing fix and regression tests are available in 853bdf5, on codex2/gpu-timing-report. It adapts the timing changes from #1735 onto 63bcca4 and preserves the original Git author.

On the same WARP fixture, main emitted no report for a single list. The patch reported 2.00 commands/frame in both DRED modes. For two lists, including a repeat of the same list, the count went from 0 to 4 with DRED off and stayed at 4 with DRED on.

The two low-FPS report windows produced 20 ms/frame, 2 commands/frame and 4 ms/frame, 1 command/frame. If you fold the regression tests or the frame-window fix into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 07:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1735#issuecomment-7185675121) @⁠Nixitov The timing fix and regression tests are available in [`853bdf5`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/853bdf540238707d066bc366ccf6eb95fdc5660e), on `codex2/gpu-timing-report`. It adapts the timing changes from #1735 onto `63bcca4` and preserves the original Git author. On the same WARP fixture, `main` emitted no report for a single list. The patch reported `2.00 commands/frame` in both DRED modes. For two lists, including a repeat of the same list, the count went from 0 to 4 with DRED off and stayed at 4 with DRED on. The two low-FPS report windows produced `20 ms/frame, 2 commands/frame` and `4 ms/frame, 1 command/frame`. If you fold the regression tests or the frame-window fix into another commit, please retain `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
This pull request has changes conflicting with the target branch.
  • README.md
  • apps/victory/src/translate.rs
  • crates/victory-gpu/src/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1735/head:github-bot/gh-1735'
git switch 'github-bot/gh-1735'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1735'
git switch 'github-bot/gh-1735'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1735'
git switch 'github-bot/gh-1735'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1735'
git switch 'main'
git merge --squash 'github-bot/gh-1735'
git switch 'main'
git merge --ff-only 'github-bot/gh-1735'
git switch 'main'
git merge 'github-bot/gh-1735'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/Marvisak--VIctory!1735
No description provided.