Files
Strata/engine/tests/hy4flash
Niko1221 2e8f436d24 fix(hy4): count the context-sized score buffer in the memory plan, and name a failed device allocation (#6744)
Hy4-Flash at a long context ended "HIP error 2 (out of memory)" right after the experts
were placed (SQ-64 at 1,048,576 and 524,288 on an RTX A6000 48 GB, and on the reporter's
R9700 / RTX 3090 Ti). An allocation trace shows why: the runner's work arena holds
chunk x (max_ctx / 4 + 8) floats of IndexPool scores, 8,590,196,736 bytes at a 1M context and
a chunk of 8192 (4.3 GB at 512K, 1.07 GB at 128K). plan_memory counted only the activation
scratch and the MoE workspace, so from about 256K up the reserve was too small and the
experts took the memory this buffer needed.

plan_memory now takes the arena as the largest of the three (hy4_plan_math.h, header-only,
tested in hy4_plan_math_test with the traced byte counts). Up to 128K nothing changes.

A failed device allocation in the runner now prints its size, the free memory and the
settings that move the KV and index buffers (HY4_KV_HOST=3, HY4_RESERVE_GB); HY4_ALLOC_TRACE=1
lists the allocations of 300 MiB and more.

Boston, 1 A6000, SQ-64, before: 1M and 512K ended in HIP error 2. After: 128K, 512K and 1M all
start without extra variables (decode 35 / 21 / 17 tok/s; 128K placement and speed unchanged;
the 33 GB cap, an R9700's size, also starts at all three).
2026-11-23 13:44:59 +01:00
..