8 GB RTX 5060: heavy mesh shaders wait on windows in host memory; windows read only through the heap never count as used (card time 57-60 -> 32 ms) #4036

Open
opened 2026-11-30 15:02:15 +00:00 by plapha · 1 comment
plapha commented 2026-11-30 15:02:15 +00:00 (Migrated from github.com)
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by plapha on 2026-11-30T15:02:15Z.


RTX 5060 8 GB, i5-14600KF, 32 GB RAM, Windows 11, driver 621.01. Series S/X profiles, heavy open-world spot (~10,000 draws per frame), frame generation off for every run below. This is a measurement for #2640, #2735 and #2098 (same shape: card "busy", SMs mostly waiting), not a PR.

Summary

  • In a captured heavy frame, mesh shaders are 53–54 % of all shader samples, and the 8 heaviest mesh shaders (about 25 % of all samples) spend about 85 % of their samples waiting on memory (long scoreboard; 60–98 % each).
  • What they wait on is geometry read over PCIe from windows in host memory: root SRVs, and buffers the shaders pick by heap index (createHandleFromHeap → rawBufferLoad).
  • The windows read only through the heap look cold to window placement, so they stay in host memory. In a census: 266 windows (1,140 MB of cells) that the mesh shaders read every frame, never counted as used.
  • With those windows counted and moved to the card (plus 256 KiB windows), the card's time for our commands at about the same draw count went from 57–60 ms to 32 ms per frame, and the submit thread's wait on the card from 7.7 ms to 0.

The data is from an older base (VIctory-NVIDIA 63b902f plus PRs ported on Nov 29) with a local hot-window zone that is not upstream. The upstream part is in "On main" below: it comes from reading the code and is not measured on main.

1. Where the card's time goes

Nsight Graphics 2026.4 GPU Trace, one frame, real-time shader profiler:

  • Whole frame: SM throughput 10 %, L2 6 %, VRAM bandwidth 6.5 %, PCIe 12 %. About 6 warps per SM on average (48 possible). NVIDIA's own DLSS pass on the same card reaches 24.6 warps and 40 % SM, so the hardware is fine.
  • Stall reasons: long scoreboard is 67 % of all stall samples. Weighted by each shader's top reason, it is 91 %. There are no local-memory stalls (no register spills).
  • About 5.5 % of L2 requests go to host memory, and 85 % of those miss. PCIe read is 146–230 MB per frame.

The 8 heaviest mesh shaders, matched to the Xbox originals by instruction sequence (similarity ≥ 0.995):
MSNC_VS_CascadeShadows_drawskinnedTexture, Transform_PositionOnly / CascadeShadows_draw, TransformSkinD, TransformD, LinearDepthSkin, PropFoliageSkinDeferred, TransformSkinD_DetailMapsOff_NoDeform, Cable.

  • The translation is not what makes them slow. Register counts are not inflated (e.g. CascadeShadows: original wave64, 116 VGPR + 98 SGPR; on NVIDIA 200 registers, live peak 194). Recognisable emulation code (scalar copies, 64-bit math) is ≤ 1.3 % of samples.
  • Transform_PositionOnly has only 48 registers and ~40 warps, and still spends 98 % on long scoreboard. Occupancy is enough; the reads are slow.
  • The waits come from dependent chains: user-data constant → heap index → meshlet header → index tables (×4) → 64-byte records (bone/instance matrices), plus loops over 80-byte records. In the one shader whose source/profile pairing I verified, 85.6 % of the waited values come from rawBufferLoad.

A D3D12 microbenchmark on the same card, a 64 MB dependent random chain:

VRAM host memory (L0 custom heap)
different address per thread 3.3 ms 310–380 ms (~100×)
same address per group 0.15 ms 2.3–2.7 ms (~16×)

Splitting reads into 4-byte loads versus 16-byte loads made less than 1 % difference, and per-command overheads (ExecuteIndirect, pipeline/table changes) add up to about 1 ms per frame. So it is neither split loads nor command count. It is serial reads over the bus.

2. The windows that look cold

The census counts the copies shaders can reach by heap index, at the same spot (heap census line, diagnostics build):

count cells bytes views cover
title-made buffers, in VRAM 3,413 685 MB 685 MB
windows, in VRAM 386 1,572 MB 962 MB
windows, in host memory, never named by a draw 266 1,140 MB 371 MB
windows, in host memory, hot but over budget 18 72 MB 33 MB

Placement counts a window as used when a draw names it (root views and so on). The heap buffer pass refreshes the windows that heap slots show without counting them. A window that the mesh shaders reach only through the heap therefore never qualifies, however often it is read.

Moving the root-SRV windows alone confirms this. In three heavy mesh shaders, the share of samples waiting on root SRVs fell from 13 / 13 / 52 % to 5 / 5 / 21 %. The heap-index share barely moved: 34 / 41 / 29 % → 31 / 29 / 27 %.

3. What changed it

All three changes were tested together, so their separate effects are not known:

  1. The heap buffer pass counts the windows it refreshes as used (about 40 lines on our local zone).
  2. VICTORY_WINDOW_KB=256 + VICTORY_WINDOW_TAILS=1: cells went from ~2,780 to ~1,640 MB for these windows.
  3. More windows moved per frame (256 instead of 16), because there were ~5,000 windows after the cut.

Results:

  • Never-named windows in host memory: 266 → 0. With a 3 GB zone, 4,811 heap windows (1,580 MB) sat in VRAM and 306 (109 MB) stayed out, held back by the zone's budget line.
  • Card time per frame, timestamp on every command (VICTORY_GPU_TIMES=1, same analysis):
before (~11k draws) after (~10–10.5k draws)
all our commands 57–60 ms 32 ms
indirect draw, per command 3.89 µs 1.84–1.92 µs
mesh, per command 4.2 µs 2.5 µs
dispatch, per command 7.4 µs 4.9–5.9 µs
submit thread waiting on the card 7.7 ms 0 ms
  • Without timing, the frame is now set by the submit thread (~46 ms to prepare, as in #2098): 13.1–14.6 fps at ~10k draws, against 12.2–12.9 before.
  • A smaller, earlier A/B without the heap fix: +600 MB of hot windows in VRAM cut PCIe read per frame by 35–44 % and gave +7–14 % fps.
  • The submit thread's preparation did not get worse with seven times as many windows (45–48 ms, against 48–52 ms).

On main (c71899d): code reading, not measured

  • CARD_WINDOWS_LATE (#1756/#3574) moves windows by Shadow::frames. That counter is bumped in shadow::loose(), i.e. when a window is looked up.
  • heap_buffer_pass keeps each slot's copy from pass to pass. It looks slots up again only when they are written, and all of them once every HEAP_ROUND (16) passes. Every other pass it calls refresh on the kept copy, which does not touch frames.
  • So a window that the shaders reach only through the heap seems to collect a frame count at most once every 16 passes, while draw-named windows collect one every frame. If that reading is right, these windows would sort last for LATE and lose to idle draw-named windows under CARD_WINDOWS_IDLE_MS.
  • The 8 GB budget tier's default window room is 0, so on 8 GB cards none of this gets to the card by default. My numbers above suggest that on 8 GB cards those few hundred MB matter more than anything else on the card side.

Limits

  • One PC, one spot, runs of 2–3 minutes. I did not drive or play long with these changes. Pictures looked normal, but nobody checked them closely.
  • The "after" run had the texture pool capped (VICTORY_TEXTURE_BUDGET_MB=1024, which removed about 0.8 GB of textures). Without the cap, windows and textures fight for the last ~0.7 GB of an 8 GB card, and there is no rule for who wins.
  • The baseline run had a smaller budget (see side note), so part of the before/after gap may come from that.
  • Per-command times come from a diagnostics build with a timestamp per command; that adds overhead, so read them as a split, not as absolute frame time.
  • After the move, mesh shaders still wait on serial reads for about half their samples. That remainder is not explained yet.

Side note: NVIDIA overlay

During these runs, NVIDIA Overlay.exe (the NVIDIA app's in-game overlay) held 3,176 MB of dedicated VRAM. After a restart it went back up to 1,136 MB within a few minutes of play. It lowered the budget Windows gave the game from 7,127 to 5,905 MB (the system changed the budget of the card's memory). This was seen on this one PC, once. It may be worth checking before reading any 8 GB measurement.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:6699271013 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/4036). Originally posted by [plapha](https://github.com/plapha) on 2026-11-30T15:02:15Z. --- **RTX 5060 8 GB, i5-14600KF, 32 GB RAM, Windows 11, driver 621.01.** Series S/X profiles, heavy open-world spot (~10,000 draws per frame), frame generation off for every run below. This is a measurement for #2640, #2735 and #2098 (same shape: card "busy", SMs mostly waiting), not a PR. ## Summary - In a captured heavy frame, **mesh shaders are 53–54 % of all shader samples**, and the 8 heaviest mesh shaders (about 25 % of all samples) spend **about 85 % of their samples waiting on memory** (long scoreboard; 60–98 % each). - What they wait on is **geometry read over PCIe from windows in host memory**: root SRVs, and buffers the shaders pick **by heap index** (`createHandleFromHeap` → `rawBufferLoad`). - The windows read **only through the heap** look cold to window placement, so they stay in host memory. In a census: **266 windows (1,140 MB of cells) that the mesh shaders read every frame, never counted as used**. - With those windows counted and moved to the card (plus 256 KiB windows), the card's time for our commands at about the same draw count went from **57–60 ms to 32 ms per frame**, and the submit thread's wait on the card from 7.7 ms to 0. The data is from an older base (VIctory-NVIDIA `63b902f` plus PRs ported on Nov 29) with a local hot-window zone that is not upstream. The upstream part is in "On main" below: it comes from reading the code and is **not measured on main**. ## 1. Where the card's time goes Nsight Graphics 2026.4 GPU Trace, one frame, real-time shader profiler: - Whole frame: SM throughput 10 %, L2 6 %, VRAM bandwidth 6.5 %, PCIe 12 %. About 6 warps per SM on average (48 possible). NVIDIA's own DLSS pass on the same card reaches 24.6 warps and 40 % SM, so the hardware is fine. - Stall reasons: long scoreboard is 67 % of all stall samples. Weighted by each shader's top reason, it is 91 %. There are no local-memory stalls (no register spills). - About 5.5 % of L2 requests go to host memory, and 85 % of those miss. PCIe read is 146–230 MB per frame. The 8 heaviest mesh shaders, matched to the Xbox originals by instruction sequence (similarity ≥ 0.995): `MSNC_VS_CascadeShadows_drawskinnedTexture`, `Transform_PositionOnly` / `CascadeShadows_draw`, `TransformSkinD`, `TransformD`, `LinearDepthSkin`, `PropFoliageSkinDeferred`, `TransformSkinD_DetailMapsOff_NoDeform`, `Cable`. - **The translation is not what makes them slow.** Register counts are not inflated (e.g. CascadeShadows: original wave64, 116 VGPR + 98 SGPR; on NVIDIA 200 registers, live peak 194). Recognisable emulation code (scalar copies, 64-bit math) is ≤ 1.3 % of samples. - `Transform_PositionOnly` has only 48 registers and ~40 warps, and still spends 98 % on long scoreboard. Occupancy is enough; the reads are slow. - The waits come from dependent chains: user-data constant → heap index → meshlet header → index tables (×4) → 64-byte records (bone/instance matrices), plus loops over 80-byte records. In the one shader whose source/profile pairing I verified, 85.6 % of the waited values come from `rawBufferLoad`. A D3D12 microbenchmark on the same card, a 64 MB dependent random chain: | | VRAM | host memory (L0 custom heap) | |---|---|---| | different address per thread | 3.3 ms | 310–380 ms (~100×) | | same address per group | 0.15 ms | 2.3–2.7 ms (~16×) | Splitting reads into 4-byte loads versus 16-byte loads made less than 1 % difference, and per-command overheads (ExecuteIndirect, pipeline/table changes) add up to about 1 ms per frame. So it is neither split loads nor command count. It is serial reads over the bus. ## 2. The windows that look cold The census counts the copies shaders can reach by heap index, at the same spot (`heap census` line, diagnostics build): | | count | cells | bytes views cover | |---|---|---|---| | title-made buffers, in VRAM | 3,413 | 685 MB | 685 MB | | windows, in VRAM | 386 | 1,572 MB | 962 MB | | **windows, in host memory, never named by a draw** | **266** | **1,140 MB** | **371 MB** | | windows, in host memory, hot but over budget | 18 | 72 MB | 33 MB | Placement counts a window as used when a draw names it (root views and so on). The heap buffer pass refreshes the windows that heap slots show **without counting them**. A window that the mesh shaders reach only through the heap therefore never qualifies, however often it is read. Moving the root-SRV windows alone confirms this. In three heavy mesh shaders, the share of samples waiting on root SRVs fell from 13 / 13 / 52 % to 5 / 5 / 21 %. The heap-index share barely moved: 34 / 41 / 29 % → 31 / 29 / 27 %. ## 3. What changed it All three changes were tested together, so their separate effects are not known: 1. The heap buffer pass counts the windows it refreshes as used (about 40 lines on our local zone). 2. `VICTORY_WINDOW_KB=256` + `VICTORY_WINDOW_TAILS=1`: cells went from ~2,780 to ~1,640 MB for these windows. 3. More windows moved per frame (256 instead of 16), because there were ~5,000 windows after the cut. Results: - Never-named windows in host memory: 266 → **0**. With a 3 GB zone, 4,811 heap windows (1,580 MB) sat in VRAM and 306 (109 MB) stayed out, held back by the zone's budget line. - Card time per frame, timestamp on every command (`VICTORY_GPU_TIMES=1`, same analysis): | | before (~11k draws) | after (~10–10.5k draws) | |---|---|---| | all our commands | 57–60 ms | **32 ms** | | indirect draw, per command | 3.89 µs | 1.84–1.92 µs | | mesh, per command | 4.2 µs | 2.5 µs | | dispatch, per command | 7.4 µs | 4.9–5.9 µs | | submit thread waiting on the card | 7.7 ms | 0 ms | - Without timing, the frame is now set by the submit thread (~46 ms to prepare, as in #2098): 13.1–14.6 fps at ~10k draws, against 12.2–12.9 before. - A smaller, earlier A/B without the heap fix: +600 MB of hot windows in VRAM cut PCIe read per frame by 35–44 % and gave +7–14 % fps. - The submit thread's preparation did not get worse with seven times as many windows (45–48 ms, against 48–52 ms). ## On main (`c71899d`): code reading, not measured - `CARD_WINDOWS_LATE` (#1756/#3574) moves windows by `Shadow::frames`. That counter is bumped in `shadow::loose()`, i.e. when a window is **looked up**. - `heap_buffer_pass` keeps each slot's copy from pass to pass. It looks slots up again only when they are written, and all of them once every `HEAP_ROUND` (16) passes. Every other pass it calls `refresh` on the kept copy, which does not touch `frames`. - So a window that the shaders reach only through the heap seems to collect a frame count at most once every 16 passes, while draw-named windows collect one every frame. If that reading is right, these windows would sort last for `LATE` and lose to idle draw-named windows under `CARD_WINDOWS_IDLE_MS`. - The 8 GB budget tier's default window room is 0, so on 8 GB cards none of this gets to the card by default. My numbers above suggest that on 8 GB cards those few hundred MB matter more than anything else on the card side. ## Limits - One PC, one spot, runs of 2–3 minutes. I did not drive or play long with these changes. Pictures looked normal, but nobody checked them closely. - The "after" run had the texture pool capped (`VICTORY_TEXTURE_BUDGET_MB=1024`, which removed about 0.8 GB of textures). Without the cap, windows and textures fight for the last ~0.7 GB of an 8 GB card, and there is no rule for who wins. - The baseline run had a smaller budget (see side note), so part of the before/after gap may come from that. - Per-command times come from a diagnostics build with a timestamp per command; that adds overhead, so read them as a split, not as absolute frame time. - After the move, mesh shaders still wait on serial reads for about half their samples. That remainder is not explained yet. ## Side note: NVIDIA overlay During these runs, `NVIDIA Overlay.exe` (the NVIDIA app's in-game overlay) held **3,176 MB of dedicated VRAM**. After a restart it went back up to 1,136 MB within a few minutes of play. It lowered the budget Windows gave the game from 7,127 to 5,905 MB (`the system changed the budget of the card's memory`). This was seen on this one PC, once. It may be worth checking before reading any 8 GB measurement.
github-actions[bot] commented 2026-11-30 15:02:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by github-actions[bot] on 2026-11-30T15:02:26Z.


Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU, Windows version (10 or 11)

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7282332544 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/4036#issuecomment-7282332544). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T15:02:26Z. --- Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU, Windows version (10 or 11)
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
trustno1-coder/VIctory-NVIDIA#4036
No description provided.