launcher: give Proton's syscall stack room for the driver's pipeline compiles #564

Merged
gtb-sbe merged 1 commit from upstream-pr/564 into main 2026-11-30 11:44:50 +00:00
gtb-sbe commented 2026-11-30 02:21:28 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by gtb-sbe on 2026-11-30T02:21:28Z.


Refs #472 (@1093i3511 reported this crash there on an RX 6600 and worked around it with TUXBOX_SKIP_SHADERS=35af8e6d,e5fbc632).

Problem

On current main (f482572a, with #557 so it starts and #389), ProjectScarlett 1.0.2.1 crashed twice during loading on my RX 9060 XT (RADV, Mesa 26.2.6, GE-Proton11-14). Both times it was the driver compiling the same compute pipeline, CS e5fbc632 (1.96 MB of DXIL), and 35af8e6d is the other program 1093i3511 had to skip:

0028:err:seh:handle_syscall_fault Syscall stack overrun.
 backtrace: --- Exception 0xc0000005 at ...: libvulkan_radeon.so + 0x71fcd5.
0028:err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call.
Game exited with exit code 3

Cause

  • Wine runs every Unix call on a per-thread kernel stack, 1 MiB by default (kernel_stack_size = 0x100000 in dlls/ntdll/unix/loader.c), and the Vulkan driver compiles pipelines on it. big_stack.rs's 64 MiB thread stack covers vkd3d-proton's DXIL to SPIR-V conversion, which runs on the PE side, but not this.
  • Mesa's SPIR-V front end walks structured control flow recursively (structured_post_order_traversal() in src/compiler/spirv/vtn_structured_cfg.c), about 96 bytes per block in a sequence. The translated program is mostly one long run of ifs: 15,521 selection constructs, 49,875 blocks, nesting depth 4.
  • I converted its DXIL with the dxil-spirv CLI and compiled it natively on RADV with a chosen stack. 1 MiB segfaults in structured_post_order_traversal, with the recursive call at +0x71fcd5, the same address as the game's crash. 2 MiB and more compile it in 4.7 s.
  • Proton reads WINE_KERNEL_STACK_SIZE (KiB). Valve's proton_10.0, proton_11.0, experimental_10.0, experimental_11.0 and bleeding-edge all have it, and so does GE-Proton11-14's ntdll.so. Upstream Wine has a fixed 1 MiB.
  • This isn't RADV-specific: every Mesa Vulkan driver uses that front end. NVIDIA's driver has its own compiler, and I haven't tried it.

Change

  • The launcher sets WINE_KERNEL_STACK_SIZE=16384 for Proton launches, so for run, verify and check. A value set in the environment is kept, and the wine backend is left alone.
  • New Lanes scenario branch-chain: a compute program of 14,000 ifs in a row, generated at build time by branch_chain_fixture.py. Each branch tests its own multiple of a per-lane key, and each of 64 lanes stores its total, which the CPU checks. It's compiled with -Od, because DXC's optimizer is quadratic in the number of branches (minutes and about 10 GiB at 20,000). It has its own gate, lanes-selftest-branch-chain, which raises TUXBOX_PIPELINE_DEADLINE to 600 s and the gate's timeout to 240 s, because vkd3d-proton's conversion alone takes about 30 s (31 s natively, 38 s for the whole scenario here). It isn't part of all.
  • Unit tests for the default, for a user value and for the wine backend, plus a source check that the scenario is registered and has its own gate. Docs: docs/ENVIRONMENT.md and the Lanes README.

Measured

On an RX 9060 XT (1002:7590), RADV / Mesa 26.2.6, GE-Proton11-14, Linux 6.18:

What Result
branch-chain through tuxbox.py run, WINE_KERNEL_STACK_SIZE=1024 (Proton's default) Syscall stack overrun in vkCreateComputePipelines, exit 3 after 41 s
branch-chain through tuxbox.py run, this change lanes-selftest PASS ... scenario=branch-chain passed=1, 38 s
verify --only lanes-selftest, this change 29 of 29 gates pass, lanes-selftest-branch-chain included (67 s for the suite)
verify --only lanes-selftest, WINE_KERNEL_STACK_SIZE=1024 28 pass; lanes-selftest-branch-chain fails with exit code 3 and no report
ProjectScarlett with 16 MiB 35af8e6d (155 s), 8ae931bd (119 s) and e5fbc632 (118 s) compiled, no overrun; the run got past the point where it crashed before
Native, N sequential ifs, 1 MiB stack 10,000 compile, 12,000 and more segfault

The ProjectScarlett run that got furthest with this setting ended later, at the intro start, on the title's heartbeat watchdog, during a stall with compute-queue label waits that nothing had submitted a writer for. That's a separate problem, and I'm looking into it on its own.

Not covered

  • NVIDIA: not run. The scenario should pass there either way, but I haven't checked, and NVIDIA's own compiler may have a different limit.
  • Upstream Wine (--backend wine) has no such setting, so the crash stays there, and with a Mesa driver the new lanes-selftest-branch-chain gate fails on that backend on purpose: the title would crash there too. A real fix belongs in Mesa (the walk would have to be iterative; I have a game-free reproducer, a generated SPIR-V of N sequential ifs) or in the translator: fewer blocks per program would also cut vkd3d's conversion, which takes 95 s for e5fbc632.
  • Memory: kernel stack pages are only used when touched. I didn't measure the cost separately.

Checks

  • python tuxbox.py check --no-gpu: 9 passed, 1 failed. The failure is test_stage_baseline.GuestWatch.test_a_guest_that_died_stops_the_sandbox_instead_of_waiting_out_the_timeout (0 != 'guest gone'), the only failing test of 763. It fails the same way on unchanged main (f482572a) on this machine and passes in CI here, and #560 changes that test. The new tests (tests/test_lanes_branch_chain.py, KernelStack in tests/test_host.py) pass.

  • python tuxbox.py verify --only lanes-selftest --backend proton --adapter 1002:7590 (RX 9060 XT, RADV / Mesa 26.2.6, GE-Proton11-14): 29 of 29 passed.

  • Full python tuxbox.py check --backend proton --adapter 1002:7590 on this PR's head (RX 9060 XT, RADV / Mesa 26.2.6, Proton Experimental experimental-11.0-20261112): 13 passed, 1 failed. Every GPU step passed (build, Lanes and fixtures on the GPU with 201 gates and lanes-selftest-branch-chain among them, the D3D12 regression controls, the shader translator on the GPU). The one failure is the same GuestWatch Python test as above.

    Evidence: TuxBox check of dde11d41be80, no uncommitted changes, GPU 1002:7590: 13 passed, 1 failed, 0 not run
    
  • NVIDIA: not run.

AI use

I made this branch with an AI coding agent (Claude Code), following AGENTS.md. It traced the crash from the game logs to the pipeline with a per-thread compile log, reproduced it offline (dxil-spirv CLI, a small native Vulkan harness, gdb), read the Wine and Mesa sources, and wrote the launcher change, the Lanes scenario, the tests and this description. The measurements above ran on my machine.

<!-- greyfinch-sync:brcly/TuxBox:issue:5557826730 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/564). Originally posted by [gtb-sbe](https://github.com/gtb-sbe) on 2026-11-30T02:21:28Z. --- Refs #472 (@1093i3511 reported this crash there on an RX 6600 and worked around it with `TUXBOX_SKIP_SHADERS=35af8e6d,e5fbc632`). ## Problem On current `main` (`f482572a`, with #557 so it starts and #389), ProjectScarlett 1.0.2.1 crashed twice during loading on my RX 9060 XT (RADV, Mesa 26.2.6, GE-Proton11-14). Both times it was the driver compiling the same compute pipeline, `CS e5fbc632` (1.96 MB of DXIL), and `35af8e6d` is the other program 1093i3511 had to skip: ```text 0028:err:seh:handle_syscall_fault Syscall stack overrun. backtrace: --- Exception 0xc0000005 at ...: libvulkan_radeon.so + 0x71fcd5. 0028:err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call. Game exited with exit code 3 ``` ## Cause - Wine runs every Unix call on a per-thread kernel stack, 1 MiB by default (`kernel_stack_size = 0x100000` in `dlls/ntdll/unix/loader.c`), and the Vulkan driver compiles pipelines on it. `big_stack.rs`'s 64 MiB thread stack covers vkd3d-proton's DXIL to SPIR-V conversion, which runs on the PE side, but not this. - Mesa's SPIR-V front end walks structured control flow recursively (`structured_post_order_traversal()` in `src/compiler/spirv/vtn_structured_cfg.c`), about 96 bytes per block in a sequence. The translated program is mostly one long run of `if`s: 15,521 selection constructs, 49,875 blocks, nesting depth 4. - I converted its DXIL with the dxil-spirv CLI and compiled it natively on RADV with a chosen stack. 1 MiB segfaults in `structured_post_order_traversal`, with the recursive call at `+0x71fcd5`, the same address as the game's crash. 2 MiB and more compile it in 4.7 s. - Proton reads `WINE_KERNEL_STACK_SIZE` (KiB). Valve's `proton_10.0`, `proton_11.0`, `experimental_10.0`, `experimental_11.0` and `bleeding-edge` all have it, and so does GE-Proton11-14's `ntdll.so`. Upstream Wine has a fixed 1 MiB. - This isn't RADV-specific: every Mesa Vulkan driver uses that front end. NVIDIA's driver has its own compiler, and I haven't tried it. ## Change - The launcher sets `WINE_KERNEL_STACK_SIZE=16384` for Proton launches, so for `run`, `verify` and `check`. A value set in the environment is kept, and the `wine` backend is left alone. - New Lanes scenario `branch-chain`: a compute program of 14,000 `if`s in a row, generated at build time by `branch_chain_fixture.py`. Each branch tests its own multiple of a per-lane key, and each of 64 lanes stores its total, which the CPU checks. It's compiled with `-Od`, because DXC's optimizer is quadratic in the number of branches (minutes and about 10 GiB at 20,000). It has its own gate, `lanes-selftest-branch-chain`, which raises `TUXBOX_PIPELINE_DEADLINE` to 600 s and the gate's timeout to 240 s, because vkd3d-proton's conversion alone takes about 30 s (31 s natively, 38 s for the whole scenario here). It isn't part of `all`. - Unit tests for the default, for a user value and for the `wine` backend, plus a source check that the scenario is registered and has its own gate. Docs: `docs/ENVIRONMENT.md` and the Lanes README. ## Measured On an RX 9060 XT (`1002:7590`), RADV / Mesa 26.2.6, GE-Proton11-14, Linux 6.18: | What | Result | | --- | --- | | `branch-chain` through `tuxbox.py run`, `WINE_KERNEL_STACK_SIZE=1024` (Proton's default) | `Syscall stack overrun` in `vkCreateComputePipelines`, exit 3 after 41 s | | `branch-chain` through `tuxbox.py run`, this change | `lanes-selftest PASS ... scenario=branch-chain passed=1`, 38 s | | `verify --only lanes-selftest`, this change | 29 of 29 gates pass, `lanes-selftest-branch-chain` included (67 s for the suite) | | `verify --only lanes-selftest`, `WINE_KERNEL_STACK_SIZE=1024` | 28 pass; `lanes-selftest-branch-chain` fails with exit code 3 and no report | | ProjectScarlett with 16 MiB | `35af8e6d` (155 s), `8ae931bd` (119 s) and `e5fbc632` (118 s) compiled, no overrun; the run got past the point where it crashed before | | Native, N sequential `if`s, 1 MiB stack | 10,000 compile, 12,000 and more segfault | The ProjectScarlett run that got furthest with this setting ended later, at the intro start, on the title's heartbeat watchdog, during a stall with compute-queue label waits that nothing had submitted a writer for. That's a separate problem, and I'm looking into it on its own. ## Not covered - **NVIDIA:** not run. The scenario should pass there either way, but I haven't checked, and NVIDIA's own compiler may have a different limit. - **Upstream Wine** (`--backend wine`) has no such setting, so the crash stays there, and with a Mesa driver the new `lanes-selftest-branch-chain` gate fails on that backend on purpose: the title would crash there too. A real fix belongs in Mesa (the walk would have to be iterative; I have a game-free reproducer, a generated SPIR-V of N sequential `if`s) or in the translator: fewer blocks per program would also cut vkd3d's conversion, which takes 95 s for `e5fbc632`. - **Memory:** kernel stack pages are only used when touched. I didn't measure the cost separately. ## Checks - `python tuxbox.py check --no-gpu`: 9 passed, 1 failed. The failure is `test_stage_baseline.GuestWatch.test_a_guest_that_died_stops_the_sandbox_instead_of_waiting_out_the_timeout` (`0 != 'guest gone'`), the only failing test of 763. It fails the same way on unchanged `main` (`f482572a`) on this machine and passes in CI here, and #560 changes that test. The new tests (`tests/test_lanes_branch_chain.py`, `KernelStack` in `tests/test_host.py`) pass. - `python tuxbox.py verify --only lanes-selftest --backend proton --adapter 1002:7590` (RX 9060 XT, RADV / Mesa 26.2.6, GE-Proton11-14): 29 of 29 passed. - Full `python tuxbox.py check --backend proton --adapter 1002:7590` on this PR's head (RX 9060 XT, RADV / Mesa 26.2.6, Proton Experimental `experimental-11.0-20261112`): 13 passed, 1 failed. Every GPU step passed (build, Lanes and fixtures on the GPU with 201 gates and `lanes-selftest-branch-chain` among them, the D3D12 regression controls, the shader translator on the GPU). The one failure is the same `GuestWatch` Python test as above. ```text Evidence: TuxBox check of dde11d41be80, no uncommitted changes, GPU 1002:7590: 13 passed, 1 failed, 0 not run ``` - NVIDIA: not run. ## AI use I made this branch with an AI coding agent (Claude Code), following `AGENTS.md`. It traced the crash from the game logs to the pipeline with a per-thread compile log, reproduced it offline (dxil-spirv CLI, a small native Vulkan harness, gdb), read the Wine and Mesa sources, and wrote the launcher change, the Lanes scenario, the tests and this description. The measurements above ran on my machine.
ReverendOzmund commented 2026-11-30 06:00:57 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by ReverendOzmund on 2026-11-30T06:00:57Z.


Confirmed on NVIDIA: RTX 3080 Ti, driver 620.73.04, GE-Proton11-14, main f482572a + #557 + #501 (private views). With WINE_KERNEL_STACK_SIZE=16384, CS 35af8e6d compiled in 1015 s and e5fbc632 in 979 s with no stack overrun. In an earlier run without it, 8ae931bd sat in pipeline creation for over two hours and never finished; with it, that program now comes from the cache.

<!-- greyfinch-sync:brcly/TuxBox:comment:7270219702 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/564#issuecomment-7270219702). Originally posted by [ReverendOzmund](https://github.com/ReverendOzmund) on 2026-11-30T06:00:57Z. --- Confirmed on NVIDIA: RTX 3080 Ti, driver 620.73.04, GE-Proton11-14, main f482572a + #557 + #501 (private views). With WINE_KERNEL_STACK_SIZE=16384, CS 35af8e6d compiled in 1015 s and e5fbc632 in 979 s with no stack overrun. In an earlier run without it, 8ae931bd sat in pipeline creation for over two hours and never finished; with it, that program now comes from the cache.
ReverendOzmund commented 2026-11-30 07:09:36 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by ReverendOzmund on 2026-11-30T07:09:36Z.


Same machine, a cold cache this time: CS 8ae931bd finished in 210 s with WINE_KERNEL_STACK_SIZE=16384. Without it, the same program sat in pipeline creation for over two hours and never finished.

<!-- greyfinch-sync:brcly/TuxBox:comment:7271420554 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/564#issuecomment-7271420554). Originally posted by [ReverendOzmund](https://github.com/ReverendOzmund) on 2026-11-30T07:09:36Z. --- Same machine, a cold cache this time: CS 8ae931bd finished in 210 s with WINE_KERNEL_STACK_SIZE=16384. Without it, the same program sat in pipeline creation for over two hours and never finished.
brcly commented 2026-11-30 11:44:58 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T11:44:58Z.


Merged, thanks. This is a model bug report and fix: you traced the crash through Wine and Mesa, built a reproducer that runs without the game, and added a gate that fails without the change.

NVIDIA, the one gap you listed: verify --only lanes-selftest passes 29 of 29 on an RTX 4070 Ti SUPER (10de:2705, GE-Proton11-14), lanes-selftest-branch-chain included. @ReverendOzmund's game runs on the 3080 Ti cover the in-game side, including 8ae931bd, which never finished without it.

Your GuestWatch failure was #560, merged just before this.

<!-- greyfinch-sync:brcly/TuxBox:comment:7277468633 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/564#issuecomment-7277468633). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T11:44:58Z. --- Merged, thanks. This is a model bug report and fix: you traced the crash through Wine and Mesa, built a reproducer that runs without the game, and added a gate that fails without the change. NVIDIA, the one gap you listed: `verify --only lanes-selftest` passes 29 of 29 on an RTX 4070 Ti SUPER (`10de:2705`, GE-Proton11-14), `lanes-selftest-branch-chain` included. @ReverendOzmund's game runs on the 3080 Ti cover the in-game side, including `8ae931bd`, which never finished without it. Your `GuestWatch` failure was #560, merged just before this.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!564
No description provided.