GPU: cut the per-frame copy and pipeline-library churn #363
No reviewers
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!363
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-363"
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?
@meeyao on GitHub · 2026-11-24 23:56 UTC · original
meeyao:linux-copy-perf→main· +175 −18 · 5 files · 7 commits · openChanges from the Linux/Proton run, where the frame is host-side copies and waits (the GPU is ~10% busy):
NtReadVirtualMemoryinstead of a kernel copy per call;memcpycommitted ranges instead of a kernel copy per call;VirtualQueryonly for large reads, and count whatmemcpymoves;The last two pipeline-library commits are Pablo Barros' from Pablo-Barros/VIctory#1683. The zero-padding fix from that series is deliberately left to #238.
Measured on the RTX 3070 host: world frames 0.3–0.5 fps, 2.1–3.6 s/frame; copies 1.1–2.1 s;
copied whole (memory not watched): 0.0 ms/frame; the library logs oncerefuses a mesh pipeline it just storedand stops growing (231 MB here). Nothing in shadow is fixed by this.This is the copy/pipeline part of the original #28, split as asked.
Checked with
cargo xwin check --all-targets -p victory-gpu --target x86_64-pc-windows-msvc. Behaviour on Windows is unchanged exceptNtReadVirtualMemory, which is the same kernel pathReadProcessMemoryuses; not run in the title here.@pepezin-ai on GitHub · 2026-11-25 00:57 UTC · original
Regression on native Windows: copy back goes from ~34 ms to ~3.6 s per frame with this PR
Tested on Windows 11, AMD Ryzen 7 5700X (8C/16T), 32 GB RAM (DDR4-3200), NVIDIA RTX 5070 12 GB, Series X profile, release build.
fxceless/victory-forkmain @2119b0e+ #156 + #213 + d214807 (R9G9B9E5 stand-in),VICTORY_HOST_WAVE=32, AnyXboxX tuned settings (LATE_WAIT=3,WIDE_BACK=1,CARD_BUFFERS_MB=1024, loop limit 256).Frame-line samples (
victory_gpu::host):A build with #203 but without #363 (newer main
a803c87+ #156 + #213 + #203) averaged 2.3 fps (max 3.8) in the same scene, with copy back at ~52 ms per frame, so the copy-back regression points at #363's copy changes (NtReadVirtualMemoryreads / memcpy of committed ranges). The PR was measured under Linux/Proton; on native Windows it seems to make the copy back far slower. Maybe gate the new read path behind a switch or keep the old path on Windows.No game files or personal data in this report.
@meeyao on GitHub · 2026-11-25 01:16 UTC · original
Thanks for the measurement - this is a real regression and the numbers point straight at it.
The copy-back path in this PR writes title memory through
write_mapped, which now first asksVirtualQueryfor each piece's committed run to use a plainmemcpy. The fork's own comment records what that query costs in the title's big pools: about 2 ms per call, because it walks the page tables to the region's end. Under Wine the piece count per frame was small enough that it hid; on native Windows, at ~100 pieces a frame, 2 ms each is the 3.6 s you measured. The 34 ms base path wasNtWriteVirtualMemoryper 64 KiB piece with no query at all.Fix: gate the mapped-run/memcpy path on Wine (
ntdll!wine_get_versionpresent) and keep the kernel piece path on native Windows, where it was already the fast one. The same applies to the read side.I will push that to
linux-copy-perfand ask you to re-run the same prison-cell scene.@Jonirulah on GitHub · 2026-11-25 01:17 UTC · original
I tested this PR on native Windows, and here it makes frames about 6-15x slower than without it.
Setup
--console series-s).VICTORY_RELAY=2 VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024 VICTORY_LEAN_WINDOWS=1 VICTORY_PIPELINE_WAIT_MS=24.main(2119b0e) + #188, #270, #186, #159, #265, #97, #258, #241, #203, #261.Opening cutscene, same scene, warm pipeline library
Diagnostics build (earlier run, this PR together with #194; the regression later reproduced with #363 alone, above), per frame:
My guess, untested: the
memcpypath faults on pages we guard/write-watch, which would explain the page faults and fallbacks. I did not bisect the seven commits, so I can't say whether it's the copy commits or the pipeline-library ones. The jump in GPU time is odd, though: it may be the library change forcing mesh pipelines to be rebuilt every run, or host copies landing differently.The Proton/Linux numbers in the description may well hold there. On native Windows, though, this should probably be gated behind a switch, or kept to Wine only.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.