Linux/Proton on an 8-core Zen 2: thread placement is a no-op under Wine, guards cost ~20 µs each, a title thread spins on SwitchToThread #2719
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA#2719
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?
@Aiken-Project-A on GitHub · 2026-11-29 16:33 UTC · original
Setup: RTX 2060 6 GB (Turing), NVIDIA 615.78.08, Ryzen 9 4900H (8 cores / 16 threads, two 4-core CCX with 4 MB L3 each, the same layout as the console's CPU), 64 GB, Linux 7.2, Wine 11 (Proton branch,
7b3ceaf8) with the wineserver view-tree patch, vkd3d-proton master71cae091, main829188e9,VICTORY_WAVE_FOLDED=0, Series S, DLSS quality. Linux only, so there is no%LOCALAPPDATA%; log lines are at the end, and full play logs (12 MB each) on request.Two scenes per run, both from a new game:
1. Thread placement does nothing under Wine;
VICTORY_TITLE_AFFINITY=freehelps hereSetThreadSelectedCpuSetsandSetProcessDefaultCpuSetsare stubs in Wine (dlls/kernelbase/memory.c: FIXME, return TRUE), so none of the placement incores.rshappens under Proton. The title's own affinities do apply (SetThreadGroupAffinityworks): 8 workers at HIGHEST on 0–7, 11 threads on 8–12, one TIME_CRITICAL thread alone on 13. VIctory's ~40 threads float over all 16 CPUs and land on the same ones. Per-thread schedstat over 20 s at the window:fast)freeThe café is too noisy from run to run to show it (86–111 ms either way).
2. A guard costs ~20 µs on Linux, and the guards' lock is held across it
Making a block (64 KiB) read-only is an
mprotectthat has to shoot down the TLB on every CPU the process runs on, 16 here (Zen 2 has no INVLPGB).perf trace: 7,000–12,000mprotecta second, 17–23 µs on average, worst 18 ms. Diagnostics build, per frame, all threads (the "asking about title memory" line):As #2519 found, these waits are mostly parallel and off the critical path: the timeline chain has 1.6–5 ms of
VirtualProtectand 1–1.5 ms of faults a frame.VICTORY_GUARD_HOT=200and=1000cut the protection changes (window: 41–65 → 32 and 8 ms) but copied up to twice as much (café: ~50 → 100 MB a frame), and the frame did not move. On an 8-core machine the cost is the cores it takes from the title's workers (item 7 of #2415).3. A title thread spins on
SwitchToThread, and Wine makes every yield three system callsOne title thread calls
SwitchToThread~68,000 times a second, in a wait loop. Wine'sNtYieldExecutionwrapssched_yield()in twogetrusage(RUSAGE_THREAD)calls to tell whether a switch happened: 136,000 extra system calls a second. Time a title thread spends in such a loop shows on the timeline chain as "outside our spans", the same as the title's real work. A Wine build with a singlesched_yield(switch told by the elapsed time) and withNtGetWriteWatchnot holdingvirtual_mutexacross thePAGEMAP_SCANran fine in game, but moved neither the frame nor the guard numbers.4. No effect here
VICTORY_NARROW_BARRIERS=1: 94 against 93 ms at the window, picture intact.Log lines
The window, default (
VICTORY_TITLE_AFFINITYunset):The window,
VICTORY_TITLE_AFFINITY=free, the same binary:The café, diagnostics build, the guards' line (cut after "changing protections"; the "holes" and "view ranges" parts left out):
Full play logs, timelines and per-thread snapshots on request.
@github-actions[bot] on GitHub · 2026-11-29 16:33 UTC · original
Please attach both logs from the run that went wrong. Without them we can only guess. Paste
%LOCALAPPDATA%into the address bar of File Explorer to get there.%LOCALAPPDATA%\victory\logs\: the newestvictory-nvidia-play-<date>-<time>-<number>.log(fromvictory.exe) orvictory-nvidia-<date>-<time>.log(from the script launcher). The window shows its path at the start, on the lineLog: ....%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newestvictory-<date>-<time>-<number>.crash.login%LOCALAPPDATA%\VIctory\data\7952987A\temp\.Also say which GPU, Windows version (10 or 11)
@transbinaryunicorn-sys on GitHub · 2026-11-29 17:01 UTC · original · edited 2026-11-29 17:07 UTC
this was not measured with a cut scene it was ingame, but with the same scenary view going outside jason house standing on the porch looking to the sea and looking in the palms sea view around 20-23 fps palms around 16 with VICTORY_TITLE_AFFINITY=free
Data point from the other end of the scale: Xeon w7-3465X (28C/56T, Intel, single socket), RTX 5090, Linux (Nobara), driver 615.78.08, GE-Proton11-7 with view-tree wineserver, vkd3d-proton
71cae091, main829188e9(+VICTORY_CODE_TABLE_AFTER=1,VICTORY_PATCH_SSE4A=0, see #1428), DLSS off. In-game after the prologue, standing still at the same spot, median of the last 2 min ofms/framelines:asking the write watch and the guards, median)VICTORY_TITLE_AFFINITY=freetaskset -c 0-15(16 physical cores, no SMT)So
freehelps here too, a bit more than on your 8-core. My guess was that fewer CPUs means cheaper TLB shootdowns permprotect, but restricting the process to 16 cores made both the frame time and the guard time clearly worse. On this machine, contention for cores outweighs the shootdown cost; the title and VIctory's threads scale with the core count. GPU time is 0.5–1.4 ms/frame, so it's all CPU.@transbinaryunicorn-sys on GitHub · 2026-11-30 18:10 UTC · original
Follow-up from the 28-core side (Xeon w7-3465X 28C/56T, RTX 5090, Linux, current main after the 2026-11-30 merges + #4196). In-game, standing still, ~25 fps, ~40 ms/frame, GPU ~0 ms, so all CPU.
Where the frame goes (submitting thread, from the
preparing per frameline): ~30 ms in submissions, of it 15–21 ms refreshes: ~10,000 a frame in ~42 flushes, ~90 % "known to copy nothing". The frame line'scopiesis 18–21 ms for 50–70 MB, i.e. a flat ~3 GB/s.What I tried, and what didn't move it:
VICTORY_PATCH_SSE4Aback on (with #4196, the SSE4a race fix)VICTORY_RANGE_MEMO(on by default)VICTORY_SOFT_VIEWS=0VICTORY_WIDE_THREADS8 (default cap) / 16 / 24VICTORY_LOG=warnsafecopycopies in-process)So the copy throughput is flat at ~3 GB/s regardless of thread count, which points to something serial in the refresh path rather than to cores, Wine, or the bus. On this CPU more threads simply aren't the lever; the cost is in the ~10k refreshes per frame on the submitting thread, most of which end up copying nothing.
Side note: Streamline logs
setDynamicMFGParams failed with status 1about 50×/s with DLSS FG on (RTX 5090, SDK 2.14.16); harmless as far as I can tell, but it fails every frame.Happy to run any build or switch on this machine.
@transbinaryunicorn-sys on GitHub · 2026-11-30 20:08 UTC · original
Linux/Wine: where the CPU time goes (RTX 5090, Xeon w7-3465X, GE-Proton11-7, ntsync)
TL;DR: the frame is not limited by copying bytes or by one busy thread. It waits on memory protection:
VIctory's guards on view memory (
watch.rs) make hundreds ofVirtualProtectcalls and write faultsper frame, and Wine serializes all of them behind one process-wide lock. Windows pays part of this too.
1. perf (whole process, 30 s in play, ~25 fps)
victory-list-*at ~52 %,victory-submitat ~49 %.About 15 of 56 cores are busy, so threads are waiting, not computing.
victory_safe_copy_at) is only ~1-2 ms per frame. The "copies 20 ms" in the fpsline is the wall time of the whole refresh phase (
host.rs, "the time it took, not the threads' sum"),so the "~3 GB/s" derived from it is not a bandwidth limit.
2.
VICTORY_TIMELINE(diagnostics build, 3 recordings × 4 frames)VirtualProtect(almost all 64 KiB)GetWriteWatchVirtualProtectis the largest cause of our own on the frame's chain (2-3.3 ms on average, up to 8 ms insingle frames) and the largest reason the card sits idle (~16 ms of idle time per frame).
VirtualProtectcalls and nearly all faults run on the title's threads: guard → the titlewrites → fault → open → guarded again at the next refresh.
3. Micro-benchmark (
VirtualProtect64 KiB, and write fault + vectored handler, N threads in parallel)(Windows: Surface with Alder Lake, 12 threads; Wine: same Proton as the game.)
8-16 threads give exactly the 60-100 µs seen in the game.
VirtualProtectcontends as well (its throughput drops from 1.1M/s to 0.36M/s), but faultsscale (up to 850k/s). Under Wine, faults are ~4× slower and they also slow down
VirtualProtect.GetWriteWatchcosts the same on both.4.
VICTORY_GUARD_HOT=50(A/B every 30 s, withVICTORY_FAULT_UNLOCKED=0)FAULT_UNLOCKED.