residency: test bounded page exchange at the title VRAM cap #398
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!398
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-398"
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?
@lucalocastro on GitHub · 2026-12-04 00:14 UTC · original
lucalocastro:codex/title-cap-exchange-draft→main· +363 −24 · 9 files · 2 commits · draftEl-Biiscuit observed roughly 5,000 pages waiting for promotion on the RX 6700 XT with a 512 MiB title budget. Once the budget filled, very few pages moved up. This draft tests whether making a small amount of room helps frame pacing in that scene. It follows the discussion on #303 and targets main so the eviction experiment can be measured independently.
What changes
With
VICTORY_PAGE_CAP_EXCHANGE=1, a saturated title budget and sufficient free device memory, the governor can demote up to 16 previously GPU-used pages per eligible pass. Eligible pages have been idle for 16–149 busy ticks. An ordinary cold candidate or a planned CPU-touch demotion disables exchange for that pass. Eligible promotions must be waiting. The next pass reads the budget again before promoting anything into that space. The switch defaults to off.What the local replay shows
With 5,000 fixed requests and sufficient idle victims, the baseline served 0 and the experiment served 3,600 in 450 simulated passes. This took 3,600 demotions. With only 64 eligible victims, it served 64. If the simulated driver rejected every demotion, it served 0. Actual GPU reuse, migration cost and frame pacing still need hardware measurements.
Requested hardware comparison
If someone with the RX 6700 XT can reproduce the plateau, the tester guide includes the commands for eight matched four-minute runs in ABBAABBA order. Both arms use the same binary, 512 MiB budget, city save and camera movement. Please share the per-run summary or the eight pairs of
residency.csvandbench_stats.txt, plus the GPU and driver version. A useful outcome would be repeatably fewer frames above 200 ms per minute and a lower P99 alongside successful promotions. Quick returns and refused moves help identify costly churn.A follow-up comparison with #356 would be welcome once there is a baseline for this experiment.
Local verification
The Windows diagnostic executable built successfully. Five residency tests and six benchmark-filtered core tests passed. Both shell scripts passed syntax checks. The repository-wide switch check flags four guard settings already documented on main, and the asset-policy scan reports ten existing paths outside this diff.
@Luxuride on GitHub · 2026-12-04 11:28 UTC · original
The replay test convinced me the ordinary path is unchanged —
available + reclaimed,lackingand theremainingdecrement all reduce to the old arithmetic, and the exchange path deliberately leavesavailablealone so a freed slot is spent the next pass.One doc fix before testers see it:
docs/SETTINGS.md:58says "idle for at least 16 busy ticks" butexchange_candidateis(16..COLD)withCOLD = 150(um/residency.rs:8,:491-494), and a victim aged >= 150 goes tocold, which makesexchange_limit'scold == 0test disable the exchange for that pass. So it is 16..149, and any colder victim cancels the pass — otherwise a tester watching older pages will conclude the switch does nothing.Also:
VICTORY_BENCH_TITLE_512is benchmark-only but sits in the menu table (row 59) with norun.conf.defaultentry; the runtime-only section is its home. And an exchange demotion is counted twice (DOWN_EXCHANGEandDOWN_ROOM,:832-836), so that log column is no longer comparable with a switch-off run.Unrelated but next to it:
crates/victory-core/src/bench.rs:120indexes p99 withdiv_ceilwhilelow_1pct(:99) floors, so a 100-frame sample reports two different frames; your new test only pins the 304-frame case where both agree.@El-Biiscuit on GitHub · 2026-12-04 11:57 UTC · original
@lucalocastro Here are the eight runs on the RX 6700 XT, plus one extra run with the probe at debug level.
Setup. This PR at
fff93be, diagnostics build, shaders warmed. Settings fromdocs/CAP-EXCHANGE-TEST.md:VICTORY_BENCH_TITLE_512=1,VICTORY_PAGES=1,VICTORY_PAGE_PASS_MS=400,VICTORY_PAGE_MOVE_MB=32,VICTORY_PAGE_ADAPTIVE=0,VICTORY_LOG=info. Same harness as my #303 runs: city save on foot, camera turning for the whole run, 4 min per run, Series X, FSR 4 Quality to 3840x2160, RT off. RADV (Mesa 26.3.1), Linux 7.3.card_mb_for_title=512in every run. Order A B B A A B B A; 8/8 valid, 0 kernel faults, 0 driver refusals.Output of
tools/cap-exchange-summary.sh, in run order:Frame times, P99 and hitches per minute overlap, so I see no effect on frame pacing here.
Note on the summary window. Almost all exchanges happen in the first minute: run 2 reached 279 by 60 s and 283 by the end. The script starts at 60 s, so it shows
up3–30 for B against 116–269 for A. Over the whole run both arms promote the same number of pages, and in B the exchanges take the place of A's cold demotions.Why it stops. One extra B run with
victory_gpu::um::residency=debug: 496page cap exchange probelines, and 485 of them havecandidates=0, withcold=0, about 4,500–4,800 waiting and about 1 GB of the card free. So after the first minute no on-card title page is in the 16–149 tick age band: everything in the 512 MiB is being used by the GPU. In this scene the queue isn't stuck for lack of a victim policy. The title room is full of hot pages, so an exchange would only help if a waiting page is worth more than a hot resident one.Related: in an overnight series on the same card (1080p, low preset, main
6064c04), #369 with a larger title share (VICTORY_CARD_KEPT_MB=6144) was the only memory change that improved both median and P99 (~41.7 ms vs ~46.1 ms on main, P99 ~82 vs ~100 ms, 2 runs each). That points the same way: more room helps here, reshuffling a full room doesn't.@lucalocastro on GitHub · 2026-12-04 12:04 UTC · original · edited 2026-12-04 12:09 UTC
@El-Biiscuit Thanks for running all eight sessions and collecting the debug trace. The 485 of 496 passes with zero exchange candidates explain why the queue persists after warm-up. The frame-time ranges overlap on this save, so I’ll keep the experiment opt-in. The whole-run and post-warm-up promotion totals answer different questions, and I’ll use the same measurement window when comparing them.
@Luxuride I’ve prepared the documentation and counter fixes locally. Exchange demotions now have their own count, and P99 uses the same frame as the existing 1% low. I added a 100-frame regression case. The changes are now on this PR in
44d6f0ad1b.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.