GPU diagnostics: count copy-back waits by fill caller and write declarations by binding #136
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/136"
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 DexNom/VIctory. Originally posted by SamuelHaleDev on 2026-11-27T17:40:26Z.
Hardware
victory-play.exe --1080p-to-1440p, no--rt, retail Series X image, shader cache warmedProblem statement
In the opening interior scene, about 400 ms of each 520–650 ms frame is the CPU waiting for the card. The settle line said "title memory read by a fill of upload memory", but couldn't tell which caller's fills, or which declared writes they overlapped.
Solution
Diagnostics only, with no behaviour change. Three counters that answer that question from an ordinary run.
What changed
host.rsFillcarries aFillBytag: texture copy, root CBV, dynamic CBV slot, or other.FILL_SETTLES), printed as "settles for a fill of upload memory per frame, by caller".defer_fillis replaced bydefer_fill_by, so every caller names itself.shadow.rs:Shadow::gpu_writesbecomesgpu_writes_bywith aDeclarertag (root UAV, table buffer UAV, page-directory ranges, page-directory pages). Per frame and per binding it prints declared ranges, bytes, and ranges of 64 MiB or more (DECLARED): "shader write ranges declared per frame, by binding".host/card_steps_probe.rs: withVICTORY_CARD_STEPS_PROBE=1, sampled blocked fills also log the declared write spans they met and the host copy each lies in: "blocked upload fill, the declared writes it met".list.rs,draw.rs,memory.rs, and a test inhost.rs/resource.rs.Design decisions
writtenspan afterwards. Removingdefer_fillandgpu_writesmakes every future caller name itself instead of silently counting as "other".Flight/Declaredcarry none, and adding it is new plumbing better left to a separate change.Baseline
Before these counters, the settle line only showed totals. Minute 3–4, still camera at a window:
After change
The same scene and window, read from the new lines:
defer_table_constant): 1.0–2.0 per frame. Texture copy, root CBV and other: 0.What it means: the game binds near-whole-heap UAV views of a 174 MB heap that also holds its constants. Any CPU read of those constants therefore waits on every flight in the air. The declaration matches the views; it isn't a runtime over-estimate.
What I tried: pointing aligned table CBVs at the shadow, as
root_viewdoes. It rendered correctly, but only ~7% of slots are 256-byte aligned. Total waiting didn't change (467 → 465 ms per frame), so it isn't included.What would fix it: this points at the GPU-side written-page mask that
Shadow::gpu_writesalready notes as a shortcut.Tests:
cargo test -p victory-gpu --features diagnosticspasses (239 passed, 4 ignored).inplace::tests::warp_a_title_buffer_in_place_shows_its_bytes_at_its_offset(see #80). Three reruns passed.diagnosticsbuild cleanly.cargo xtask policypasses.Notes
main.🤖 Generated with Claude Code
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.