Under Wine, copies of title memory are not sparse buffers by default (GPU reset once the world loads) #69
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/Belobug--VIctory-Belobug-AMD!69
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-69"
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?
@sil-kong on GitHub · 2026-11-25 13:18 UTC · original
sil-kong:wine-no-sparse→main· +52 −1 · 1 files · 2 commits · openUnder Wine, once the world loads, sparse copies of title memory hang the GPU until the driver resets it. This turns them off by default under Wine only.
What happens
Linux, RX 7900 XT (RDNA3), RADV / Mesa 26.2.7, GE-Proton10-34's Wine with vkd3d-proton from Proton Experimental,
x86_64-pc-windows-gnurelease of71652a2, with title memory copied (VICTORY_COPY_MEMORY=1, which #53 makes the default under Wine).The intro and loading pass. When the world loads, the GPU time per frame goes from tens of ms to seconds:
A minute later the card was reset and the desktop (Hyprland, same GPU) went down with it; the machine had to be restarted. The kernel journal of that boot was not flushed, so I have no reset line to quote, only the log above and the crash.
Each tile mapping of a sparse copy becomes a sparse bind on the queue in vkd3d-proton (
UpdateTileMappings), which on RADV is costly, and the world maps many tiles a frame.Change
One function,
sparse()incrates/victory-gpu/src/shadow.rs. Under Wine (ntdll exportswine_get_version, asxmem::on_winetells) copies of title memory are made per title buffer or window, as beforecc4d18d. Windows is unchanged.VICTORY_SPARSE0The log line says which:
copies of title memory in sparse buffers on=false wine=true.Tested
Same machine, same build plus this change, same save, first room of the prison. Nothing else changed between the two runs.
The cost: without sparse copies the CPU copies more per frame (about 640 MB in about 100 ms here), so this trades the GPU hang for CPU time. Some of #18's work might make the sparse path usable under Wine later;
VICTORY_SPARSE=1is there to try it.#6 (Linux, RADV, the desktop froze once the world was black) might be the same; I can't tell from here.
Builds with
cargo build --release -p victory --target x86_64-pc-windows-gnu; no new warnings.@sil-kong on GitHub · 2026-11-25 15:11 UTC · original
Done: the choice is now
sparse_policy(switch, wine), a pure functionsparse_oncalls once, andsparse_copies_are_off_under_wine_unless_asked_forcovers unset (on natively, off under Wine) andVICTORY_SPARSE=0/1on both hosts. The test passes (cargo test -p victory-gpu --lib, run under Wine). Also rebased on current main (01aadd1).@TobiasFornell on GitHub · 2026-11-25 21:35 UTC · original
Adding an RDNA4 data point here: on CachyOS Linux, RX 9070 XT (RDNA4, RADV), Proton Experimental (Belobug-based local branch with #53's copy mode, #100's 4 KiB tile-base fix, and local CPU-prep patches), sparse copies of title memory do not trigger the ~6 s GPU hang or device reset seen on RDNA3 / Mesa 26.2.7.
In a 600 s prison-cell run (measured after world entry:
461 ms/framemedian — 292 ms prep, 88 ms copy-back, 81 ms GPU), sparse copies ran cleanly with 0 kernel GPU page faults. KeepingVICTORY_SPARSE=1available as an opt-in override when defaulting it off under Wine looks like the right call.@gut0to on GitHub · 2026-11-25 15:08 UTC · original
On
crates/victory-gpu/src/shadow.rsline 1789 (outdated):Could the default/override policy be extracted into a small pure helper and tested for both Wine defaults and explicit VICTORY_SPARSE=0/1? This toggle changes a GPU-reset-prone path, and OnceLock currently leaves the environment-selection cases untested. AI-assisted review; I checked the selection logic and test coverage.
@gut0to on GitHub · 2026-11-25 15:08 UTC · original · reviewed
AI-assisted review: I checked the changed behavior and the associated test coverage.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.