Repository navigation
Description
Summary
On the linux-x86_64-hip-rx7900 build (strata-inkling 0.1.65, BUILD.json source: f-0219-rc c6f6427d9de9, gfx1100 / RX 7900 XTX 24 GiB), the integer quantized KV modes (--kv k8v4, --kv k8v8) allocate more VRAM than --kv fp16, OOMing at lower total context than fp16 does. --kv fp8 works fine at every depth tested. The failure point scales with --max-context, not with actual prompt size. The CPU backend's --kv k8v4 selfcheck passes, so the quant math is correct — this looks like the hip page/scale allocator.
Repro (all runs single-console --bench, parallel=1, --vram-reserve-mib 512, pack Inkling-2-Mini-SQ-20.strata)
| --kv | prompt | --max-context | result |
|---|---|---|---|
| fp16 | 1k | 64k | OK — decode 63.5 t/s |
| k8v4 | 1k | 64k | OK — decode 86.5 t/s |
| k8v4 | 32768 | 65536 | OK — decode 33.7 t/s |
| k8v4 | 49152 | 65536 | OK — decode 27.9 t/s |
| k8v4 | 65536 | 131072 | FATAL [ink-hip] kv grow v: out of memory (during decode growth) |
| k8v8 | 65536 | 131072 | FATAL [ink-hip] kv grow v: out of memory |
| fp8 | 65536 | 131072 | OK — decode 24.0 t/s |
| k8v4 | 131072 | 163840 | FATAL [ink-hip] kv grow v: out of memory (during prefill) |
fp16 (serve, --parallel 8) |
grew to ~78,592 prompt tokens | 262144 | OOM (kv grow v) only at ~79k with 8 slots; single-slot fp16 comfortably exceeds any k8v4-working depth |
Engine restarts after the fatal error; every subsequent request in that slot re-OOMs identically (deterministic).
Why this is anomalous
Per the shipped sizing tables (vram_fit.py: KV_BYTES = {"fp16": 2112, "int8": 1056, "q4_0": 576, "k8v4": 816} per token per attention layer — Qwen family), k8v4 should be ~2.6x smaller than fp16, yet it OOMs at strictly lower context. fp8 (per-element format, no block scale buffers) is unaffected, which points at the scale-buffer growth path: the binary's grow error strings come as a set kv grow k / ks / v / vs (K, K-scales, V, V-scales), with GGML-style block-64 quant (quantize_q8_1_g64) and paged pools (SlotKvPages::init(..., KvDtype), VisitKvPool::ensure_page, k3_kv_paged_store<>). Failure scaling with --max-context at fixed prompt size suggests the quant path sizes something from max-context (pre-allocation or stride mistake — e.g. per-token instead of per-block scale stride would be 8x bloat on the ks/vs buffers).
Control
strata-inkling --selfcheck --native SQ-20 --cpu --kv k8v4 → PASS backend=cpu (CPU (avx2, 1 threads)) — the K8V4/K8V8 round-trip assertions pass, so this is backend-specific allocation, not quant logic.
Environment
- strata-inkling 0.1.65, package
strata-inkling-0.1.65-linux-x86_64-hip-rx7900.tar.gz(bundled HIP 7 runtime), strata-control 0.2.19 bundle - RX 7900 XTX (gfx1100), 24 GiB; host RAM 64 GiB; Linux (kernel 7.2.8-omarchy at filing; repro identical after update to 7.2.15-omarchy), pack SQ-20 (bit-exact)
- Also observed (separate, likely dup of [Engine] sm_75 inkling path: --kv k8v8/k8v4 segfault, CUDA 700 when prompt+gen fills --max-context, DSpark OOM at 131K #6590):
--draft dsparkat serve ctx 163840 dies at ~141k depth with[ink-hip] ds frnn grow: out of memory, and produced zero decode gain on all probes (with draft on/off at matched prompts: 40.9 vs 41.2 t/s @39k) — the accept rate appears to be ~0 on this backend.
Related / dedup
- [Engine] sm_75 inkling path: --kv k8v8/k8v4 segfault, CUDA 700 when prompt+gen fills --max-context, DSpark OOM at 131K #6590 (sm_75 CUDA: k8v8/k8v4 segfault + OOM when prompt+gen fills
--max-context+ DSpark OOM at 131K) — same flags, same max-context-scaled shape on another backend; possibly a shared root cause (quant-KV sized from--max-contextwithout the fp16 growth/streaming logic). - [Engine] strata-inkling: --kv k8v8 and --kv k8v4 SIGSEGV immediately after load on Linux RTX 3090 (sm_86) #6645 (CUDA 3090: k8v8/k8v4 SIGSEGV right after load) — same modes, different failure.
- [Engine] SYCL 2x Arc Pro B60: --kv k8v4 collapses generation quality (8/48 vs 36/48 fp16) while ~10% faster - Qwen3.8-Flash-Next Q2_0 #6673 (k8v4 quality collapse, SYCL) — same mode, different symptom.
- [Engine] Inkling-2-Mini on RTX 3090 24 GB: long prompts OOM at ink_cuda.cuh:54 unless --max-context is small (SQ-20 and SQ-15) #6609 (max-context-scaled long-prompt OOM on CUDA) — same shape with plain fp16-class KV.
- HIP 0.1.65 cluster: [Engine] 0.1.65 HIP: any GGUF model SIGSEGVs in HipBackend::init — the HIP backend reads through the .strata reader instead of the model adapter #6579/[Engine] 0.1.65 HIP gfx1200: illegal memory access in batched prefill (Inkling-2 GGUF, NVFP4→SF4 experts); short prompts are fine #6580/[Engine] hip-rx9070 (gfx1201): Inkling-2-mini prompts of 64+ tokens fail in prefill with NaN logits; --set chunk=<64 works #6601/[TUI] Inkling-2-Mini SQ-15 planned as full-VRAM on a 16 GB Radeon runs out of memory at about 8.6K tokens of a 32K context #6613/[Engine] strata-inkling 0.1.65 (gfx1101): non-finite logits for every prompt of 64+ tokens in serve mode #6636 (init SIGSEGV, illegal access, NaN, VRAM sizing at 8.6k tokens on a 16 GB card).
- Searched terms: k8v4, k8v8, "kv grow", "ink-hip", hip vram, quant, "out of memory" — no report of quant-KV inflating VRAM vs fp16 on HIP.
Impact / workaround today
Quantized KV on hip is strictly counterproductive: it costs memory (vs fp16) and decode speed (dequant cost beats the bandwidth win at depth). --kv fp8 is a zero-accuracy-cost workaround on Inkling (fidelity 1.00/0.958 agreement on a 24-probe suite, fp16 vs fp8 indistinguishable) — but fp8 isn't documented anywhere as the supported mode; a per-backend --kv support matrix in the docs would save users this investigation.
Activity
Lomare commentedon Nov 22, 2026
Follow-up: source read + controlled retest — correcting one claim in the original report
Correction first: the original table compared
fp16under--serve --parallel 8 --max-context 262144againstk8v4under--benchat--max-context 131072. That comparison was confounded. A controlled same-shape retest (console--bench,parallel=1,--vram-reserve-mib 512, RX 7900 XTX, SQ-20):--kvbench decode err: [ink-hip] kv grow v: out of memorySo the accurate claim is not "k8v4/k8v8 allocate more than fp16" — it is: k8v4/k8v8 allocate byte-identical to fp16; the quantized storage is silently never applied. fp8 is the only
--kvmode that actually reduces memory on this engine.The source confirms it
Since the engine source is public, the mechanism is visible in
engine/src/inkling2/hip/ink_hip_backend.hip.cpp:VisitKvPoolhas exactly two storage shapes:K8V4/K8V8 fall into the
2ubranch — full fp16-sized pages. The scale buffers are gated the same way (if (is_fp8) { ...alloc... "kv grow ks" ... }), so they exist for fp8 only — which also matches our original observation order (kv grow vfails before any scale allocation is even attempted).The pool never sees the requested integer format at all:
— any other
KvDtypeenum collapses tois_fp8=false.alloc_slot()receives the per-session dtype and ignores it — the parameter is literally commented out:The CUDA-side inkling engine (
engine/src/inkling2/cuda/) appears to have no KV-dtype handling at all — consistent with [Engine] strata-inkling: --kv k8v8 and --kv k8v4 SIGSEGV immediately after load on Linux RTX 3090 (sm_86) #6645 (k8v4/k8v8 SIGSEGV on CUDA immediately after load).Taken with #6673 (k8v4 quality collapse on SYCL), it looks like
--kv k8v4|k8v8are accepted by the inkling CLI as inherited Qwen-family flags but were never implemented for this engine on any backend: hip allocates fp16-sized pages and pays the quantize/dequantize kernel cost for zero memory savings, CUDA crashes, SYCL degrades.Suggested fix shape
--kvmodes per backend (silently paying quant overhead with fp16-class memory is the worst outcome — users would assume the memory win is real).fp8is the only reduced-memory mode — it shows no measurable accuracy cost vs fp16 in our testing, so it's a genuinely good default to document).elem_binVisitKvPoolplus the ignoredalloc_slotdtype parameter are the touch points.(For context: a real deployment here has mitigated by pinning
--kv fp8 --parallel 1, which lifts usable depth from ~65k to 141k+ on this card; k8v4-style depth (~200k+) remains out of reach until the modes are actually implemented.)Thanks — and apologies for the confounded first table; the corrected claim above should be the one that survives in this thread.
Lomare commentedon Nov 22, 2026
Small correction: the "Linux (kernel 6.x)" line in the Environment section was wrong — the box was on 7.2.8-9-omarchy at filing time. We've since updated to 7.2.15-1-omarchy and re-run the repro: identical results (k8v4 OOM at the same point, fp8 unaffected), consistent with the allocation logic being userspace.
Lomare commentedon Nov 22, 2026
One correction to my earlier comment here: I wrote that the CUDA-side inkling engine "appears to have no KV-dtype handling at all" — that was wrong.
ink_runner.cuhhas a fullInkKvDtypepath (per-format allocation viakv_bytes_per_visit_pos, half-width V for K8V4). So #6645 is a crash inside a real CUDA implementation, not an unimplemented mode. The claim that survives (and the one this issue is about): hip/metal/sycl accept the flag while their pools ignore the dtype and allocate fp16-sized pages.I've opened #6692 implementing the reject-at-init fix shape (hip/metal/sycl guards +
--kvparse no longer silently treating typos asauto); CUDA is deliberately left unguarded there since its path deserves a real fix.Lomare commentedon Nov 23, 2026
Update from our side: the fix has landed on
mainvia 759ccf6 ("harden hy4 vcache headroom, inkling2 Metal/HIP/SYCL/CUDA guards, GGUF layout, and CMake checks") — we verified the HIP/Metal/SYCL--kv k8v4/k8v8rejection (with the "allocates fp16-sized pages" explanation), theunknown --kv valuehard-error, and thekv_dtype_guard_testCMake wiring are all present. Our PR #6692 (same fix, raced by 759ccf6) is closed as superseded.One note: the 0.2.20 / engines 0.1.66 release commit (2e87c08) predates 759ccf6 by ~5 hours, so the fix is on
mainbut not yet in a released engine build. We're on the hip-rx7900 0.1.65 engine where the bug reproduces — happy to re-run the repro (--kv k8v4/--kv k8v8under--serve --parallel 8on the 7900) against the next released engine and confirm here so this can be closed. Just ping us, or we'll check on the next engine release ourselves.launch: a --kv the Inkling engine does not take is said, not dropped;…
Lomare commentedon Nov 24, 2026
Re-ran the repro against engine 0.1.67 (v0.2.21, hip-rx7900 line, rebuilt from source with the release build flags; RX 7900 XTX / gfx1100,
--serve --parallel 8 --max-context 262144). The over-allocation signature no longer reproduces on the main HIP engine:--kv k8v8→ hard reject at init (exit 2, ~66 ms, no GPU work):--kv must be fp16, int8, q4_0 or k8v4--kv k9v9) → same hard parse error — no silentautofallback--kv k8v4→ accepted and served (READY 262144) with correctly-sized pools: expert cache 9,165 slots / 14.85 GiB vs q4_0's 8,917 / 14.44 GiB — not the ~2–4× fp16-sized allocation reported for 0.1.65One caveat so this isn't over-claimed: our binary doesn't compile the inkling2 backends, so we can't runtime-verify the new inkling2 hip/metal/sycl guard from this build (759ccf6 is in-tree at HEAD). From our side the reported defect (silent accept + fp16-sized pages) is confirmed gone on the main engine at the 0.1.67 level; a maintainer — or anyone with a released
strata-inkling0.1.67 on the same card — can confirm the init-time rejection there, after which this looks closable.Lomare commentedon Nov 26, 2026
Final verification from the 7900 XTX box, closing from our side.
Build:
strata 0.1.67, built from source on this machine (v0.2.21 + a local watchdog-recovery patch; HEADd46f5f26,git merge-base --is-ancestorconfirms 759ccf6 is in-tree). RX 7900 XTX / gfx1100, hip backend.Runtime (main engine) — confirmed:
--kv k8v8→strata generate: --kv must be fp16, int8, q4_0 or k8v4, exit 2, with no model load and no GPU work (it exits right after the host memory-guard line).--kv k9v9→ same hard parse error, exit 2 — no silentautofallback.inkling2 HIP guard — source + unit, with an honest caveat: the SQ-20 test pack is no longer on this machine (deleted after our 11-22 benchmarking), so we cannot runtime-verify the session-init rejection against a real inkling model. What we could verify:
engine/src/inkling2/hip/ink_hip_backend.hip.cpp:580:if (kv_dtype_is_int_quant(opts.kv_dtype)) { err = "[ink-hip] --kv k8v4/k8v8 is not supported on the HIP backend (allocates fp16-sized pages); use --kv fp8 or fp16"; ... }kv_dtype_guard_testcompiled standalone from this tree on this machine and passes:kv_dtype_guard_test: OK(exit 0).Net: the reported defect (silent accept + fp16-sized pages on hip) is runtime-verified gone on the main engine at the 0.1.67 level, and the inkling2 hip guard is present and unit-green at HEAD. Closing as fixed; anyone running a real inkling model on a 0.1.67 build should see the init-time
[ink-hip] --kv k8v4/k8v8 is not supported on the HIP backendrejection — if that string ever doesn't fire, please reopen.