Wine fixes: pipeline worker stack, hot guard blocks, no reserved buffers; opt-in preload #135

Manually merged
github merged 1 commit from github-bot/gh-135 into main 2026-12-05 20:45:18 +00:00 AGit
Owner

@⁠r32601366 on GitHub · 2026-12-05 19:23 UTC · original
r32601366:linux-wine-fixes → main · +142 −3 · 4 files · 1 commits · merged 2026-12-05 20:42 UTC

All three Wine fixes default on only when Wine is detected
(host::on_wine); Windows behaviour is unchanged unless the variable is set.

  • LARP_WORKER_STACK_MB: pipeline workers get a 64 MiB stack under Wine
    (vkd3d-proton's DXIL to SPIR-V translation can recurse past 2 MiB).
    Reserved, not committed. 0 = Rust default.
  • LARP_GUARD_HOT=: a guarded block written again within 20 ms of its
    guarding stays unguarded for 20 ms and is reported written at every
    guarding, so no write is missed; fewer faults and protection changes,
    which are expensive under Wine. 0 = off.
  • LARP_WINE_NO_SPARSE: no reserved buffers under Wine, working around an
    NVIDIA GPU VA mapping failure under Proton + vkd3d-proton that took the
    whole machine down. =0 keeps reserved buffers.
  • LARP_PRELOAD=1 (off by default, not Wine-specific): make the listed
    pipelines, save list and blobs, exit before input.

Documented in docs/environment-variables.md. Split from #89.

Build: cross-built for x86_64-pc-windows-gnullvm, no errors. Not run in game on this branch.

**@⁠r32601366** on GitHub · 2026-12-05 19:23 UTC · [original](https://github.com/gamingwithhomie/larp/pull/135) `r32601366:linux-wine-fixes` → `main` · +142 −3 · 4 files · 1 commits · merged 2026-12-05 20:42 UTC All three Wine fixes default on only when Wine is detected (host::on_wine); Windows behaviour is unchanged unless the variable is set. - LARP_WORKER_STACK_MB: pipeline workers get a 64 MiB stack under Wine (vkd3d-proton's DXIL to SPIR-V translation can recurse past 2 MiB). Reserved, not committed. 0 = Rust default. - LARP_GUARD_HOT=<ms>: a guarded block written again within 20 ms of its guarding stays unguarded for 20 ms and is reported written at every guarding, so no write is missed; fewer faults and protection changes, which are expensive under Wine. 0 = off. - LARP_WINE_NO_SPARSE: no reserved buffers under Wine, working around an NVIDIA GPU VA mapping failure under Proton + vkd3d-proton that took the whole machine down. =0 keeps reserved buffers. - LARP_PRELOAD=1 (off by default, not Wine-specific): make the listed pipelines, save list and blobs, exit before input. Documented in docs/environment-variables.md. Split from #89. Build: cross-built for x86_64-pc-windows-gnullvm, no errors. Not run in game on this branch.
All three Wine fixes default on only when Wine is detected
(host::on_wine); Windows behaviour is unchanged unless the variable is set.

- LARP_WORKER_STACK_MB: pipeline workers get a 64 MiB stack under Wine
  (vkd3d-proton's DXIL to SPIR-V translation can recurse past 2 MiB).
  Reserved, not committed. 0 = Rust default.
- LARP_GUARD_HOT=<ms>: a guarded block written again within 20 ms of its
  guarding stays unguarded for 20 ms and is reported written at every
  guarding, so no write is missed; fewer faults and protection changes,
  which are expensive under Wine. 0 = off.
- LARP_WINE_NO_SPARSE: no reserved buffers under Wine, working around an
  NVIDIA GPU VA mapping failure under Proton + vkd3d-proton that took the
  whole machine down. =0 keeps reserved buffers.
- LARP_PRELOAD=1 (off by default, not Wine-specific): make the listed
  pipelines, save list and blobs, exit before input.

Documented in docs/environment-variables.md. Split from #89.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 19:26:40 +00:00
Author
Owner

@⁠Kassadd on GitHub · 2026-12-05 19:39 UTC · original

Ran this on CachyOS + Proton Experimental 11.0, RTX 4080 SUPER, vkd3d-proton 3.2.0 — your note says it was not run in game, so here is one.

All three Wine fixes come up on their own (WINE_NO_SPARSE: no reserved buffers, worker stack, guard hot at its 20 ms default), no switches needed. World frames only, >1000 draws/frame, same route and same build otherwise:

before #135 with #135
median 33.3 ms 33.4 ms
p90 90.9 ms 57.0 ms
p95 275.6 ms 124.4 ms
frames over 100 ms — 4 of 80 (5%)

The median is the title's own 30 fps cap either way; what moved is the tail, which is the part that felt like a stutter. That is consistent with what you describe: the hot-guard change removes protection faults, and those are expensive under Wine.

No Xid 31 in this run, where every other build here took one within 4 to 8 minutes of world play — NVRM: Xid (PCI:0000:01:00): 31, MMU Fault followed by relay: the device was lost before fence value …. If LARP_WINE_NO_SPARSE is what stopped it, that is the single most useful thing in this PR for Linux users. I have not run it long enough to call it fixed rather than delayed, so treat it as promising rather than confirmed.

One caveat on the numbers: 92 pipelines were still being made during the run, so the p99 (821 ms) is compile work and not a steady-state frame. I will re-measure once the cache settles.

**@⁠Kassadd** on GitHub · 2026-12-05 19:39 UTC · [original](https://github.com/gamingwithhomie/larp/pull/135#issuecomment-7444173188) Ran this on CachyOS + Proton Experimental 11.0, RTX 4080 SUPER, vkd3d-proton 3.2.0 — your note says it was not run in game, so here is one. All three Wine fixes come up on their own (`WINE_NO_SPARSE: no reserved buffers`, worker stack, guard hot at its 20 ms default), no switches needed. World frames only, >1000 draws/frame, same route and same build otherwise: | | before #135 | with #135 | |---|---|---| | median | 33.3 ms | 33.4 ms | | p90 | 90.9 ms | **57.0 ms** | | p95 | 275.6 ms | **124.4 ms** | | frames over 100 ms | — | 4 of 80 (5%) | The median is the title's own 30 fps cap either way; what moved is the tail, which is the part that felt like a stutter. That is consistent with what you describe: the hot-guard change removes protection faults, and those are expensive under Wine. **No `Xid 31` in this run**, where every other build here took one within 4 to 8 minutes of world play — `NVRM: Xid (PCI:0000:01:00): 31, MMU Fault` followed by `relay: the device was lost before fence value …`. If `LARP_WINE_NO_SPARSE` is what stopped it, that is the single most useful thing in this PR for Linux users. I have not run it long enough to call it fixed rather than delayed, so treat it as promising rather than confirmed. One caveat on the numbers: 92 pipelines were still being made during the run, so the p99 (821 ms) is compile work and not a steady-state frame. I will re-measure once the cache settles.
Author
Owner

@⁠r32601366 on GitHub · 2026-12-05 19:57 UTC · original

Thanks for running it, that's the measurement this PR was missing.

The tail moving while the median stays at the 30 fps cap is what we saw here too. On the Xid 31: our crash was the same family (NVRM: intermapRegisterDmaMapping: Failed to insert new mapping node before the machine went down), and it went away with reserved buffers off. To pin which fix stops it on your side: a run with only LARP_WINE_NO_SPARSE=0 (the other two fixes still on) should bring the MMU fault back within your usual 4–8 min if it is the reserved buffers. I can tighten the comment and docs around that switch once you have it.

**@⁠r32601366** on GitHub · 2026-12-05 19:57 UTC · [original](https://github.com/gamingwithhomie/larp/pull/135#issuecomment-7444411135) Thanks for running it, that's the measurement this PR was missing. The tail moving while the median stays at the 30 fps cap is what we saw here too. On the Xid 31: our crash was the same family (`NVRM: intermapRegisterDmaMapping: Failed to insert new mapping node` before the machine went down), and it went away with reserved buffers off. To pin which fix stops it on your side: a run with only `LARP_WINE_NO_SPARSE=0` (the other two fixes still on) should bring the MMU fault back within your usual 4–8 min if it is the reserved buffers. I can tighten the comment and docs around that switch once you have it.
github-bot referenced this pull request from a commit 2026-12-05 20:45:09 +00:00
github manually merged commit 9dae677520 into main 2026-12-05 20:45:18 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.