feat(cuda): arm117 — port adaptive-KV-streaming onto baseline + Gate G/R/B pass; rig cells pending (#117) - #118
feat(cuda): arm117 — port adaptive-KV-streaming onto baseline + Gate G/R/B pass; rig cells pending (#117)#118ddvnguyen wants to merge 64 commits into
Conversation
Assisted-by: OpenAI Codex
Assisted-by: OpenAI Codex
Assisted-by: OpenAI Codex
Assisted-by: OpenAI Codex
Assisted-by: OpenAI Codex
Assisted-by: OpenAI Codex
* fix: Windows support for benchmark_kv_stream server path and shutdown * fix: mask SIGINT during Windows server stop in benchmark_kv_stream
…slot streaming for the Hydra RPC split Gate R resolution for the adaptive-KV-streaming arm (PR #117): - upstream wiring requires every KV layer on one CUDA device in-process; under the production RPC layer split the first KV layers belong to the RPC peer, whose backend reg has no kv-stream proc addresses -> stock boot throws 'requires the CUDA backend' - LLAMA_KV_STREAM_DEVICE=CUDA0 restricts streaming to layers on the named device; other layers keep an ordinary fully-resident KV buffer (3060 unstreamed resident fallback shape). Unset -> stock behavior unchanged - single_sequence is a stock hard reject; LLAMA_KV_STREAM_ALLOW_MULTISEQ=1 opts -np>1 in so the concurrency hypothesis is testable upstream-untested - device-filter count of zero now fails early with a clear error
…pshot artifact entry
|
Rig pass complete. Rig restored & verified (health 200 ×2, VRAM 15847/11911 exact production signature, Verdicts
Cell A
Per the doc's FAIL bar, concurrency violation stands regardless of the clean single-slot verdict. The Artifacts
|
…i-stream ubatches fell back instead of asserting Root cause of the np2 crash (arm117 rig repro, instrumented): - dispatch entered ggml_cuda_kv_stream_fattn purely on buffer membership (runtime_from_tensor(dst->src[1/2]) != nullptr), but ggml_cuda_flash_attn_ext_streamed_supported() additionally requires Q/K/V ne[3] == 1 (single stream). A cont-batch decode spanning 2 busy parallel slots builds K/V 4D views with ne[3] == ns == 2, streamed_supported() returns false and the GGML_ASSERT at kv_stream_fattn entry aborted the server. - now falls back to the ordinary flash_attn_ext path (kv-stream buffer is host-mapped pinned storage; reads are semantically exact zero-copy) with a WARN line. - known remaining limitation: upstream's page/dirty-row accounting has no stream dimension (mark_dirty_rows pages shared across n_stream), so concurrent-slot outputs remain not-exact; documented in arm doc Results. np2 streaming stays disqualified except as measurement-only opt-in. Evidence attached: crashdiagnostics + fallback repro logs
Round 2: root cause + numbers + q8_0 verdict (rig verified, rig restored)1) np2 crash — root-caused, fixed (
|
| config | mean tok/s (turns 1-9) | turn 1 | turn 9 |
|---|---|---|---|
baseline binary (d50efc6f, resident) |
24.26 | 31.54 | 21.89 |
| port + streaming ON (9/16 layers streamed, stage 2048 MiB) | mean 17.25 | 31.52 | 21.41 |
- Streaming costs ≈ −28.9% mean decode at this shape.
- Depth curve: baseline flat ~21-24 tok/s at 40-60K resident; streaming dips to 8.79-10.78 tok/s at 40-53K (host pool round-trips dominate once the 2048 MiB resident pool is exceeded), then recovers at 60K.
- turn-1 parity (31.52 vs 31.54) confirms the shallow-context path is unchanged.
3) q8_0 K+V question — definite NO
- Crash mechanism is a geometry check (
ne[3]==1), not type support; Gate T already proved q8_0 and q5_1 both DIRECT. In the diagnostic print the K/V of the same layer always share ONE buffer pointer — no mixed-runtime identity possible in the failing node; fits() nil/nil case was the prepare_graph probe on a plain-buffer node (not dispatch). page_bytesare quant-size dependent only throughggml_cuda_kv_stream_page_bytes()geometry math, which self-adjusts; no mixed-size sensitive path (2D stride checks are per-type row-size formulas).- A q8_0/q8_0 np2 pre-fix boot would merely reproduce the same abort (disallowed per doc); the correct fix is the geometry gate + multistream layout work, not the quant.
Rig: restored — health 200 ×2, VRAM 15847/11911 exact, prod pod Running.
Artifacts: arm117-artifacts/crashdiag-Aon-np2-server.log (instrumented assert traces), fallback-Aon-np2-server.log (post-fix concurrent repro), perf-on.txt + perf-base.txt (turn-by-turn). Doc updated (fork/arm-adaptive-kv-streaming @ 58de2e67).
Executes the port (S0/S1/Gate-B) for #117's
docs/arms/arm-adaptive-kv-streaming.md.Port, not rebase — results materially BETTER than the doc's risk budget:
feature/adaptive-kv-streambranch is a linear rebase-carry whose upstream lineage includes5266f24da(v0.4.0 = our baseline base) AND sparse-FA CUDA + ggml: add sparse-fa for DSV4/GLM ggml-org/llama.cpp#27970, and continues to ~2026-09-06. The feared pre-sparse-fa fattn.cu skew does not exist.baseline(d50efc6f); the one hidden feature dependency (7fa262b3UM-mirror) included; the 6 irrelevant upstream carries excluded. Only 2 trivial conflict resolutions.Gate G (code read): zero touch on recurrent/SSM/GDN paths (
gated_delta_net.cu,ssm-*.cuh,llama-memory-recurrent*.cppuntouched). Draft KV not streamed by upstream design.Gate R verdict: runtime is per-CUDA-device per-process, proc-address based; the rpc-server peer has no llama-layer, so stock RPC composition is impossible upstream-side. Implemented (lower-risk path, doc fallback respected):
LLAMA_KV_STREAM_DEVICE=CUDA0device filter — CUDA0 layers stream, 3060 share fully resident, production RPC topology intact. PlusLLAMA_KV_STREAM_ALLOW_MULTISEQ=1opt-in so-np 2(this fork's load-bearing production config, upstream-untested) is measurable rather than hard-rejected.Gate B: llama-server + ggml-rpc-server build OK at
86;120, CUDA 13.2.2, FA_ALL_QUANTS. CPU-side unit tests of the ported feature all green (plan 241 asserts / config 18 / softmax).Rig cells: not started. One physical rig; PR #116's arm holds it (rig-coordination protocol). Parity control, Gate T probe, and cells A/C/D run once the rig is released.
Arm doc updated with
## Resultsonfork/arm-adaptive-kv-streamingatfa111588.