Repository navigation
GPU (diagnostics): the frame-rate line ranks host copies by what video memory would save - #2929
0xkn0wh3r3 wants to merge 1 commit into
Conversation
…o memory would save Host copies of title memory live in system memory, so every shader access crosses the bus on a discrete GPU. To choose what belongs in video memory, victory_gpu::heat counts per copy (title start, length), since the last frame-rate line: - GPU time: with per-command timing (VICTORY_GPU_TIMING and VICTORY_D3D12_DRED), each command's time split over the copies it binds, by bytes. Commands reading heap views or title memory by address are counted as rows of their own. - bytes copied in by refreshes; - bytes copied back. The line lists the copies by estimated gain: GPU time x (1 - 1/20), less moving the changed bytes at 28.7 GB/s. Both constants come from synthetic measurements on an RTX 5070 Ti (Marvisak#2912). It ranks and moves nothing. Diagnostics builds only. HostList::slowest now builds on a new command_times, which gives each command's time in order.
kotekompotek
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Verified head 2087d734 cleanly on origin/main (63bcca43) on Windows 11 x64.
Code Review
- All
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
- Default build (
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.
With Marvisak#2721 and Marvisak#2051: the list keeps both the frame budget's timing and the heat's uses, and each parallel refresh reports its copied bytes to the heat.
|
Automated triage for the maintainers. Merge candidate. Adds a diagnostics-only report ( CI: passing. Generated by Claude Code |
|
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. |
Problem
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