Device-shared TLS scratch + grid-independent WLS reuse collapse per-cmdbuf 304MB TLS and
per-dispatch WLS into ~1 BO each. Peak priv-VA 3985MB->908MB, no OOM at any ubatch (was crash
at >=72). Verified on panthor. Real upstreamable Mesa panvk bug fix (mesa-panvk-0010).
BUT prefill speedup NOT achieved: larger ubatch is 3x SLOWER (ub64=21, ub128=5.8, ub256=7.4 t/s)
because llama.cpp's L-variant matmul shader spills ~10x more registers (the 304MB stack) -> poor
Mali occupancy. ub64 @ 21 t/s stays the ceiling, ties CPU. Remaining lever = ggml-vulkan L-shader
Mali tuning (separate effort). See docs/RESULTS.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cleanup_frequency (10->2) and free-on-reset both no-effect: cmdbufs are in-flight so can't be
reset. ~12 live 304MB TLS-stack BOs = 3.65GB. Real levers: cut x19 core overalloc, or reduce
in-flight depth. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Live instrumentation on panthor: WLS reuse verified working (644 REUSE/46 ALLOC) but the
crash is dominated by the TLS *stack* alloc in emit_tls() at EndCommandBuffer — L-variant
matmul shader spills 10x more registers (tls_size 544->5328 B/thread => 38MB->304MB stack),
x~12 cmdbufs retained in the tls pool => ~3GB, over the 4GB priv heap. Remaining fix is
structural (free tls-pool BOs post-submit and/or fix the x19 sparse-core overallocation).
See docs/root-cause-final.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Instrument-first panthor boot confirms Fable's diagnosis: ~326 per-dispatch WLS allocs
exhaust the sub-4GB priv VA heap at ub>=128. Grow-only single-max reuse (fix v1) halves the
pressure (326->715 dispatches) but WLS sizes vary 128x (155KB-19MB) so a single buffer is
insufficient. Refined fix pending 2nd review.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>