Linux/Proton: from 10 s to 90 ms a frame, without changing Windows #71

Closed
github-bot wants to merge 0 commits from github-bot/gh-71 into main AGit
Owner

@⁠Hasusmogus on GitHub · 2026-11-27 07:25 UTC · original
Hasusmogus:wine-perf-upstream → main · +1287 −118 · 39 files · 35 commits · closed without merging

Runs the pareto-residency build under Proton on Linux, and fixes from getting it there. Tested on an RTX 5060 (8 GB) with GE-Proton11-14, Series S profile, 1080p: from about 10 s a frame at first to 90 ms at best. Merged with current upstream main (583108b).

Linux / Proton (no effect on Windows)

  • scripts/play-proton.sh and docs/linux.md: build on Fedora with cargo-xwin and start under umu-run / Proton with the pareto-residency settings.
  • patches/wineserver-view-tree.patch: a wineserver that keeps a process's views in a tree (the list walk at every map and unmap was the largest single cost).
  • Write watches asked in 8 MiB pieces, and the runtime's placeholder reservations known without asking: only under Wine (under_wine()), or where the system cannot answer.
  • The card's budget less 1 GiB under Wine (VICTORY_CARD_BUDGET_MB): Linux moves nothing to system memory.
  • memcmp of our own (SSE2) under Wine, whose CRT compares 8 bytes a step; on Windows calls go to vcruntime140's own, as before.

Also on Windows

  • Pipeline library: an empty one is created with a null blob pointer (vkd3d-proton refused a non-null pointer of length 0, so nothing was ever kept there). The documented form on Windows too.
  • Pipelines whose making ends their thread are noticed, replaced and left out from then on (refused-pipelines.txt, VICTORY_REFUSED_RETRY=1). Only checked after a wait has run out.
  • No draw waits for a pipeline already more than a second in the making (VICTORY_PIPELINE_WAIT_LONG=1: as before). Passes over the screen keep their budget; dispatches still wait in full through VICTORY_PIPELINE_COMPUTE_WAIT. A 91 s pipeline had held 500 ms of each 684 ms frame.
  • Texture pool: a freed piece is used again once every submission begun before it came back has finished (with retire()'s margin), not only after 2.5 s (VICTORY_POOL_FENCED=0: as before). Cards under 12 GiB keep a tenth of their budget in empty blocks instead of 4 GiB. Cards of 12 GiB and up keep the same spare blocks.
  • VICTORY_LOG_FILE: logs (and crash reports) to a file.
  • Shader container names in the "shader translated" log line.
  • Earlier fork work: idle host lists aged out (VICTORY_LIST_POOL_AGE=0: kept), list threads a third of the logical processors (VICTORY_THIN_THREADS), docs/profiling.md, a Linux CI job for the portable crates, and the indirect-clamp tests asserting the exact charge for either VICTORY_INDIRECT_REST setting (upstream's WARP skip kept).

Merge notes

  • Upstream and wine-perf each added a Wine placeholder fallback: kept wine-perf's block-keyed RwLock (a read lock for the hot query), one place forgetting freed ones.
  • DirectStorage workers: upstream's worker_count and VICTORY_DSTORAGE_PRIORITY.
  • Pipeline make: both the refused pipelines and upstream's catch_unwind in make_with.
  • placed_filler_twins() returns 0 outside the diagnostics build.
  • Fixed after the merge: the long-pipeline skip ran after the frame's shared wait budget was taken, so it never gave it back.

Checked

  • cargo xwin clippy --workspace --all-targets [--all-features] -- -D warnings: clean.
  • Under Wine, victory-gpu fails the same 6 tests on upstream main, on wine-perf before the merge, and after it (watch and D3D12 tests that need Windows); Windows CI runs them for real.
  • Not yet measured on Windows hardware: the pipeline wait and texture pool changes are the ones to watch there.

🤖 Generated with Claude Code

**@⁠Hasusmogus** on GitHub · 2026-11-27 07:25 UTC · [original](https://github.com/DoubleGhosty/cool_fox/pull/71) `Hasusmogus:wine-perf-upstream` → `main` · +1287 −118 · 39 files · 35 commits · closed without merging Runs the pareto-residency build under Proton on Linux, and fixes from getting it there. Tested on an RTX 5060 (8 GB) with GE-Proton11-14, Series S profile, 1080p: from about 10 s a frame at first to 90 ms at best. Merged with current upstream `main` (583108b). ## Linux / Proton (no effect on Windows) - `scripts/play-proton.sh` and `docs/linux.md`: build on Fedora with cargo-xwin and start under umu-run / Proton with the pareto-residency settings. - `patches/wineserver-view-tree.patch`: a wineserver that keeps a process's views in a tree (the list walk at every map and unmap was the largest single cost). - Write watches asked in 8 MiB pieces, and the runtime's placeholder reservations known without asking: only under Wine (`under_wine()`), or where the system cannot answer. - The card's budget less 1 GiB under Wine (`VICTORY_CARD_BUDGET_MB`): Linux moves nothing to system memory. - `memcmp` of our own (SSE2) under Wine, whose CRT compares 8 bytes a step; on Windows calls go to vcruntime140's own, as before. ## Also on Windows - **Pipeline library**: an empty one is created with a null blob pointer (vkd3d-proton refused a non-null pointer of length 0, so nothing was ever kept there). The documented form on Windows too. - **Pipelines whose making ends their thread** are noticed, replaced and left out from then on (`refused-pipelines.txt`, `VICTORY_REFUSED_RETRY=1`). Only checked after a wait has run out. - **No draw waits for a pipeline already more than a second in the making** (`VICTORY_PIPELINE_WAIT_LONG=1`: as before). Passes over the screen keep their budget; dispatches still wait in full through `VICTORY_PIPELINE_COMPUTE_WAIT`. A 91 s pipeline had held 500 ms of each 684 ms frame. - **Texture pool**: a freed piece is used again once every submission begun before it came back has finished (with `retire()`'s margin), not only after 2.5 s (`VICTORY_POOL_FENCED=0`: as before). Cards under 12 GiB keep a tenth of their budget in empty blocks instead of 4 GiB. Cards of 12 GiB and up keep the same spare blocks. - `VICTORY_LOG_FILE`: logs (and crash reports) to a file. - Shader container names in the "shader translated" log line. - Earlier fork work: idle host lists aged out (`VICTORY_LIST_POOL_AGE=0`: kept), list threads a third of the logical processors (`VICTORY_THIN_THREADS`), `docs/profiling.md`, a Linux CI job for the portable crates, and the indirect-clamp tests asserting the exact charge for either `VICTORY_INDIRECT_REST` setting (upstream's WARP skip kept). ## Merge notes - Upstream and wine-perf each added a Wine placeholder fallback: kept wine-perf's block-keyed `RwLock` (a read lock for the hot query), one place forgetting freed ones. - DirectStorage workers: upstream's `worker_count` and `VICTORY_DSTORAGE_PRIORITY`. - Pipeline `make`: both the refused pipelines and upstream's `catch_unwind` in `make_with`. - `placed_filler_twins()` returns 0 outside the diagnostics build. - Fixed after the merge: the long-pipeline skip ran after the frame's shared wait budget was taken, so it never gave it back. ## Checked - `cargo xwin clippy --workspace --all-targets [--all-features] -- -D warnings`: clean. - Under Wine, victory-gpu fails the same 6 tests on upstream `main`, on wine-perf before the merge, and after it (watch and D3D12 tests that need Windows); Windows CI runs them for real. - Not yet measured on Windows hardware: the pipeline wait and texture pool changes are the ones to watch there. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Both clippy runs (`-D warnings`, with and without --all-features) failed
on the pinned 1.98.1 toolchain with about 40 errors, mostly lints that are
newer than the code. Fix them in place: is_multiple_of, explicit transmute
types, precedence parentheses, sort_*_by_key, needless borrows. Remove an
unused diagnostics-only variable. Mark items that only the diagnostics
build or the tests use, and three structural lints, with targeted allows.
No behaviour change.

Add a `portable` job on ubuntu-latest that tests victory-core, -formats,
-pipeline, -shader, -game and xtask (which includes the asset-policy check).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The README opened with codec_d's instructions, which link a private
release, then told readers to clone avatarmanz/VIctory-7900XTX. Split it
into a section per fork, build the pareto-residency launcher from source,
clone this repository, and credit codec_d.

findings.md still called VICTORY_INDIRECT_REST=0 an experiment, but
f4b48ad made it the default. The bug journal now notes that its local
paths and binary hashes refer to the author's machine.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI: fix clippy, add Linux tests; docs cleanup
Idle host lists: list.rs keeps up to 512 run host lists for reuse, and a
command allocator keeps its high-water memory over every reset. The docs
attribute 9 GB of the 40-46 GB footprint to lists' allocators. Nothing
trimmed that pool. The once-a-second sweep now lets go of lists, oldest
first, that rested longer than the RAM-scaled idle time, keeping the
newest 64; under memory pressure it drops all but those 64.
VICTORY_LIST_POOL_AGE=0 restores the old behaviour.

VICTORY_THIN started 8 threads whatever the CPU. The default is now a
third of the logical processors, clamped to 2-8: still 8 on the 24-thread
machine it was measured on, 5 on an eight-core/16-thread CPU.
VICTORY_THIN_THREADS still overrides it.

docs/profiling.md: how to measure memory fit, CPU vs card, and our own
GPU passes with the existing tools on a Series X-class PC.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
f4b48ad turned VICTORY_INDIRECT_REST off by default (a record that does
not fit takes nothing), but two tests still expected it to take the rest:
- host_list_budget_starts_empty_at_each_submission: the third record now
  spends the budget exactly, so it is full in either mode and the test
  checks what it is about, that the budget starts empty per submission.
- warp_batch_charges_every_execution: the expected spent budget is worked
  out for the mode the clamp was compiled with.

depth_bounds_pipeline_loads_and_filters_draws: the draw outside the bounds
passed on the CI runners' WARP adapter. The test turned the depth test off
to let depth bounds alone decide; it now uses a depth test that always
passes and writes nothing, which means the same and keeps the depth stage
on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tests: fix the 3 failing victory-gpu tests
scripts/play-proton.sh starts victory.exe under umu-run (Proton) or Wine
with Play-VIctory.cmd's pareto-residency settings. It turns Linux paths
into Wine Z: paths, and keeps the shader cache and saves under XDG folders
outside the prefix. docs/linux.md covers the build with cargo-xwin, the
NVIDIA driver, Steam as an alternative, and what was and was not tested
under Wine.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title asks for 33,333 us (SetFrameIntervalX) because its graphics
settings hold a frame rate of 30 (settings +0x210): +0x1e0fb30 and
+0x22434a0 turn it into a frame time (+0x98f84ac), +0x247ab10 picks the
interval from it and the display's 60/120 Hz (a 120 Hz mode alone changes
nothing at 30), and +0x120530 is a QueryPerformanceCounter limiter of its
own at the same rate.

VICTORY_FRAME_INTERVAL_MS=<ms> (16.667, 8.333, 0 = no wait): frame.rs ticks
at that interval whatever the title sets; the loader makes the two loads of
the setting "mov eax, rate; nop" (rate = 1000/ms rounded, 0 = the title's
own "no limit"), with the original bytes checked. VICTORY_TITLE_FPS=<n>|off
overrides the rate or leaves the title alone. Diagnostics:
VICTORY_TIMER_LOG=1 logs the title's timers once a second and frame pacing
bands every 5 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Run fps-1 (our clock at 16.667 ms, the title left at 30): the menus ran at
16.7 ms until the title's own limiter came up at 30 s (then 33.3 ms), and
meanwhile five of its seven timers stepped 33.3 ms a frame: game time ran
at twice the wall clock. The timer update (+0x2226040) takes the real time
since the last frame but at least 1/rate (+0x6849844), and that rate comes
from +0x2241fd0, a third read of the same setting. It now returns the rate
asked for (1000 for no limit), the original bytes checked first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title takes its output size from its settings (settings.xml video/resolutionFullscreen,
3840x2160 as a Series X wrote it) and applies it at +0x224352b (+0x22434a0) through the one
screen size setter +0x2478130; the back buffers follow (+0x247ad10). VICTORY_OUTPUT=<w>x<h>
(one of the title's own modes) makes that block write the size into the settings, then take
the title's own path. VICTORY_RENDER_SCALE=<0.5..1.0> replaces the title's own upscaler's 2/3
(+0x28f1e78) and FidelityFX's scale (+0x28ef680, as pull request #53); VICTORY_UPSCALER=<6|7>
is pull request #53's picker patch (+0x7e93f0). Each site's bytes are compared first; another
build is left alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title makes its back buffers in a 64 MB pool (Series X) and stops at an int3 unless less
than 2 MB of it is left over; at 1920x1080 49 MB are (run res-1 stopped there 2 s in).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Series S renders through FidelityFX (+0x28ef680). With its scale at 0.5 (run res-6) FidelityFX's
jitter phase count came back 0 and the title divided by it at +0x28f03e8, 49 s in. The title's
own upscaler (Series X) ran at 1.0 (run res-4). The FidelityFX patch stays, behind its own switch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The console takes constant buffers on 16 bytes, D3D12 views on 256, so every
constant buffer a draw's tables name was copied at each submission into upload
memory of ours (~23,000 a frame of the city, ~9 MB, out of the title's graphics
memory that renderer port 1 already has the card read in place), and each root
one not on 256 bytes (64 KiB each).

With the switch, translated shaders read constant buffers as raw bytes
(victory_shader::emit::constants_raw): a table's (or one picked from the heap)
through the raw twin of its slot, a root one as a root SRV. The host makes a
table's constant buffer in title memory in place a raw view of the title's
bytes in that twin (descriptor::host::constant_raw_at): no copy, no step at
submission. Others are copied as before (their twin is a raw view of the copy);
a title slot's constant buffer view gets a raw twin (a raw read through a
constant buffer view has no end on AMD). The shader cache keys on the switch
(only when on: translations cached without it keep their key, so the
translator version stays). VICTORY_PORT_CBV_PLACE=0 copies again while reading
raw; with VICTORY_AB=<s>,VICTORY_PORT_CBV_PLACE both sides in one run.
Per-second line: "renderer port 5 (VICTORY_PORT_CBV=1) per frame: ...".
Test: emit::tests::table_constant_buffers_read_as_raw_bytes_through_their_twins
(WARP: the twin is read, the slot's own view is not).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title's routine at image+0x1e86440 reserves 185 MB of graphics memory
below 4 GiB, splits it into five pieces, takes all their physical pages
in one XMemAllocatePhysicalPages and maps them in order: one stretch of
one section. Its 174 MB buffer at 0x34e10000 (the ring of constants, and
what the skinning passes write through one view of all of it) had a host
copy in the card's memory, ~17 MB a frame sent up in ~600 pieces, shader
writes fetched back and compared, and ~6,000 constant fills a frame.

With the switch the stretch is mapped once more at an address of ours and
opened as a host heap there (OpenExistingHeapFromAddress1); title buffers
and windows in it are buffers placed in that heap, the existing in-place
form of a host copy: nothing tracked, sent up, fetched back or compared.
The title's own views stay free to change; when it maps other pages
there the region is forgotten. A line on the frame-rate report counts
the CPU fills and buffer copies of ours that still read or write it.

Replay (play-1125-0127, heap in the PC's memory): the title's own work
+~3 ms on the card; the 30 ms added there are our compare passes, which
do not run over memory in place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Run port1-1: the title maps the five pieces of its 185 MB heap in another
order than their addresses, so the heap was views of one section in a
scattered order ("not one stretch of a section: Scattered") and nothing
was placed. With VICTORY_PORT_CONSTANTS=1 xmem now gives the page numbers
mapped into a 32-bit graphics reservation the slices at their offset in
it, when the reservation is all one section and both slices are fresh
(never mapped or written: no commit bit), which the title cannot observe.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	README.md
#	crates/victory-gpu/src/indirect.rs
Under GE-Proton11-14 on an RTX 5060 (8 GB), Series S at 1080p:

- Log to a file (VICTORY_LOG_FILE): Proton passes no stderr through;
  crash reports and panics go there too.
- Pipeline library: ask vkd3d-proton for an empty one with a null
  pointer; it refused a non-null pointer of length 0, so no pipeline
  was ever kept between runs.
- Pipeline workers that end while making a pipeline (a stack overflow
  in vkd3d-proton's DXIL-to-SPIR-V; Wine ends the thread silently) are
  noticed, replaced, and their pipeline is left out from then on
  (refused-pipelines.txt); a full-budget wait names what is stalled.
- Wine's memory lock: placeholders the runtime reserved are known
  without asking (Wine lacks that information class); write watches
  are asked in 8 MiB pieces; VICTORY_COMMITTED_QUERY=1 in the script
  (QueryWorkingSetEx reads /proc/self/pagemap under the lock).
- Texture pool: a freed piece is used again once every submission
  begun before has finished (with retire()'s margin), not only after
  2.5 s; cards under 12 GiB keep a tenth of their budget in empty
  blocks, not 4 GiB. Loading took 2.7 GB of staging and 4.1 GB of
  blocks on the card before.
- Under Wine plan with the card's budget less 1 GiB
  (VICTORY_CARD_BUDGET_MB): Linux moves nothing to the PC's memory.
- play-proton.sh: VICTORY_CONSOLE, vkd3d-proton's cache beside ours,
  and the GE-Proton11-14-victory compat tool when installed (a
  wineserver that keeps a process's views in a tree; the list walk at
  every map and unmap was the largest cost of all).
- docs/linux.md: what was found.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With Play-VIctory.cmd's constant:0.8 the prologue's rooms were dark red
and its yard milky white under Proton; with the estimate the rooms are
lit by their lamps and the yard by the sunset, at the same frame time
(219 against 207 ms, within the runs' spread).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
FidelityFX's upscaler, the title's choice on Series S, is a network of
8-bit dot products: its eight largest layers (one dispatch each, at the
output size) took 120 of the 200 ms of an RTX 5060's frame, with the card
at 51 W of 145 and its memory 3-13 % busy. With VICTORY_UPSCALER=6 the
prologue went from 207 to 115 ms a frame, the picture alike.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
At translation and when a pipeline is left out for having ended a
thread: the costliest passes of the RTX 5060's frame could only be told
by hash, and the left-out one is CS_Prop_BatchNoCull.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts resolved: write watches asked in pieces with upstream's
no_reset(); port 6's forget_views beside the placeholders' bookkeeping;
port 7 hooks taken; low placeholders tracked in both forms; list.rs,
known.rs, emit/mod.rs and README.md as upstream has them (the stale
list::let_go_idle call dropped with them).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
What takes seconds to make ends in some later frame whatever this one
waits: after upstream's translator changes one pipeline took 91 s and
more, and every frame that drew with it waited the whole 500 ms budget
(684 ms frames). Passes over the screen keep their budget;
VICTORY_PIPELINE_WAIT_LONG=1 waits as before. The same scene: 119 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Upstream leaves the hair passes out as broken; on an RTX 5060 under
Proton they draw right (the prologue's characters were bald without
them) at no cost measured (101 ms a frame with, 119 without).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Under Wine the C runtime's memcmp compares eight bytes at a step: the
threads comparing host copies with title memory spent 6.7 % of the
process's processor time in it. Defined in the executable, the linker
takes ours (victory.exe no longer imports memcmp); in the same scene it
is 2.2 %, and ucrtbase.dll's share fell from 15.9 % to 4.1 %. Checked
against a byte at a time at every length, offset and place of a change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A change of protection costs far more under Wine than on Windows (Wine's
memory lock, a TLB shootdown on every core running the process). With a
written block resting 50 ms instead of 3: blocks made read-only a frame
861 -> 461, guard faults 478 -> 364, the guards' lock waits 221 -> 173 ms;
frame time alike within the runs' spread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Wine maps thread priorities to niceness only with a hard RLIMIT_NICE
above 20; without, the title's threads compete for eight cores with our
pipeline workers and streaming on equal terms. With the limit raised
(prlimit, as the gamemode group gives): 104 and 106 ms a frame in two
runs, p90 113 and 114, against 118-122 and 134-143 without.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One for each logical processor as before when unset. On the RTX 5060 PC
(16 logical) with thread priorities in effect, 6 made no difference
(108 against 104-106 ms a frame): kept as a switch for smaller PCs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Against GE-Proton11-14's wine (ValveSoftware/wine a47c73f with GE's
protonprep wine section applied): a process's views in a tree by base
as well as the list, so map_view's overlap check and unmap_view's
lookup no longer walk all of them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts: the Wine placeholder fallback (kept wine-perf's block-keyed
RwLock), dstorage workers (upstream's worker_count and priority), pipeline
make (both: refused pipelines and upstream's catch_unwind), the indirect
tests (wine-perf's exact assertions; upstream's WARP skip stays).
Also two clippy fixes from wine-perf.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- memcmp: ours (SSE2, 16 bytes a step) only under Wine; on Windows the
  call goes to vcruntime140's own (AVX2), found once.
- Pipeline wait: a pipeline in the making for over a second is skipped
  before the frame's shared budget is taken. After the merge it returned
  after taking it, so the give-back never ran and each such pipeline held
  the rest of the frame's budget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
patches/wineserver-view-tree.patch failed repository_passes_policy. Patches
are text we wrote and keep the size, binary and encoded-run checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 07:29:31 +00:00
github-bot closed this pull request 2026-11-27 09:01:56 +00:00
Author
Owner

@⁠DoubleGhosty on GitHub · 2026-11-27 09:01 UTC · original

Cherry-picked the clean, non-conflicting Linux/Proton improvements into main (policy .patch/.diff support 4f569b6e and Wine-only 16-byte SSE2 memcmp), while keeping cool_fox's existing launchers/README intact.

**@⁠DoubleGhosty** on GitHub · 2026-11-27 09:01 UTC · [original](https://github.com/DoubleGhosty/cool_fox/pull/71#issuecomment-7214187048) Cherry-picked the clean, non-conflicting Linux/Proton improvements into main (policy .patch/.diff support 4f569b6e and Wine-only 16-byte SSE2 memcmp), while keeping cool_fox's existing launchers/README intact.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.