diff options
Diffstat (limited to 'docs/linux_proton.md')
| -rw-r--r-- | docs/linux_proton.md | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/docs/linux_proton.md b/docs/linux_proton.md index de4760d70..42487ed49 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,72 @@ 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 | |||
| 175 | On 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 | ||
| 176 | drew the first world frames: the opening night street and a sunset street with palms, cars and a character, over | ||
| 177 | eight minutes in the world without a GPU hang, at about one frame per six seconds. The runtime was `main` `a73a57e13` | ||
| 178 | with #1914, #1957, #1972, #2044, #2097, #2124, #2129, #2144, #2162, #2195 and #2240 merged; they went into `main` | ||
| 179 | together with this section. Each step below removed a stop that ended every earlier run; they are in the order | ||
| 180 | they were found. | ||
| 181 | |||
| 182 | 1. **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. | ||
| 189 | 2. **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. | ||
| 197 | 3. **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 | That run left out the programs `LEONIDA_SKIP_COMPUTE` named, which kept them out of the journal; the pre-compile | ||
| 202 | now builds them too unless it is given `--skip-listed`. | ||
| 203 | The `pipeline_cache.bin` that `make_game.py`'s pipelines stage writes with `vk_pipeline_check` gave no hits: 0 of | ||
| 204 | 5,526 journal pipeline keys were in its 29,861 objects (9 shader binaries were identical, so the machine code | ||
| 205 | matched and the keys did not). Each of three differences is enough for a miss on RADV: | ||
| 206 | - **The set of shaders:** the runtime's warm-up builds the library's compute programs (`library/index.json`, | ||
| 207 | 2,683 modules); the stage builds the main index and `bvh/`, and only 25 library modules are byte-identical to a | ||
| 208 | main-index one. | ||
| 209 | - **Robustness:** on RADV the runtime enables `robustBufferAccess`, `robustBufferAccess2` and `nullDescriptor`; | ||
| 210 | `vk_pipeline_check` turns `robustBufferAccess` off and leaves robustness2 off. RADV puts the robustness state into | ||
| 211 | every shader stage key, so every pipeline, compute and graphics, misses. | ||
| 212 | - **Layout and subgroup request:** for compute with set-0 bindings (2,244 of the 2,683) the checker builds set 0 | ||
| 213 | from default bindless features and requests the subgroup size without the runtime's full-subgroups flag; RADV | ||
| 214 | hashes the whole set layout and the stage flags. Graphics would miss anyway: the checker pairs each stage with a | ||
| 215 | stub and fixed state, and RADV hashes the full graphics state. | ||
| 216 | 4. **Leave out the ray-tracing programs.** 724 library compute programs have 2 MiB of SPIR-V or more (676 of them | ||
| 217 | ray-tracing resolve). The 89-167 s each in the driver were measured with wave64-emulated packs; with the native | ||
| 218 | pack of step 2 they build in seconds, so compile time is not the reason any more. Measured afterwards on the same | ||
| 219 | 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 | ||
| 220 | 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 | ||
| 221 | of them in the journal and no skip list (one run per build) took them all from the journal and got no further | ||
| 222 | than runs with the skip list: one stopped submitting after 404 s with the GPU idle, the other lost the device | ||
| 223 | about 214 s in with every queue idle, a loss that also happens with the skip list set | ||
| 224 | ([running.md](running.md#settings-every-platform-needs)). Whether their output is correct is not measured, so the | ||
| 225 | longest runs still leave them out. `LEONIDA_RT_AS=off` drops acceleration-structure builds and copies, and | ||
| 226 | `LEONIDA_SKIP_COMPUTE=<name>,<name>,...` with those programs' `lib_cs_NNNNN` names (picked by module size from | ||
| 227 | `library/index.json`) drops their dispatches at play. The picture then lacks whatever those passes draw. | ||
| 228 | 5. **Keep the title's hang watchdog kicked.** The title exits on purpose (a write to address 0) when its main loop has | ||
| 229 | not reported for 30 s, which a world load under the runtime exceeds. `LEONIDA_TITLE_WATCHDOG=0` defuses it only | ||
| 230 | together with `LEONIDA_TITLE_WATCHDOG_KICK=<trap RVA>,<kick RVA>` (hex; `runtime/src/main.cpp`); the two values are | ||
| 231 | measured locally and never committed. With `=0` alone the loader logs that the watchdog stays armed. | ||
| 232 | |||
| 233 | The rest of that run's environment came from a Linux/Proton report on an RTX 3090: `LEONIDA_ASYNC_PIPELINES=0`, | ||
| 234 | `LEONIDA_DEVICE_TYPE=6`, `LEONIDA_MAP_READBACK=1`, `LEONIDA_TITLE_WINDOWS_MB=4096`, `LEONIDA_FRAME_PACING=1` and | ||
| 235 | `LEONIDA_PRESENT_NO_TEAR=1`. Still wrong after it: frames alternate between white-out, a correct picture and black; | ||
| 236 | some geometry is drawn in the wrong place; VRAM reached 18.3 of 22.3 GB; the run ended on a breakpoint in the title | ||
| 237 | after 12 minutes. | ||
| 238 | |||
| 169 | ## Reporting a result | 239 | ## Reporting a result |
| 170 | 240 | ||
| 171 | Say the machine (OS, GPU and driver, RAM), the commit, the environment switches that differ from the defaults, and | 241 | Say the machine (OS, GPU and driver, RAM), the commit, the environment switches that differ from the defaults, and |