Windows over PCIe are not the GPU cost on an RTX 5070 Ti; the CPU side of host copies is (measurements and a proposal) #1187
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#1187
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?
@Marukooh on GitHub · 2026-11-25 23:11 UTC · original
Host copies of title memory: the windows outside buffers are not why the card is slow on an RTX 5070 Ti, and what the CPU side costs
The test
VICTORY_CARD_WINDOWS_MBdefaults to 0, so windows of title memory outside buffers (vertices, indices and constants from the title's allocator) stay in the PC's memory and shaders read them over PCIe. I ran the same build withVICTORY_TEXTURE_DROP_MIPS=1(to leave room) at0and at3072, 70 s each, in the prologue (2,500-6,000 draws a frame, pipelines ready; RTX 5070 Ti, Proton, vkd3d-proton):The windows did go to the card (+259 copies, +1,076 MB), but GPU time did not drop. On this card the PCIe reads of windows are not what the ~110 ms of GPU time is made of. Preparing went down by about 23 ms, but on five windows with different camera angles that is not settled.
Where a frame went before hoisted clamps (228 ms,
0b0074e+ local work)With the argument clamps hoisted the card is down to about 50-58 ms a frame. The frame (about 155 ms) is now this CPU side: preparing about 80 ms and copy-back about 50 ms.
A proposal
Each of these costs grows with the memory a submission names, not with the memory that changed. Ideas, in the order I would measure them:
SLOT_FAULTS, andmemory.rsitself suggests "a dirty-page mask written by the shader". With one store more per buffer store (dirty[page] = 1, or appended once per page), each submission knows exactly which 64 KiB pages it wrote. The hash and compare passes, the "before" twins and the assumption that shaders write only declared ranges would go. Writes through UAVs picked from the heap by index would be seen too.OpenExistingHeapFromAddress1is in vkd3d-proton) instead of a CPU memcpy.Measurements that would decide them: the share of fetched pages the CPU actually reads before the GPU writes them again, and the bytes declared written per submission against the pages actually written.
Related: #1184 (hoisted clamps), #1186 (per-call ranking of hot shaders).
@BitWuehler on GitHub · 2026-11-26 00:01 UTC · original
Can confirm the exact same behavior on an RTX 5080 (16 GB, GE-Proton + vkd3d-proton) in world frames:
VICTORY_WINDOW_UPLOAD=1+VICTORY_CARD_WINDOWS_MB=256placed 57 windows (248 MB) into the GPU upload heap and turned down 1,152 for the 80% card room cap.preparinghalved (122.1 ms -> 59.1 ms,copies 84.8 -> 43.8 ms,copying back 84.4 -> 44.8 ms), but card busy jumped from ~70% to 98% (12.8 msidle) and median FPS dropped from4.0 fps(peak8.6) down to1.1 fps(peak2.8).Note: Log analysis and write-up were AI-assisted based on local runtime measurements.
@spk-c on GitHub · 2026-11-26 01:08 UTC · original
We have two small, independent contributions to the CPU-side copy path, rather than changing memory placement or skipping writes:
All three isolated contributions passed fork CI against the corrected baseline. They are not evidence of a frame-time improvement: no controlled runtime A/B, no change to the amount of data copied, and no claim that moving windows into VRAM helps. The next useful measurement is command count and phase time under matched workloads, alongside correctness. AI-assisted implementation and analysis.
@HLVM04 on GitHub · 2026-11-26 01:26 UTC · original · edited 2026-11-26 17:25 UTC
A Windows data point for the "the CPU side, not the card, is the frame" reading, same card (RTX 5070 Ti, Ryzen 7 9800X3D, Series S profile, native D3D12):
9376fd6stack (+ #798 #783 #799 #780 #770 #827), means after 60 s were 90 ms preparing, 43 ms on the GPU and 69 ms copying back, p50 149 ms. On our current stack the card is waited for about 1 ms a frame; the frame is CPU-bound.VICTORY_MERGE_RUNSto 65536 instead was slower (119 ms).VICTORY_SKIP_WC_BACK=1(#868) took our copy-back from 18 to 2 mswith nothing visibly brokenin 2 runs of 200 s (see the correction below). But about 17% of title buffer copies then read write-combined memory whose shader writes never come back, so they read stale bytes. So an owner-per-page scheme would also need to cover the title buffer copies the layer runs on the CPU, not only the title's own CPU reads.Few runs each, scene variance applies.
Edit (2026-11-26), correction: on our stack
VICTORY_SKIP_WC_BACK=1does break the picture: the room's lamp light goes missing and rooms render dark. Our earlier runs were judged only by the character, not by the room lighting, so the "nothing visibly broken" above was wrong. Whether the stale title buffer copies are the cause is not checked.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.
@Marukooh on GitHub · 2026-11-26 17:34 UTC · original
Two local Series X follow-ups on RTX 5070 Ti / Proton, with warm pipelines:
The focused readback and alias follow-ups are in #1348 and #1346.