GPU (diagnostics): the frame-rate line ranks host copies by what video memory would save #2929
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2929
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2929"
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?
@0xkn0wh3r3 on GitHub · 2026-11-26 00:19 UTC · original
0xkn0wh3r3:gpu/copy-heat→main· +311 −7 · 5 files · 1 commits · closed without mergingProblem
Host copies of title memory are in system memory (
Host::shared_buffer), so on a discrete GPU every shader access crosses the bus. Synthetic measurements on an RTX 5070 Ti (#2912'suma_bench) put video memory at:The placement PRs choose copies by other criteria:
Nothing on main says which copies a frame actually spends its GPU time on, or how many of their bytes change every frame. Moving a copy that changes every frame costs a copy up and a copy down.
What this adds (diagnostics builds; moves nothing)
crate::heatcounts per host copy (title start, length) since the last frame-rate line:VICTORY_GPU_TIMING=1 VICTORY_D3D12_DRED=1), each command's time is split over the copies it binds, by bytes bound.HostList::defer_refresh, recorded with the index of the command that follows).defer_heap), or reach title memory at computed addresses (defer_memory), may read any copy. They are counted as two rows of their own.Batch::flush);The frame-rate line gains:
That example shows the format only; it is not a measurement.
The estimate per copy is GPU time × (1 − 1/20), less (bytes in + bytes back) / 28.7 GB/s:
The rows are ranked by that estimate. #2734's resident copies, or #2130's, can then be chosen by it. The heat-based placement itself would be a later PR.
HostList::slowestnow builds on a newcommand_times, which gives each command's time in order.Tests
heat::tests::a_command_s_time_is_split_by_the_bytes_it_binds: splitting by bytes, the heap row, and commands past the timed ones.heat::tests::copies_rank_by_what_video_memory_would_save: a read-only copy ranks before an equally read copy rewritten whole every frame, and a barely read copy comes last. Also covers the totals and the heap row.I traced the counters through the existing GPU tests in a diagnostics build. Refresh and copy-back bytes reach the right copies.
GPU-time attribution is covered only by the unit test: no existing test runs a translated dispatch through
Statewith bound copies and command notes. It needs a run with the switches above.Workspace clippy (both configurations) is clean.
victory-gpu lib tests, normal build: 233 passed, 2 failed. The failures,
dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views, also fail on clean main on this machine.Diagnostics build:
host::present_plane_tests::compositor_failure_presents_primary_in_the_same_frameexits the test process (code 2173) on clean main as well.Related
@kotekompotek on GitHub · 2026-11-26 00:27 UTC · original · reviewed
Scoped review: ranks candidates without moving anything — the safe shape for this. The accounting is honest about its limits (heap-internal view reads and computed-address reads counted as separate rows, not smeared over copies), and the constants come from the new uma_bench numbers rather than guesses. Diagnostics-only. LGTM.
@fuzeofficlal on GitHub · 2026-11-26 00:28 UTC · original · reviewed
Verified head
2087d734cleanly onorigin/main(63bcca43) on Windows 11 x64.Code Review
heat.rsplumbing and call sites are cleanly gated behind#[cfg(feature = "diagnostics")], leaving default non-diagnostics builds with zero overhead.HostList::note_useonly records when bothdred_on()andtiming()are active, andheat::logmoves the map out underHEAT.lock().take()before sorting and formatting so the lock is never held across sorting/logging.Local Verification
shadow::tests): 9/9 passed.--features diagnostics(heat::+shadow::tests+host::testsnon-descriptor): 23/23 passed (includinga_command_s_time_is_split_by_the_bytes_it_bindsandcopies_rank_by_what_video_memory_would_save).cargo clippy --locked -p victory-gpu --tests -- -D warnings(default and--features diagnostics) &cargo xtask policy(192 files ok): clean.Looks clean and ready to merge.
@Marvisak on GitHub · 2026-11-26 04:25 UTC · original
Automated triage for the maintainers.
Merge candidate. Adds a diagnostics-only report (
victory-gpu/src/heat.rs) ranking host copies of title memory by what moving them to video memory might save, from per-command GPU time (HostList::command_times, split out ofslowestwithout behaviour change), bytes refreshed and bytes copied back; it is all behindcfg(feature = "diagnostics").note_useattributes a refresh to the next noted command, which is right for the draw and dispatch paths indraw.rs; a barrier note recorded between binding and the draw would take that time instead, andcommandsdouble-counts when one command binds two ranges of one copy. Both are minor for a ranking aid.CI: passing.
Generated by Claude Code
@0xkn0wh3r3 on GitHub · 2026-11-26 08:05 UTC · original
Replaced by #3102, which combines this with the rest of the host-memory placement work in one PR, with measurements on a discrete and an integrated GPU. Closing here.
Pull request closed