Linux (vkd3d-proton): dxil-spirv's CFG structurizer takes 20+ GB on two ~284 KB translated compute programs, so system memory runs out or the title's watchdog fires during world loading #611

Closed
opened 2026-11-26 04:27:09 +00:00 by github-bot · 2 comments
Owner

@⁠xstraok on GitHub · 2026-11-24 02:30 UTC · original

A retail game (Series X profile, 1.0.2.1) on Linux (Wine + vkd3d-proton, RADV) stops presenting ~150 s into world loading. Then either system memory runs out (32 GB machine) or the title's watchdog fires (0xc0000005 in game_scarlett_master.exe+0x23cf683 (write at address 0x0), as in #505 / #534).

What happens.

  • At the stall, XCL_THREAD_DUMP_AT shows one title thread in d3d12_device_CreateComputePipelineState. Below it the stack is vkd3d_shader_compile_dxil → dxil_spv_converter_run → CFGStructurizer::run → structurize → find_selection_merges → CFGNode::get_outer_selection_dominator → CFGNode::dominates_all_reachable_exits, the last frame recursing (symbols from the vkd3d-proton build).
  • The other title PSO threads wait in XCL, so submits drop to 0. RSS (anonymous) grows ~500 MB/s from that moment.
  • dxil-spirv's thread-local allocator frees nothing until the conversion ends (free_in_thread: "Don't bother freeing"), so the structurizer's working set only grows.

Reproduced outside the game. I ran the native dxil-spirv CLI (vkd3d-proton's submodule, 8b48f0e0) over the 126 DXIL blobs in XCL's cache (dxil/*.dxil, dxil/translated/*_Compute_*):

  • Two of them run past 30 s: e55c11d728be9ebb.dxil (= translated/2e0055c25f49848a_Compute_0_4_0, 284 048 B) and cf9c9f793b127fa3.dxil (284 400 B).
  • The first reaches 4.5 GB RSS in 5 s and 20.5 GB in 60 s, still running when I stopped it.
  • Its DXIL has 3443 basic blocks and 381 switches (dxc -dumpbin, 40 k lines).
  • Every other blob converts in under 2 s. Two 346 952 B blobs crash the CLI (exit 139); I did not look at those.
  • Native D3D12 drivers on Windows take DXIL directly, so this is likely Linux / vkd3d-proton only.

Possibly related: #560 (the AMD jump at the first wave of world compute pipelines), #533 (bounded compute pipeline waits), #172 (structured form instead of the switch (pc) dispatcher, which would change the CFG these programs give dxil-spirv). I have not checked whether these two programs are pc-chain programs.

Not known: whether #172 or a smaller HLSL shape avoids it. Also unknown: the slower growth earlier in loading (~150 MB/s, from ~80 s, anonymous 16 MB-multiple mappings at 0x13_…–0x20_…). It may also be compile memory that Wine's heap keeps, but that is not measured.

Tested: RX 9060 XT (RDNA4, Mesa 26.2.6 RADV), Ryzen 5 7600, 32 GB RAM, Arch Linux, Proton Experimental Wine + vkd3d-proton 3.1 (#257). XCL main a6f5f7a + #257 + #458 + #496 + #484 + #610 (#575's clamp), release. 2 runs, both stalled the same way: one stopped by a RAM guard at 171 s, one hit the watchdog at 181 s.

AI-assisted: Claude Code (Claude Opus 5.5) found the stack, built the dxil-spirv CLI, ran the scan and wrote this text. I made the runs.

**@⁠xstraok** on GitHub · 2026-11-24 02:30 UTC · [original](https://github.com/xcl-dev/xcl/issues/611) A retail game (Series X profile, 1.0.2.1) on Linux (Wine + vkd3d-proton, RADV) stops presenting ~150 s into world loading. Then either system memory runs out (32 GB machine) or the title's watchdog fires (`0xc0000005 in game_scarlett_master.exe+0x23cf683 (write at address 0x0)`, as in #505 / #534). **What happens.** - At the stall, `XCL_THREAD_DUMP_AT` shows one title thread in `d3d12_device_CreateComputePipelineState`. Below it the stack is `vkd3d_shader_compile_dxil → dxil_spv_converter_run → CFGStructurizer::run → structurize → find_selection_merges → CFGNode::get_outer_selection_dominator → CFGNode::dominates_all_reachable_exits`, the last frame recursing (symbols from the vkd3d-proton build). - The other title PSO threads wait in XCL, so submits drop to 0. RSS (anonymous) grows ~500 MB/s from that moment. - dxil-spirv's thread-local allocator frees nothing until the conversion ends (`free_in_thread`: "Don't bother freeing"), so the structurizer's working set only grows. **Reproduced outside the game.** I ran the native `dxil-spirv` CLI (vkd3d-proton's submodule, `8b48f0e0`) over the 126 DXIL blobs in XCL's cache (`dxil/*.dxil`, `dxil/translated/*_Compute_*`): - Two of them run past 30 s: `e55c11d728be9ebb.dxil` (= `translated/2e0055c25f49848a_Compute_0_4_0`, 284 048 B) and `cf9c9f793b127fa3.dxil` (284 400 B). - The first reaches 4.5 GB RSS in 5 s and 20.5 GB in 60 s, still running when I stopped it. - Its DXIL has 3443 basic blocks and 381 `switch`es (`dxc -dumpbin`, 40 k lines). - Every other blob converts in under 2 s. Two 346 952 B blobs crash the CLI (exit 139); I did not look at those. - Native D3D12 drivers on Windows take DXIL directly, so this is likely Linux / vkd3d-proton only. **Possibly related:** #560 (the AMD jump at the first wave of world compute pipelines), #533 (bounded compute pipeline waits), #172 (structured form instead of the `switch (pc)` dispatcher, which would change the CFG these programs give dxil-spirv). I have not checked whether these two programs are pc-chain programs. **Not known:** whether #172 or a smaller HLSL shape avoids it. Also unknown: the slower growth earlier in loading (~150 MB/s, from ~80 s, anonymous 16 MB-multiple mappings at `0x13_…–0x20_…`). It may also be compile memory that Wine's heap keeps, but that is not measured. **Tested:** RX 9060 XT (RDNA4, Mesa 26.2.6 RADV), Ryzen 5 7600, 32 GB RAM, Arch Linux, Proton Experimental Wine + vkd3d-proton 3.1 (#257). XCL `main` `a6f5f7a` + #257 + #458 + #496 + #484 + #610 (#575's clamp), release. 2 runs, both stalled the same way: one stopped by a RAM guard at 171 s, one hit the watchdog at 181 s. AI-assisted: Claude Code (Claude Opus 5.5) found the stack, built the dxil-spirv CLI, ran the scan and wrote this text. I made the runs.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:27:09 +00:00
Author
Owner

@⁠ddm-j on GitHub · 2026-11-24 05:18 UTC · original

dxil-spirv #371 (merged upstream 2026-11-23) fixes most of this: ≥10× faster on this title's largest compute shaders, and in game ~7-10× more pipelines get built per run. #257's kit still builds vkd3d-proton v3.1, which pins the old dxil-spirv.

dxil-spirv #371 ("rewrite the recursive algorithms to be as iterative as possible", fixing dxil-spirv #366: since the structurizer rewrite, large compute shaders need ~2x the stack) is not in vkd3d-proton v3.1 (dxil-spirv 8b48f0e, the pin you tested) nor in vkd3d-proton master yet (34f0ff8).

Tested

  • Fedora, RTX 4070 Ti 12 GB (NVIDIA 615.78.08), Proton Experimental 11.0 Wine. XCL main f4ce27c + #257 + #684, release x86_64-pc-windows-gnu.
  • Offline, native dxil-spirv CLI at 8b48f0e and at 53aac41 (#371's merge), options close to vkd3d-proton on NVIDIA (--bindless --ssbo-uav --ssbo-srv --typed-uav-read-without-format --enable-shader-demote --subgroup-size 32 32), on the 20 largest compute DXIL files in XCL's cache (1.3-25 MB):
    • 53aac41, 8 MB stack: all 20 convert; 17 in 1-13 s, two in ~180 s, one in ~430 s; peak RSS 0.3-7 GB.
    • 53aac41, 1 MB stack (ulimit -s 1024, a Windows thread's size): 19 of 20; the one ~13 MB shader still segfaults.
    • 8b48f0e (sampled, stopped once the answer was clear): the smallest of the 20 over 900 s (timed out) vs 1.2 s; a ~5 MB one 108 s vs 11 s.
  • In game: vkd3d-proton master 30b0eb9 with subprojects/dxil-spirv at 53aac41 + #257's patch builds clean. Three 300 s runs back to back with #690's preload: 340 / 417 / 483 pipeline sets recorded as used, against 45-49 with v3.1. At the stop, title threads now wait mostly on the driver's own compile (winevulkan), no longer in dxil-spirv's structurizer. The watchdog stop itself does not move yet (~100 s here).

Suggestion for #257: build vkd3d-proton with dxil-spirv at or after 53aac41 until a vkd3d-proton release carries it. Since one large shader still overflows a 1 MB stack, vkd3d pipeline creation is also safer on XCL's own workers with a big stack than on a title thread (the resolve_wait path builds on the title's thread).

Not tested

  • RADV / AMD. The test suite. More than three runs in a row. Whether 53aac41 changes anything besides speed and stack use.

AI use

  • Claude Code (Claude Opus 5.5) built both versions, ran the conversions and the game runs, and wrote this comment from the logs; checked by me.
**@⁠ddm-j** on GitHub · 2026-11-24 05:18 UTC · [original](https://github.com/xcl-dev/xcl/issues/611#issuecomment-7122819048) **dxil-spirv #371 (merged upstream 2026-11-23) fixes most of this: ≥10× faster on this title's largest compute shaders, and in game ~7-10× more pipelines get built per run. #257's kit still builds vkd3d-proton v3.1, which pins the old dxil-spirv.** dxil-spirv #371 ("rewrite the recursive algorithms to be as iterative as possible", fixing dxil-spirv #366: since the structurizer rewrite, large compute shaders need ~2x the stack) is not in vkd3d-proton v3.1 (dxil-spirv `8b48f0e`, the pin you tested) nor in vkd3d-proton master yet (`34f0ff8`). **Tested** - Fedora, RTX 4070 Ti 12 GB (NVIDIA 615.78.08), Proton Experimental 11.0 Wine. XCL `main` `f4ce27c` + #257 + #684, release `x86_64-pc-windows-gnu`. - Offline, native dxil-spirv CLI at `8b48f0e` and at `53aac41` (#371's merge), options close to vkd3d-proton on NVIDIA (`--bindless --ssbo-uav --ssbo-srv --typed-uav-read-without-format --enable-shader-demote --subgroup-size 32 32`), on the 20 largest compute DXIL files in XCL's cache (1.3-25 MB): - `53aac41`, 8 MB stack: all 20 convert; 17 in 1-13 s, two in ~180 s, one in ~430 s; peak RSS 0.3-7 GB. - `53aac41`, 1 MB stack (`ulimit -s 1024`, a Windows thread's size): 19 of 20; the one ~13 MB shader still segfaults. - `8b48f0e` (sampled, stopped once the answer was clear): the smallest of the 20 over 900 s (timed out) vs 1.2 s; a ~5 MB one 108 s vs 11 s. - In game: vkd3d-proton master `30b0eb9` with `subprojects/dxil-spirv` at `53aac41` + #257's patch builds clean. Three 300 s runs back to back with #690's preload: 340 / 417 / 483 pipeline sets recorded as used, against 45-49 with v3.1. At the stop, title threads now wait mostly on the driver's own compile (winevulkan), no longer in dxil-spirv's structurizer. The watchdog stop itself does not move yet (~100 s here). **Suggestion for #257:** build vkd3d-proton with dxil-spirv at or after `53aac41` until a vkd3d-proton release carries it. Since one large shader still overflows a 1 MB stack, vkd3d pipeline creation is also safer on XCL's own workers with a big stack than on a title thread (the `resolve_wait` path builds on the title's thread). **Not tested** - RADV / AMD. The test suite. More than three runs in a row. Whether `53aac41` changes anything besides speed and stack use. **AI use** - Claude Code (Claude Opus 5.5) built both versions, ran the conversions and the game runs, and wrote this comment from the logs; checked by me.
Author
Owner

@⁠xstraok on GitHub · 2026-11-24 05:28 UTC · original

Confirmed on RADV. RX 9060 XT 16 GB (RDNA4, Mesa 26.2.6), Proton Experimental, vkd3d-proton v3.1 with subprojects/dxil-spirv moved to 53aac418 + #257's patch, XCL f4ce27c + #257 + #496 + #610 + #172 (+ #708 in the last runs): the 20+ GB structurizer runs and the hangs are gone in every run since (9 runs). The stop is now the same as yours. Thread dumps at the stop (real::build_compute → translated_compute_pso → dxc::compile, then d3d12core/winevulkan) show a title render thread compiling new ~870–910 KB-DXIL compute shaders one at a time on first bind, ~11 s each (DXC, then 3.1–3.4 s in the driver). A second render thread waits in pso_async::resolve_wait, the main thread waits on both, and the title's watchdog fires ~30 s later. A rerun takes the cached ones in ~10 ms and stops on the next new ones, so it is compile time, not a hang.

+1 on bumping dxil-spirv in #257's kit. Closing this one since the upstream fix covers it; the first-bind compile stall is a separate problem.

(Drafted with Claude Code, Claude Opus 5.5; numbers from my runs.)

**@⁠xstraok** on GitHub · 2026-11-24 05:28 UTC · [original](https://github.com/xcl-dev/xcl/issues/611#issuecomment-7122976077) Confirmed on RADV. RX 9060 XT 16 GB (RDNA4, Mesa 26.2.6), Proton Experimental, vkd3d-proton v3.1 with `subprojects/dxil-spirv` moved to `53aac418` + #257's patch, XCL `f4ce27c` + #257 + #496 + #610 + #172 (+ #708 in the last runs): the 20+ GB structurizer runs and the hangs are gone in every run since (9 runs). The stop is now the same as yours. Thread dumps at the stop (`real::build_compute` → `translated_compute_pso` → `dxc::compile`, then `d3d12core`/`winevulkan`) show a title render thread compiling new ~870–910 KB-DXIL compute shaders one at a time on first bind, ~11 s each (DXC, then 3.1–3.4 s in the driver). A second render thread waits in `pso_async::resolve_wait`, the main thread waits on both, and the title's watchdog fires ~30 s later. A rerun takes the cached ones in ~10 ms and stops on the next new ones, so it is compile time, not a hang. +1 on bumping dxil-spirv in #257's kit. Closing this one since the upstream fix covers it; the first-bind compile stall is a separate problem. *(Drafted with Claude Code, Claude Opus 5.5; numbers from my runs.)*
This discussion has been locked. Commenting is limited to contributors.
No description provided.