Repository navigation
diag(gpu): GPU time per pipeline on D3DMetal, where timestamps read 0 (VICTORY_GPU_TIMING_CUTS) - #646
Merged
pragyaangaur merged 1 commit intoNov 28, 2026
Conversation
…NG_CUTS) D3D12 timestamps all read 0 under D3DMetal, so VICTORY_GPU_TIMING times whole host lists on a Mac and cannot say which pipeline of a list took the time. With VICTORY_GPU_TIMING_CUTS a title list goes on in a fresh host list around the draws and dispatches of a few pipelines at a time (as it does after a wait or for a clamp cut), so each such list runs one pipeline and its wall time is that pipeline's; everything else stays together and the frame keeps its shape. A list of shader hashes takes those pipelines; 'sweep' takes 16 at a time of the pipelines the title is drawing with, the next ones after every frame-rate line. Each frame-rate line is followed by the pipelines ranked by their time above the lists' floor, per frame they had lists in. Diagnostics builds only; off, nothing changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On a Mac,
VICTORY_GPU_TIMING=1cannot say which pipeline a list's time went to. D3D12 timestamps read 0 under D3DMetal, so the report readslists 264.5 ms/frame of wall time, their commands 0.0 ms/frame. The two loop-to-the-limit passes found so far (#148, #610) were each found by hand.What
VICTORY_GPU_TIMING_CUTS(diagnostics builds; it turnsVICTORY_GPU_TIMINGon). A title list goes on in a fresh host list around the draws and dispatches of a few pipelines at a time, the same move as after a wait or for #570's clamp cut. Each such host list then runs one pipeline, and timing mode already submits and waits for every list on its own, so the list's wall time is that pipeline's GPU time. Everything else stays together, so the frame keeps its shape.=<hash>,<hash>: the pipelines with a listed 16-digit shader hash, for the whole run.=sweep(orsweep:<n>, 16 by default):nof the pipelines the title is drawing with, in the order it first drew with them, the nextnafter every frame-rate line. Standing still for a few minutes times every pipeline of the scene, draws included.Every frame-rate line is followed by:
Figures are per frame the pipeline had lists in, because a pipeline's turn starts and ends inside a report's frames. The floor is what an empty list costs (the tenth percentile of all lists' wall time).
Unset or
0, nothing changes, and without thediagnosticsfeature the cut is compiled out.Measured
M5 Pro, 48 GB, macOS 27.2, D3DMetal 4.0 beta 3, Series X, 1280x720, diagnostics build,
VICTORY_FAULT_TRACKING=1. First prison room, standing still, no input, medians of the 5-second report lines. One run each.VICTORY_GPU_TIMING=1(maind1609d9+ #610's commit, its switch off)bf896c4562fa=b6df66af105d8b2d,63381c3250b287fad3627cf9fca98797cf2=sweep(16)82699612f2d2d2f10cc=sweep:2433d7908(this change before the rebase)f08ab16ad89bSo listing two pipelines, or sweeping 16 at a time, leaves the frame where plain timing has it; 24 at a time costs about 7%.
What it found on main
d1609d9in that room:compute b6df66af105d8b2d(the hair pass of #610), 112 to 115 dispatches in one listcompute 63381c3250b287fa, one dispatchThe sweep timed 1,199 pipelines in 330 s. Cross-check for the first row: #610's switch on the same Mac took GPU time from 262.7 to 163.1 ms (same exe, off and on). After those two, no pipeline is above 6 ms a frame.
Two cautions for reading it:
ebe4e53f031f5249for 2 to 15 s a frame. Listed alone, that pipeline costs 0.7 ms. That mode is not in this PR.Verification
On
33d7908(this change on maind1609d9), M5 Pro, Wine + D3DMetal 4.0 beta 3:cargo test --workspace --locked --no-fail-fast: 772 passed, 0 failed, 23 ignored.tools/macos/test-wine.sh --workspace --locked --no-fail-fast -- --test-threads=1: 1,549 passed, 0 failed, 40 ignored.cargo clippy --target x86_64-pc-windows-gnullvm --workspace --all-targets --locked -- -D warnings, and the same with--all-features: clean.cargo xtask policy: 300 files ok.timing_cuts.rs(the switch's values, what is cut, the sweep's order with pipelines coming and going, the ranking, a pipeline timed in part of a report's frames); they ran in both suites.Then rebased onto
d1b5e54without conflicts (this head); both Windows clippy runs and the unit tests pass again there. The game runs above were made before the rebase, on the commits the table names.Not covered: other Macs, and Windows hosts (where timestamps advance and the cuts are not needed).
Prepared with Claude Opus 5.5 and Claude Fable 5.2 (Claude Code).