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:
Diffstat (limited to 'docs/linux_proton.md')
-rw-r--r--docs/linux_proton.md82
1 files changed, 77 insertions, 5 deletions
diff --git a/docs/linux_proton.md b/docs/linux_proton.md
index c792a550d..61627b69a 100644
--- a/docs/linux_proton.md
+++ b/docs/linux_proton.md
@@ -6,8 +6,7 @@ counts, timings and settings only: no game data, no traces.
6 6
7Status in one line: on Linux/Proton and on native Windows the retail 1.0.2.1 package launches, shows its launch 7Status in one line: on Linux/Proton and on native Windows the retail 1.0.2.1 package launches, shows its launch
8movie, first-run pages and landing prompt, runs the story load to its end with the loading slideshow drawing its 8movie, first-run pages and landing prompt, runs the story load to its end with the loading slideshow drawing its
9artwork, and enters the world phase. A first world frame has not been verified yet on any of the three machines; what 9artwork, and enters the world phase. A first world frame has been verified on Linux/AMD (RX 7900 XTX, RADV, 2026-11-26; see [AMD on Linux: what got the world drawn](#amd-on-linux-what-got-the-world-drawn)); it has not been verified yet on any of the three machines in the table below, and what stops it there is listed under [Where it stops](#where-it-stops).
10stops it is listed under [Where it stops](#where-it-stops).
11 10
12## Test machines 11## Test machines
13 12
@@ -53,12 +52,15 @@ the layout the comments at their top describe (`/opt/leonida` for traces, overla
53 `__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1`. 52 `__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1`.
54- **Input:** a pad through GameInput/SDL3, or the keyboard pad (`LEONIDA_KEYBOARD_PAD=always`), or a script: 53- **Input:** a pad through GameInput/SDL3, or the keyboard pad (`LEONIDA_KEYBOARD_PAD=always`), or a script:
55 `LEONIDA_INPUT_SCRIPT=a@210,a@240` presses A at those seconds (any length since this branch; it was cut at 63 54 `LEONIDA_INPUT_SCRIPT=a@210,a@240` presses A at those seconds (any length since this branch; it was cut at 63
56 characters before). 55 characters before). The script also works in a build without SDL3, where it drives one scripted pad
56 ([docs/gameinput.md](gameinput.md#scripted-input-without-sdl3)); pads and the keyboard pad need SDL3.
57- **Window:** frames are presented in the title's own window; `LEONIDA_PRESENT_WINDOW=own|hidden` chooses otherwise. 57- **Window:** frames are presented in the title's own window; `LEONIDA_PRESENT_WINDOW=own|hidden` chooses otherwise.
58 58
59Three setup mistakes each give a blank or empty picture without an error: the executable's embedded shaders missing 59Three setup mistakes each give a blank or empty picture without an error: the executable's embedded shaders missing
60from the library (`exe/index.json`), a build without SDL3 (no pad), and a BCPack predictor file that was never 60from the library (`exe/index.json`), a build without SDL3 and without `LEONIDA_INPUT_SCRIPT` (no pad, so nothing
61generated (`tools/build_dstorage_history.py`; without it the loading art and most BC7 textures stay empty). 61gets past the first prompt; set a script, or build with SDL3 for a pad or the keyboard pad), and a BCPack predictor
62file that was never generated (`tools/build_dstorage_history.py`; without it the loading art and most BC7 textures
63stay empty).
62 64
63## Running the game under Wine with one command 65## Running the game under Wine with one command
64 66
@@ -147,6 +149,10 @@ Each item was a stop on at least one of the machines. Tests named in the pull re
147 149
148## Where it stops 150## Where it stops
149 151
152- **Writes into title memory.** A window is a read-side copy, so a UAV or raw write used to stop at the copy: the
153 missing return copy is the `WRITE_INVALID` device loss of #1537. The layer now copies the reached ranges back to
154 the title's pages at the next refresh, before the forward copy, and the title's own newer words win. Not yet
155 measured on a GPU with the world phase in front of it.
150- **Streamed memory that reaches its destination late or not at all.** The title calls queue slot 31 156- **Streamed memory that reaches its destination late or not at all.** The title calls queue slot 31
151 (`CopyPageMappingsBatchX`) about 300 times per boot. With #968 this branch maps each batch's pool pages at the 157 (`CopyPageMappingsBatchX`) about 300 times per boot. With #968 this branch maps each batch's pool pages at the
152 destination and at the paired CPU view the layer reads (`docs/d3d12_vulkan.md`, section 4.9), so most streamed 158 destination and at the paired CPU view the layer reads (`docs/d3d12_vulkan.md`, section 4.9), so most streamed
@@ -163,6 +169,72 @@ Each item was a stop on at least one of the machines. Tests named in the pull re
163- **Under Wine** a thread that takes an access violation while holding the process heap lock can still deadlock 169- **Under Wine** a thread that takes an access violation while holding the process heap lock can still deadlock
164 with xmem's fault handler; the test for it is skipped there. 170 with xmem's fault handler; the test for it is skipped there.
165 171
172## AMD on Linux: what got the world drawn
173
174On 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
175drew the first world frames: the opening night street and a sunset street with palms, cars and a character, over
176eight minutes in the world without a GPU hang, at about one frame per six seconds. The runtime was `main` `a73a57e13`
177with #1914, #1957, #1972, #2044, #2097, #2124, #2129, #2144, #2162, #2195 and #2240 merged; they went into `main`
178together with this section. Each step below removed a stop that ended every earlier run; they are in the order
179they were found.
180
1811. **Raise amdgpu's GPU timeout.** `modinfo amdgpu -p` shows `lockup_timeout` with a default of 2000 ms: the kernel
182 resets any ring whose job runs over 2 s. World frames take seconds, so a run ended about 30 s into the world with
183 `ring gfx_0.0.0 timeout` in `journalctl -k`, no page fault, and a black last frame. Raise it as root and reboot:
184 `amdgpu.lockup_timeout=30000,60000,10000,10000` on the kernel command line (graphics, compute, SDMA, video, in
185 ms), or `options amdgpu lockup_timeout=30000,60000,10000,10000` in a file under `/etc/modprobe.d/` followed by an
186 initramfs rebuild. A real hang then freezes that ring, and a desktop on the same GPU, for up to that long, so don't
187 make it unlimited. Windows reporters raise `TdrDelay` for the same reason.
1882. **Native wave64 shaders.** On a GPU that runs wave64 natively (AMD RDNA), translate with
189 `make_game.py --stages shaders --wave64-emulate off`. Before `max_subgroup_decider` (`make_game.py`), the auto
190 mode took the smallest `maxSubgroupSize` over every Vulkan device, so an installed llvmpipe (8) turned emulation on for all
191 23,841 wave64 shaders. Emulated single-wave compute programs were then translated in the round-loop form, which
192 hung the GPU on several library programs and drove RADV's compiler past 12 GiB (53 GB uncapped) on the largest; the
193 translator no longer does that for single-wave programs ([design.md](design.md), row "Wave64 emulation:
194 single-wave barrier fallback").
195 The auto mode now leaves CPU devices out when a GPU is listed and names the device that decided.
1963. **Fill the pipeline journal with the runtime itself.** `gta6rt --precompile-pipelines --threads 16`, under Wine,
197 with the environment of the game run (`LEONIDA_SHADERS`, `LEONIDA_PIPELINE_CACHE_DIR`, `LEONIDA_DEVICE_FAULT`;
198 `--precompile-pipelines` in [d3d12_vulkan.md](d3d12_vulkan.md)). It built 3,693 compute pipelines; the next boot took
199 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.
200 That run left out the programs `LEONIDA_SKIP_COMPUTE` named, which kept them out of the journal; the pre-compile
201 now builds them too unless it is given `--skip-listed`.
202 The `pipeline_cache.bin` that `make_game.py`'s pipelines stage writes with `vk_pipeline_check` gave no hits: 0 of
203 5,526 journal pipeline keys were in its 29,861 objects (9 shader binaries were identical, so the machine code
204 matched and the keys did not). Each of three differences is enough for a miss on RADV:
205 - **The set of shaders:** the runtime's warm-up builds the library's compute programs (`library/index.json`,
206 2,683 modules); the stage builds the main index and `bvh/`, and only 25 library modules are byte-identical to a
207 main-index one.
208 - **Robustness:** on RADV the runtime enables `robustBufferAccess`, `robustBufferAccess2` and `nullDescriptor`;
209 `vk_pipeline_check` turns `robustBufferAccess` off and leaves robustness2 off. RADV puts the robustness state into
210 every shader stage key, so every pipeline, compute and graphics, misses.
211 - **Layout and subgroup request:** for compute with set-0 bindings (2,244 of the 2,683) the checker builds set 0
212 from default bindless features and requests the subgroup size without the runtime's full-subgroups flag; RADV
213 hashes the whole set layout and the stage flags. Graphics would miss anyway: the checker pairs each stage with a
214 stub and fixed state, and RADV hashes the full graphics state.
2154. **Leave out the ray-tracing programs.** 724 library compute programs have 2 MiB of SPIR-V or more (676 of them
216 ray-tracing resolve). The 89-167 s each in the driver were measured with wave64-emulated packs; with the native
217 pack of step 2 they build in seconds, so compile time is not the reason any more. Measured afterwards on the same
218 machine (RX 7900 XTX, RADV, Mesa 26.3.1, Wine): all 721 such programs of that pack built, 360 of them in 170 s on 32
219 threads, 2.5-32 s each, the largest (13 MiB) in 28.5 s alone, at a peak of 14 GiB of RAM. Two world runs with all
220 of them in the journal and no skip list (one run per build) took them all from the journal and got no further
221 than runs with the skip list: one stopped submitting after 404 s with the GPU idle, the other lost the device
222 about 214 s in with every queue idle, a loss that also happens with the skip list set
223 ([running.md](running.md#settings-every-platform-needs)). Whether their output is correct is not measured, so the
224 longest runs still leave them out. `LEONIDA_RT_AS=off` drops acceleration-structure builds and copies, and
225 `LEONIDA_SKIP_COMPUTE=<name>,<name>,...` with those programs' `lib_cs_NNNNN` names (picked by module size from
226 `library/index.json`) drops their dispatches at play. The picture then lacks whatever those passes draw.
2275. **Keep the title's hang watchdog kicked.** The title exits on purpose (a write to address 0) when its main loop has
228 not reported for 30 s, which a world load under the runtime exceeds. `LEONIDA_TITLE_WATCHDOG=0` defuses it only
229 together with `LEONIDA_TITLE_WATCHDOG_KICK=<trap RVA>,<kick RVA>` (hex; `runtime/src/main.cpp`); the two values are
230 measured locally and never committed. With `=0` alone the loader logs that the watchdog stays armed.
231
232The rest of that run's environment came from a Linux/Proton report on an RTX 3090: `LEONIDA_ASYNC_PIPELINES=0`,
233`LEONIDA_DEVICE_TYPE=6`, `LEONIDA_MAP_READBACK=1`, `LEONIDA_TITLE_WINDOWS_MB=4096`, `LEONIDA_FRAME_PACING=1` and
234`LEONIDA_PRESENT_NO_TEAR=1`. Still wrong after it: frames alternate between white-out, a correct picture and black;
235some geometry is drawn in the wrong place; VRAM reached 18.3 of 22.3 GB; the run ended on a breakpoint in the title
236after 12 minutes.
237
166## Reporting a result 238## Reporting a result
167 239
168Say the machine (OS, GPU and driver, RAM), the commit, the environment switches that differ from the defaults, and 240Say the machine (OS, GPU and driver, RAM), the commit, the environment switches that differ from the defaults, and