Commit Graph
7 Commits
Author SHA1 Message Date
adm 1772050087 [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.
2026-12-02 23:23:07 +01:00
adm c1c5221642 [HIP][Core] DSpark GPU drafter + verify perf & correctness fixes (13.93 tok/s, strata parity)
Fix all DSpark speculative bottlenecks and long-context/multi-turn bugs:
- Single-pass base-unembed Top-512 screen + on-GPU Markov loop & argmax (reads 922 MB unembed once per round, <=32 B D2H).
- On-GPU batched verify argmax + forward_batch_taps_no_logits (eliminates double unembed and 4.8 MB D2H per round).
- Wave32 online-softmax dspark_block_attn (0 bytes LDS, fixes >16.2k token crash on Global layer 1; regression-tested at c_len=17000).
- Vectorized M-tiled Wave32 router_gemv_batched, zero-scratch small-M SWA GQA, WMMA gemm_bf16 for m>=1, fdot2 MoE for b<=12.
- Persistent DsparkContext + PrefixCache DsparkSnapshot save/restore (multi-turn RESUME parity tested).
- Accepted-count EMA governor starting at n_draft=5 (adapts 2..7).
- Docs (README.md, docs/ORIENTATION.md) + changelog in review/2026-12-02-fix-drafter-e-ottimizzazioni.md.

Measured on gfx1150 (Inkling-2-Mini, temperature=0, 100% greedy EXACT):
- Rust coding (RingBuffer<T>, 128 tok): OFF 6.83 -> VETTA_SPEC=1 13.93 tok/s (2.04x, n_draft=5; strata-inkling 13.66 tok/s).
- Short prose (capital, 96 tok): nd=5 4.58 -> 9.09 tok/s (+98.5%); adaptive EMA 8.93 tok/s decode.
Validated: cargo test --workspace (-D warnings), all 7 Lean 4 proofs (0 sorryAx), HIP/LD/GW GPU parity gates.
2026-12-02 23:13:43 +01:00
adm a4752953fb [Docs] record 2026-12-02 landed state: batched+WMMA prefill, flat VRAM, budget clamp
README + ORIENTATION refreshed to the measured current state (the 618s sequential
first-token is now historical): chunked batched prefill + FP16 WMMA MoE + BF16 WMMA
dense + FlashAttention-2 WMMA prefill => synthetic 2048 prefill 60->12.9s (-78%),
~6.3ms/token (16k agent prompt ~105s, was ~7min); greedy-vs-reference EXACT gate,
internal M=1-vs-M=B parity global-scale tolerance (P1 policy). Flat bounded VRAM
(persistent states, SWA-window ckpt, cap8 grid-protected prefix cache, 512MiB pool
cap, long->short KV reuse). Budget clamp (clamp_max_new) + configurable window
(--max-context): 16504-token prompt generates live (was ERR 0). Roadmap: drafter
integration next, then DMA layer streaming (io_uring O_DIRECT + hipHostRegister
SlabRing) as the hard memory frontier; INT8 fused MoE + HIP graph capture remain.
Lean verify list now 6 files (prefix_cache.lean). Includes the two 2026-12-02 peer
audits in review/.
2026-12-02 05:22:07 +01:00
adm 442d26c90c [Docs] Prefix cache validated at scale: VRAM bounded past cap 6, pinned anchors survive eviction, EXACT parity at 1024 2026-12-01 20:47:47 +01:00
adm 8c8ae4485a [Docs] Prefix checkpoint cache landed: multi-turn prefill reuse, EXACT parity, 57.8x measured 2026-12-01 20:30:33 +01:00
adm b1f65942c8 [Docs] Document the first real interactive GUI inference (2026-12-01, measured)
Federico completed the first real conversation with vetta-infer through the
strata-ctl web GUI on Sogliola:
  'Ciao, sono Federico' -> 'Ciao Federico! Piacere di conoscerti. Come posso aiutarti oggi?'
  2650 prompt + 53 completion tokens, 4.2 tok/s decode, first token 618 s.

The 618 s time-to-first-token is the sequential prefill of the ~2650-token agent
prompt (~140 ms/token); decode is ~4.2 tok/s. Recorded honestly as the current
performance frontier (not a hang).

- README M1 milestone: inference landed (EXACT parity + strata-ctl link), with a
  dedicated measured first-GUI-conversation bullet; refreshed verification counts
  (5 Lean files incl. inkling_loop.lean).
- ORIENTATION 'Current state (honest)': replaced the stale 'No token generated
  yet' with the real state (full forward, EXACT parity, agent link, first GUI
  chat, blocking-sync CPU fix A/B 101.2%->54.2%); marked road steps 1-5 landed,
  M2 performance (graph capture / batched prefill / expert WMMA) as the frontier.
2026-12-01 19:26:15 +01:00
adm 356f9c458e [HIP][Docs] embed_bf16 + gemm_bf16 kernels (GPU-verified) + newcomer orientation guide
- kernels/hip: k_embed_bf16_gather (BF16 table -> f32 token rows, exact) and
  k_gemm_bf16 (y[M,N] = x[M,K] @ w[N,K]^T, BF16 in / f32 accumulate,
  correctness-first per-element; WMMA tiling is the later performance pass).
  C ABI + safe Rust wrappers (embed_bf16_gather, gemm_bf16) + DeviceBuf
  byte-level h2d/d2h.
- Verified LIVE on gfx1150: embed exact, gemm max_rel_err 0.0 across
  (2,8,16)/(4,32,64)/(1,128,256), rms_norm ~1e-6. Three kernels now cover the
  trunk + projection compute path (embed, norm, gemm).
- docs/ORIENTATION.md: a guide for newcomers arriving from vLLM/llama.cpp/
  SGLang — what this engine is, the five ideas behind the mental-model shift
  (microkernel+services, models compiled to .vbundle, forward pass as a
  Lean-proven validated plan, proof-first, parity discipline), the crate map,
  the honest current state (CPU pipeline done, GPU begun, no token yet), and
  the ordered road to the first agent chat and beyond. Linked from README.

Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; GPU parity 4/4 (--features hip).
2026-12-01 04:54:05 +01:00