Skip to content

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

Closed
superboynick wants to merge 3 commits into
trustno1-coder:mainfrom
superboynick:pr/mapping-stripes
Closed

superboynick wants to merge 3 commits into
trustno1-coder:mainfrom
superboynick:pr/mapping-stripes

Conversation

@superboynick

@superboynick superboynick commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

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 (gpu: two opt-in refresh changes — read textures without the mapping lock, and share one read across eight (Series X 2.25 -> 4.06 fps) #59, or New GPU/CPU Pipeline, 30+ FPS, Ultrawide 32:9 Support, Ray Tracing + Ray Reconstruction, Untie Physics from FPS, NVIDIA Reflex, and more #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.

ProjectsbyDrew pushed a commit to ProjectsbyDrew/VIctory-NVIDIA that referenced this pull request Nov 27, 2026
…t-frame-window

fix(gpu): average copy statistics over the full reporting interval
@superboynick

Copy link
Copy Markdown
Contributor Author

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
superboynick force-pushed the pr/mapping-stripes branch 5 times, most recently from 0b03591 to 5d3358d Compare November 28, 2026 01:30
eleboucher pushed a commit to eleboucher/VIctory-NVIDIA that referenced this pull request Nov 28, 2026
…t-frame-window

fix(gpu): average copy statistics over the full reporting interval
eleboucher pushed a commit to eleboucher/VIctory-NVIDIA that referenced this pull request Nov 28, 2026
…t-frame-window

fix(gpu): average copy statistics over the full reporting interval
Codex and others added 3 commits November 28, 2026 11:50
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.
@trustno1-coder

Copy link
Copy Markdown
Owner

Thanks for this. I'm closing it without merging: it conflicts with #59, merged now, which changed the same texture refresh path in texture.rs and host.rs. If you'd still like the address-range stripes in, please rebase on the current main and open a new pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants