Card accounting: weigh only the levels a host copy holds #3751
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!3751
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3751"
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?
@Mikey970 on GitHub · 2026-11-30 05:57 UTC · original
Mikey970:pr/card-accounting-held-levels→main· +129 −30 · 1 files · 2 commits · openTitle: [pr-diagnostics] Card accounting: weigh only the levels a host copy holds
Fixes #
What it changes
VICTORY_CARD_ACCOUNTING=1writes a line that says… of which N MB are levels whose title memory is not mapped. Withheld_only, a host copy of the levels a view shows holds the title's levels fromHostTexture::baseon. Butcard_accountinginresource.rsshared the copy's bytes over every level of the description. So the larger levels the copy never held, which are usually not mapped, made up most of the copy's weight, and the unmapped MB were overstated.What changes:
held_levels, with a unit test:card_accounting_weighs_only_the_levels_a_host_copy_holds.This is diagnostics only and changes no behaviour.
How it was tested
In game on this branch's base (
main41adb551+ this change): the full route completed and the line carries the new tail, e.g.card accounting: room true, the card 11939 MB in use of a budget of 14124 MB; … alive 2902 MB, of which 961 MB are levels whose title memory is not mapped … weighed by the levels each copy holds: 2095 copies 240 MB with no held level mapped, 58305 copies 1849 MB with every held level mapped. Build:mainat41adb551with this change, release, RTX 4080 16 GB, Ryzen 7 9800X3D, 32 GB RAM, Series X profile, DLSS Performance through Streamline (1080p rendered, 3840x2160 output), ray tracing off, frame generation off, warm pipeline cache from an earlier run, the 375 s Chapter 1 route (interrogation, therapist, flyover, boat, shore) driven byVICTORY_KEYS.GPU and profile: RTX 4080, 32 GB RAM, Series X profile, 1080p rendered to 4K with DLSS, Chapter 1 flyover. Measured first on our fork's build (figures below); the in-game check on this branch is above.
Before: the line reported 3,100–4,600 MB of about 7,000 MB of host copies as levels not mapped.
After: weighed by held levels, the same scene reports 2,900 MB. The new tail of the line reported 1,686–1,779 MB in copies with no held level mapped.
For shader changes, the wave sizes tested: n/a
cargo testpassed for the crates it touches: yes.cargo test -p victory-gpu --lib card_accountinggave 1 passed. Clippy forvictory-gpu(--all-targets, and again with--all-features) added no new warnings. Pristinemainalready fails-D warnings:victory-shaderhas 3 errors, andvictory-gpuhas 25 pre-existing warnings. None of them are in this change.cargo xtask policy --stagedpassed.Checked for overlap
held_onlyturned up #3454, #2986 and #2538, which change card admission and eviction, not this diagnostic's arithmetic.🤖 Generated with Claude Code
@Dukestar69 on GitHub · 2026-11-30 06:10 UTC · original · approved these changes
Tested locally merged onto
main(41adb551).crates/victory-gpu/src/resource.rs.cargo test -p victory-gpu --lib resource::passed (45 passed; 0 failed; 1 ignored, including the newcard_accounting_weighs_only_the_levels_a_host_copy_holdstest) with 0 new warnings.Accurate VRAM accounting weighing only the mip levels a host copy actually holds. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@Mikey970 on GitHub · 2026-11-30 14:44 UTC · original
Small follow-up
955b5540:held_levelssetlargest_missingonly for levels before the mip tail. A host copy whosebaselies inside the tail, with the tail not mapped, therefore did not count its largest level as missing; now it does. I added two cases tocard_accounting_weighs_only_the_levels_a_host_copy_holds(passes) and found no new clippy warnings. Still merges cleanly withmain.🤖 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.