Frame budget: where the time goes in the prison yard (RTX 5090, Linux/Wine), and which PRs move it #3425

Open
opened 2026-11-27 00:45:00 +00:00 by neonbyte1 · 22 comments
neonbyte1 commented 2026-11-27 00:45:00 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-27T00:45:00Z.


A frame budget for one fixed scene, so that performance PRs can be ranked by what they actually remove. Measured numbers only; I'll keep this updated as runs and PRs land. Others' rows for other GPUs/OSes are welcome in the same form.

Setup: RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with its vkd3d-proton. main (63bcca4) plus the unmerged PRs this setup needs to render the world (#2723, #439, #233, #320, #2118, #2703, #2101, #1129, #2312), plus #2958, #3120 (overlap on), #2309, #2461, #3353/#3378, #3313. GTA VI's opening prison yard, a warm shader cache, diag build. Untimed numbers are medians of the last 30 frame-rate lines of a 600 s run; timed numbers come from VICTORY_GPU_TIMING=1 (which turns overlap off), with every command in the table rather than the log's top 25.

The title caps itself at 30 fps (#2469), so the target is 33.3 ms.

Where we are

Stack Frame fps On the GPU Preparing Copy-back
Base above 553-563 ms 1.8 438-443 63 48-50
+ #3312 (VRAM shadow buffers) 386 2.6 245 85 52
+ #3318 372 2.7 243 81 49

The CPU side and the GPU side run one after the other: with #3312 every submission waits for its own copy lists, so #3120's overlap no longer helps.

CPU side: ~136 ms per frame (best stack + #3341 + #2472)

Part ms/frame Where Open PRs aimed at it
Copy-back of marked pages (2,813 pages, 101 MB) 50.7 shadow.rs copy-back #3246, #3320, #3343 (+#3341 measured slower here)
Refresh change checks + memcpy 23.9 shadow.rs/host.rs refresh path #3305, #3289, #3387
Descriptor heap mirroring (384k slots) 18.1 HostHeap::sync_slots none found
#3312's two waited-for copy lists per submission ~14 upload_vram_copies / readback_vram_copies none yet (see below)
Bindless upload list 10.1 bindless::uploads none found
Title copies, heap steps, the rest ~15

One lock, watch::GUARDS, is held ~49 ms/frame by our own paths, and the title spends 52 ms in its write-fault handler queueing behind it.

GPU side: 155 ms of commands per frame (timed)

Class ms/frame Commands/frame
G-buffer draws (mesh + pixel) 51.9 1,869
Indirect-argument clamps 35.4 4,909
Shadow draws (mesh only) 21.8 1,885
Indirect compute 21.7 920
Other dispatches 10.2 3,394
Preludes and the rest ~14

The untimed "on the GPU" figure (~240 ms) is mostly not GPU work: lists take ~176 ms of wall time, the rest is the CPU waiting on synchronous copies. With #3312 in, GatherCopy (41 ms) and the BVH trace (28 ms) left the top of the table.

Findings so far:

  • Clamps: #2472's batched clamp never runs under Wine: its shader fails Wine's D3DCompile (E5005 'Load' on RWByteAddressBuffer, [RootSignature] ignored), so every log shows no batched argument clamp: falling back to inline. #3197's window shader has the same problem. A Wine-compilable version plus #3197 is being measured.
  • Write marks off saves ~0.7 ms of GPU time on this stack: with #2958 and #3312 they're no longer a GPU cost.
  • Read marks off isn't a usable measurement: VRAM fills to 32 GB and everything slows 2x, so it measures memory pressure, not the atomics.

Per-PR results on this setup

PR Effect here Note
#2958 871 → 673 ms coalesced view marks
#3120 ~16% less frame time (before #3312) overlap
#3312 553-563 → 386 ms biggest single gain; makes submissions synchronous
#3318 386 → 372 ms
#2465 (port) 871 → 665 ms alone; nothing extra on top of #2958
#2848 +30 ms preparing bisect running
#3341 copy-back +5-7 ms in two independent pairs
#2472 no effect: shader doesn't compile under Wine fix being measured
#2051 with #3312: deferred refreshes skip the VRAM upload, the title later crashes fix being measured; whichever of #2051/#3312 lands second needs it

Still being measured: asynchronous read-back on top of #3312 (to restore the overlap), batched clamps (#2472 fix + #3197), #3387, #3343, #3305, #3289, #3320, #3246, and two small CPU fixes (heap mirroring, bindless uploads).

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6637604328 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-27T00:45:00Z. --- A frame budget for one fixed scene, so that performance PRs can be ranked by what they actually remove. Measured numbers only; I'll keep this updated as runs and PRs land. Others' rows for other GPUs/OSes are welcome in the same form. **Setup:** RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with its vkd3d-proton. `main` (`63bcca4`) plus the unmerged PRs this setup needs to render the world (#2723, #439, #233, #320, #2118, #2703, #2101, #1129, #2312), plus #2958, #3120 (overlap on), #2309, #2461, #3353/#3378, #3313. GTA VI's opening prison yard, a warm shader cache, diag build. Untimed numbers are medians of the last 30 frame-rate lines of a 600 s run; timed numbers come from `VICTORY_GPU_TIMING=1` (which turns overlap off), with every command in the table rather than the log's top 25. The title caps itself at 30 fps (#2469), so the target is 33.3 ms. ## Where we are | Stack | Frame | fps | On the GPU | Preparing | Copy-back | |---|---|---|---|---|---| | Base above | 553-563 ms | 1.8 | 438-443 | 63 | 48-50 | | + #3312 (VRAM shadow buffers) | 386 | 2.6 | 245 | 85 | 52 | | + #3318 | **372** | **2.7** | 243 | 81 | 49 | The CPU side and the GPU side run one after the other: with #3312 every submission waits for its own copy lists, so #3120's overlap no longer helps. ## CPU side: ~136 ms per frame (best stack + #3341 + #2472) | Part | ms/frame | Where | Open PRs aimed at it | |---|---|---|---| | Copy-back of marked pages (2,813 pages, 101 MB) | 50.7 | `shadow.rs` copy-back | #3246, #3320, #3343 (+#3341 measured slower here) | | Refresh change checks + memcpy | 23.9 | `shadow.rs`/`host.rs` refresh path | #3305, #3289, #3387 | | Descriptor heap mirroring (384k slots) | 18.1 | `HostHeap::sync_slots` | none found | | #3312's two waited-for copy lists per submission | ~14 | `upload_vram_copies` / `readback_vram_copies` | none yet (see below) | | Bindless upload list | 10.1 | `bindless::uploads` | none found | | Title copies, heap steps, the rest | ~15 | | | One lock, `watch::GUARDS`, is held ~49 ms/frame by our own paths, and the title spends 52 ms in its write-fault handler queueing behind it. ## GPU side: 155 ms of commands per frame (timed) | Class | ms/frame | Commands/frame | |---|---|---| | G-buffer draws (mesh + pixel) | 51.9 | 1,869 | | Indirect-argument clamps | 35.4 | 4,909 | | Shadow draws (mesh only) | 21.8 | 1,885 | | Indirect compute | 21.7 | 920 | | Other dispatches | 10.2 | 3,394 | | Preludes and the rest | ~14 | | The untimed "on the GPU" figure (~240 ms) is mostly not GPU work: lists take ~176 ms of wall time, the rest is the CPU waiting on synchronous copies. With #3312 in, `GatherCopy` (41 ms) and the BVH trace (28 ms) left the top of the table. Findings so far: - **Clamps:** #2472's batched clamp never runs under Wine: its shader fails Wine's `D3DCompile` (`E5005 'Load' on RWByteAddressBuffer`, `[RootSignature]` ignored), so every log shows `no batched argument clamp: falling back to inline`. #3197's window shader has the same problem. A Wine-compilable version plus #3197 is being measured. - **Write marks off** saves ~0.7 ms of GPU time on this stack: with #2958 and #3312 they're no longer a GPU cost. - **Read marks off** isn't a usable measurement: VRAM fills to 32 GB and everything slows 2x, so it measures memory pressure, not the atomics. ## Per-PR results on this setup | PR | Effect here | Note | |---|---|---| | #2958 | 871 → 673 ms | coalesced view marks | | #3120 | ~16% less frame time (before #3312) | overlap | | #3312 | 553-563 → 386 ms | biggest single gain; makes submissions synchronous | | #3318 | 386 → 372 ms | | | #2465 (port) | 871 → 665 ms alone; nothing extra on top of #2958 | | | #2848 | +30 ms preparing | bisect running | | #3341 | copy-back +5-7 ms in two independent pairs | | | #2472 | no effect: shader doesn't compile under Wine | fix being measured | | #2051 | with #3312: deferred refreshes skip the VRAM upload, the title later crashes | fix being measured; whichever of #2051/#3312 lands second needs it | Still being measured: asynchronous read-back on top of #3312 (to restore the overlap), batched clamps (#2472 fix + #3197), #3387, #3343, #3305, #3289, #3320, #3246, and two small CPU fixes (heap mirroring, bindless uploads). _AI-assisted (Claude); measured on my machine, no game data shared._
Dathinel commented 2026-11-27 01:15:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-27T01:15:33Z.


A row for a small card, with a different tree and scene, so it compares only loosely. RTX 3050 Laptop 4 GB (32-lane waves), Ryzen 7 7435HS, 24 GB RAM, Windows 11 native, Series S profile, a cool_fox-lineage tree, outdoor free play by a boat. Frame 150 to 154 ms (6.5 to 6.7 fps): 65 preparing, 70 on the GPU, 26 copy-back, in series. That is after skipping the 41 bvh_skinning programs and both CS_Primary_GatherCopy variants. Before the skips, a batch timing that does not serialise the frame gave 128.5 ms of commands: GatherCopy 49.7 in one command, bvh_skinning:* 23.0, each G-buffer family under 4. One run per figure; night not checked with the skips.

https://github.com/Dathinel/victory-4gb/issues/4

No game files or captures attached. Written with AI assistance (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7207143028 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7207143028). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-27T01:15:33Z. --- A row for a small card, with a different tree and scene, so it compares only loosely. RTX 3050 Laptop 4 GB (32-lane waves), Ryzen 7 7435HS, 24 GB RAM, Windows 11 native, Series S profile, a cool_fox-lineage tree, outdoor free play by a boat. Frame 150 to 154 ms (6.5 to 6.7 fps): 65 preparing, 70 on the GPU, 26 copy-back, in series. That is after skipping the 41 `bvh_skinning` programs and both `CS_Primary_GatherCopy` variants. Before the skips, a batch timing that does not serialise the frame gave 128.5 ms of commands: `GatherCopy` 49.7 in one command, `bvh_skinning:*` 23.0, each G-buffer family under 4. One run per figure; night not checked with the skips. https://github.com/Dathinel/victory-4gb/issues/4 No game files or captures attached. Written with AI assistance (Claude Code).
neonbyte1 commented 2026-11-27 03:54:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-27T03:54:16Z.


Update with this round's measurements (same setup as above; every comparison now uses a control run of the base taken right next to the candidate, because the same build drifted by up to ~25 ms between runs hours apart).

New best: 372 → ~315 ms per frame (3.2 fps) by making #3312's read-back asynchronous on top of #3120's overlap: the upload and read-back run as their own copy lists before and after the submission's lists on the same queue, and the CPU reads them in finish once the fence is reached. Also not reading back marked declared ranges whole (742 MB/frame that were discarded). The main-compatible part is offered on #3312.

Run (same period) Frame On the GPU Preparing Copy-back
B (main + needed PRs + #3312 + #3318) 372 ms 243 81 49
B + asynchronous read-back 314-320 ms 179-183 70-72 56-61

Overlap stops there. With the waits for our own copies gone, 22 of 24 submissions per frame were still "heavy" (#3120's rule). A prototype that tracks writes per submission brought that to 6, with a correct picture, but no frame gain (312 vs 314 ms in adjacent runs): the title's queues are chained through label waits for values it writes once per frame, two frames ahead, so the title itself serializes. Held queue items are already released on completion. The remaining lever is making each part cheaper.

Per-PR results added:

PR Effect here Note
#2848 (earlier head) +30 ms preparing all of it from fd7de0f6 (read-shared SHADER_HEAPS lock), which the author has since dropped; current head being measured
#2051 no change (409 vs 405 ms) with #3312 it needs an upload fix for deferred refreshes or the title crashes; posted on both PRs
#2472 its batch shader now compiles under Wine (fix offered), but on its own it removes only ~4 ms of GPU time here most indirect draws here write a UAV or read-mark, so they aren't hoisted; #3197's windows plus a read-mark rule are being measured
write marks / memory marks off 0 ms of GPU not a cost any more with #2958 + #3312

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7209362818 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7209362818). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-27T03:54:16Z. --- Update with this round's measurements (same setup as above; every comparison now uses a control run of the base taken right next to the candidate, because the same build drifted by up to ~25 ms between runs hours apart). **New best: 372 → ~315 ms per frame (3.2 fps)** by making #3312's read-back asynchronous on top of #3120's overlap: the upload and read-back run as their own copy lists before and after the submission's lists on the same queue, and the CPU reads them in `finish` once the fence is reached. Also not reading back marked declared ranges whole (742 MB/frame that were discarded). The `main`-compatible part is offered on #3312. | Run (same period) | Frame | On the GPU | Preparing | Copy-back | |---|---|---|---|---| | B (`main` + needed PRs + #3312 + #3318) | 372 ms | 243 | 81 | 49 | | B + asynchronous read-back | 314-320 ms | 179-183 | 70-72 | 56-61 | **Overlap stops there.** With the waits for our own copies gone, 22 of 24 submissions per frame were still "heavy" (#3120's rule). A prototype that tracks writes per submission brought that to 6, with a correct picture, but no frame gain (312 vs 314 ms in adjacent runs): the title's queues are chained through label waits for values it writes once per frame, two frames ahead, so the title itself serializes. Held queue items are already released on completion. The remaining lever is making each part cheaper. **Per-PR results added:** | PR | Effect here | Note | |---|---|---| | #2848 (earlier head) | +30 ms preparing | all of it from `fd7de0f6` (read-shared `SHADER_HEAPS` lock), which the author has since dropped; current head being measured | | #2051 | no change (409 vs 405 ms) | with #3312 it needs an upload fix for deferred refreshes or the title crashes; posted on both PRs | | #2472 | its batch shader now compiles under Wine (fix offered), but on its own it removes only ~4 ms of GPU time here | most indirect draws here write a UAV or read-mark, so they aren't hoisted; #3197's windows plus a read-mark rule are being measured | | write marks / memory marks off | 0 ms of GPU | not a cost any more with #2958 + #3312 | _AI-assisted (Claude); measured on my machine, no game data shared._
neonbyte1 commented 2026-11-27 04:53:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-27T04:53:57Z.


Update: ~315 → 223 ms per frame (4.5 fps), from batching the indirect-argument clamps.

Adjacent runs Frame On the GPU Preparing Copy-back
B + asynchronous read-back 316 ms 184 71 56
+ #2472 + #3197 windows, both made to compile under Wine, + a read-mark rule 223 ms 84 76 58

Pictures match the control at two late frames. Details on #2472 and #3197. Timed, GPU command time per frame went from 155 to 65 ms: the clamps from 35 to 10 ms (4,909 → 1,133), and the indirect draws themselves from 98 to 32 ms, because a barrier, a one-group dispatch and a rebind between every two draws had been breaking up the draw stream.

Where the frame goes now: the CPU side (preparing ~76 ms + copy-back ~58 ms) is larger than the GPU (~84 ms), and they still run one after the other. Next targets are the CPU table in the first post (copy-back of marked pages, refresh change checks, heap mirroring, bindless uploads, the watch::GUARDS lock); the open PRs for them (#3246, #3289, #3305, #3320, #3343, #3387) are being measured.

Also: #2848's current head (without the read-shared SHADER_HEAPS lock) no longer adds preparing time here (79 ms vs 77-81 for its base).

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7210183519 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7210183519). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-27T04:53:57Z. --- Update: **~315 → 223 ms per frame (4.5 fps)**, from batching the indirect-argument clamps. | Adjacent runs | Frame | On the GPU | Preparing | Copy-back | |---|---|---|---|---| | B + asynchronous read-back | 316 ms | 184 | 71 | 56 | | + #2472 + #3197 windows, both made to compile under Wine, + a read-mark rule | **223 ms** | **84** | 76 | 58 | Pictures match the control at two late frames. Details on [#2472](https://github.com/Marvisak/VIctory/pull/2472#issuecomment-7209623715) and [#3197](https://github.com/Marvisak/VIctory/pull/3197#issuecomment-7209623995). Timed, GPU command time per frame went from 155 to 65 ms: the clamps from 35 to 10 ms (4,909 → 1,133), and the indirect draws themselves from 98 to 32 ms, because a barrier, a one-group dispatch and a rebind between every two draws had been breaking up the draw stream. **Where the frame goes now:** the CPU side (preparing ~76 ms + copy-back ~58 ms) is larger than the GPU (~84 ms), and they still run one after the other. Next targets are the CPU table in the first post (copy-back of marked pages, refresh change checks, heap mirroring, bindless uploads, the `watch::GUARDS` lock); the open PRs for them (#3246, #3289, #3305, #3320, #3343, #3387) are being measured. Also: #2848's current head (without the read-shared `SHADER_HEAPS` lock) no longer adds preparing time here (79 ms vs 77-81 for its base). _AI-assisted (Claude); measured on my machine, no game data shared._
borosf commented 2026-11-27 11:36:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by borosf on 2026-11-27T11:36:34Z.


Others' rows are welcome, so here is the Intel Arc one. Same form, Windows, and a 12 GB card that caps shader-visible heaps at 1,000,000, which changes which PRs matter.

Setup: Intel Arc B580 12 GB, Windows 11 x64, Ryzen 5 5600, 32 GB RAM. main (63bcca4) plus #2958 only — that is all this setup needs to reach a lit scene (before it the picture is a pink wash, #2703 removes the root-view offset drops). Warm shader cache, --profile diag --features diagnostics, --console series-x, VICTORY_GPU_TIMING=1 VICTORY_D3D12_DRED=1, 200 s run. Numbers are the last frame line and the last per-frame statistics line of that run, not medians of 30 (this card changes scene too slowly to collect 30); untimed rows are per frame.

Where we are

Stack Frame fps On the GPU Preparing Copy-back draws/frame
main + #2958 981.3 ms 1.0 675.4 217.5 (copies 85.1, textures 9.8) 85.1 2,742
+ #3419 1,161–1,204 ms 0.8–0.9 938.3 160.9–167.5 60.6–63.6 2,396

The + #3419 row is not a regression and not a win: it is a different point in the world with 1,175 more draws submitted per frame, because #3419 stops dropping them (see below). Timing on this card needs a fixed scene before such rows mean anything.

CPU side, per frame (copies per frame line, 200 s)

Part ms/frame What it is Open PRs aimed at it
Title threads waiting to write views 105.0 time to acquire SHADER_HEAPS, not work #2848, #3320
Guards in the fault handler 76.18 1,007 guard faults, 4,610 protect calls for 5,360 pages, 4,718 pages opened #3343, #3387, #3395
Marked-page copy-back 60.6 1,284 pages compared, 42.8 MB written back #3341, #3320
GPU writes step 53.8 the refresh batch flushed before each unmarked GPU write #3265, #3391, #3089
Snapshots 37.6 504.4 MB held before shader writes #3035, #3262
Heap slots the title copied 36.6 493,568 slots #3265, #3139, #3215
Heap texture uploads 29.8 #3472, #3439
protecting 27.2 the syscalls behind the 4,610 protects #2849, #3343
Watches 26.52 5,828.8 MB checked to find 5,694.1 MB unchanged #3484
Moves (ReadProcessMemory) 24.72 12.79 MB unmapped #3265, #3391
Copy-back compared 17.1 95.5 MB #3341
Copy step 15.7 #3265
Title memory / heaps / preludes 7.1 / 3.0 / 2.9
Fallbacks 7.1 48.7 copies met an unmapped page; ~0.46 ms each, and ReadProcessMemory will not say where it stopped, so the retry re-copies the range from the start (#3358) #3125
Change checks 7.2 + 4.1 asking for other mappings, waiting for the guard lock

Refresh bytes are 10,036.9 MB/frame asked for, merged per copy — the copy step is 15.7 ms, so that is not 10 GB of host traffic. Page faults are 37,007/frame total, 15,326 of them preparing. Working set 21,037 MB, 0 hard faults.

GPU side, after #2958

675.4 ms measured, class split: indirect compute 326.5 ms (43 %), direct dispatch 183.0, mesh/indexed 9.4. Top buckets: indirect [compute 915ed81ea580a276] 171.5 ms (the #898 lane), dispatch a7eeed0646be1ab7 52.95 (this is #2958's tile-mask reset, 1,866.2 ms before it), indirect bc6ca78d5425c179 41.8, cb6adcc6da2613ff 35.4.

PRs measured on this card

PR Measured effect here
#2958 CS_ResetTilesMask 1,866.2 → 56.8 ms; frame 4,734.3 → 1,298.8 ms; GPU 4,158.7 → 759.6 ms. Also the picture: pink wash → lit scene.
#2703 Root-view slot drops 199.2 + 177.0/frame → 0 in 4 runs, 0 device removals.
#3419 no dynamic slots drop events 201 → 0; the capped heap keeps count = 737,856, dynamic = 262,144 instead of 934,464 / 65,536. No draw reads a title slot past the cut (for_draw=true 0 occurrences either way).
#3437 Below noise here: commit 16,665 MB against 16,643 / 16,811 MB for unmodified baseline runs of the same length. Needs a loose-window byte counter before it can be called a RAM win.

Two Intel-only rows

  • Capped heaps. The title asks for 1,245,184 view slots; this host refuses anything past 1,000,000, so count + DYNAMIC and count + MIN_DYNAMIC both fail and the fallback squeezes dynamic slots 4× (262,144 → 65,536), which costs 2,422 + 444 + 258 dropped draws/dispatches per frame. #3419 removes all of it. 310,720 title slots are unserved (507,328 warnings per heap build once #3419 widens the dynamic budget), none of them read by a draw.
  • Device removal (page fault at 0x8000…, reason text "GPU will not respond"): 1–3 runs in 4 here depending on the tree, and it also happens on a fork lineage without our commits. Tracked in #2671; not attributable to any PR in this table.

Synthetic tests only in the tree; every number above is a run of the title on my own dump.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7217271641 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7217271641). Originally posted by [borosf](https://github.com/borosf) on 2026-11-27T11:36:34Z. --- Others' rows are welcome, so here is the Intel Arc one. Same form, Windows, and a **12 GB card that caps shader-visible heaps at 1,000,000**, which changes which PRs matter. **Setup:** Intel Arc B580 12 GB, Windows 11 x64, Ryzen 5 5600, 32 GB RAM. `main` (`63bcca4`) **plus #2958 only** — that is all this setup needs to reach a lit scene (before it the picture is a pink wash, #2703 removes the root-view offset drops). Warm shader cache, `--profile diag --features diagnostics`, `--console series-x`, `VICTORY_GPU_TIMING=1 VICTORY_D3D12_DRED=1`, 200 s run. Numbers are the **last** frame line and the **last** per-frame statistics line of that run, not medians of 30 (this card changes scene too slowly to collect 30); untimed rows are per frame. ## Where we are | Stack | Frame | fps | On the GPU | Preparing | Copy-back | draws/frame | |---|---|---|---|---|---|---| | `main` + #2958 | **981.3 ms** | 1.0 | 675.4 | 217.5 (copies 85.1, textures 9.8) | 85.1 | 2,742 | | + #3419 | 1,161–1,204 ms | 0.8–0.9 | 938.3 | 160.9–167.5 | 60.6–63.6 | 2,396 | The `+ #3419` row is **not** a regression and not a win: it is a different point in the world with 1,175 more draws submitted per frame, because #3419 stops dropping them (see below). Timing on this card needs a fixed scene before such rows mean anything. ## CPU side, per frame (`copies per frame` line, 200 s) | Part | ms/frame | What it is | Open PRs aimed at it | |---|---|---|---| | Title threads waiting to write views | **105.0** | time to acquire `SHADER_HEAPS`, not work | #2848, #3320 | | Guards in the fault handler | **76.18** | 1,007 guard faults, 4,610 protect calls for 5,360 pages, 4,718 pages opened | #3343, #3387, #3395 | | Marked-page copy-back | **60.6** | 1,284 pages compared, 42.8 MB written back | #3341, #3320 | | `GPU writes` step | **53.8** | the refresh batch flushed before each unmarked GPU write | #3265, #3391, #3089 | | Snapshots | 37.6 | 504.4 MB held before shader writes | #3035, #3262 | | Heap slots the title copied | 36.6 | 493,568 slots | #3265, #3139, #3215 | | Heap texture uploads | 29.8 | | #3472, #3439 | | `protecting` | 27.2 | the syscalls behind the 4,610 protects | #2849, #3343 | | Watches | 26.52 | 5,828.8 MB checked to find 5,694.1 MB unchanged | #3484 | | Moves (`ReadProcessMemory`) | 24.72 | 12.79 MB unmapped | #3265, #3391 | | Copy-back compared | 17.1 | 95.5 MB | #3341 | | Copy step | 15.7 | | #3265 | | Title memory / heaps / preludes | 7.1 / 3.0 / 2.9 | | | | Fallbacks | 7.1 | 48.7 copies met an unmapped page; ~0.46 ms each, and `ReadProcessMemory` will not say where it stopped, so the retry re-copies the range from the start (#3358) | #3125 | | Change checks | 7.2 + 4.1 | asking for other mappings, waiting for the guard lock | | Refresh bytes are 10,036.9 MB/frame **asked for**, merged per copy — the copy step is 15.7 ms, so that is not 10 GB of host traffic. Page faults are 37,007/frame total, 15,326 of them preparing. Working set 21,037 MB, 0 hard faults. ## GPU side, after #2958 675.4 ms measured, class split: **indirect compute 326.5 ms (43 %)**, direct dispatch 183.0, mesh/indexed 9.4. Top buckets: `indirect [compute 915ed81ea580a276]` **171.5 ms** (the #898 lane), `dispatch a7eeed0646be1ab7` 52.95 (this is #2958's tile-mask reset, **1,866.2 ms before it**), `indirect bc6ca78d5425c179` 41.8, `cb6adcc6da2613ff` 35.4. ## PRs measured on this card | PR | Measured effect here | |---|---| | **#2958** | `CS_ResetTilesMask` 1,866.2 → **56.8 ms**; frame 4,734.3 → **1,298.8 ms**; GPU 4,158.7 → **759.6 ms**. Also the picture: pink wash → lit scene. | | **#2703** | Root-view slot drops **199.2 + 177.0/frame → 0** in 4 runs, 0 device removals. | | **#3419** | `no dynamic slots` drop events **201 → 0**; the capped heap keeps `count = 737,856, dynamic = 262,144` instead of `934,464 / 65,536`. No draw reads a title slot past the cut (`for_draw=true` 0 occurrences either way). | | **#3437** | **Below noise here**: commit 16,665 MB against 16,643 / 16,811 MB for unmodified baseline runs of the same length. Needs a loose-window byte counter before it can be called a RAM win. | ## Two Intel-only rows - **Capped heaps.** The title asks for 1,245,184 view slots; this host refuses anything past 1,000,000, so `count + DYNAMIC` and `count + MIN_DYNAMIC` both fail and the fallback squeezes dynamic slots 4× (262,144 → 65,536), which costs 2,422 + 444 + 258 dropped draws/dispatches per frame. #3419 removes all of it. 310,720 title slots are unserved (507,328 warnings per heap build once #3419 widens the dynamic budget), none of them read by a draw. - **Device removal** (`page fault at 0x8000…`, reason text "GPU will not respond"): 1–3 runs in 4 here depending on the tree, and it also happens on a fork lineage without our commits. Tracked in **#2671**; not attributable to any PR in this table. Synthetic tests only in the tree; every number above is a run of the title on my own dump.
neonbyte1 commented 2026-11-27 11:40:46 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-27T11:40:46Z.


@borosf thanks, that's exactly the form I hoped for, and the Intel row shows the same CPU-side shape we see on NVIDIA under Wine: waiting for the SHADER_HEAPS lock is your largest item (105 ms) and one of ours too (74-88 ms in the same "title threads waiting to write views" counter). We traced ours to the heap sync holding that lock for its whole pass; a version that holds it per 16-page chunk is in our queue now, and I'll post the number here when it's in.

A few of the PRs you list against these costs (#3484, #3395, #3472, #3439, #3419, #3437) aren't in our measurements yet; I'll run the ones that target our largest items on the same base and add them to the table.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7217351021 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7217351021). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-27T11:40:46Z. --- @borosf thanks, that's exactly the form I hoped for, and the Intel row shows the same CPU-side shape we see on NVIDIA under Wine: waiting for the `SHADER_HEAPS` lock is your largest item (105 ms) and one of ours too (74-88 ms in the same "title threads waiting to write views" counter). We traced ours to the heap sync holding that lock for its whole pass; a version that holds it per 16-page chunk is in our queue now, and I'll post the number here when it's in. A few of the PRs you list against these costs (#3484, #3395, #3472, #3439, #3419, #3437) aren't in our measurements yet; I'll run the ones that target our largest items on the same base and add them to the table. _AI-assisted (Claude); measured on my machine, no game data shared._
KainanP commented 2026-11-27 12:31:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-27T12:31:20Z.


A synthetic repro of the "title threads waiting to write views" row (borosf's 105 ms, neonbyte1's 74-88 ms), with A/Bs of the open PRs that touch it.

Bench: sync_contention_bench (#[ignore]d; commit f34bcfb8 cherry-picks onto any tree; cargo test -p victory-gpu --release sync_contention_bench -- --ignored --nocapture --test-threads=1).

  • A placed, write-watched view heap of 2^20 slots (capped at 934,464 by the host here).
  • Each frame, one thread rewrites 200 random 64 KiB pages and runs one sync_heaps, while 5 title threads write a view every 20 µs into pages of their own.
  • It checks that every view written before a sync is in the shader-visible view addresses after it, and that every slot is right after a final quiet sync.
  • SYNC_BENCH_* variables change the shape. SYNC_BENCH_SLOTS=1245184 SYNC_BENCH_PAST_CAP=1 gives the title's heap size, with pages past the cap.

On main it reproduces the shape: a 9.6 ms sync leaves each title thread blocked for all of it, so the threads wait 49.5 ms per frame in total (per-write p99 9.7 ms, against 2-3 µs uncontended).

RTX 4060 Laptop, each PR against its base 63bcca4, interleaved runs, medians:

PR sync_heaps title wait /frame lost views note
base 9.6 ms 49.5 ms 0
#3055 7.6 ms 39.7 ms 0 faster in all 4 setups (also 7.9 → 6.0 game-shaped, 10.1 → 8.5 Intel UHD); the lock is still held for the whole pass
#3139 11.0 ms 56.5 ms 0 no gain (7.9 → 7.9 game-shaped)
#3356 13.4 ms 69.1 ms 0 slower everywhere; VirtualQuery on a guarded write-watch pool
#3512 6.9 ms game-shaped (base 7.9) 36.3 (41.5) 0 gains only with pages past the cap, as intended
#2848 8.6 ms 44.9 ms 0 current head doesn't touch the sync (noise)
#2821 (RwLock) 17.5 ms 12.0 ms 0 the wait goes away, but the sync slows down while the threads write views during it (1.0 ms wait / 9.7 ms sync at 200 µs between writes)

Details are on each PR. The full victory-gpu suite on RTX fails only the two tests that main also fails here, on every tree. No tree lost a view or left one stale.

What this suggests: shortening the sync (#3055) only scales the wait down. Making the lock shared (#2821, #2848's dropped fd7de0f6, #3320's reverted change) removes the wait but moves cost onto the submitting thread, which is the +30 ms "preparing" that was measured in-game. Holding the lock per chunk sits between the two. @neonbyte1, I couldn't find your per-16-page-chunk version on a branch yet. When it's up, I'll run it through the same bench (or you can cherry-pick f34bcfb8; it prints sync time, wait and the lost-view check in one line). I'm not opening a PR of my own for this.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7218340670 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7218340670). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T12:31:20Z. --- A synthetic repro of the "title threads waiting to write views" row (borosf's 105 ms, neonbyte1's 74-88 ms), with A/Bs of the open PRs that touch it. **Bench:** [`sync_contention_bench`](https://github.com/KainanP/VIctory/blob/bench/sync-heaps-contention/crates/victory-gpu/src/descriptor/sync_bench.rs) (`#[ignore]`d; commit `f34bcfb8` cherry-picks onto any tree; `cargo test -p victory-gpu --release sync_contention_bench -- --ignored --nocapture --test-threads=1`). - A placed, write-watched view heap of 2^20 slots (capped at 934,464 by the host here). - Each frame, one thread rewrites 200 random 64 KiB pages and runs one `sync_heaps`, while 5 title threads write a view every 20 µs into pages of their own. - It checks that every view written before a sync is in the shader-visible view addresses after it, and that every slot is right after a final quiet sync. - `SYNC_BENCH_*` variables change the shape. `SYNC_BENCH_SLOTS=1245184 SYNC_BENCH_PAST_CAP=1` gives the title's heap size, with pages past the cap. On `main` it reproduces the shape: a 9.6 ms sync leaves each title thread blocked for all of it, so the threads wait **49.5 ms per frame** in total (per-write p99 9.7 ms, against 2-3 µs uncontended). RTX 4060 Laptop, each PR against its base `63bcca4`, interleaved runs, medians: | PR | `sync_heaps` | title wait /frame | lost views | note | |---|---|---|---|---| | base | 9.6 ms | 49.5 ms | 0 | | | #3055 | **7.6 ms** | 39.7 ms | 0 | faster in all 4 setups (also 7.9 → 6.0 game-shaped, 10.1 → 8.5 Intel UHD); the lock is still held for the whole pass | | #3139 | 11.0 ms | 56.5 ms | 0 | no gain (7.9 → 7.9 game-shaped) | | #3356 | 13.4 ms | 69.1 ms | 0 | **slower** everywhere; `VirtualQuery` on a guarded write-watch pool | | #3512 | 6.9 ms game-shaped (base 7.9) | 36.3 (41.5) | 0 | gains only with pages past the cap, as intended | | #2848 | 8.6 ms | 44.9 ms | 0 | current head doesn't touch the sync (noise) | | #2821 (`RwLock`) | **17.5 ms** | **12.0 ms** | 0 | the wait goes away, but the sync slows down while the threads write views during it (1.0 ms wait / 9.7 ms sync at 200 µs between writes) | Details are on each PR. The full `victory-gpu` suite on RTX fails only the two tests that `main` also fails here, on every tree. No tree lost a view or left one stale. What this suggests: shortening the sync (#3055) only scales the wait down. Making the lock shared (#2821, #2848's dropped `fd7de0f6`, #3320's reverted change) removes the wait but moves cost onto the submitting thread, which is the +30 ms "preparing" that was measured in-game. Holding the lock per chunk sits between the two. @neonbyte1, I couldn't find your per-16-page-chunk version on a branch yet. When it's up, I'll run it through the same bench (or you can cherry-pick `f34bcfb8`; it prints sync time, wait and the lost-view check in one line). I'm not opening a PR of my own for this. _AI use: Claude Code (Claude Opus 5.5)._
KainanP commented 2026-11-27 12:40:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-27T12:40:39Z.


On the watch::GUARDS line above (our paths hold it ~49 ms/frame, the title waits ~52 ms in its fault handler): a CPU-side benchmark run against main and the four open PRs aimed at that lock, to rank them by what they remove.

Bench: guard_contention + refreshes_under_writes_lose_nothing, split out of #3516 as a standalone test-only commit anyone can apply: KainanP/VIctory perf/guard-bench. 256 MB write-watched pool, 1,400 dirty pages per refresh, title threads writing every 20 µs during the refresh; it reports the refresh time, the writers' time in their writes, and their wait for GUARDS. i7-14650HX, Windows 11, release, 31 interleaved rounds, medians; other agents' compiles were running, so the per-round PR/main ratio is the number to read.

Writers' wait for GUARDS, PR / main (median of per-round ratios; ~±5 % is noise here):

Config main: writers in writes / waiting for GUARDS, ms #3343 #2849 #3455 #3035
1 writer 5.1 / 2.8 1.03 0.97 1.05 1.06
4 writers 37.8 / 24.3 0.95 1.02 1.00 1.02
4 writers, refresh on 4 threads 28.3 / 25.7 0.97 1.04 1.05 1.02
4 writers, twin views (aliased) 56.4 / 40.1 1.00 1.00 1.02 1.07
4 writers, copies armed (first writes save the page) 145.3 / 119.4 0.96 1.00 0.99 0.55
  • #3035 (numbers) is the only one that moves it, and only when trackers are armed (pages saved before their first write): the 64 KiB read leaving the lock halves the writers' wait and removes the refresh's (8.7 → 0.05 ms).
  • #3343 (numbers): ~5 % with 4 writers; #2849 (numbers): no change. Both batch multi-page opens, but title write faults are one page each, so one VirtualProtect per fault remains, under the lock.
  • #3455 (numbers): no change. Its shared lock is in retake only; the fault handler and takes still lock exclusively.
  • #3516 (ours, draft): moves a take's VirtualProtect out of the lock. That removes the writers' wait behind takes, but faulting writes still cost ~20–30 µs each.

refreshes_under_writes_lose_nothing passes on all four heads and on main (3 × 1,000 rounds each). So no lost write was found.

What remains with several writers is the writers queueing behind each other's fault handler, which calls VirtualProtect under GUARDS. None of the open PRs moves that call out of the lock. That is the next target for the title-side ~52 ms.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7218540756 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7218540756). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T12:40:39Z. --- On the `watch::GUARDS` line above (our paths hold it ~49 ms/frame, the title waits ~52 ms in its fault handler): a CPU-side benchmark run against `main` and the four open PRs aimed at that lock, to rank them by what they remove. **Bench:** `guard_contention` + `refreshes_under_writes_lose_nothing`, split out of #3516 as a standalone test-only commit anyone can apply: [KainanP/VIctory `perf/guard-bench`](https://github.com/KainanP/VIctory/commit/ab96ee44e6bf35ec1dc5cd97c0f059797950b2e8). 256 MB write-watched pool, 1,400 dirty pages per refresh, title threads writing every 20 µs during the refresh; it reports the refresh time, the writers' time in their writes, and their wait for `GUARDS`. i7-14650HX, Windows 11, release, 31 interleaved rounds, medians; other agents' compiles were running, so the per-round PR/main ratio is the number to read. Writers' wait for `GUARDS`, PR / `main` (median of per-round ratios; ~±5 % is noise here): | Config | main: writers in writes / waiting for `GUARDS`, ms | #3343 | #2849 | #3455 | #3035 | |---|---|---|---|---|---| | 1 writer | 5.1 / 2.8 | 1.03 | 0.97 | 1.05 | 1.06 | | 4 writers | 37.8 / 24.3 | 0.95 | 1.02 | 1.00 | 1.02 | | 4 writers, refresh on 4 threads | 28.3 / 25.7 | 0.97 | 1.04 | 1.05 | 1.02 | | 4 writers, twin views (aliased) | 56.4 / 40.1 | 1.00 | 1.00 | 1.02 | 1.07 | | 4 writers, copies armed (first writes save the page) | 145.3 / 119.4 | 0.96 | 1.00 | 0.99 | 0.55 | - **#3035** ([numbers](https://github.com/Marvisak/VIctory/pull/3035#issuecomment-7218536546)) is the only one that moves it, and only when trackers are armed (pages saved before their first write): the 64 KiB read leaving the lock halves the writers' wait and removes the refresh's (8.7 → 0.05 ms). - **#3343** ([numbers](https://github.com/Marvisak/VIctory/pull/3343#issuecomment-7218535207)): ~5 % with 4 writers; **#2849** ([numbers](https://github.com/Marvisak/VIctory/pull/2849#issuecomment-7218535611)): no change. Both batch multi-page opens, but title write faults are one page each, so one `VirtualProtect` per fault remains, under the lock. - **#3455** ([numbers](https://github.com/Marvisak/VIctory/pull/3455#issuecomment-7218536027)): no change. Its shared lock is in `retake` only; the fault handler and takes still lock exclusively. - **#3516** (ours, draft): moves a take's `VirtualProtect` out of the lock. That removes the writers' wait behind takes, but faulting writes still cost ~20–30 µs each. `refreshes_under_writes_lose_nothing` passes on all four heads and on `main` (3 × 1,000 rounds each). So no lost write was found. What remains with several writers is the writers queueing behind each other's fault handler, which calls `VirtualProtect` under `GUARDS`. None of the open PRs moves that call out of the lock. That is the next target for the title-side ~52 ms. _AI use: Claude Code (Claude Opus 5.5)._
neonbyte1 commented 2026-11-27 12:41:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-27T12:41:41Z.


@KainanP thanks, that ranking matches what we saw in game for #3343 (no frame change), and it tells me what to expect from #3035: its in-game A/B on our stack is queued for this afternoon (merged onto our lease-runs code, which needed one extra OPENED bump where a lease opens guarded pages without going through open(); otherwise a fault's unlocked read straddling a whole lease could be kept). I'll post the frame numbers here and on #3035.

One data point on where the title's lock wait sits, from a critical-path read of our logs and code (no new runs): on our stack the title is at least a frame ahead of the GPU work (at each present, queue 0 still holds ~246 items that waited ~177 ms for the next frame's label values), so its ~84 ms waiting to write views and ~62 ms in the fault handler fall in time it would spend waiting anyway. The frame is the serial chain of our submissions (preparing + GPU + copy-back, ~198 ms), because 22 of ~24 submissions a frame complete before the next is prepared and the title's GPU-side waits are released only after the copy-back writes their labels. So the guard-lock wait you identify becomes frame time once that chain overlaps; we're working on that first, then the fault handler's VirtualProtect under GUARDS is the obvious next target.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7218561361 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7218561361). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-27T12:41:41Z. --- @KainanP thanks, that ranking matches what we saw in game for #3343 (no frame change), and it tells me what to expect from #3035: its in-game A/B on our stack is queued for this afternoon (merged onto our lease-runs code, which needed one extra `OPENED` bump where a lease opens guarded pages without going through `open()`; otherwise a fault's unlocked read straddling a whole lease could be kept). I'll post the frame numbers here and on #3035. One data point on where the title's lock wait sits, from a critical-path read of our logs and code (no new runs): on our stack the title is at least a frame ahead of the GPU work (at each present, queue 0 still holds ~246 items that waited ~177 ms for the next frame's label values), so its ~84 ms waiting to write views and ~62 ms in the fault handler fall in time it would spend waiting anyway. The frame is the serial chain of our submissions (preparing + GPU + copy-back, ~198 ms), because 22 of ~24 submissions a frame complete before the next is prepared and the title's GPU-side waits are released only after the copy-back writes their labels. So the guard-lock wait you identify becomes frame time once that chain overlaps; we're working on that first, then the fault handler's `VirtualProtect` under `GUARDS` is the obvious next target. _AI-assisted (Claude); measured on my machine, no game data shared._
KainanP commented 2026-11-27 13:06:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-27T13:06:25Z.


On the "Descriptor heap mirroring (384k slots), 18.1 ms, HostHeap::sync_slots, none found" row: I wrote a bench in that shape and ran the open PRs through it. I also covered borosf's "heap slots the title copied" row (493,568 slots, 36.6 ms), which goes through the same mirror.

Bench: bench/sync-slots (f233390e on top of f34bcfb8; cherry-pick both, #[ignore]d).

  • sync_slots_bench: each frame, 192 random 64 KiB pages (393,216 slots) of a 2^20-slot placed view heap are written, with 0, ~9.5k or ~85k records changed, then one sync_heaps.
  • copy_simple_bench: 393,216 slots a frame copied with copy_simple in runs of 1-1024.
  • Every shape runs with and without 5 title threads writing views.
  • Both check every view address afterwards.
  • Run: cargo test -p victory-gpu --release sync_slots_bench -- --ignored --nocapture --test-threads=1.

Where the time goes on main (RTX 4060 Laptop):

  • Scanning 393k unchanged slots is cheap: ~1.2 ms for the record diff, plus ~1.7 ms for the write-watch/page walk.
  • Each changed slot's mirror costs ~1 µs. ~9.5k changed per frame gives 12-17 ms, close to the 18.1 ms row, so the row is most likely mirror of changed slots, not the scan.
  • copy_simple of records the slots already hold costs 71 ns/slot here, the same as borosf's 74 ns/slot, because each slot takes SHADER_HEAPS and the slot locks on its own.

PRs (interleaved against base 63bcca4; per-PR tables on each):

PR heap sync (~9.5k changed, 5 title threads) other shapes copies (same records, runs of 64, alone / 5 threads)
base 13.1 ms, title wait 64 ms 28 / 256 ms
#3055 9.2 ms (×0.70), wait 46 ms ×0.63-0.82 in all six shapes ~same
#3139 13.2 ms (×1.07) ×1.8 slower when pages are written with no change (2.9 → 4.9 ms); ×0.71-0.84 at 85k changed ~same
#2971 13.4 ms (×1.03) neutral within noise (memory PR) ~same
#3265 12.6 ms (control: doesn't touch the sync) 5 / 11 ms (runs of 1024: 27 → 3 ms; 177 → 12 ms with threads)

No tree lost a view or left a slot stale (0 in all 56 runs).

What this suggests for the two rows:

  • Copies (borosf's 36.6 ms): #3265 removes most of it whenever the title copies runs of ≥ 8 slots.
  • Heap sync (18.1 ms): #3055 is the only open PR that shortens it, by ~20-35%. The rest of the cost is the ~1 µs mirror per changed slot. A sync_slots-only fix isn't clear from this data, so I'm not opening a PR for it.

Earlier contention runs of #3356, #3512, #2848 and #2821 are in my previous comment.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7219063899 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7219063899). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T13:06:25Z. --- On the "Descriptor heap mirroring (384k slots), 18.1 ms, `HostHeap::sync_slots`, none found" row: I wrote a bench in that shape and ran the open PRs through it. I also covered borosf's "heap slots the title copied" row (493,568 slots, 36.6 ms), which goes through the same `mirror`. **Bench:** [`bench/sync-slots`](https://github.com/KainanP/VIctory/commits/bench/sync-slots) (`f233390e` on top of `f34bcfb8`; cherry-pick both, `#[ignore]`d). - `sync_slots_bench`: each frame, 192 random 64 KiB pages (393,216 slots) of a 2^20-slot placed view heap are written, with 0, ~9.5k or ~85k records changed, then one `sync_heaps`. - `copy_simple_bench`: 393,216 slots a frame copied with `copy_simple` in runs of 1-1024. - Every shape runs with and without 5 title threads writing views. - Both check every view address afterwards. - Run: `cargo test -p victory-gpu --release sync_slots_bench -- --ignored --nocapture --test-threads=1`. **Where the time goes on `main`** (RTX 4060 Laptop): - Scanning 393k unchanged slots is cheap: ~1.2 ms for the record diff, plus ~1.7 ms for the write-watch/page walk. - Each changed slot's `mirror` costs ~1 µs. ~9.5k changed per frame gives 12-17 ms, close to the 18.1 ms row, so the row is most likely `mirror` of changed slots, not the scan. - `copy_simple` of records the slots already hold costs 71 ns/slot here, the same as borosf's 74 ns/slot, because each slot takes `SHADER_HEAPS` and the slot locks on its own. **PRs** (interleaved against base `63bcca4`; per-PR tables on each): | PR | heap sync (~9.5k changed, 5 title threads) | other shapes | copies (same records, runs of 64, alone / 5 threads) | |---|---|---|---| | base | 13.1 ms, title wait 64 ms | | 28 / 256 ms | | **#3055** | **9.2 ms (×0.70)**, wait 46 ms | ×0.63-0.82 in all six shapes | ~same | | #3139 | 13.2 ms (×1.07) | **×1.8 slower** when pages are written with no change (2.9 → 4.9 ms); ×0.71-0.84 at 85k changed | ~same | | #2971 | 13.4 ms (×1.03) | neutral within noise (memory PR) | ~same | | **#3265** | 12.6 ms (control: doesn't touch the sync) | | **5 / 11 ms** (runs of 1024: 27 → 3 ms; 177 → 12 ms with threads) | No tree lost a view or left a slot stale (0 in all 56 runs). What this suggests for the two rows: - **Copies (borosf's 36.6 ms):** #3265 removes most of it whenever the title copies runs of ≥ 8 slots. - **Heap sync (18.1 ms):** #3055 is the only open PR that shortens it, by ~20-35%. The rest of the cost is the ~1 µs `mirror` per changed slot. A `sync_slots`-only fix isn't clear from this data, so I'm not opening a PR for it. Earlier contention runs of #3356, #3512, #2848 and #2821 are in [my previous comment](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7218340670). _AI use: Claude Code (Claude Opus 5.5)._
KainanP commented 2026-11-27 13:38:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-27T13:38:08Z.


This follows up my sync_slots bench above. I profiled where a changed slot's ~1 µs mirror goes (main, RTX 4060 Laptop, ~9.5k changed of 393k):

  • bindless::Viewed::set (the census) takes ~480-690 ns, about half. Most of it is the slot HashMap (~290 ns, it misses the cache at 600k-1M entries) and counting the old range out of the BTreeMaps.
  • make takes ~310 ns, of which CreateShaderResourceView is only ~100-140 ns.
  • keep/retire take ~100 ns, the locks plus view_at ~60-100 ns, and prepare ~50 ns.

A host-descriptor cache wouldn't pay off here, since the driver call is ~10 % of the cost. #3522 makes the census cheaper instead:

  • ~9.5k changed: heap sync 10.8 → 8.5 ms (×0.79) alone, and ×0.86 with 5 title threads (title wait 54 → 45 ms).
  • ~85k changed: ×0.59 alone, ×0.71 with 5 title threads.
  • No slot was lost in any of the 42 runs.

My estimate is ~3-4 ms of the 18.1 ms row. @neonbyte1, an A/B of the heap sync on the world would settle it.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7219742317 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7219742317). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T13:38:08Z. --- This follows up my sync_slots bench above. I profiled where a changed slot's ~1 µs `mirror` goes (`main`, RTX 4060 Laptop, ~9.5k changed of 393k): - `bindless::Viewed::set` (the census) takes ~480-690 ns, about half. Most of it is the slot `HashMap` (~290 ns, it misses the cache at 600k-1M entries) and counting the old range out of the `BTreeMap`s. - `make` takes ~310 ns, of which `CreateShaderResourceView` is only ~100-140 ns. - `keep`/`retire` take ~100 ns, the locks plus `view_at` ~60-100 ns, and `prepare` ~50 ns. A host-descriptor cache wouldn't pay off here, since the driver call is ~10 % of the cost. #3522 makes the census cheaper instead: - ~9.5k changed: heap sync 10.8 → 8.5 ms (×0.79) alone, and ×0.86 with 5 title threads (title wait 54 → 45 ms). - ~85k changed: ×0.59 alone, ×0.71 with 5 title threads. - No slot was lost in any of the 42 runs. My estimate is ~3-4 ms of the 18.1 ms row. @neonbyte1, an A/B of the heap sync on the world would settle it. _AI use: Claude Code (Claude Opus 5.5)._
shawshanker18 commented 2026-11-27 14:21:46 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by shawshanker18 on 2026-11-27T14:21:46Z.


A row from the other end of the hardware range, in the same form: a laptop with little memory, Windows, D3D12 directly (no Wine).

Setup: RTX 4050 Laptop GPU (6 GB, driver 621.14), 16 GB RAM, Windows 11, Series X profile, 1920×1080. Build: the fxceless-based fork-nv2 branch (not main + the stack above), diag profile with --features diagnostics. Env: VICTORY_INDIRECT_WINDOW=1 VICTORY_FETCH_COPY_QUEUE=1 VICTORY_CARD_REHASH_RUNS=1 VICTORY_ALIAS_ONCE=1 VICTORY_FAST_READ=1. Scene: first world scene after load, 56 world frames (≥500 draws) over one 10-minute run.

Frame fps On the GPU Preparing of it: title copies Copy-back
25th pct 325 ms 3.1 130 128 79 ms / 161 MB 88 ms / 63 MB
median 385 ms 2.6 66 178 80 ms / 128 MB 96 ms / 60 MB
75th pct 523 ms 1.9 70 290 86 ms / 156 MB 103 ms / 73 MB

Compared with the 5090 rows, the split flips: here the GPU is ~66 ms and the CPU side (preparing + copy-back) is ~270 ms at the median, so on a laptop CPU the copy-back and copy paths are most of the frame. Copy-back alone takes about twice as long here (96 ms) as on the 5090 (~50 ms) for a similar size (~60 MB).

Two other measurements from the same runs, in case they help rank PRs:

  • Dropped draws: 373 per frame without a host pipeline. 338 of them are the ray-tracing structure builder's stages (off by default, VICTORY_BVH_BUILDER unset), ~16 from a local NVIDIA VICTORY_SKIP_PIPELINES list, ~6 compute pipelines the driver refused.
  • The submission lock: a local experiment that lets settle_now wait for the relay without holding host.submitted did not change the median (2.5 fps both ways, two 10-minute runs), so on this machine the lock is not where the time goes; the copy paths are.

No game data or shader hashes in this comment.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7220686592 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7220686592). Originally posted by [shawshanker18](https://github.com/shawshanker18) on 2026-11-27T14:21:46Z. --- A row from the other end of the hardware range, in the same form: a laptop with little memory, Windows, D3D12 directly (no Wine). **Setup:** RTX 4050 Laptop GPU (6 GB, driver 621.14), 16 GB RAM, Windows 11, Series X profile, 1920×1080. Build: the fxceless-based `fork-nv2` branch (not `main` + the stack above), `diag` profile with `--features diagnostics`. Env: `VICTORY_INDIRECT_WINDOW=1 VICTORY_FETCH_COPY_QUEUE=1 VICTORY_CARD_REHASH_RUNS=1 VICTORY_ALIAS_ONCE=1 VICTORY_FAST_READ=1`. Scene: first world scene after load, 56 world frames (≥500 draws) over one 10-minute run. | | Frame | fps | On the GPU | Preparing | of it: title copies | Copy-back | |---|---|---|---|---|---|---| | 25th pct | 325 ms | 3.1 | 130 | 128 | 79 ms / 161 MB | 88 ms / 63 MB | | **median** | **385 ms** | **2.6** | **66** | **178** | 80 ms / 128 MB | **96 ms / 60 MB** | | 75th pct | 523 ms | 1.9 | 70 | 290 | 86 ms / 156 MB | 103 ms / 73 MB | Compared with the 5090 rows, the split flips: here the GPU is ~66 ms and the CPU side (preparing + copy-back) is ~270 ms at the median, so on a laptop CPU the copy-back and copy paths are most of the frame. Copy-back alone takes about twice as long here (96 ms) as on the 5090 (~50 ms) for a similar size (~60 MB). Two other measurements from the same runs, in case they help rank PRs: - **Dropped draws:** 373 per frame without a host pipeline. 338 of them are the ray-tracing structure builder's stages (off by default, `VICTORY_BVH_BUILDER` unset), ~16 from a local NVIDIA `VICTORY_SKIP_PIPELINES` list, ~6 compute pipelines the driver refused. - **The submission lock:** a local experiment that lets `settle_now` wait for the relay without holding `host.submitted` did not change the median (2.5 fps both ways, two 10-minute runs), so on this machine the lock is not where the time goes; the copy paths are. No game data or shader hashes in this comment.
neonbyte1 commented 2026-11-27 14:28:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-27T14:28:35Z.


@KainanP thanks, the bench settles which heap PRs to measure in the world: #3522, #3055 and #3265 are being built on our stack now and will get in-game A/Bs against adjacent controls (heap-sync time and the title-copy row first, frame second). Results here and on each PR.

@shawshanker18 useful row, and two things line up with ours:

  • Dropped draws: 341 of our ~350 per frame are the same ray-tracing structure builder's dispatches, held back because its 64-lane programs run as 32-lane halves on NVIDIA (BVH builder held back … made=53 refused=0); the drop line gives them no reason bucket, which is why they look anonymous. Only ~9 a frame are refused shaders.
  • Where the time goes: on our 5090 setup the frame is the serial sum of preparing + GPU + copy-back (~78 + 77 + 43 ms), because 22 of ~24 submissions a frame complete before the next is prepared and the title's GPU-side waits are released only after the copy-back writes their labels. On a laptop CPU the same chain is CPU-dominated, as your split shows. An overlap of that chain is the change we're testing next; it should help both ends of the range, and on yours the copy paths stay the next target after it.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7220830276 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7220830276). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-27T14:28:35Z. --- @KainanP thanks, the bench settles which heap PRs to measure in the world: #3522, #3055 and #3265 are being built on our stack now and will get in-game A/Bs against adjacent controls (heap-sync time and the title-copy row first, frame second). Results here and on each PR. @shawshanker18 useful row, and two things line up with ours: - **Dropped draws:** 341 of our ~350 per frame are the same ray-tracing structure builder's dispatches, held back because its 64-lane programs run as 32-lane halves on NVIDIA (`BVH builder held back … made=53 refused=0`); the drop line gives them no reason bucket, which is why they look anonymous. Only ~9 a frame are refused shaders. - **Where the time goes:** on our 5090 setup the frame is the serial sum of preparing + GPU + copy-back (~78 + 77 + 43 ms), because 22 of ~24 submissions a frame complete before the next is prepared and the title's GPU-side waits are released only after the copy-back writes their labels. On a laptop CPU the same chain is CPU-dominated, as your split shows. An overlap of that chain is the change we're testing next; it should help both ends of the range, and on yours the copy paths stay the next target after it. _AI-assisted (Claude); measured on my machine, no game data shared._
JurajSimicevic commented 2026-11-27 17:52:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by JurajSimicevic on 2026-11-27T17:52:39Z.


Rows for RTX 5080, Windows 11, native D3D12, on a tree with #439 and #2121. On this card, #2958 takes the frame from 3.16 s to 1.74 s, and #3312 on top of it takes the frame to 0.53 s (1.9 fps). With both, the GPU time falls from 2.9 s to 150 ms, close to the other rows (66 ms on shawshanker18's RTX 4050 Laptop, 77 ms on neonbyte1's 5090).

Setup: RTX 5080, driver 617.42, Windows 11 26200.

  • Tree: main 63bcca4 + #2098, #2626, #2464, #2118, #439 at e2d3cfd and #2121 at 0bc5edb, plus #3415's dump diagnostics. Nothing else for performance.
  • Diag build, warm shader and pipeline caches, Series X profile.
  • Scene: the opening prison cell, looking out at the yard. The world is entered with VICTORY_KEYS (Enter every 4 s up to 64 s), with no input after.
  • Untimed numbers are medians of the last 30 frame-rate lines after 7 minutes in the world, without DRED.
  • Timed numbers come from VICTORY_GPU_TIMING=1 with VICTORY_D3D12_DRED=1 (the commands are only noted with DRED). They are medians over 30 reports, with every command kind, not the log's top 25 (a local change to the report).
Stack Frame fps On the GPU Preparing Copy-back Draws
Tree above 3,164 ms 0.3 2,913 76 177 ~4,860
+ #2958 1,743 ms 0.6 1,482 76 179 4,941
+ #2958 + #3312 (576188a) 530 ms 1.9 150 96 195 4,941

GPU side, timed, before #3312 (ms/frame, with commands/frame in brackets):

Class Tree above + #2958
Mesh draws (G-buffer and shadows) 1,104 (4,018) 271 (4,207)
Vertex/pixel draws 461 (410) 25 (450)
Dispatches 725 (3,180) 571 (2,730)
Indirect compute 385 (917) 365 (920)
All commands 2,792 1,254

Unlike the Wine numbers, on this card nearly all of "on the GPU" was command time (lists 2,816 ms of wall time against 2,792 of commands). The command counts are close to the opening table's, but each class cost 15-70 times more here.

What this suggests:

  • #3312 is the largest single change on this tree. With the same draw count, the GPU time falls about 10x. So most of the GPU time that #2958 left went to the shadow buffers, page tables and bitmaps that #3312 moves into video memory. Desamodeth measured 15-26% for #3312 on main + #2885, so how much it gains depends on the tree. Preparing rises by 20 ms (about 30 MB more title copies a frame) and copy-back by 16 ms. Details are on #3312.
  • Draws: with #2958, mesh draws drop about 4x and vertex/pixel draws about 18x. That is also a bigger gain than Desamodeth measured for #2958 on main + #2885 with an RTX 5070 (590 → 491 and 613 → 566 ms).
  • What is left: with both PRs, preparing (96 ms) and copy-back (195 ms) are more than half of the frame, as in the other rows. I haven't timed the GPU classes with #3312 yet.
  • #3318 conflicts with #3312's copy-back loop, so I left it out.

Not tested: more than one run per row, other scenes, a timed run with #3312.

Local diagnostics only. No game data: timings and counts.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7224881447 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7224881447). Originally posted by [JurajSimicevic](https://github.com/JurajSimicevic) on 2026-11-27T17:52:39Z. --- **Rows for RTX 5080, Windows 11, native D3D12, on a tree with #439 and #2121.** On this card, **#2958 takes the frame from 3.16 s to 1.74 s, and #3312 on top of it takes the frame to 0.53 s (1.9 fps)**. With both, the GPU time falls from 2.9 s to 150 ms, close to the other rows (66 ms on shawshanker18's RTX 4050 Laptop, 77 ms on neonbyte1's 5090). **Setup:** RTX 5080, driver 617.42, Windows 11 26200. - Tree: `main` `63bcca4` + #2098, #2626, #2464, #2118, #439 at `e2d3cfd` and #2121 at `0bc5edb`, plus #3415's dump diagnostics. Nothing else for performance. - Diag build, warm shader and pipeline caches, Series X profile. - Scene: the opening prison cell, looking out at the yard. The world is entered with `VICTORY_KEYS` (Enter every 4 s up to 64 s), with no input after. - Untimed numbers are medians of the last 30 frame-rate lines after 7 minutes in the world, without DRED. - Timed numbers come from `VICTORY_GPU_TIMING=1` with `VICTORY_D3D12_DRED=1` (the commands are only noted with DRED). They are medians over 30 reports, with every command kind, not the log's top 25 (a local change to the report). | Stack | Frame | fps | On the GPU | Preparing | Copy-back | Draws | |---|---:|---:|---:|---:|---:|---:| | Tree above | 3,164 ms | 0.3 | 2,913 | 76 | 177 | ~4,860 | | + #2958 | 1,743 ms | 0.6 | 1,482 | 76 | 179 | 4,941 | | + #2958 + #3312 (`576188a`) | **530 ms** | **1.9** | **150** | 96 | 195 | 4,941 | **GPU side, timed, before #3312** (ms/frame, with commands/frame in brackets): | Class | Tree above | + #2958 | |---|---:|---:| | Mesh draws (G-buffer and shadows) | 1,104 (4,018) | 271 (4,207) | | Vertex/pixel draws | 461 (410) | 25 (450) | | Dispatches | 725 (3,180) | 571 (2,730) | | Indirect compute | 385 (917) | 365 (920) | | **All commands** | **2,792** | **1,254** | Unlike the Wine numbers, on this card nearly all of "on the GPU" was command time (lists 2,816 ms of wall time against 2,792 of commands). The command counts are close to the opening table's, but each class cost 15-70 times more here. What this suggests: - **#3312 is the largest single change on this tree.** With the same draw count, the GPU time falls about 10x. So most of the GPU time that #2958 left went to the shadow buffers, page tables and bitmaps that #3312 moves into video memory. Desamodeth measured 15-26% for #3312 on `main` + #2885, so how much it gains depends on the tree. Preparing rises by 20 ms (about 30 MB more title copies a frame) and copy-back by 16 ms. Details are on #3312. - **Draws:** with #2958, mesh draws drop about 4x and vertex/pixel draws about 18x. That is also a bigger gain than Desamodeth measured for #2958 on `main` + #2885 with an RTX 5070 (590 → 491 and 613 → 566 ms). - **What is left:** with both PRs, preparing (96 ms) and copy-back (195 ms) are more than half of the frame, as in the other rows. I haven't timed the GPU classes with #3312 yet. - #3318 conflicts with #3312's copy-back loop, so I left it out. **Not tested:** more than one run per row, other scenes, a timed run with #3312. Local diagnostics only. No game data: timings and counts. AI-assisted.
JurajSimicevic commented 2026-11-27 18:08:42 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by JurajSimicevic on 2026-11-27T18:08:42Z.


Follow-up to my RTX 5080 rows: the timed split with #3312. Same tree, scene and method. One run with VICTORY_GPU_TIMING=1 and DRED, medians over 30 reports after 5.5 minutes in the world (ms/frame, with commands/frame in brackets):

Class + #2958 + #2958 + #3312
Mesh draws (G-buffer and shadows) 271 (4,207) 104 (4,159)
Vertex/pixel draws 25 (450) 2 (434)
Dispatches 571 (2,730) 17 (2,542)
Indirect compute 365 (920) 14 (911)
All commands 1,254 145

What this shows:

  • Compute is where #3312 gains most. Dispatches and indirect compute fall from 936 to 32 ms a frame, about 30x. With #2958 alone, four compute programs took 472 ms a frame between them, and the costliest ran 17 times a frame at about 12 ms each. With #3312 they take 1.5 ms together, at the same run counts. So they were bound by title memory in system memory. The draw count and the image look unchanged, but I haven't compared those programs' outputs between the two runs.
  • Mesh draws are most of what is left: 104 of 145 ms, down about 2.6x. The costliest single commands are now all mesh draws (11 of the top 12 indirect), at 2-10 ms a frame each.
  • With DRED on, this run's frame is 629 ms (GPU 185, preparing 100, copy-back 228), against 530 ms without DRED in the rows above.

Local diagnostics only. No game data: timings and counts.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7225173505 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7225173505). Originally posted by [JurajSimicevic](https://github.com/JurajSimicevic) on 2026-11-27T18:08:42Z. --- **Follow-up to [my RTX 5080 rows](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7224881447): the timed split with #3312.** Same tree, scene and method. One run with `VICTORY_GPU_TIMING=1` and DRED, medians over 30 reports after 5.5 minutes in the world (ms/frame, with commands/frame in brackets): | Class | + #2958 | + #2958 + #3312 | |---|---:|---:| | Mesh draws (G-buffer and shadows) | 271 (4,207) | **104** (4,159) | | Vertex/pixel draws | 25 (450) | **2** (434) | | Dispatches | 571 (2,730) | **17** (2,542) | | Indirect compute | 365 (920) | **14** (911) | | **All commands** | **1,254** | **145** | What this shows: - **Compute is where #3312 gains most.** Dispatches and indirect compute fall from 936 to 32 ms a frame, about 30x. With #2958 alone, four compute programs took 472 ms a frame between them, and the costliest ran 17 times a frame at about 12 ms each. With #3312 they take 1.5 ms together, at the same run counts. So they were bound by title memory in system memory. The draw count and the image look unchanged, but I haven't compared those programs' outputs between the two runs. - **Mesh draws are most of what is left:** 104 of 145 ms, down about 2.6x. The costliest single commands are now all mesh draws (11 of the top 12 indirect), at 2-10 ms a frame each. - With DRED on, this run's frame is 629 ms (GPU 185, preparing 100, copy-back 228), against 530 ms without DRED in the rows above. Local diagnostics only. No game data: timings and counts. AI-assisted.
upipibi commented 2026-11-27 22:29:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-27T22:29:30Z.


@neonbyte1 for the watch::GUARDS row (the title's 52 ms a frame queueing in its write-fault handler): #3455's VICTORY_PORT_GUARD will not move it as the PR stands. Its fault handler on_write still takes GUARDS.write(), and the one shared use needs VICTORY_PORT_JOURNAL too. A local benchmark of concurrent write faults showed no difference between off and on (details and lines in #3455). The fork's port 6 that #3455 is ported from does take the lock shared in the faults (open_faulted), with a claim per block. That is the part that would remove this row.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7229371384 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7229371384). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-27T22:29:30Z. --- @neonbyte1 for the `watch::GUARDS` row (the title's 52 ms a frame queueing in its write-fault handler): #3455's `VICTORY_PORT_GUARD` will not move it as the PR stands. Its fault handler `on_write` still takes `GUARDS.write()`, and the one shared use needs `VICTORY_PORT_JOURNAL` too. A local benchmark of concurrent write faults showed no difference between off and on (details and lines in #3455). The fork's port 6 that #3455 is ported from does take the lock shared in the faults (`open_faulted`), with a claim per block. That is the part that would remove this row. AI-assisted (Claude Code).
neonbyte1 commented 2026-11-27 22:34:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-27T22:34:15Z.


@upipibi thanks, that's exactly the missing piece. You're right: on our stack the row is the exclusive GUARDS take in the fault handler. Our own counters say the same thing: about 50-58 ms per frame in the handler and 71-79 ms of the title's threads waiting to write views.

What we have measured against that row so far: #3035 (reading the saved bytes outside the lock) takes about 8 ms off the handler time and 7.5 ms off the frame on our stack. It doesn't change that every fault still waits for every other fault.

We're now building the shared-lock fault path on our stack, re-implemented from the design you describe in port 6 (gleaf-6/VIctory-7900XTX- 42ddb597: per-block state in atomics, a claim per block, only mapping changes, kernel writes and frees exclusive), behind a switch, with credit to that fork and to you. That includes concurrency tests (faults on distinct blocks, a fault racing a refresh, a fault racing a free) and your benchmark shape. The in-game A-B-A-B result will be posted here, against an adjacent control.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7229438138 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7229438138). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-27T22:34:15Z. --- @upipibi thanks, that's exactly the missing piece. You're right: on our stack the row is the exclusive `GUARDS` take in the fault handler. Our own counters say the same thing: about 50-58 ms per frame in the handler and 71-79 ms of the title's threads waiting to write views. What we have measured against that row so far: #3035 (reading the saved bytes outside the lock) takes about 8 ms off the handler time and 7.5 ms off the frame on our stack. It doesn't change that every fault still waits for every other fault. We're now building the shared-lock fault path on our stack, re-implemented from the design you describe in port 6 (gleaf-6/VIctory-7900XTX- `42ddb597`: per-block state in atomics, a claim per block, only mapping changes, kernel writes and frees exclusive), behind a switch, with credit to that fork and to you. That includes concurrency tests (faults on distinct blocks, a fault racing a refresh, a fault racing a free) and your benchmark shape. The in-game A-B-A-B result will be posted here, against an adjacent control. _AI-assisted (Claude); measured on my machine, no game data shared._
upipibi commented 2026-11-28 02:07:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T02:07:01Z.


For the copy-back row: #3570 measures a lever that no upstream PR has yet, VICTORY_WC_NO_BACK from the AMD forks (#3570 lists Belobug#630 as related work; the code is in crossducking/RAZDA4A-XEN, branch dev f8bbae3, crates/victory-gpu/src/wc.rs, GPL-3). I read their code and the #3570 numbers; I ran nothing.

What it does. XMem records the protection the title asks for (xmem.rs:209 → wc::title_memory_protection). Shader writes into memory the title asked for as write-combined (the console's 0x400 bit), which the console's CPU writes but does not read back, are not copied back into title memory. The range is marked as the card's instead (Shadow::card_owns). skip_back (wc.rs:113-133) does this only when all four hold:

  • the whole range is write-combined;
  • it is at least VICTORY_WC_NO_BACK_MIN_KB (64 by default);
  • the copy is in video memory;
  • the copy is write-watched.

Anything else is copied back as before.

Measured in #3570:

  • RX 9070 XT, matched run (MJ26gaming): copy-back fell from 9-10 to 4.9 ms and from ~22 to 0.9 MB/frame, with the same draws and drops, and frames reached the 30 fps cap. The picture matched in diagnostics captures with VICTORY_WC_NO_BACK_MIN_KB=1024.
  • RX 7900 GRE (KwameKai4): frame time went from 70.7 to 52.1 ms, but the draw counts differed between runs.
  • Caution: a VICTORY_WC_BAR=1 variant from the same source ignores the minimum and breaks lighting.

Upstream would need the XMem protection hook, a copy in video memory (close to what #3312 provides), and the write-watch condition. There are no NVIDIA numbers yet.

AI-assisted (Claude Code, Claude Opus 5.5 read the fork's source and #3570).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7232141638 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7232141638). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-28T02:07:01Z. --- For the copy-back row: #3570 measures a lever that no upstream PR has yet, `VICTORY_WC_NO_BACK` from the AMD forks (#3570 lists Belobug#630 as related work; the code is in crossducking/RAZDA4A-XEN, branch `dev` `f8bbae3`, `crates/victory-gpu/src/wc.rs`, GPL-3). I read their code and the #3570 numbers; I ran nothing. **What it does.** XMem records the protection the title asks for (`xmem.rs:209` → `wc::title_memory_protection`). Shader writes into memory the title asked for as write-combined (the console's `0x400` bit), which the console's CPU writes but does not read back, are not copied back into title memory. The range is marked as the card's instead (`Shadow::card_owns`). `skip_back` (`wc.rs:113-133`) does this only when all four hold: - the whole range is write-combined; - it is at least `VICTORY_WC_NO_BACK_MIN_KB` (64 by default); - the copy is in video memory; - the copy is write-watched. Anything else is copied back as before. **Measured in #3570:** - **RX 9070 XT, matched run (MJ26gaming):** copy-back fell from 9-10 to 4.9 ms and from ~22 to 0.9 MB/frame, with the same draws and drops, and frames reached the 30 fps cap. The picture matched in diagnostics captures with `VICTORY_WC_NO_BACK_MIN_KB=1024`. - **RX 7900 GRE (KwameKai4):** frame time went from 70.7 to 52.1 ms, but the draw counts differed between runs. - **Caution:** a `VICTORY_WC_BAR=1` variant from the same source ignores the minimum and breaks lighting. Upstream would need the XMem protection hook, a copy in video memory (close to what #3312 provides), and the write-watch condition. There are no NVIDIA numbers yet. AI-assisted (Claude Code, Claude Opus 5.5 read the fork's source and #3570).
reallyvibe commented 2026-11-28 11:07:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by reallyvibe on 2026-11-28T11:07:14Z.


@neonbyte1 a coordination question on the watch::GUARDS fault-handler row.

#3035 (reading the saved bytes outside the guard lock) was closed by its author on 28 Nov without a comment. You measured it at 196.1 → 188.6 ms per frame, with the handler down from ~58 to 50 ms.

Before we do anything: would reviving it complement your shared-lock fault path or duplicate it?

  • Does your re-implementation of the port 6 design (per-block claims, faults taking the lock shared) already include the unlocked read, so that #3035 would only be churn?
  • Or would it help to land #3035 first as a smaller, separate step? If so, should it carry the extra OPENED bump you needed where your lease code opens guarded pages without going through open()?

If reviving it would get in your way, we can instead run your branch's concurrency tests on native Windows once it's up: faults on distinct blocks, a fault racing a refresh, a fault racing a free. We'd also run KainanP's guard_contention benchmark there. Your numbers so far are Linux/Wine. Our machine is an RTX 4050 Laptop and a Ryzen 7 7445HS on Windows 11. These runs would be CPU-only and synthetic, with no game.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7238340143 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7238340143). Originally posted by [reallyvibe](https://github.com/reallyvibe) on 2026-11-28T11:07:14Z. --- @neonbyte1 a coordination question on the `watch::GUARDS` fault-handler row. #3035 (reading the saved bytes outside the guard lock) was closed by its author on 28 Nov without a comment. You measured it at 196.1 → 188.6 ms per frame, with the handler down from ~58 to 50 ms. Before we do anything: would reviving it complement your shared-lock fault path or duplicate it? - Does your re-implementation of the port 6 design (per-block claims, faults taking the lock shared) already include the unlocked read, so that #3035 would only be churn? - Or would it help to land #3035 first as a smaller, separate step? If so, should it carry the extra `OPENED` bump you needed where your lease code opens guarded pages without going through `open()`? If reviving it would get in your way, we can instead run your branch's concurrency tests on native Windows once it's up: faults on distinct blocks, a fault racing a refresh, a fault racing a free. We'd also run KainanP's `guard_contention` benchmark there. Your numbers so far are Linux/Wine. Our machine is an RTX 4050 Laptop and a Ryzen 7 7445HS on Windows 11. These runs would be CPU-only and synthetic, with no game. AI-assisted (Claude Code).
neonbyte1 commented 2026-11-28 11:11:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-28T11:11:19Z.


@farhankhan8571811-star reviving #3035 wouldn't get in our way; it complements what we planned. Answers:

  • The shared-lock fault path doesn't exist yet. I said on 27 Nov that we were building it. We haven't, and I should have said so here. A critical-path analysis of today's runs (RTX 5090, Wine) moved it down our list: the frame is one serial chain of preparing + blocked-on-GPU + copy-back (about 85 + 66 + 53 ms on our integration). The fault handler's 86-99 ms a frame are spent on title threads that run a frame ahead and have slack, so on our setup that time doesn't become frame time until the chain overlaps. The GPU overlap comes first for us. On a laptop CPU, where the chain is CPU-bound, the handler may matter sooner.
  • #3035 as a separate, smaller step: yes. Whatever shared path we build later keeps the unlocked read of the saved bytes, so #3035 isn't churn. Our measurement still stands: −7.5 ms per frame and −8 ms in the handler, against an adjacent control.
  • The OPENED bump isn't needed on upstream. It's only needed where our lease code opens guarded pages without going through open(), and that code is in my #3677, not upstream. If #3677 lands, I'll add the bump there. #3035 can stay as its author wrote it.
  • Your Windows runs: concurrency tests and KainanP's guard_contention on native Windows would be valuable once a shared-path branch exists. I'll tag you when it's up rather than ask you to wait on it now.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7238384596 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7238384596). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-28T11:11:19Z. --- @farhankhan8571811-star reviving #3035 wouldn't get in our way; it complements what we planned. Answers: - **The shared-lock fault path doesn't exist yet.** I said on 27 Nov that we were building it. We haven't, and I should have said so here. A critical-path analysis of today's runs (RTX 5090, Wine) moved it down our list: the frame is one serial chain of preparing + blocked-on-GPU + copy-back (about 85 + 66 + 53 ms on our integration). The fault handler's 86-99 ms a frame are spent on title threads that run a frame ahead and have slack, so on our setup that time doesn't become frame time until the chain overlaps. The GPU overlap comes first for us. On a laptop CPU, where the chain is CPU-bound, the handler may matter sooner. - **#3035 as a separate, smaller step: yes.** Whatever shared path we build later keeps the unlocked read of the saved bytes, so #3035 isn't churn. Our measurement still stands: −7.5 ms per frame and −8 ms in the handler, against an adjacent control. - **The `OPENED` bump isn't needed on upstream.** It's only needed where our lease code opens guarded pages without going through `open()`, and that code is in my #3677, not upstream. If #3677 lands, I'll add the bump there. #3035 can stay as its author wrote it. - **Your Windows runs:** concurrency tests and KainanP's `guard_contention` on native Windows would be valuable once a shared-path branch exists. I'll tag you when it's up rather than ask you to wait on it now. _AI-assisted (Claude); measured on my machine, no game data shared._
neonbyte1 commented 2026-11-28 19:29:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-28T19:29:45Z.


Frame budget update, 2026-11-28 (RTX 5090, Linux, Wine 11.22 + vkd3d-proton, Series X profile, 2560×1440, ray tracing on, prison yard; 420 s runs after a warm-up, medians of the last 30 frame lines, adjacent A-B-A-B unless noted). The tree is our integration of upstream main 63bcca43c plus ~500 open PRs (neonbyte1/VIctory main), so absolute numbers aren't upstream's.

Where a frame goes (one serial chain under the submission lock, ~207 ms):

Stage ms Biggest parts
Preparing ~85 refresh batches 39 (copies 9, GPU writes 11), heap descriptor sync 19 (of it ~15 making descriptors), texture uploads 4
Blocked on the GPU ~62 ~50 waiting for page-table submissions' declared writes (~340 MB/frame declared)
Copy-back ~55 read-backs 25, marked pages 22

GPU work itself is ~58 ms: 924 indirect dispatches (19 ms) plus their argument clamps (9 ms) are ~46 % of it. Off the chain (on title threads with slack): ~85 ms in the guard fault handler, ~80 ms of title threads waiting to write views, 22 ms of draws waiting for pipelines (a first-use burst, 0 in steady state).

Measured today:

Change Result Verdict
Indirect dispatches in the shared clamp windows + plain DISPATCH signature −22 ms frame, −20 ms GPU (both pairs) merged on our fork; relates to our #3676
Lean form from #2312 (fxceless/victory-fork#1352) +14 ms under vkd3d-proton Windows differs (5080: a gain); a 4080 run is pending
Page-table submissions without a full barrier −5 ± 6 ms not proven: the wait moves into settles, the dependency is real
Copy-back off the submission lock ±0 the title's label waits serialize, not our lock
Shared lock for view writes +60 ms the waits vanish but the contention moves into the chain (per-heap slot lock)
Chunked guard-lock take ±0 handler time unchanged
UAV order fence in the console flow (correctness, #439) +3 ms merged; reported on #439/#3683

Corrections to my earlier posts here: the "shared-lock fault path" I said we were building was never built (corrected on 28 Nov in reply to farhankhan). #3035's revival is now #3754.

What's next on our side: narrower declared write ranges for the page-table programs, earlier labels (the title's next submission starts only after the previous one's labels are written), and #3265's batched descriptor copies, whose in-game A/B I promised here and haven't run yet. It's on tomorrow's queue.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7244586999 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7244586999). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-28T19:29:45Z. --- **Frame budget update, 2026-11-28** (RTX 5090, Linux, Wine 11.22 + vkd3d-proton, Series X profile, 2560×1440, ray tracing on, prison yard; 420 s runs after a warm-up, medians of the last 30 frame lines, adjacent A-B-A-B unless noted). The tree is our integration of upstream main `63bcca43c` plus ~500 open PRs (neonbyte1/VIctory `main`), so absolute numbers aren't upstream's. **Where a frame goes** (one serial chain under the submission lock, ~207 ms): | Stage | ms | Biggest parts | |---|---|---| | Preparing | ~85 | refresh batches 39 (copies 9, GPU writes 11), heap descriptor sync 19 (of it ~15 making descriptors), texture uploads 4 | | Blocked on the GPU | ~62 | **~50 waiting for page-table submissions' declared writes** (~340 MB/frame declared) | | Copy-back | ~55 | read-backs 25, marked pages 22 | GPU work itself is ~58 ms: 924 indirect dispatches (19 ms) plus their argument clamps (9 ms) are ~46 % of it. Off the chain (on title threads with slack): ~85 ms in the guard fault handler, ~80 ms of title threads waiting to write views, 22 ms of draws waiting for pipelines (a first-use burst, 0 in steady state). **Measured today:** | Change | Result | Verdict | |---|---|---| | Indirect dispatches in the shared clamp windows + plain `DISPATCH` signature | **−22 ms frame, −20 ms GPU** (both pairs) | merged on our fork; relates to our #3676 | | Lean form from #2312 (fxceless/victory-fork#1352) | +14 ms under vkd3d-proton | Windows differs (5080: a gain); a 4080 run is pending | | Page-table submissions without a full barrier | −5 ± 6 ms | not proven: the wait moves into settles, the dependency is real | | Copy-back off the submission lock | ±0 | the title's label waits serialize, not our lock | | Shared lock for view writes | +60 ms | the waits vanish but the contention moves into the chain (per-heap slot lock) | | Chunked guard-lock take | ±0 | handler time unchanged | | UAV order fence in the console flow (correctness, #439) | +3 ms | merged; reported on #439/#3683 | **Corrections to my earlier posts here:** the "shared-lock fault path" I said we were building was never built (corrected on 28 Nov in reply to farhankhan). #3035's revival is now #3754. **What's next on our side:** narrower declared write ranges for the page-table programs, earlier labels (the title's next submission starts only after the previous one's labels are written), and #3265's batched descriptor copies, whose in-game A/B I promised here and haven't run yet. It's on tomorrow's queue. _AI-assisted (Claude); measured on my machine, no game data shared._
reallyvibe commented 2026-11-28 21:48:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by reallyvibe on 2026-11-28T21:48:04Z.


@neonbyte1's split between the serial chain and off-chain time (7244586999) and the Moves row in @borosf's native table (7217271641) made me check what moves counts at main 63bcca43, and measure the copy itself (synthetic, native Windows). None of it shows what produced FIND-30's figure; the in-game parts are hypotheses until checked on a run.

What moves covers. moves is C::MoveUs, added around the first read() in copy_mapped. Its callers are copy steps and Batch::flush's shadow refreshes (serial), and texture refreshes on up to 4 threads through in_parallel. All of it runs inside execute under the submission lock, but the counter is one atomic, so for the texture path it is summed worker time, not elapsed critical-path time.

The frame line's textures … ms is summed likewise (texture.rs#L544-L551). That phase's elapsed time is "heap texture uploads" (host.rs#L1205-L1209). So moves can't go into a chain budget as it stands.

No byte counter shares its scope: copies … MB is serial only, textures … MB parallel only, title copies copy steps only, and refreshes … MB requested bytes, as borosf noted. The windows differ too: frame-line values are reset every second but printed every five (host.rs#L3049-L3070), while copystat covers all five seconds (host.rs#L3124).

So "MB per moves ms" is an apparent rate from counters that may describe different copies: both the ≈1.75 GB/s implied by FIND-30's "205 MB … 117 ms" (pes7) and the ≈9 GB/s I get from "copies 480 MB" and "moves (about 52 ms)" in zed6000's native #400 run. Neither is a measured copy throughput.

Within one window the parallel share of moves can't exceed textures … ms: 9.8 of 24.72 ms in borosf's run. That gives an indicative estimate of roughly 10 ms or less from summing there, not a rigorous bound, as the two figures come from different lines and windows.

The copy itself, native Windows (synthetic). A standalone C benchmark makes host::read's in-process ReadProcessMemory call on memory allocated as main does (plain, write-watch, SEC_RESERVE placeholder views; the D3D12 shared_buffer heap as destination). 1,088 fresh-process runs, all copies verified; medians, GB/s = 10^9 B/s:

RPM memcpy
1 MiB calls: plain / write-watch → shared_buffer / 64 KiB views → shared_buffer 7.98 / 7.67 / 7.04 GB/s 10.4–10.7 GB/s
time per call at 511 B / 512 B / 4 KiB 0.59 / 1.04 / 1.48 µs ≤0.53 µs (64 B–4 KiB)
4 copiers as in_parallel, title-like background load: elapsed / by summed call time 8.1 / 2.0 GB/s 9.1 / 2.3 GB/s
same load, one copier 6.5 / 6.5 GB/s 9.1 / 9.0 GB/s

Memory type matters little, per-call cost steps up at 512 bytes, and with four copiers on this bandwidth-limited laptop summed call time reads ~4× below elapsed throughput (background load detailed in the repo).

RPM vs memcpy on trimmed pages. With the working set emptied before every pass (~131k soft faults per 256 MiB pass, no hard faults), RPM ran at 2.95 GB/s and memcpy at 1.48 GB/s. Net of each configuration's warm pass time, that is roughly 0.42 vs 1.2 µs extra per fault, which could matter for user-mode copies (#2349) under memory pressure.

It covers only soft faults on the copied pages, 1 MiB calls, a full trim each pass and vcruntime's memcpy (not #2349's routine). Native runs do fault while preparing (15,326 a frame in borosf's run), but nothing shows they hit copy pages, so this is not evidence of an in-game regression. It doesn't apply under Wine, where the current-process NtReadVirtualMemory is a memmove (desplmfao).

Limits:

  • One laptop: Ryzen 7 7445HS, single-channel DDR5-5600, RTX 4050 Laptop, Windows 11 build 26300 Insider, 72–87% memory load, desktop apps running.
  • 3–5 runs per configuration, so effects under ~10% aren't established.
  • No title code, no GPU traffic, stand-in threads; 4 copiers where in_parallel would pick 3 here; moves's as_micros() truncation not modelled.

To settle it on a native diagnostics run:

  1. Existing counters. Elapsed copy time can't exceed copies … ms plus "heap texture uploads", so moves above that would be summed worker time. That only holds when the counters cover compatible windows and scopes: today, a steady scene.
  2. If that isn't decisive, two diagnostics-only counters in copy_mapped, beside @Jackster's QueryUs attribution (#3429): bytes passed to read(), and MoveUs split by submitting thread vs workers.
  3. For the trim question: preparing page faults, working set and hard faults with and without memory pressure, plus a user-mode copy A/B.

Source, configurations, raw results and a script recomputing every figure here: github.com/reallyvibe/victory-kcopy-bench@b58af47b79. No game data used.

AI-assisted (Claude Code): it wrote and ran the benchmark and drafted this comment; all runs were on my machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7246282679 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7246282679). Originally posted by [reallyvibe](https://github.com/reallyvibe) on 2026-11-28T21:48:04Z. --- @neonbyte1's split between the serial chain and off-chain time ([7244586999](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7244586999)) and the `Moves` row in @borosf's native table ([7217271641](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7217271641)) made me check what `moves` counts at main `63bcca43`, and measure the copy itself (synthetic, native Windows). None of it shows what produced FIND-30's figure; the in-game parts are hypotheses until checked on a run. **What `moves` covers.** `moves` is `C::MoveUs`, added around the first `read()` in [`copy_mapped`](https://github.com/Marvisak/VIctory/blob/63bcca43c6a00a758510398fa43096ce7e4f7df0/crates/victory-gpu/src/host.rs#L2481-L2501). Its callers are copy steps and `Batch::flush`'s shadow refreshes (serial), and texture refreshes on up to 4 threads through [`in_parallel`](https://github.com/Marvisak/VIctory/blob/63bcca43c6a00a758510398fa43096ce7e4f7df0/crates/victory-gpu/src/texture.rs#L493-L527). All of it runs inside `execute` under the submission lock, but the counter is one atomic, so for the texture path it is summed worker time, not elapsed critical-path time. The frame line's `textures … ms` is summed likewise ([texture.rs#L544-L551](https://github.com/Marvisak/VIctory/blob/63bcca43c6a00a758510398fa43096ce7e4f7df0/crates/victory-gpu/src/texture.rs#L544-L551)). That phase's elapsed time is "heap texture uploads" ([host.rs#L1205-L1209](https://github.com/Marvisak/VIctory/blob/63bcca43c6a00a758510398fa43096ce7e4f7df0/crates/victory-gpu/src/host.rs#L1205-L1209)). So `moves` can't go into a chain budget as it stands. No byte counter shares its scope: `copies … MB` is serial only, `textures … MB` parallel only, `title copies` copy steps only, and `refreshes … MB` requested bytes, as borosf noted. The windows differ too: frame-line values are reset every second but printed every five ([host.rs#L3049-L3070](https://github.com/Marvisak/VIctory/blob/63bcca43c6a00a758510398fa43096ce7e4f7df0/crates/victory-gpu/src/host.rs#L3049-L3070)), while copystat covers all five seconds ([host.rs#L3124](https://github.com/Marvisak/VIctory/blob/63bcca43c6a00a758510398fa43096ce7e4f7df0/crates/victory-gpu/src/host.rs#L3124)). So "MB per `moves` ms" is an apparent rate from counters that may describe different copies: both the ≈1.75 GB/s implied by [FIND-30](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7174389247)'s "205 MB … 117 ms" (pes7) and the ≈9 GB/s I get from "copies 480 MB" and "moves (about 52 ms)" in [zed6000's native #400 run](https://github.com/Marvisak/VIctory/issues/400#issuecomment-7199562322). Neither is a measured copy throughput. Within one window the parallel share of `moves` can't exceed `textures … ms`: 9.8 of 24.72 ms in borosf's run. That gives an indicative estimate of roughly 10 ms or less from summing there, not a rigorous bound, as the two figures come from different lines and windows. **The copy itself, native Windows (synthetic).** A standalone C benchmark makes `host::read`'s in-process `ReadProcessMemory` call on memory allocated as main does (plain, write-watch, `SEC_RESERVE` placeholder views; the D3D12 `shared_buffer` heap as destination). 1,088 fresh-process runs, all copies verified; medians, GB/s = 10^9 B/s: | | RPM | memcpy | |---|---:|---:| | 1 MiB calls: plain / write-watch → `shared_buffer` / 64 KiB views → `shared_buffer` | 7.98 / 7.67 / 7.04 GB/s | 10.4–10.7 GB/s | | time per call at 511 B / 512 B / 4 KiB | 0.59 / 1.04 / 1.48 µs | ≤0.53 µs (64 B–4 KiB) | | 4 copiers as `in_parallel`, title-like background load: elapsed / by summed call time | 8.1 / 2.0 GB/s | 9.1 / 2.3 GB/s | | same load, one copier | 6.5 / 6.5 GB/s | 9.1 / 9.0 GB/s | Memory type matters little, per-call cost steps up at 512 bytes, and with four copiers on this bandwidth-limited laptop summed call time reads ~4× below elapsed throughput (background load detailed in the repo). **RPM vs memcpy on trimmed pages.** With the working set emptied before every pass (~131k soft faults per 256 MiB pass, no hard faults), RPM ran at 2.95 GB/s and memcpy at 1.48 GB/s. Net of each configuration's warm pass time, that is roughly 0.42 vs 1.2 µs extra per fault, which could matter for user-mode copies (#2349) under memory pressure. It covers only soft faults on the copied pages, 1 MiB calls, a full trim each pass and vcruntime's `memcpy` (not #2349's routine). Native runs do fault while preparing (15,326 a frame in borosf's run), but nothing shows they hit copy pages, so this is not evidence of an in-game regression. It doesn't apply under Wine, where the current-process `NtReadVirtualMemory` is a `memmove` ([desplmfao](https://github.com/Marvisak/VIctory/pull/2349#issuecomment-7162652844)). **Limits:** - One laptop: Ryzen 7 7445HS, single-channel DDR5-5600, RTX 4050 Laptop, Windows 11 build 26300 Insider, 72–87% memory load, desktop apps running. - 3–5 runs per configuration, so effects under ~10% aren't established. - No title code, no GPU traffic, stand-in threads; 4 copiers where `in_parallel` would pick 3 here; `moves`'s `as_micros()` truncation not modelled. **To settle it on a native diagnostics run:** 1. **Existing counters.** Elapsed copy time can't exceed `copies … ms` plus "heap texture uploads", so `moves` above that would be summed worker time. That only holds when the counters cover compatible windows and scopes: today, a steady scene. 2. **If that isn't decisive,** two diagnostics-only counters in `copy_mapped`, beside @Jackster's `QueryUs` attribution (#3429): bytes passed to `read()`, and `MoveUs` split by submitting thread vs workers. 3. **For the trim question:** preparing page faults, working set and hard faults with and without memory pressure, plus a user-mode copy A/B. Source, configurations, raw results and a script recomputing every figure here: https://github.com/reallyvibe/victory-kcopy-bench/tree/b58af47b794b80f95bef837aaadb06e6cc038c2b. No game data used. AI-assisted (Claude Code): it wrote and ran the benchmark and drafted this comment; all runs were on my machine.
zed6000 commented 2026-11-29 17:41:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-29T17:41:53Z.


The heap-sync PRs on an RX 7900 XTX (native Windows, AMD driver 32.0.32029.2010, Ryzen 9 7900X3D), measured on the neonbyte1/VIctory integration tree 8d9b82fd9 (neonbyte1/VIctory#64). In the prison yard this box spends 54-57 ms a frame in heap slots the title copied, against the 5090 box's 17 ms (about 35,000 slots made a frame against 15,000), and its title threads wait 254-274 ms on the heaps' lock.

  • #3265: merges onto that tree. A-B-A-B (2 control runs, 3 with the PR): the title frame is 376.4 ms on the control means against 377.2 ms with the PR. The sync, the writers' wait and the picture are unchanged (details on the PR).
  • #3522: conflicts with the tree's merge of #2940 (the bindless reverse index), which reworked the same census structures, so it needs a port before it can be measured there.
  • #3055: about 3,000 lines in conflict in descriptor/host.rs and shadow.rs against that tree, so it needs a port too.
  • Also on this box: taking the sync off the submitting thread with a kept thread (neonbyte1/VIctory#146, behind a switch) cuts preparing by 35-45 ms. But the frame does not move, because the title's view writers wait correspondingly longer on the same lock. Here the frame follows the total holds on the heaps' lock, whoever takes them.

AI-assisted (Claude), posted for zed6000; counts and times from VIctory's own report lines; no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7259893360 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/3425#issuecomment-7259893360). Originally posted by [zed6000](https://github.com/zed6000) on 2026-11-29T17:41:53Z. --- **The heap-sync PRs on an RX 7900 XTX** (native Windows, AMD driver 32.0.32029.2010, Ryzen 9 7900X3D), measured on the neonbyte1/VIctory integration tree `8d9b82fd9` (neonbyte1/VIctory#64). In the prison yard this box spends **54-57 ms a frame** in `heap slots the title copied`, against the 5090 box's 17 ms (about 35,000 slots made a frame against 15,000), and its title threads wait 254-274 ms on the heaps' lock. - **#3265:** merges onto that tree. A-B-A-B (2 control runs, 3 with the PR): the title frame is 376.4 ms on the control means against 377.2 ms with the PR. The sync, the writers' wait and the picture are unchanged (details on the PR). - **#3522:** conflicts with the tree's merge of #2940 (the bindless reverse index), which reworked the same census structures, so it needs a port before it can be measured there. - **#3055:** about 3,000 lines in conflict in `descriptor/host.rs` and `shadow.rs` against that tree, so it needs a port too. - **Also on this box:** taking the sync off the submitting thread with a kept thread (neonbyte1/VIctory#146, behind a switch) cuts preparing by 35-45 ms. But the frame does not move, because the title's view writers wait correspondingly longer on the same lock. Here the frame follows the total holds on the heaps' lock, whoever takes them. _AI-assisted (Claude), posted for zed6000; counts and times from VIctory's own report lines; no game data shared._
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory#3425
No description provided.