perf(um): VICTORY_LAZY_HIDDEN=1 maps lazily bound pages hidden from the card until it asks (only with VICTORY_BVH_HARDWARE=0; off by default) #639

Open
github-bot wants to merge 1 commit from github-bot/gh-639 into main AGit
Owner

@⁠Raptorbk45 on GitHub · 2026-12-05 22:37 UTC · original
Raptorbk45:perf/lazy-hidden → main · +43 −2 · 3 files · 1 commits · open

This only acts with VICTORY_BVH_HARDWARE=0. On main the hardware node test is on by default wherever the card and driver have it (VICTORY_BVH_HARDWARE unset; run.sh exports VICTORY_BVH_IN_PLACE=1), and then this switch does nothing but log that it is ignored. It is for people who run with VICTORY_BVH_HARDWARE=0 (no hardware node test; note that the low–high presets set VICTORY_BVH_BUILDER=0 but not VICTORY_BVH_HARDWARE=0, so they still need it set).

8aec563 (#38) made lazy binding show every page to the card at once, because the nodes of a hardware BVH64 hold addresses the card follows without anything asking for them. Without the hardware node test nothing reads that way, so with VICTORY_LAZY_HIDDEN=1 a lazily bound page that nothing has pointed the card at yet is mapped HIDDEN again (as before 8aec563) and shown when something does (want → reveal). Each page shown is an address-mapping call of about 40 µs on the submitting thread; in our streaming bursts a third to a half of the pages bound were never asked for.

Off by default; with it off (or with VICTORY_BVH_HARDWARE not 0) the protections passed are exactly main's.

How it was checked

Run after the final edit, on Linux (CachyOS), against main at 8c4e6633:

  • ./build.sh check (release, MSVC target): passes; the one warning (room_lately never used, resource.rs) is already on main
  • cargo xtask policy: passes
  • cargo test -p victory-core --lib menu: 18 passed

Not run: the game, on this branch. The data below is from our fork.

Branch head: d0b388b8.

No unit test: the switch only changes the protection bits handed to the unified-memory driver path (map/show_as), which needs RADV with the unified-memory patch and a card; the decision itself is two env reads.

Data (from our fork, not re-measured on this branch)

Measured on our fork on 5 December 2026, the first 150 s of the world after loading the save where the arrest cinematic plays (the cinematic plays by itself; runs launched unattended), with a RADV build carrying extra counters. Conditions: RX 7700 XT 12 GB, Ryzen 5 5600X, 32 GB, CachyOS, RADV from setup.sh's Mesa, CONSOLE=series-s, 1920x1080, no ray tracing (VICTORY_BVH_BUILDER=0 VICTORY_BVH_HARDWARE=0), VICTORY_FRAME_INTERVAL_MS=0, VICTORY_RECORD_PLACES=1 VICTORY_RECORD_RANGES=1 and the rest of our fork's run.sh defaults.

Runs Median fps Seconds with a frame over 100 ms Seconds under 20 fps Frame in the streaming bursts
Fork defaults (4 runs) 39.6 14.6 % 11.3 56.2 ms
VICTORY_PAGES=0 alone (1 run) 38.8 10.8 % 8 47.6 ms
VICTORY_LAZY_HIDDEN=1 alone (1 run) 41.1 12.8 % 8 52.1 ms
VICTORY_PAGES=0 VICTORY_LAZY_HIDDEN=1 (6 runs) 39.7 8.0 % 5.8 46.4 ms

The median does not move; the bursts get shorter. Together the two halve the mapping calls in the bursts (about 7,300 → 3,200 a second) and the submitting thread's time applying the title's page mappings (about 20 → 12 ms a frame). Most of the gain is VICTORY_PAGES=0 (already on main); this switch's own share is the difference between the second and fourth rows, with one run of the former. No broken image seen in those runs. More context in #636. Please measure on your own streaming scenes before trusting it.

Checks

  • One subject
  • Off by default; off = main
  • Docs: docs/SETTINGS.md and run.conf.default, both saying it only acts with VICTORY_BVH_HARDWARE=0
  • N/A: unit test (see above)
  • Queue checked: #596 changes um/residency.rs, not lazy binding; independent
  • cargo xtask policy
**@⁠Raptorbk45** on GitHub · 2026-12-05 22:37 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/639) `Raptorbk45:perf/lazy-hidden` → `main` · +43 −2 · 3 files · 1 commits · open **This only acts with `VICTORY_BVH_HARDWARE=0`.** On `main` the hardware node test is on by default wherever the card and driver have it (`VICTORY_BVH_HARDWARE` unset; `run.sh` exports `VICTORY_BVH_IN_PLACE=1`), and then this switch does nothing but log that it is ignored. It is for people who run with `VICTORY_BVH_HARDWARE=0` (no hardware node test; note that the low–high presets set `VICTORY_BVH_BUILDER=0` but not `VICTORY_BVH_HARDWARE=0`, so they still need it set). 8aec563 (#38) made lazy binding show every page to the card at once, because the nodes of a hardware BVH64 hold addresses the card follows without anything asking for them. Without the hardware node test nothing reads that way, so with `VICTORY_LAZY_HIDDEN=1` a lazily bound page that nothing has pointed the card at yet is mapped `HIDDEN` again (as before 8aec563) and shown when something does (`want` → `reveal`). Each page shown is an address-mapping call of about 40 µs on the submitting thread; in our streaming bursts a third to a half of the pages bound were never asked for. Off by default; with it off (or with `VICTORY_BVH_HARDWARE` not `0`) the protections passed are exactly `main`'s. ## How it was checked Run after the final edit, on Linux (CachyOS), against `main` at 8c4e6633: - `./build.sh check` (release, MSVC target): passes; the one warning (`room_lately` never used, `resource.rs`) is already on `main` - `cargo xtask policy`: passes - `cargo test -p victory-core --lib menu`: 18 passed Not run: the game, on this branch. The data below is from our fork. Branch head: `d0b388b8`. No unit test: the switch only changes the protection bits handed to the unified-memory driver path (`map`/`show_as`), which needs RADV with the unified-memory patch and a card; the decision itself is two env reads. ## Data (from our fork, not re-measured on this branch) Measured on our fork on 5 December 2026, the first 150 s of the world after loading the save where the arrest cinematic plays (the cinematic plays by itself; runs launched unattended), with a RADV build carrying extra counters. Conditions: RX 7700 XT 12 GB, Ryzen 5 5600X, 32 GB, CachyOS, RADV from `setup.sh`'s Mesa, `CONSOLE=series-s`, 1920x1080, **no ray tracing (`VICTORY_BVH_BUILDER=0 VICTORY_BVH_HARDWARE=0`)**, `VICTORY_FRAME_INTERVAL_MS=0`, `VICTORY_RECORD_PLACES=1 VICTORY_RECORD_RANGES=1` and the rest of our fork's `run.sh` defaults. | Runs | Median fps | Seconds with a frame over 100 ms | Seconds under 20 fps | Frame in the streaming bursts | |---|---:|---:|---:|---:| | Fork defaults (4 runs) | 39.6 | 14.6 % | 11.3 | 56.2 ms | | `VICTORY_PAGES=0` alone (1 run) | 38.8 | 10.8 % | 8 | 47.6 ms | | `VICTORY_LAZY_HIDDEN=1` alone (1 run) | 41.1 | 12.8 % | 8 | 52.1 ms | | `VICTORY_PAGES=0 VICTORY_LAZY_HIDDEN=1` (6 runs) | 39.7 | 8.0 % | 5.8 | 46.4 ms | The median does not move; the bursts get shorter. Together the two halve the mapping calls in the bursts (about 7,300 → 3,200 a second) and the submitting thread's time applying the title's page mappings (about 20 → 12 ms a frame). Most of the gain is `VICTORY_PAGES=0` (already on `main`); this switch's own share is the difference between the second and fourth rows, with one run of the former. No broken image seen in those runs. More context in #636. Please measure on your own streaming scenes before trusting it. ## Checks - [x] One subject - [x] Off by default; off = `main` - [x] Docs: `docs/SETTINGS.md` and `run.conf.default`, both saying it only acts with `VICTORY_BVH_HARDWARE=0` - N/A: unit test (see above) - [x] Queue checked: #596 changes `um/residency.rs`, not lazy binding; independent - [x] `cargo xtask policy`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 22:39:25 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/639/head:github-bot/gh-639'
git switch 'github-bot/gh-639'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-639'
git switch 'github-bot/gh-639'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-639'
git switch 'github-bot/gh-639'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-639'
git switch 'main'
git merge --squash 'github-bot/gh-639'
git switch 'main'
git merge --ff-only 'github-bot/gh-639'
git switch 'main'
git merge 'github-bot/gh-639'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.