A frame chain: line per frame, and refreshed bytes by backing (VICTORY_BACKING_STATS=1) #4378
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!4378
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4377"
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?
@IRennie74 on GitHub · 2026-11-30 19:26 UTC · original
IRennie74:pr/frame-chain→main· +1858 −823 · 40 files · 12 commits · closed without mergingFixes #
What it changes
Two diagnostics, both compiled only into diagnostics builds; release builds are unchanged.
frame chain:(crates/victory-gpu/src/chain.rs): one line per frame, written three presents later when the card and the relay are done with it, of the frame's way from the title's calls to the card and back to what the title is told. Times are milliseconds since the title's present of the frame before:queue::behind::present), and when it began the next frame (frame::wait);It is on in diagnostics builds;
VICTORY_FRAME_CHAIN=0turns it off. The hooks are an atomic stamp or two each (queue.rs,queue/behind.rs,frame.rs, and the relay's landing and flight sends inhost.rs);chain::on()is false in release builds, so they cost a branch there.Why: on a 5600X with an RTX 3060 nothing looked saturated by itself in the sampling profile, yet the frame was about 56 ms. The frame was a chain of stages with too little overlap, and every saving on one stage was taken up by another. The timeline shows that chain for three frames; this line shows it for every frame of a benchmark run. Reconstructed from the profile, the logs and the timeline, the chain was:
VICTORY_SUBMIT_FRAMES=2took the gate's 11-17 ms to 0.0, but the submitting thread's work grew by about as much (refreshes 11-16 -> 13-19 ms), so the critical path is that thread, not the gate.Refreshed bytes by backing (
crates/victory-gpu/src/backing.rs,VICTORY_BACKING_STATS=1): every 10 s beside the frame-rate line, the bytes refreshes copy and the bytes copies in the card's memory send up, split by what backs them on the host (a view of a page-pool section from the views' book;xmem's private allocations; other private memory; other mapped memory; the image; free or reserved, found with a cachedVirtualQuery), the allocations behind them by size class, which allocations hold 90% of the bytes, and how often each was freed or, for a section, had views made (its remaps). Hooks:shadow.rs(refresh and card-dirty sends),watch.rs(allocations and frees),inplace.rs(section gone, view made, and aview_shareslookup). Off unless asked: thousands of refreshes a frame each take two locks there.Why: reading title memory in place on the card ("one memory") has two openings on native D3D12, and which fits depends on where the hot bytes live: a page-pool section can be opened whole as one heap and addressed by section offset, while private memory opens by address and is then pinned until the heap goes. This says which allocations those bytes are in.
Left out on purpose:
VICTORY_TELL_EARLY(from the same source commit) was never measured, so it is not in this pull request.How it was tested
GPU and profile: RTX 3060 12 GB, Ryzen 5 5600X, 32 GB, Series S, 960x540 internal, DLSS Performance, frame generation off, ray tracing default. Diagnostics builds, standing at the opening.
Before: no per-frame view of the chain; the submitting thread's busy time was known only as a frame average.
After,
frame chain:(with the sampling profile and timeline it was read beside): the submitting thread busy 44-54 ms of a 55-58 ms frame, the title at the gate 11-17 ms a frame, the card idle 14-21 ms a frame while that thread prepared.After,
VICTORY_BACKING_STATS=1, standing: refreshed 32.5-33.5 MB a frame (pool views 25.6, private 6.9); sent up 22.3 (17.3, 4.9). Three allocations hold 90%, none ever freed:XMemVirtualAlloc, 1,277 MBThe first and the third could be opened once and read in place; the second is remapped constantly and would need a table of pages.
These figures were measured on the working branch these commits come from. On this branch, rebased on current
main, the code was built and its tests run, but it was not run in game again.For shader changes, the wave sizes tested: not applicable (no shader changes).
cargo testpassed for the crates it touches: yes for this change.cargo test -p victory-gpu --lib --features diagnostics: 1211 passed, 69 ignored, 5 failed, all in files this does not touch (compose,list::thin,shader_cache,watch::ask_holds,rangelock); the newchainandbackingtests pass.cargo build --locked --profile diag -p victory --features diagnosticsbuilds.cargo clippy -p victory-gpu --all-targets -- -D warningsstops only on lints already inmain(shadow.rsrangedunused,copystat.rsmbunused,host.rs:5092manualis_multiple_of).Checked for overlap
@trustno1-coder on GitHub · 2026-12-01 18:42 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