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) #1253

Open
opened 2026-11-26 03:16:38 +00:00 by Yorivel · 2 comments
Yorivel commented 2026-11-26 03:16:38 +00:00 (Migrated from github.com)
Contributor

Imported from fxceless/victory-fork. Originally posted by Yorivel on 2026-11-26T03:16:38Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6618730388 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/1256). Originally posted by [Yorivel](https://github.com/Yorivel) on 2026-11-26T03:16:38Z. --- *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.
HLVM04 commented 2026-11-26 03:25:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from fxceless/victory-fork. Originally posted by HLVM04 on 2026-11-26T03:25:59Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7181714382 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/1256#issuecomment-7181714382). Originally posted by [HLVM04](https://github.com/HLVM04) on 2026-11-26T03:25:59Z. --- 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.
KyleS98 commented 2026-11-26 23:07:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from fxceless/victory-fork. Originally posted by KyleS98 on 2026-11-26T23:07:23Z.


Same block, same waits, on another card, plus two more fixes that failed and one measurement of what the waits cost. In case it saves someone the runs.

Setup. RTX 3090 Ti 24 GB, Ryzen 9 9950X3D, 64 GB, Windows 11 26200. Tree: #994's head (with #854/#993) + #911 + #868 + the descriptor part of #1117 and some changes of ours (integration/v8). Series S profile, the ray-tracing resolve shaders skipped (the rt_off_hashes.txt list of #1268), structure builder off, RELAY=2, JOIN_PARTS=1, small buffers on the card. Prologue cell, hands-off, 5 to 6 minute runs, one run per row.

What the waits cost here. 53 ms a frame. The submitting thread prepares for about 32 ms and stands waiting for the card 15 ms; the card runs about 38 ms a frame (the title's lists 28, our send-and-hash lists 4.5, our compare lists 5.5) and is idle 14 to 17 ms "behind us". A counter on the submissions that wait says where that idle time is:

submissions that waited for flights whose memory they read: 2.1 per frame, of 54 lists each; the first step that waits is in list 30 of them on average; from the wait's end to the card 6.3 ms each (13.3 ms a frame with nothing for the card to run)

So the frame is about the card's work plus the preparing of those two submissions, during which the card has just finished everything.

The block. As you describe: fill_ahead turns itself off on a fill of 2,048 bytes of write-combining memory that shaders rewrite (first changed byte at offset 4 or 16), and from then on the title's 2 KiB copy from the same place into a ring waits, twice a frame ("title memory read: by a buffer copy 1.9, by a fill 0.2").

tried frame result
as it is 53.3 ms picture right
fills never go back to waiting (a local VICTORY_FILL_WAIT=never) 45.5 ms no settles, card 70 → 82 % busy; a dark, stepped smear on the cell's left wall in every frame (looks like #1223)
the waiting submission is prepared BEFORE its wait, and only the copies and fills that read such memory (and what depends on a held copy) run after it 50 ms the same smear: other steps of that submission need the flights landed too, the wait protects more than the copies and fills
VICTORY_JOIN_MOST=1 (parts not joined) 63 ms 29 submissions a frame; our send-and-hash and compare lists take 21.6 ms of card time instead of 10
VICTORY_JOIN_MOST=8 VICTORY_JOIN_LISTS=96 58 ms 6 submissions; the card is idle 20.8 ms a frame, the waiting submissions being larger
VICTORY_WIDE_REFRESH=1 53–54 ms no change
VICTORY_SKIP_WC_COMPARE=1 with copies under 1 MiB left alone 60–62 ms then (before a later change), no change pieces compared 10,769 → 4,136, passes 388 → 338
render scale 0.5 (#1323) 51.6 ms the title's lists 27.9 → 26.9 ms of card time: they are not bound by pixels here

The 45.5 ms row is what a fix that keeps those bytes on the card could gain on this card; nothing cheaper worked here either.

A side finding from the unjoined run: on our tree the print on the back of the shirt is missing in the cell with parts joined and there with JOIN_MOST=1. Joined parts are prepared together, so a later part's texture refresh reads title memory before an earlier part's texture read-back has landed. Not joining a part behind parts whose shader-declared ranges or texture read-back ranges it reads on the CPU brings the print back for one more submission a frame (53.3 → 55 ms): f420f2a. Declared buffer ranges alone did not; the read-back ranges did. Whether fork main loses the print the same way with JOIN_PARTS=1 I have not checked.

Numbers and text only. AI-assisted (Claude Code, Claude Fable 5.2).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7205273088 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/1256#issuecomment-7205273088). Originally posted by [KyleS98](https://github.com/KyleS98) on 2026-11-26T23:07:23Z. --- Same block, same waits, on another card, plus two more fixes that failed and one measurement of what the waits cost. In case it saves someone the runs. **Setup.** RTX 3090 Ti 24 GB, Ryzen 9 9950X3D, 64 GB, Windows 11 26200. Tree: #994's head (with #854/#993) + #911 + #868 + the descriptor part of #1117 and some changes of ours ([`integration/v8`](https://github.com/KyleS98/VIctory-Neo/commits/integration/v8)). Series S profile, the ray-tracing resolve shaders skipped (the `rt_off_hashes.txt` list of #1268), structure builder off, `RELAY=2`, `JOIN_PARTS=1`, small buffers on the card. Prologue cell, hands-off, 5 to 6 minute runs, one run per row. **What the waits cost here.** 53 ms a frame. The submitting thread prepares for about 32 ms and stands waiting for the card 15 ms; the card runs about 38 ms a frame (the title's lists 28, our send-and-hash lists 4.5, our compare lists 5.5) and is idle 14 to 17 ms "behind us". A counter on the submissions that wait says where that idle time is: > submissions that waited for flights whose memory they read: 2.1 per frame, of 54 lists each; the first step that waits is in list 30 of them on average; from the wait's end to the card 6.3 ms each (13.3 ms a frame with nothing for the card to run) So the frame is about the card's work plus the preparing of those two submissions, during which the card has just finished everything. **The block.** As you describe: `fill_ahead` turns itself off on a fill of 2,048 bytes of write-combining memory that shaders rewrite (first changed byte at offset 4 or 16), and from then on the title's 2 KiB copy from the same place into a ring waits, twice a frame ("title memory read: by a buffer copy 1.9, by a fill 0.2"). | tried | frame | result | |---|---|---| | as it is | 53.3 ms | picture right | | fills never go back to waiting (a local `VICTORY_FILL_WAIT=never`) | 45.5 ms | no settles, card 70 → 82 % busy; **a dark, stepped smear on the cell's left wall in every frame** (looks like #1223) | | the waiting submission is prepared BEFORE its wait, and only the copies and fills that read such memory (and what depends on a held copy) run after it | 50 ms | **the same smear**: other steps of that submission need the flights landed too, the wait protects more than the copies and fills | | `VICTORY_JOIN_MOST=1` (parts not joined) | 63 ms | 29 submissions a frame; our send-and-hash and compare lists take 21.6 ms of card time instead of 10 | | `VICTORY_JOIN_MOST=8 VICTORY_JOIN_LISTS=96` | 58 ms | 6 submissions; the card is idle 20.8 ms a frame, the waiting submissions being larger | | `VICTORY_WIDE_REFRESH=1` | 53–54 ms | no change | | `VICTORY_SKIP_WC_COMPARE=1` with copies under 1 MiB left alone | 60–62 ms then (before a later change), no change | pieces compared 10,769 → 4,136, passes 388 → 338 | | render scale 0.5 (#1323) | 51.6 ms | the title's lists 27.9 → 26.9 ms of card time: they are not bound by pixels here | The 45.5 ms row is what a fix that keeps those bytes on the card could gain on this card; nothing cheaper worked here either. **A side finding from the unjoined run:** on our tree the print on the back of the shirt is missing in the cell with parts joined and there with `JOIN_MOST=1`. Joined parts are prepared together, so a later part's texture refresh reads title memory before an earlier part's texture read-back has landed. Not joining a part behind parts whose shader-declared ranges or texture read-back ranges it reads on the CPU brings the print back for one more submission a frame (53.3 → 55 ms): [f420f2a](https://github.com/KyleS98/VIctory-Neo/commit/f420f2a). Declared buffer ranges alone did not; the read-back ranges did. Whether fork main loses the print the same way with `JOIN_PARTS=1` I have not checked. Numbers and text only. AI-assisted (Claude Code, Claude Fable 5.2).
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
fxceless/victory-fork#1253
No description provided.