perf: under Wine, land copy-back by reading into title memory #276
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!276
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-276"
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?
@Anzymanz on GitHub · 2026-11-26 00:01 UTC · original
Anzymanz:perf/wine-land-by-read→main· +97 −5 · 3 files · 2 commits · closed without mergingWhat
Under Wine/Proton,
write_mapped(copy-back: putting what shaders wrote back into title memory) now lands the bytes with a read into title memory (ReadProcessMemoryon our own process, from the host copy) instead ofNtWriteVirtualMemory. On Windows nothing changes.VICTORY_DIRECT_WRITESkeeps working and gains a value:read(new default there)1, as before1NtWriteVirtualMemory0WriteProcessMemoryreadWhy
In Wine,
NtWriteVirtualMemoryalways makes a wineserver request, even for the current process: the bytes go through the request socket and wineserver writes them withprocess_vm_writev.NtReadVirtualMemoryon the current process is amemmoveinside the process, under an exception guard. Both refuse an unmapped page the same way, sowrite_mapped's 64 KiB / 4 KiB fallback over holes keeps working (tested).Measurements (GE-Proton11-14, RX 9070 XT, RADV; measured)
Microbenchmark, own process, per call:
NtWriteVirtualMemorymemcpyThe title in its open world, first 180 s, same save, same scene (diagnostics host lines; medians):
NtWriteVirtualMemory(3 runs)Tests
host::write_way_tests::wine_lands_by_reading_unless_told_otherwise: mode selection.host::write_way_tests::every_landing_writes_mapped_pages_and_skips_holes: every mode writes the committed pages and skips a reserved, uncommitted hole.Both pass under Proton (
proton runinprefix victory_gpu-*.exe host::). Thereleaseanddiag --features diagnosticsbuilds ofvictorysucceed (cargo-xwin).descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewedfails under Proton both with and without this change; it is not touched here.cargo xtask policy: ok.Note
On upstream VIctory,
write_mappedalready lands throughread(). This brings the AnyXboxX copy back in line under Wine, while keepingNtWriteVirtualMemoryas the default on Windows, where it was measured (run 24).Docs:
VICTORY_DIRECT_WRITESrow indocs/running-gta6.mdanddocs/fr/lancer-gta6.md.AI assistance: written with Claude (Anthropic, Claude Code); measurements run and checked on my own machine.
🇫🇷 Sous Wine/Proton, le retour de copie passe désormais par une lecture (
ReadProcessMemorysur notre propre processus) au lieu deNtWriteVirtualMemory, qui fait toujours un aller-retour au wineserver sous Wine. Sous Windows rien ne change. Mesuré : retour de copie de 246–277 ms à 116 ms par image pour ~74 Mo, image de ~1130 à 833 ms.VICTORY_DIRECT_WRITES=1garde l'ancien comportement. Tests et documentation EN/FR inclus. Rédigé avec l'aide de Claude (IA).🤖 Generated with Claude Code
@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 00:02 UTC · original · edited 2026-11-26 00:04 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
b49127cℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@LooperSalty on GitHub · 2026-11-26 14:01 UTC · original
This PR now conflicts with main in
third_party/victory/crates/victory-gpu/src/host.rs. Please rebase on main, re-check the Wine copy-back change against the current code, runcargo testfor the crate and force-push your branch.🤖 Generated with Claude Code
@Anzymanz on GitHub · 2026-11-27 01:28 UTC · original
Thanks for the ping. I re-checked the change against current
main, and it is superseded, so I'm closing this rather than rebasing it.On
main(the Vice-Tay base),write_mappedlands copy-back throughcrate::safecopy::copy: one in-processrep movsbwhose faults the watch handler takes. It is on by default (VICTORY_SAFE_COPY), and it never goes through the kernel. This PR replaced a wineserver round trip (NtWriteVirtualMemory) withReadProcessMemory. On the new base it would only change theVICTORY_SAFE_COPY=0fallback, which isn't worth the extra mode or the docs line.Not done: no re-measure on the new base and no
cargo testthere, since the code it changed is no longer on the default path. The numbers in the description (GE-Proton11-14: 118 us per 64 KiB written against 19 us read) were measured on the old base only.Written with Claude Code.
Pull request closed