Perf: memo fast path, residency + scheduler tunables (+19% avg, +19% 1% lows on RX 6800 XT) #369
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!369
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-369"
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?
@BeanieMen on GitHub · 2026-12-03 20:48 UTC · original
BeanieMen:perf-wins-upstream→main· +479 −30 · 10 files · 7 commits · openWhat this is
Seven perf commits, each with a measured win, all behind env switches, measured on GTA V (Series X dump) on an RX 6800 XT at FSR 4 Quality 1440p to 4K, no frame gen, 2-minute measured benchmark runs. Net result of the session these come from: 17.5 avg / 9.7 1% low -> 20.8 avg / 11.5 1% low (+19% both). This branch compiles clean (
cargo check --release, x86_64-pc-windows-msvc); the numbers below were benched on the same commits in our tree. Only changes with a measured win are included; neutral ones were left out.1. Tested, works (in this PR)
VICTORY_MEMO, default on,=0disables): skips the builder's repeated work. 1% lows +12% (10.2 -> 11.5, repeated A/B), avg unchanged.06d5386VICTORY_CARD_KEPT_MB, 9216 in tests): part of the memory bundle that moved avg 17.9 -> 20.2.3f75a65678716c899f1ef77465e692a7da8c05dbbbTRANSLATOR_VERSIONto 20 on current main (wrap-safe).22437d2in our tree) was dropped because your2533c7c(batch non-overlapping BVH arena UAV updates) already covers it. Also tested working in our tree: defaulting to the resizable-BAR path (+3-4.5% avg).2. Tested, doesn't work (benched, kept out)
VICTORY_LATE_MOSTin-flight cap 512 + late fence: 1% lows 9.8 -> 8.5. Reverted to defaults.MOVE_MB=128: avg up, but 1% low 9.1 (-7%). 64 is the shipped value.3. Queued to test
WaveSize(32)for mesh groups of <=32 threads (ac3facaon our perf branch).VICTORY_ANISO_CAP, a quality trade, benched separately).04e3531) to size up dispatch merging before building it.4. Needs further research
@copilot-pull-request-reviewer[bot] on GitHub · 2026-12-03 20:48 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
a1b4aca0e6to06d53869d9@Bushyon on GitHub · 2026-12-03 21:48 UTC · original · edited 2026-12-03 22:08 UTC
Tested on RX 7800 XT 16 GB, Ryzen 9 7900, 31 GB RAM, Fedora 44,
VICTORY_BENCH, 5 min (240 s measured), clean settings, one run each. "PR tuned" addsVICTORY_CARD_KEPT_MB=9216 VICTORY_PAGE_MOVE_MB=64.No errors or GPU faults. No average gain here with either setting; the nort lows look a bit better with the PR, but draw counts differ between runs and it needs repeats.
On this card the tuned setting raised the title's card room from 4080 to 7152 MB, but title memory on the card at the end stayed about the same (3.0 to 3.4 GB of 9.3 GB), so the benchmark scene did not use the extra room. A driving route may behave differently.
@Kal0s-design on GitHub · 2026-12-03 22:40 UTC · original
Tested
06d5386natively on Windows 11 (MSVC) with one NVIDIA desktop card, plus WARP for the D3D12 tests in the shader suite. No game run, just the crate tests and reading the diff commit by commit.The main thing first. main moved on after this branch was cut and #344 already took TRANSLATOR_VERSION 20 (crates/victory-shader/src/lib.rs:30 on main). The merge is textually clean because both sides make the same edit, so the merged tree would stay at 20 while
c05dbbbchanges DXIL. The cache key is the version plus the loop limit and a list of switches (crates/victory-gpu/src/shader_cache.rs:87), and counted_loop has no switch, so caches built at 20 by either side would be reused by the other. Needs a rebase and a bump to 21.Second, the description says every change is behind an env switch, but several aren't
678716c, relay and late-wait threads go to above normal priority unconditionally (host.rs:3392, host.rs:3475)899f1ef, batched take in jobs.rs:141 always on77465e6, translator threads always at normal now (list/thin.rs:323). Theif let Some(p) = priorityblock below it is dead code after thisc05dbbb, counted_loop is always on (emit/lower.rs:3425)92a7da8, the heaps insert dedup is always on (same result, fine), and residency::line() now walks every page of every pool and logs "warm pages left in RAM" on each report whatever the knobs say (um/residency.rs:986)The real switches (VICTORY_MEMO, CARD_KEPT_MB, HEAT_VIEW_MB, WARM_FRAMES, STRIKE_DECAY, PAGE_SWAP) default to the old behaviour as far as I can see, and none of them touch shader output.
Per commit
3f75a65CARD_KEPT_MB. Default 12288 matches the old constant. It doesn't trim like the other knobs, so "9216 " silently falls back to the default, and there's no bound, 0 hands the whole card to the title and a very large value just drops the high bits ofmb << 20(um.rs:259)899f1efbatched take. Every index once, I added a local test that drains take() for every count from 0 to 2999 and runs the pool at 100, 1000 and 5000 jobs, all pass. The existing pool test stops at 49 so it barely reaches the batchingc05dbbbcounted_loop. I couldn't break it. Local tests on the IR (lt/scc1 and ge/scc0, bound just under and at the limit, wrong polarity, a wrapping step, a wrapping literal start, a non constant start, start above the bound) all come out as expected, and a pixel shader with the loop translates with and without the counter (1775 vs 1811 bytes of DXIL). The helper skips validation quietly if the validator doesn't load and I didn't confirm it did, so I wouldn't count that as validated. I didn't find an existing test with a loop of this shape, so the passing suite says little about this commit. The doc comment ends with "Not compiled", looks like a leftover06d5386memo. I couldn't find a missed invalidation. copies, card_pages and stretches only grow and are in the signature, faults and the directory are fixed per Memory, the land closure bumps the epoch, and the keys and memo both go on list reset. A title write doesn't clear the keys either, but it didn't before the PR, so a hit skips nothing the old code would have redone. One difference, memoed() never looks at the frame number, so the per frame work (take_faults, look_again, warm, report) waits for the next slow call. A new list's first call is always slow so it's probably fine, but the EPOCH comment reads as if nothing is deferred. Also the comments say VICTORY_MEMO=1 while it's on by defaultTests, PR vs main (merge base
0b652f8), switches unsetThe PR adds no tests of its own. counted_loop and the batched take are easy to cover with small unit tests like the ones above.
Clippy on both touched crates, no new warnings.
AI-assisted: yes
github-bot referenced this pull request2026-12-04 01:12:08 +00:00
@fsrajner on GitHub · 2026-12-04 08:14 UTC · original
Tested on top of main together with the other PRs listed below, at the defaults and with
VICTORY_CARD_KEPT_MB=9216. On an RX 9070 XT at 4K, FSR 4 Quality with RT, this scene shows no measurable change. Our frames are GPU-bound here, while your 6800 XT numbers may be more CPU/scheduler bound. The merge with current main conflicted only inresidency.rslocal counters.Setup: RX 9070 XT 16 GB, Ryzen 7 7800X3D, CachyOS, RADV from this repo's
setup.sh. Series X, 3840x2160 output, FSR 4 Quality (4.1.2), RT at defaults, headless gamescope. Same save (the intro); the game stops 120 s after the first press. The figures come from the 5 sstats: framewindows after loading. 2 runs per variant; main =0fd7614. The PR build is main + #382 + #392 + #393 + #408 + #445 + #369 together. #398 was left out because it conflicts with #369 in the residency planning. The #369 merge conflicted only with local counters.VICTORY_TEXTURE_BARRIERS=1VICTORY_CARD_KEPT_MB=9216The first run of main and of the PR build each began by re-preparing shaders after a translator change. That is likely where the 48 ms run and the 82.9 ms worst window come from. Otherwise the spread between runs is about ±1 ms/frame, so all of these are within noise. In this scene the card is the limit (about 21-24 ms of GPU wait per frame).
@Luxuride on GitHub · 2026-12-04 12:20 UTC · original
The memo fast path is the interesting half, and it is unreviewable inside a bag of seven changes — three of which are unmeasured knobs and one of which changes shader semantics.
The one I would not land as written:
crates/victory-shader/src/emit/shadow_mask.rs:39addscounted_loop(135 lines recognising two preds, a latch exit,s_cmp_lt/ge_u32, a phi froms_mov_b32,s_add_u32with step > 0,trips = (k−k0).div_ceil(step) < limit, no u32 wrap), andcrates/victory-shader/src/emit/lower.rs:3425uses it to remove the loop cap entirely — with no test for the recogniser and no differential count in the body, plusTRANSLATOR_VERSION19 → 20 so every existing user retranslates. A misjudged loop exits at the cap today; without the cap it hangs the card until TDR. Keep the cap as a backstop (even2 * limitbuys you the safety) and add a test per recognised shape.The rest of the split is obvious once you decide to split:
crates/victory-gpu/src/memory.rs:1627-2005memo path keyed onEPOCHwith per-argument keys — this alone is a PR.crates/victory-gpu/src/um/residency.rs:925-938shipsVICTORY_STRIKE_DECAYandVICTORY_PAGE_SWAPdefault-off and documented in code as "Unmeasured", while your own residency section reports the um_all4 knobs as worse (1% lows 11.4 → 10.6). That contradicts the body's claim that only measured wins are included. Take them out or land them later with numbers.crates/victory-gpu/src/memory.rs:243VICTORY_WARM_FRAMESis a third unmeasured, undocumented knob; the newline()calls inum/residency.rs(w_crowd/w_settled/w_quiet/w_noview, "strikes decayed") are debug noise on the HUD line.crates/victory-gpu/src/list/thin.rs:323setslet priority: Option<i32> = None;and leaves theSetThreadPriorityblock below it dead. Delete the block rather than parking it behind a constant.48 behind, no conflict.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.