RTX 4090: ~70 ms of a 153 ms frame is the submitting thread waiting, from the skinning passes' whole-heap declaration (frame critical path, three failed fixes) #1256

Open
opened 2026-11-26 04:00:31 +00:00 by github-bot · 1 comment
Owner

@⁠Yorivel on GitHub · 2026-11-26 03:16 UTC · original

AI-assisted (Claude Code). Numbers and log lines only, no game data.

RTX 4090: ~70 ms of a 153 ms frame is the submitting thread waiting for flights, and almost all of it traces back to one thing. The skinning passes' view covers the title's whole 174 MB heap, so every CPU-side fill, copy and refresh in that heap waits for them. Three cheaper fixes tried here failed; numbers below so nobody repeats them.

Setup. RTX 4090 24 GB (32-lane waves), driver 621.40, i9-14900K, 64 GB, Windows 11, Series X profile, diagnostics build, the barracks after the hand-off, settled. Tree: main 085ee7c + #994 (with #854/#993) + #346 (named windows declared only when marked) + #500 + #501 + #1188. Structure builder on, RELAY=2, VICTORY_BACK_QUIET=1 + VICTORY_BACK_OWN_VIEW=1 and the README's speed set. 153-168 ms a frame (6.0-6.4 fps), 0 exceptions.

The frame, from the frame log's "usual frame" line

ms a frame
render thread, in the present call 152
submitting thread: preparing 71
submitting thread: waiting for the card 69
card busy: title lists 82, our send-and-hash 20, compare 10 ~112
card idle (36.5 of it "behind us") 39

The submitting thread and the card take turns, and each waits for the other.

Why the thread waits ("of the waiting for the card in settles, by what settled")

reason settles a frame ms a frame
title memory read (1 buffer copy, 2 fills of upload memory) 3.0 49.9
title memory changed under shader writes 0.6 21.1
everything else 0 0

What they read, from fill_check:

  • The copy: 2 KiB from a fixed place (0xdc07ea300 / 0xdc07eab00) to a new place in a ring (0xd1f3…) every frame. Every check found 1-7 source bytes changed by the flights and 0 destination bytes, so the wait was needed for its source.
  • The fills: fill_ahead turned itself off for good at frame 1127, on that same block: "a fill of upload memory read 2048 bytes at 0xdc07eab00 … ahead of a flight whose shaders changed them … Fills wait for good."
  • The flights: they declare the whole heap because of the skinning passes' view (avatarmanz's card_steps notes name it: dispatches 17af15c4015cb4b6, 55679a0547649d0b, … through the view at offset 5920 of the bindless table). Every fill, copy or refresh anywhere in the heap collides with them.

Tried and failed (all local experiments, off by default)

  1. Table constant buffers read the heap's host copy in place, and copies inside that copy run on the card (VICTORY_CB_DIRECT, after root_view and copy_on_card). The read settles fell 49.9 → 21.2 ms. But "changed under shader writes" rose 21.1 → 40.1 and preparing 71 → 87: each constant now needs a refresh of the title's CPU-written bytes, under the same declaration. Frame 153 → 171-184 ms.
  2. The same + VICTORY_MERGE_RUNS=8192. "Changed under" went to 0, but "title memory read" rose to 274 ms; frames of 390 ms to 2 s.
  3. Waits count a huge declared range (≥ 16 MB) only on its 64 KiB pages a landing changed in the last 8 frames (VICTORY_NARROW, with 64 frames of learning first and a safety net). The safety net fired every time narrowing came on (frames 3148 and 3212, new pages each time). The passes' writes move through the heap, so recent pages don't predict the next frame. A GPU-side page mask would only say where writes landed after the fact, so it would not help either.

What that leaves

The bytes that cause the waits are pure card-to-card data: shaders write them, and a constant buffer and a copy that later shaders read take them in. The title's CPU never reads them. Only taking those steps off the CPU removes the wait: running them on the card in queue order, as avatarmanz/VIctory-7900XTX's VICTORY_CARD_STEPS does (its notes measured the same wait at 25-30 ms of a 105 ms frame on AMD). Its version depends on much of that fork's submission pipeline. On this 4090, that tree with card steps on and gomeaw's descriptor fixes ran 203-245 ms a frame without the builder, so card steps alone don't close the gap on NVIDIA either.

What I can provide: the frame logs, and the three experiments as patches, if any of it helps.

**@⁠Yorivel** on GitHub · 2026-11-26 03:16 UTC · [original](https://github.com/fxceless/victory-fork/issues/1256) *AI-assisted (Claude Code). Numbers and log lines only, no game data.* **RTX 4090: ~70 ms of a 153 ms frame is the submitting thread waiting for flights, and almost all of it traces back to one thing. The skinning passes' view covers the title's whole 174 MB heap, so every CPU-side fill, copy and refresh in that heap waits for them. Three cheaper fixes tried here failed; numbers below so nobody repeats them.** **Setup.** RTX 4090 24 GB (32-lane waves), driver 621.40, i9-14900K, 64 GB, Windows 11, Series X profile, diagnostics build, the barracks after the hand-off, settled. Tree: `main` `085ee7c` + #994 (with #854/#993) + #346 (named windows declared only when marked) + #500 + #501 + #1188. Structure builder on, `RELAY=2`, `VICTORY_BACK_QUIET=1` + `VICTORY_BACK_OWN_VIEW=1` and the README's speed set. 153-168 ms a frame (6.0-6.4 fps), 0 exceptions. ## The frame, from the frame log's "usual frame" line | | ms a frame | |---|---| | render thread, in the present call | 152 | | **submitting thread: preparing** | **71** | | **submitting thread: waiting for the card** | **69** | | card busy: title lists 82, our send-and-hash 20, compare 10 | ~112 | | card idle (36.5 of it "behind us") | 39 | The submitting thread and the card take turns, and each waits for the other. ## Why the thread waits ("of the waiting for the card in settles, by what settled") | reason | settles a frame | ms a frame | |---|---|---| | title memory read (1 buffer copy, 2 fills of upload memory) | 3.0 | **49.9** | | title memory changed under shader writes | 0.6 | 21.1 | | everything else | 0 | 0 | What they read, from `fill_check`: - **The copy:** 2 KiB from a fixed place (`0xdc07ea300` / `0xdc07eab00`) to a new place in a ring (`0xd1f3…`) every frame. Every check found 1-7 source bytes changed by the flights and 0 destination bytes, so the wait was needed for its source. - **The fills:** `fill_ahead` turned itself off for good at frame 1127, on that same block: *"a fill of upload memory read 2048 bytes at 0xdc07eab00 … ahead of a flight whose shaders changed them … Fills wait for good."* - **The flights:** they declare the whole heap because of the skinning passes' view (avatarmanz's card_steps notes name it: dispatches `17af15c4015cb4b6`, `55679a0547649d0b`, … through the view at offset 5920 of the bindless table). Every fill, copy or refresh anywhere in the heap collides with them. ## Tried and failed (all local experiments, off by default) 1. **Table constant buffers read the heap's host copy in place, and copies inside that copy run on the card** (`VICTORY_CB_DIRECT`, after `root_view` and `copy_on_card`). The read settles fell 49.9 → 21.2 ms. But "changed under shader writes" rose 21.1 → 40.1 and preparing 71 → 87: each constant now needs a refresh of the title's CPU-written bytes, under the same declaration. Frame 153 → 171-184 ms. 2. **The same + `VICTORY_MERGE_RUNS=8192`.** "Changed under" went to 0, but "title memory read" rose to 274 ms; frames of 390 ms to 2 s. 3. **Waits count a huge declared range (≥ 16 MB) only on its 64 KiB pages a landing changed in the last 8 frames** (`VICTORY_NARROW`, with 64 frames of learning first and a safety net). The safety net fired every time narrowing came on (frames 3148 and 3212, new pages each time). The passes' writes move through the heap, so recent pages don't predict the next frame. A GPU-side page mask would only say where writes landed after the fact, so it would not help either. ## What that leaves The bytes that cause the waits are pure card-to-card data: shaders write them, and a constant buffer and a copy that later shaders read take them in. The title's CPU never reads them. Only taking those steps off the CPU removes the wait: running them on the card in queue order, as avatarmanz/VIctory-7900XTX's `VICTORY_CARD_STEPS` does (its notes measured the same wait at 25-30 ms of a 105 ms frame on AMD). Its version depends on much of that fork's submission pipeline. On this 4090, that tree with card steps on and gomeaw's descriptor fixes ran 203-245 ms a frame without the builder, so card steps alone don't close the gap on NVIDIA either. What I can provide: the frame logs, and the three experiments as patches, if any of it helps.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:00:31 +00:00
Author
Owner

@⁠HLVM04 on GitHub · 2026-11-26 03:25 UTC · original · edited 2026-11-26 17:25 UTC

One data point on the "changed under shader writes" part (your 21.1 ms row and experiment 2), from an RTX 5070 Ti, Ryzen 7 9800X3D, Windows 11, Series S profile, on a local stack based on fork main 0b0074e plus several open PRs (not your tree):

  • In our runs those settles came from the merge run cap: about 60,000 runs of 3 bytes a frame hit it.
  • Raising VICTORY_MERGE_RUNS to 65536 was slower for us too (119 ms median against 101), which matches what you saw with 8192.
  • What worked here was a local change of ours that defers merges that hit the cap to the next submission instead of settling: the "changed under shader writes" settles went away and the median went 101 -> 91 ms.

Limits: a handful of runs, a different scene and card, and it does nothing for your larger 49.9 ms "title memory read" row. The change is not a PR.

Edit (2026-11-26), correction on the merge deferral: the local "defer merges past the run cap to the next submission" change above made draws read stale bytes: over-budget title changes under shader-written ranges landed a submission late (with ray tracing on, the main character's skin draw lost its geometry). Please don't copy it as described. Our replacement merges every run at once and joins nearby runs (gap of 64 bytes); it is as fast on our stack (in-world ~45–46 ms) and the skin draw is back with ray tracing on. Exact merging without the gap was ~300 ms a frame. The 101 → 91 ms figure above was for the old, deferring version.

**@⁠HLVM04** on GitHub · 2026-11-26 03:25 UTC · [original](https://github.com/fxceless/victory-fork/issues/1256#issuecomment-7181714382) · edited 2026-11-26 17:25 UTC One data point on the "changed under shader writes" part (your 21.1 ms row and experiment 2), from an RTX 5070 Ti, Ryzen 7 9800X3D, Windows 11, Series S profile, on a local stack based on fork main `0b0074e` plus several open PRs (not your tree): - In our runs those settles came from the merge run cap: about 60,000 runs of 3 bytes a frame hit it. - Raising `VICTORY_MERGE_RUNS` to 65536 was slower for us too (119 ms median against 101), which matches what you saw with 8192. - What worked here was a local change of ours that defers merges that hit the cap to the next submission instead of settling: the "changed under shader writes" settles went away and the median went 101 -> 91 ms. Limits: a handful of runs, a different scene and card, and it does nothing for your larger 49.9 ms "title memory read" row. The change is not a PR. **Edit (2026-11-26), correction on the merge deferral:** the local "defer merges past the run cap to the next submission" change above made draws read stale bytes: over-budget title changes under shader-written ranges landed a submission late (with ray tracing on, the main character's skin draw lost its geometry). Please don't copy it as described. Our replacement merges every run at once and joins nearby runs (gap of 64 bytes); it is as fast on our stack (in-world ~45–46 ms) and the skin draw is back with ray tracing on. Exact merging without the gap was ~300 ms a frame. The 101 → 91 ms figure above was for the old, deferring version.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/fxceless--victory-fork#1256
No description provided.