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
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#1256
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@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:
main085ee7c+ #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=1and 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
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")
What they read, from
fill_check: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.fill_aheadturned 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."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)
VICTORY_CB_DIRECT, afterroot_viewandcopy_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.VICTORY_MERGE_RUNS=8192. "Changed under" went to 0, but "title memory read" rose to 274 ms; frames of 390 ms to 2 s.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_STEPSdoes (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 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
0b0074eplus several open PRs (not your tree):VICTORY_MERGE_RUNSto 65536 was slower for us too (119 ms median against 101), which matches what you saw with 8192.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.