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:
authorAslan2142 <jan.trencansky@protonmail.com>2026-11-26 15:41:00 +0100
committerGitHub <noreply@github.com>2026-11-26 15:41:00 +0100
commitfbf100b1b10e391625585fe6a8bf4e653662ca9a (patch)
tree497fe3bc8ef8b45d1ac8c68fa9f85196d08f11ad /docs/linux_proton.md
parent73516a2902a9872e4d21d1bdbbde4e26059497c5 (diff)
parent484b21262a21f9a99148b89ad2458b389faf7bd1 (diff)
Merge pull request #2350 from aslan2142/linux-amd-world
Self-merge by a maintainer, on purpose: current main does not get through the world on Linux/AMD, and this brings the regression fixes (the single-wave round-loop fallback of 9f98dcc61, the wave64 choice driven by llvmpipe) together with eleven PRs the world run needed. Tested on main 73516a290: translator suite 500 files / 6,365 tests, 0 failed; 513 standard-library test files pass; check_no_game_data clean on 80 files; Linux ctest 112/112; Wine suite (clang-cl + xwin, RDNA2 iGPU, RADV) with no test going from pass to fail. Not tested: native Windows, NVIDIA. The included PRs are closed in favour of this one with credit to their authors. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2).
Diffstat (limited to 'docs/linux_proton.md')
-rw-r--r--docs/linux_proton.md61
1 files changed, 61 insertions, 0 deletions
diff --git a/docs/linux_proton.md b/docs/linux_proton.md
index de4760d70..b981c2ef2 100644
--- a/docs/linux_proton.md
+++ b/docs/linux_proton.md
@@ -150,6 +150,10 @@ Each item was a stop on at least one of the machines. Tests named in the pull re
150 150
151## Where it stops 151## Where it stops
152 152
153- **Writes into title memory.** A window is a read-side copy, so a UAV or raw write used to stop at the copy: the
154 missing return copy is the `WRITE_INVALID` device loss of #1537. The layer now copies the reached ranges back to
155 the title's pages at the next refresh, before the forward copy, and the title's own newer words win. Not yet
156 measured on a GPU with the world phase in front of it.
153- **Streamed memory that reaches its destination late or not at all.** The title calls queue slot 31 157- **Streamed memory that reaches its destination late or not at all.** The title calls queue slot 31
154 (`CopyPageMappingsBatchX`) about 300 times per boot. With #968 this branch maps each batch's pool pages at the 158 (`CopyPageMappingsBatchX`) about 300 times per boot. With #968 this branch maps each batch's pool pages at the
155 destination and at the paired CPU view the layer reads (`docs/d3d12_vulkan.md`, section 4.9), so most streamed 159 destination and at the paired CPU view the layer reads (`docs/d3d12_vulkan.md`, section 4.9), so most streamed
@@ -166,6 +170,63 @@ 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 170- **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. 171 with xmem's fault handler; the test for it is skipped there.
168 172
173## AMD on Linux: what got the world drawn
174
175On 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
176drew the first world frames: the opening night street and a sunset street with palms, cars and a character, over
177eight minutes in the world without a GPU hang, at about one frame per six seconds. The runtime was `main` `a73a57e13`
178with #1914, #1957, #1972, #2044, #2097, #2124, #2129, #2144, #2162, #2195 and #2240 merged; they went into `main`
179together with this section. Each step below removed a stop that ended every earlier run; they are in the order
180they were found.
181
1821. **Raise amdgpu's GPU timeout.** `modinfo amdgpu -p` shows `lockup_timeout` with a default of 2000 ms: the kernel
183 resets any ring whose job runs over 2 s. World frames take seconds, so a run ended about 30 s into the world with
184 `ring gfx_0.0.0 timeout` in `journalctl -k`, no page fault, and a black last frame. Raise it as root and reboot:
185 `amdgpu.lockup_timeout=30000,60000,10000,10000` on the kernel command line (graphics, compute, SDMA, video, in
186 ms), or `options amdgpu lockup_timeout=30000,60000,10000,10000` in a file under `/etc/modprobe.d/` followed by an
187 initramfs rebuild. A real hang then freezes that ring, and a desktop on the same GPU, for up to that long, so don't
188 make it unlimited. Windows reporters raise `TdrDelay` for the same reason.
1892. **Native wave64 shaders.** On a GPU that runs wave64 natively (AMD RDNA), translate with
190 `make_game.py --stages shaders --wave64-emulate off`. Before `max_subgroup_decider` (`make_game.py`), the auto
191 mode took the smallest `maxSubgroupSize` over every Vulkan device, so an installed llvmpipe (8) turned emulation on for all
192 23,841 wave64 shaders. Emulated single-wave compute programs were then translated in the round-loop form, which
193 hung the GPU on several library programs and drove RADV's compiler past 12 GiB (53 GB uncapped) on the largest; the
194 translator no longer does that for single-wave programs ([design.md](design.md), row "Wave64 emulation:
195 single-wave barrier fallback").
196 The auto mode now leaves CPU devices out when a GPU is listed and names the device that decided.
1973. **Fill the pipeline journal with the runtime itself.** `gta6rt --precompile-pipelines --threads 16`, under Wine,
198 with the environment of the game run (`LEONIDA_SHADERS`, `LEONIDA_PIPELINE_CACHE_DIR`, `LEONIDA_DEVICE_FAULT`;
199 `--precompile-pipelines` in [d3d12_vulkan.md](d3d12_vulkan.md)). It built 3,693 compute pipelines; the next boot took
200 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.
201 The `pipeline_cache.bin` that `make_game.py`'s pipelines stage writes with `vk_pipeline_check` gave no hits: 0 of
202 5,526 journal pipeline keys were in its 29,861 objects (9 shader binaries were identical, so the machine code
203 matched and the keys did not). Each of three differences is enough for a miss on RADV:
204 - **The set of shaders:** the runtime's warm-up builds the library's compute programs (`library/index.json`,
205 2,683 modules); the stage builds the main index and `bvh/`, and only 25 library modules are byte-identical to a
206 main-index one.
207 - **Robustness:** on RADV the runtime enables `robustBufferAccess`, `robustBufferAccess2` and `nullDescriptor`;
208 `vk_pipeline_check` turns `robustBufferAccess` off and leaves robustness2 off. RADV puts the robustness state into
209 every shader stage key, so every pipeline, compute and graphics, misses.
210 - **Layout and subgroup request:** for compute with set-0 bindings (2,244 of the 2,683) the checker builds set 0
211 from default bindless features and requests the subgroup size without the runtime's full-subgroups flag; RADV
212 hashes the whole set layout and the stage flags. Graphics would miss anyway: the checker pairs each stage with a
213 stub and fixed state, and RADV hashes the full graphics state.
2144. **Leave out the ray-tracing programs.** 724 library compute programs have 2 MiB of SPIR-V or more (676 of them
215 ray-tracing resolve) and take 89-167 s each in the driver. `LEONIDA_RT_AS=off` drops acceleration-structure builds
216 and copies, and `LEONIDA_SKIP_COMPUTE=<name>,<name>,...` with those programs' `lib_cs_NNNNN` names (picked by
217 module size from `library/index.json`) never builds or dispatches them. The picture then lacks whatever those
218 passes draw.
2195. **Keep the title's hang watchdog kicked.** The title exits on purpose (a write to address 0) when its main loop has
220 not reported for 30 s, which a world load under the runtime exceeds. `LEONIDA_TITLE_WATCHDOG=0` defuses it only
221 together with `LEONIDA_TITLE_WATCHDOG_KICK=<trap RVA>,<kick RVA>` (hex; `runtime/src/main.cpp`); the two values are
222 measured locally and never committed. With `=0` alone the loader logs that the watchdog stays armed.
223
224The rest of that run's environment came from a Linux/Proton report on an RTX 3090: `LEONIDA_ASYNC_PIPELINES=0`,
225`LEONIDA_DEVICE_TYPE=6`, `LEONIDA_MAP_READBACK=1`, `LEONIDA_TITLE_WINDOWS_MB=4096`, `LEONIDA_FRAME_PACING=1` and
226`LEONIDA_PRESENT_NO_TEAR=1`. Still wrong after it: frames alternate between white-out, a correct picture and black;
227some geometry is drawn in the wrong place; VRAM reached 18.3 of 22.3 GB; the run ended on a breakpoint in the title
228after 12 minutes.
229
169## Reporting a result 230## Reporting a result
170 231
171Say the machine (OS, GPU and driver, RAM), the commit, the environment switches that differ from the defaults, and 232Say the machine (OS, GPU and driver, RAM), the commit, the environment switches that differ from the defaults, and