Diagnostics: host buffers alive now, by heap #3869
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3869
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3869"
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?
@Trillazill on GitHub · 2026-11-30 09:51 UTC · original
Trillazill:diag/alive-host-buffers→main· +255 −3 · 5 files · 2 commits · closed without mergingWhat this adds
A diagnostics-only line, every five seconds with the memory lines:
The memory line already says how many upload, shared and card buffers were made since the start (
host::MADE), and the textures line how much of the PC's memory the card uses. Neither says what holds that memory now. That is the open question in most of the RAM reports (#1915, #2146, #2293, #3295, #3646, #3813).alive.rscounts each buffer the host's makers give out when it is made, and uncounts it when the runtime destroys it. A small COM object rides on the resource as private data, and the resource releases it last. This is the same mechanismbook.rsuses, but without the book, which is only kept with DRED or the slot check. Hooks sit next to the existingbook::madecalls inupload_buffer,writeback_upload_buffer,shared_buffer_ownanduav_buffer_now, plusmapped_card_bufferand the pooled read-back maker. Everything is underfeature = "diagnostics"; release builds are unchanged.What it showed
RTX 4080, 32 GB RAM, Series X, default switches, a few minutes into the world:
The shared buffers are the host copies of title memory: 1,064 windows outside buffers came to 6,496 MB at the same moment. Windows that go to the card keep their shared buffer as the CPU side (
CardCpu::Shared): 402 of them (2.4 GB) held both. The 6,496 MB of windows lay over 4,922 MB of title memory.Also measured in the same session:
VICTORY_LIST_LAZY=1: at the menu it saved 20 MB (10,525 → 10,505 MB; host lists 686 → 673). Host lists are not where the memory goes.Tests
alive::tests::the_line_sums_what_lies_in_the_pcs_memory.cargo test -p victory-gpu --features diagnostics --lib -- alive:: copystat::: 9 pass.cargo test -p victory-gpu --no-fail-fast(without diagnostics, which compiles none of this): 919 pass, 3 fail.shader_cache::tests::every_switch_of_the_translator_is_in_the_keyfails on41adb551too.host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queueandhost::menu::tests::a_change_is_saved_at_once_however_the_game_was_startedpass alone (three times out of three).-p victory-gpu --lib --tests, with and without--features diagnostics): nothing in the lines this change adds or touches.cargo xtask policy --staged: ok (4 files).No game data, logs or other files from the title are in this change.
🤖 Generated with Claude Code
@tyr0nsur on GitHub · 2026-11-30 10:06 UTC · original
I reproduced a gap in the live buffer census at
7a0efe3withVICTORY_BUFFER_POOL=1. SmallHost::upload_bufferandHost::shared_buffer_nowallocations can return frompool::cpu_bufferbefore the committed-buffer hooks run. The resulting 64 MiB upload/shared heaps are missing from the census even while they stay cached. Staging blocks already use the large committed upload path, so they need no extra entry.The follow-up tracks each backing heap once from successful creation to final D3D12 release. It shows tracked CPU backing and DXGI non-local usage as independent figures because the census includes requested buffer widths and full heap capacities. An unavailable DXGI query is reported as such.
On an RTX 4060, the regression fixture found a live 64 MiB upload heap with zero bytes reported before the fix. With the patch, two placed buffers shared one 64 MiB heap in each pool. The census read 64 MiB with the buffers live, 64 MiB with the heap cached, and 0 MiB after reclaim. The committed-buffer counters stayed flat, and the same check passed on WARP. The focused diagnostics suite passed 38 tests. No title needed.
Follow-up commit against this PR
@Trillazill on GitHub · 2026-11-30 10:36 UTC · original
Good find, thanks. I'd missed that pooled buffers come back from
pool::cpu_bufferbefore the committed-buffer hooks. I cherry-picked ef6f0c9 (nowaec09f4, authorship kept). Counting each 64 MiB backing heap once, for its whole D3D12 lifetime, is the right unit. Splitting "CPU backing tracked" from DXGI non-local usage, and printing "unavailable" when the query fails, reads better than my single sum.With
--features diagnostics,alive::,copystat::andpool::tests::cpu_pool_heaps_are_counted_until_releasedpass here (10, RTX 4080). Clippy reports nothing inalive.rs,pool.rsorcopystat.rs.My in-game numbers in the description were taken with
VICTORY_BUFFER_POOLunset, so the pool's heaps weren't part of them.frame chain:line per frame, and refreshed bytes by backing (VICTORY_BACKING_STATS=1) #4378Diagnostics: host buffers alive now, by heap (what holds the PC's memory the card uses)to Diagnostics: host buffers alive now, by heapaec09f4f5ftod3fe025577@Trillazill on GitHub · 2026-12-01 06:21 UTC · original
Rebased onto main
5fabb46e. Conflict inhost.rs: main unwraps the upload buffer earlier; the hook moved next tobook::made. Tests on the rebased branch:cargo test -p victory-gpu --lib --features diagnostics -- alive:: copystat:: pool::tests::cpu_pool10 pass;cargo clippy -p victory-gpu --lib --tests --features diagnosticsno errors.@trustno1-coder on GitHub · 2026-12-01 18:48 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed