# Patches ## Apply these two (the deliverables) | patch | target | what | |-------|--------|------| | `mesa-panvk-shared-tls-wls.patch` | Mesa 26.1.3, `src/panfrost/vulkan/` | Fix the panvk priv-VA-heap exhaustion (OOM at ub>64). Device-shared TLS scratch + WLS reuse. Also contains a small `PANVK_AS_LOG` priv-heap instrument (env-gated). | | `llama.cpp-mali-mmq-warptile.patch` | llama.cpp `389ff61`, `ggml/src/ggml-vulkan/` | Mali/panvk `mul_mm`/`mul_mmq` warptile branch + `BK_STEP` spec constant (L-scoped). The 4.8× prefill. Also contains an env-gated `[panvk-tls]`/`PANVK_WLS_LOG` shader-spill trace. | Env flags used at runtime (both patches): `PANVK_SHARED_TLS=1 PANVK_WLS_REUSE=1`. Trace flags (optional): `PANVK_AS_LOG=1`, `PANVK_WLS_LOG=1`. Build panvk minimally: `meson setup build -Dvulkan-drivers=panfrost -Dgallium-drivers= ...` (mirrors a bifrost-style co-install). Point `VK_ICD_FILENAMES` at the built `libvulkan_panfrost.so`. Run on a **panthor** kernel with the GPU bound to `panthor`, not the vendor `mali` blob. ## `iterations/` — the tuning trail (not for applying) The single-variable shader experiments, in order. See `docs/shader-tuning.md` for the numbers. - `llama.cpp-0001-vk-tunable-submit-thresholds.patch` — exploratory, no effect (kept for the record). - `llama.cpp-0002-vk-cmd-cleanup-freq-env.patch` — falsified hypothesis (cmdbufs are in-flight). - `llama.cpp-0003-mali-warptile-iter1.patch` — 16-acc tile, spill 5328→96 B, ub128 4×. - `llama.cpp-0003-mali-warptile-iter3-champion.patch` — bigger workgroup, same registers, +10%. - `llama.cpp-0004-mali-shader-iter5-champion.patch` — scoped BK_STEP=2 (superseded by the final patch, which is iter5's content).