perf: cut the layer's CPU and card-side overhead (14 changes, switch-gated) #1449
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1449"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by gaxolotl on 2026-11-28T20:11:57Z.
What this is
A performance pass over the layer, driven by measurements on one machine
(i5-14600KF, 32 GB, RTX 4070 Ti 12 GB, Windows 11 26300, driver 621.24, Series X
profile, 2560x1440, DLSS Quality). Every change is behind its own
VICTORY_*switch and defaults to the new path, with
=0restoring the old one.The target was 30 fps rendered with
VICTORY_FRAMEGEN=0. It is not reachedand cannot be reached by this layer's bookkeeping — the last section has the
measurement that settles it. Everything below is still a real reduction in work
the layer was doing; it just is not the work that limits the frame.
Changes
Card command stream
0.2.0-pre.5(7c53527).10,541 fills/frame became 3,499 copies.
VICTORY_CARD_STEPS_JOIN.3,499 → 823 copies/frame.
VICTORY_CARD_STEPS_ALIGN.ReadProcessMemorya place instead of one perpage (240 ns for 1 byte vs 276 ns per place), the fill lookup under the one
list lock taken per plan, and hash runs built in order instead of sorted
(64k–85k spans a frame).
VICTORY_CARD_PLAN_FAST,VICTORY_CARD_HASH_ORDER.Descriptor heaps
never be mirrored. 22 MB → 9.7 MB read per frame.
VICTORY_SYNC_CAP.VICTORY_SYNC_WORDS.CopyDescriptors— ~16,800 calls →~368 runs/frame.
VICTORY_SYNC_NULL_RUNS.one view into many slots; each was a
Create*View.VICTORY_SYNC_MAKE_CACHE.guarded block is read-only and clean.
VICTORY_SYNC_ASK_CLEAN.Write watch / refreshes
BTreeMap(136 ns → 4 ns a page look at 100k pages), one read lock per flush,ordered ahead-range lookup. Refreshes 11.3 → 8.7 ms/frame.
VICTORY_JOURNAL_TREE,VICTORY_REFRESH_BULK.VICTORY_SEND_CHANGED(off by default).card_sides()per copyinstead of three.
VICTORY_SEND_BATCH.Textures
no room; tell the queue 256 at a time.
VICTORY_TEXSPK_SKIP_WHEN_FULL.40k slots — and bound a take to twice what the pass last served (154 takes
walked 594,000 entries to serve 48,414).
VICTORY_DUE_ORDERED,VICTORY_TEXSPK_DUE_TAKE.VICTORY_TEXSPK_ONE_RECORD.Card compare/hash passes
descriptor table (
SRV t0[64]/UAV u0[64]): 549 → 56 commands in replay,picture byte-identical.
VICTORY_CARD_PASS_BATCH.bit-identical to the CPU mirror in
torn.rs, proved by a WARP test.VICTORY_CARD_HASH_WIDE.Build
victory replaybuilds in about a minute.Verification
cargo test --release -p victory-gpu --lib: 488 passed, 0 failed.wide hash against the CPU mirror, byte for byte.
victory replayof a recorded frame: picture blake3 unchanged by every batchingchange; commands 549 → 56.
Why 30 fps is not reached — and cannot be, from here
Three controlled experiments say the frame is not bound by anything this layer
does.
1706x960) plus the ambient/reflection estimate off — two large quality
cuts — gives 19.6 fps, 51.1 ms, card 83% busy. Halving the pixels changed
nothing.
barrier is promoted to a global UAV barrier. Running the frame with them
removed is slower (44.1 ms vs 42.3 ms baseline); merging them is slower
still (53.8 ms).
victory replay --timing detailedon arecorded frame: indirect mesh draws 25.0 ms in 7,817 commands, dispatches
15.4 ms in 1,735, indirect dispatches 7.9 ms, draws 6.3 ms — against our
hash/compare passes at ~7 ms (all 549), texture copies 3.4 ms, buffer copies
2.8 ms, clamps 1.7 ms.
So the card spends ~42 ms of a ~50 ms frame launching and running ~7,800 mesh
draws at ~5 µs each, and it draws only ~125 W doing it — high occupancy, low
power, i.e. per-draw front-end work, not shading. Removing all of the layer's
GPU work would leave a ~42 ms frame (24 fps), and it would still be the title's
geometry.
The remaining lever is the translated geometry itself — how a mesh draw is
translated and launched — which is a project, not a patch series.
Measurement notes
Unattended runs drift into different content (draws 1.2k–12.9k), so raw fps is
not comparable between runs; the figures above come from the layer's own
per-frame counters or from controlled
victory replay --compareA/Bs in oneprocess.
Pull request closed