[HIP][Core] Zero-VRAM PrefixCache in pinned host RAM (PinnedBuf) + DSpark SWA ring
Close Punto 3 of the flat-VRAM plan:
- Add PinnedBuf (hipHostMallocDefault / hipHostFree with stream 0 sync on drop) and pipelined async 1D/2D D2H/H2D copy helpers in vetta_kernels.{h,hip} and vetta-infer-hip.
- Migrate LayerSnapshot (KV + ShortConv hist) and DsparkSnapshot (drafter KV + frnn_last) from VRAM DeviceBuf to host PinnedBuf (0 bytes VRAM per checkpoint).
- Size DSpark SWA layers 0/2 in DsparkContext to DS_SWA_RING=1280 (-258 MiB VRAM at 32k context).
- Add GPU regression tests: pinned_buf_zero_vram_and_roundtrip_2d (+0.00 MiB VRAM on 64 MiB alloc) and serve_gen_pinned_prefix_cache_vram_flat (4 turns up to 2100 tok, 8/8 checkpoints full, VETTA_SPEC=1: 20674->20672->20676->20676 MiB, +2.00 MiB delta).
- Update README.md, docs/ORIENTATION.md, and review/2026-12-02-fix-drafter-e-ottimizzazioni.md.
This commit is contained in:
1 parent
c1c5221642
commit
1772050087
9 files changed
+370
-88
No files matched your search
+11
-6
@@ -121,12 +121,17 @@ Five ideas explain almost everything that will surprise you:
|
||||
~6.3 ms/token. Internal M=1-vs-M=B parity is relaxed to a global-scale numeric
|
||||
tolerance per the approved P1 policy; greedy-vs-reference remains the EXACT
|
||||
blocking gate (serve_gen 4/4).
|
||||
- **VRAM is flat and bounded (2026-12-02).** Persistent per-layer KV/ShortConv
|
||||
states reused across requests (no ±3.75 GB alloc/free sawtooth), SWA-window
|
||||
checkpoints (only the last 1024 KV positions for the 40 SWA pools, full prefix
|
||||
for the 8 full-attn pools), prefix cache cap 8 with grid protection +
|
||||
LRU-on-restore, and a 512 MiB cap on the buffer pool. Long→short session
|
||||
switches reuse the persistent KV instead of reallocating it.
|
||||
- **VRAM is flat and bounded — zero-VRAM checkpoints in pinned host RAM (2026-12-02, measured).**
|
||||
Persistent per-layer KV/ShortConv states reused across requests (40 SWA pools on
|
||||
1280-slot rings + 8 Global pools; DSpark SWA layers 0/2 also on 1280-slot rings,
|
||||
saving ~258 MiB at 32k), power-of-two `BUF_POOL` bucketing (512 MiB cap), and all
|
||||
`PrefixCache` snapshots (`LayerSnapshot` KV + ShortConv + `DsparkSnapshot`) stored
|
||||
in **page-locked host RAM** (`PinnedBuf` via `hipHostMallocDefault`, async SDMA
|
||||
transfers on stream 0, `hipStreamSynchronize` before `hipHostFree` on drop).
|
||||
Verified on `gfx1150`: 64 MiB `PinnedBuf` adds `+0.00 MiB` VRAM, and a 4-turn
|
||||
multi-checkpoint sweep up to 2100 tokens filling all 8 `PrefixCache` slots with
|
||||
`VETTA_SPEC=1` holds VRAM flat at **`20,674 → 20,672 → 20,676 → 20,676 MiB`**
|
||||
(Turn 1→4 delta `+2.00 MiB`, `RESUME 0→607→1107→1607`, 100% EXACT parity).
|
||||
- **Long agent prompts are no longer refused (2026-12-02).** strata-ctl always
|
||||
sends max_new=16384; the budget is now clamped to the window (`clamp_max_new`)
|
||||
instead of hard-erroring past 16382 prompt tokens, and the window is
|
||||
|
||||
Reference in new issue
Block a user