upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/linux_proton.md
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-26 09:14:34 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-26 09:14:34 -0500
commite6a82e72b2a9f3a99c9119df4ee5ede30b683b1b (patch)
treeb93d8f1b24000e508c3390cb238881353c4cb420 /docs/linux_proton.md
parentd0ab80c09543aa4fb5ac68826e690c446e99b91b (diff)
docs/linux_proton.md: what got the world drawn on Linux with an AMD GPU
The five steps that each removed a stop of the 2026-11-26 runs on an RX 7900 XTX with RADV under Wine: amdgpu's 2 s lockup_timeout and how to raise it; a native wave64 pack; filling the pipeline journal with gta6rt --precompile-pipelines, and the three reasons the pipelines stage's pipeline_cache.bin never matches the runtime's driver keys; LEONIDA_RT_AS=off with LEONIDA_SKIP_COMPUTE for the large ray-tracing programs; and the watchdog's KICK variable, whose values stay local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/linux_proton.md')
-rw-r--r--docs/linux_proton.md56
1 files changed, 56 insertions, 0 deletions
diff --git a/docs/linux_proton.md b/docs/linux_proton.md
index de4760d70..a89e1c98b 100644
--- a/docs/linux_proton.md
+++ b/docs/linux_proton.md
@@ -166,6 +166,62 @@ Each item was a stop on at least one of the machines. Tests named in the pull re
166- **Under Wine** a thread that takes an access violation while holding the process heap lock can still deadlock 166- **Under Wine** a thread that takes an access violation while holding the process heap lock can still deadlock
167 with xmem's fault handler; the test for it is skipped there. 167 with xmem's fault handler; the test for it is skipped there.
168 168
169## AMD on Linux: what got the world drawn
170
171On 2026-11-26 a Linux machine with an RX 7900 XTX (and a Ryzen 9 7950X3D's RDNA2 iGPU), Mesa 26.3.1 (RADV) and Wine
172drew the first world frames: the opening night street and a sunset street with palms, cars and a character, over
173eight minutes in the world without a GPU hang, at about one frame per six seconds. The runtime was `main` plus several
174open D3D12-layer pull requests. Each step below removed a stop that ended every earlier run; they are in the order
175they were found.
176
1771. **Raise amdgpu's GPU timeout.** `modinfo amdgpu -p` shows `lockup_timeout` with a default of 2000 ms: the kernel
178 resets any ring whose job runs over 2 s. World frames take seconds, so a run ended about 30 s into the world with
179 `ring gfx_0.0.0 timeout` in `journalctl -k`, no page fault, and a black last frame. Raise it as root and reboot:
180 `amdgpu.lockup_timeout=30000,60000,10000,10000` on the kernel command line (graphics, compute, SDMA, video, in
181 ms), or `options amdgpu lockup_timeout=30000,60000,10000,10000` in a file under `/etc/modprobe.d/` followed by an
182 initramfs rebuild. A real hang then freezes that ring, and a desktop on the same GPU, for up to that long, so don't
183 make it unlimited. Windows reporters raise `TdrDelay` for the same reason.
1842. **Native wave64 shaders.** On a GPU that runs wave64 natively (AMD RDNA), translate with
185 `make_game.py --stages shaders --wave64-emulate off`. Before `max_subgroup_decider` (`make_game.py`), the auto
186 mode took the smallest `maxSubgroupSize` over every Vulkan device, so an installed llvmpipe (8) turned emulation on for all
187 23,841 wave64 shaders. Emulated single-wave compute programs were then translated in the round-loop form, which
188 hung the GPU on several library programs and drove RADV's compiler past 12 GiB (53 GB uncapped) on the largest; the
189 translator no longer does that for single-wave programs ([design.md](design.md), row "Wave64 emulation:
190 single-wave barrier fallback").
191 The auto mode now leaves CPU devices out when a GPU is listed and names the device that decided.
1923. **Fill the pipeline journal with the runtime itself.** `gta6rt --precompile-pipelines --threads 16`, under Wine,
193 with the environment of the game run (`LEONIDA_SHADERS`, `LEONIDA_PIPELINE_CACHE_DIR`, `LEONIDA_DEVICE_FAULT`;
194 `--precompile-pipelines` in [d3d12_vulkan.md](d3d12_vulkan.md)). It built 3,693 compute pipelines; the next boot took
195 1,900 of them from the journal in 0.1 s of driver time, and the menus ran at 30 frames/s instead of under one.
196 The `pipeline_cache.bin` that `make_game.py`'s pipelines stage writes with `vk_pipeline_check` gave no hits: 0 of
197 5,526 journal pipeline keys were in its 29,861 objects (9 shader binaries were identical, so the machine code
198 matched and the keys did not). Each of three differences is enough for a miss on RADV:
199 - **The set of shaders:** the runtime's warm-up builds the library's compute programs (`library/index.json`,
200 2,683 modules); the stage builds the main index and `bvh/`, and only 25 library modules are byte-identical to a
201 main-index one.
202 - **Robustness:** on RADV the runtime enables `robustBufferAccess`, `robustBufferAccess2` and `nullDescriptor`;
203 `vk_pipeline_check` turns `robustBufferAccess` off and leaves robustness2 off. RADV puts the robustness state into
204 every shader stage key, so every pipeline, compute and graphics, misses.
205 - **Layout and subgroup request:** for compute with set-0 bindings (2,244 of the 2,683) the checker builds set 0
206 from default bindless features and requests the subgroup size without the runtime's full-subgroups flag; RADV
207 hashes the whole set layout and the stage flags. Graphics would miss anyway: the checker pairs each stage with a
208 stub and fixed state, and RADV hashes the full graphics state.
2094. **Leave out the ray-tracing programs.** 724 library compute programs have 2 MiB of SPIR-V or more (676 of them
210 ray-tracing resolve) and take 89-167 s each in the driver. `LEONIDA_RT_AS=off` drops acceleration-structure builds
211 and copies, and `LEONIDA_SKIP_COMPUTE=<name>,<name>,...` with those programs' `lib_cs_NNNNN` names (picked by
212 module size from `library/index.json`) never builds or dispatches them. The picture then lacks whatever those
213 passes draw.
2145. **Keep the title's hang watchdog kicked.** The title exits on purpose (a write to address 0) when its main loop has
215 not reported for 30 s, which a world load under the runtime exceeds. `LEONIDA_TITLE_WATCHDOG=0` defuses it only
216 together with `LEONIDA_TITLE_WATCHDOG_KICK=<trap RVA>,<kick RVA>` (hex; `runtime/src/main.cpp`); the two values are
217 measured locally and never committed. With `=0` alone the loader logs that the watchdog stays armed.
218
219The rest of that run's environment came from a Linux/Proton report on an RTX 3090: `LEONIDA_ASYNC_PIPELINES=0`,
220`LEONIDA_DEVICE_TYPE=6`, `LEONIDA_MAP_READBACK=1`, `LEONIDA_TITLE_WINDOWS_MB=4096`, `LEONIDA_FRAME_PACING=1` and
221`LEONIDA_PRESENT_NO_TEAR=1`. Still wrong after it: frames alternate between white-out, a correct picture and black;
222some geometry is drawn in the wrong place; VRAM reached 18.3 of 22.3 GB; the run ended on a breakpoint in the title
223after 12 minutes.
224
169## Reporting a result 225## Reporting a result
170 226
171Say the machine (OS, GPU and driver, RAM), the commit, the environment switches that differ from the defaults, and 227Say the machine (OS, GPU and driver, RAM), the commit, the environment switches that differ from the defaults, and