gpu: opt in to address-range stripes on the mapping lock (streaming load wait 202 -> 23 ms) #87

Open
github-bot wants to merge 3 commits from github-bot/gh-87 into main AGit
Owner

@⁠superboynick on GitHub · 2026-11-27 17:45 UTC · original
superboynick:pr/mapping-stripes → main · +484 −57 · 9 files · 3 commits · open

What I tested

RTX 5070 Ti Laptop (12 GB, 32-lane waves), Windows 11 26100, release build, --console series-x, the 36-item play set, frame generation off. This is the striped lock from exotiquee's comment on #59, as a separate change: VICTORY_MAPPING_STRIPES=<n>, unset or 1 = the single lock, byte for byte.

Stripes are 2 MiB address ranges. A mapping call takes only the stripes its range covers, a refresh only the stripes it touches, always ascending; a range that grows releases and reacquires; FIFO ordering keeps a reader from being starved.

Windows paired on scene progress, draw count and mapping rate, draws within 4.66%; steady windows are after 300 frames in the scene, load windows are the first streaming pass.

What happened

1 stripe 4 stripes 8 stripes
steady (12 pairs), fps 5.23 5.14 5.14
steady, submit lock wait median 0 ms 0 ms 0 ms
streaming load (16 pairs), fps 2.00 3.87 3.29
streaming load, frame 499.12 ms 258.31 ms 303.71 ms
streaming load, list 310.91 ms 93.57 ms 74.58 ms
streaming load, submit lock wait median 202.03 ms 22.94 ms 7.55 ms

Two things worth knowing:

  1. It does nothing in steady state. The reader-side batching (#59, or #18 when it lands) already took the steady-state wait to zero here, and the frame is GPU-bound anyway. The whole win is in the load frames.
  2. Eight stripes is worse than four for the frame as a whole. The wait keeps falling (7.55 ms) but the load frame gets worse (303.71 ms); something else in the striped path costs more than the wait it removes. I did not chase why.

All three counts pass a 4,325,376-byte paging remap comparison and a concurrency test where a writer on unrelated stripes completes while another writer waits on readers; if the old view grows while waiting, the writer releases and retakes. With one stripe, eight startup frames are byte-identical to the build before this.

Validation: GNU release build passes; cargo test -p victory-hle passes; cargo test -p victory-gpu 415 pass, 2 fail, 35 ignored, and those two failures reproduce on d12eb1b.

What would make it mergeable

  • A second machine reproducing the load-frame win, ideally with more VRAM headroom, because the regression at eight stripes suggests something here is sensitive to pressure.
  • Or a decision that load-frame stalls are not what you want to spend a switch on — that would be a fair call, since steady-state play is unaffected.

Note: #38 touches watch.rs, xmem.rs and texture.rs in the same area, so whichever lands second will need a rebase.

Written with an AI assistant.

**@⁠superboynick** on GitHub · 2026-11-27 17:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/87) `superboynick:pr/mapping-stripes` → `main` · +484 −57 · 9 files · 3 commits · open ## What I tested RTX 5070 Ti Laptop (12 GB, 32-lane waves), Windows 11 26100, release build, `--console series-x`, the 36-item play set, frame generation off. This is the striped lock from exotiquee's comment on #59, as a separate change: `VICTORY_MAPPING_STRIPES=<n>`, unset or `1` = the single lock, byte for byte. Stripes are 2 MiB address ranges. A mapping call takes only the stripes its range covers, a refresh only the stripes it touches, always ascending; a range that grows releases and reacquires; FIFO ordering keeps a reader from being starved. Windows paired on scene progress, draw count and mapping rate, draws within 4.66%; steady windows are after 300 frames in the scene, load windows are the first streaming pass. ## What happened | | 1 stripe | 4 stripes | 8 stripes | |---|---:|---:|---:| | steady (12 pairs), fps | 5.23 | 5.14 | 5.14 | | steady, submit lock wait median | 0 ms | 0 ms | 0 ms | | streaming load (16 pairs), fps | 2.00 | **3.87** | 3.29 | | streaming load, frame | 499.12 ms | **258.31 ms** | 303.71 ms | | streaming load, list | 310.91 ms | 93.57 ms | 74.58 ms | | streaming load, submit lock wait median | **202.03 ms** | 22.94 ms | 7.55 ms | Two things worth knowing: 1. **It does nothing in steady state.** The reader-side batching (#59, or #18 when it lands) already took the steady-state wait to zero here, and the frame is GPU-bound anyway. The whole win is in the load frames. 2. **Eight stripes is worse than four for the frame as a whole.** The wait keeps falling (7.55 ms) but the load frame gets worse (303.71 ms); something else in the striped path costs more than the wait it removes. I did not chase why. All three counts pass a 4,325,376-byte paging remap comparison and a concurrency test where a writer on unrelated stripes completes while another writer waits on readers; if the old view grows while waiting, the writer releases and retakes. With one stripe, eight startup frames are byte-identical to the build before this. Validation: GNU release build passes; `cargo test -p victory-hle` passes; `cargo test -p victory-gpu` 415 pass, 2 fail, 35 ignored, and those two failures reproduce on `d12eb1b`. ## What would make it mergeable - A second machine reproducing the load-frame win, ideally with more VRAM headroom, because the regression at eight stripes suggests something here is sensitive to pressure. - Or a decision that load-frame stalls are not what you want to spend a switch on — that would be a fair call, since steady-state play is unaffected. Note: #38 touches `watch.rs`, `xmem.rs` and `texture.rs` in the same area, so whichever lands second will need a rebase. Written with an AI assistant.
Disabled by default, preserving the original refresh path and bytes. Previous Series X measurement: 2.25 to 2.58 fps, median lock wait 974 to 438 ms.
Disabled by default, keeping single-texture refreshes unchanged. Release the guard at the end of each scheduled group, before write boundaries or contended staging locks. Previous Series X run: 3.22 to 4.06 fps, median lock wait 9.5 to 0.0 ms.
Disabled by default; one stripe is the existing global lock, byte for byte.

Stripes are 2 MiB address ranges. A mapping call takes only the stripes its range
covers, a refresh only the stripes it touches, always in ascending order, and a
range that grows releases and reacquires. FIFO ordering keeps a reader from being
starved. A writer that arrives while readers hold unrelated stripes no longer
blocks, which is the point: the title makes 1,200-1,300 mapping calls a frame
during streaming, each taking the lock exclusively for any address.

Series X, the 36-item play set, paired windows matched on scene progress, draw
counts and mapping rate (draws within 4.66%):

| | 1 stripe | 4 stripes | 8 stripes |
|---|---:|---:|---:|
| steady windows (12 pairs), fps | 5.23 | 5.14 | 5.14 |
| steady, submit lock wait median | 0 ms | 0 ms | 0 ms |
| streaming load windows (16 pairs), fps | 2.00 | 3.87 | 3.29 |
| streaming, frame | 499.12 ms | 258.31 ms | 303.71 ms |
| streaming, list | 310.91 ms | 93.57 ms | 74.58 ms |
| streaming, submit lock wait median | 202.03 ms | 22.94 ms | 7.55 ms |

So this is a load-time change, not a steady-state one: with the refresh batching
below landed, the steady-state wait is already zero and the frame is GPU-bound.
Four stripes is the better trade than eight - eight lowers the wait further but
costs more elsewhere in the load frames.

All three counts pass a 4,325,376-byte paging remap comparison and a concurrency
test in which a writer on unrelated stripes completes while another writer waits
on readers; if the old view grows while waiting, the writer releases and retakes.

Builds on the two commits above, which touch the same refresh path.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 17:50:22 +00:00
Author
Owner

@⁠superboynick on GitHub · 2026-11-27 19:50 UTC · original

Independent confirmation, run by hand on the release build of this branch, Series S, same save and warm cache, menu keys to get into the scene, eight window samples an arm:

VICTORY_MAPPING_STRIPES fps
1 5.75
4 6.12

That is +6.4% on this scene, which is the direction the load-frame numbers predicted but smaller — this arm spends most of its time in ordinary play, not in the streaming pass where the wait actually is. Eight samples an arm is not enough to call a steady-state gain, so I am not claiming one: what it does say is that four stripes does not cost anything in ordinary play on this machine.

The load-frame figures in the description (submit wait 202.03 to 22.94 ms, frame 499.12 to 258.31 ms) remain the claim to check, and they need someone with a save that streams hard.

Written with an AI assistant.

**@⁠superboynick** on GitHub · 2026-11-27 19:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/87#issuecomment-7226918502) Independent confirmation, run by hand on the release build of this branch, Series S, same save and warm cache, menu keys to get into the scene, eight window samples an arm: | `VICTORY_MAPPING_STRIPES` | fps | |---|---:| | `1` | 5.75 | | `4` | 6.12 | That is +6.4% on this scene, which is the direction the load-frame numbers predicted but smaller — this arm spends most of its time in ordinary play, not in the streaming pass where the wait actually is. Eight samples an arm is not enough to call a steady-state gain, so I am not claiming one: what it does say is that four stripes does not cost anything in ordinary play on this machine. The load-frame figures in the description (submit wait 202.03 to 22.94 ms, frame 499.12 to 258.31 ms) remain the claim to check, and they need someone with a save that streams hard. Written with an AI assistant.
github-bot force-pushed github-bot/gh-87 from 4754b4756c to d6a2e332ba 2026-11-27 19:58:49 +00:00 Compare
github-bot force-pushed github-bot/gh-87 from d6a2e332ba to 3281a0268d 2026-11-27 21:01:28 +00:00 Compare
github-bot force-pushed github-bot/gh-87 from 3281a0268d to 7a85c4cc05 2026-11-27 22:49:35 +00:00 Compare
github-bot force-pushed github-bot/gh-87 from 7a85c4cc05 to 0b03591bed 2026-11-27 23:53:15 +00:00 Compare
github-bot force-pushed github-bot/gh-87 from 0b03591bed to 5d3358d5b4 2026-11-28 01:35:39 +00:00 Compare
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/87/head:github-bot/gh-87'
git switch 'github-bot/gh-87'

Merge

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