4.8 KiB
4.8 KiB
vetta-infer Architecture Blueprint
1. Hardware Ground Truth (Measured on Sogliola)
| Resource | Measured Value | Architectural Implication |
|---|---|---|
| GPU | AMD Radeon 890M (gfx1150, RDNA 3.5, 16 CU) |
Wave32 native, 16×16×16 INT8 WMMA (~44 TFLOP/s), 16×16×16 FP16 WMMA (22.14 TFLOP/s) |
| Memory | 48 GiB VRAM carveout + 46 GiB GTT/RAM (96 GiB UMA) |
VRAM and RAM share the same LPDDR5X (81.7 GB/s raw, ~75 GB/s sustained GEMM). Zero-copy hipHostRegister avoids redundant DRAM→DRAM copies |
| Storage | Dual Gen4 NVMe (~4.8 GB/s single, ~9 GB/s striped) |
`O_RDONLY |
| LAN Peer | Lyra over 2.5 Gbps Ethernet (~300 MB/s, ~0.3 ms RTT) |
Unsuitable for per-layer Tensor Parallelism; ideal for <1 KB/step remote drafting, domain routing, and Vision/RAG offload |
2. Crate Graph
┌───────────────┐
│ vetta-cli │
└───────┬───────┘
┌─────────┬───────┼───────┬───────────┐
▼ ▼ ▼ ▼ ▼
vetta-proto vetta-io vetta-hip vetta-telemetry
└─────────┴───────┼───────┴───────────┘
▼
vetta-core
vetta-core: zero external dependencies. DefinesQuantFormat,TensorMeta,SlabRing,PrefixState,HybridPrefixPool,SamplingOpts, zero-allocbuild_truncated_dist,sample_logits_exact,verify_draft_exact(Leviathan lossless),AdaptiveKController,HotColdExpertCache,DraftProviderandPrefetchAdvisortraits.vetta-io: single checked.safetensorsreader (model.safetensors.index.json+ directory fallback +pread+ overflow-safe slice checks) and single write-onceO_RDONLYNVMe cache format (VTC1, FNV-1a fingerprint, pre-reserve count check, PID-isolated.tmp.<pid>atomic commit).vetta-proto: singlestrata-ctl-compatible line protocol (INFO,READY,GENincludingGEN 0pre-warm,RESUME,PP,T,DONE,ERR,STOP,QUIT,RESET) plus compact binary/text messages for Lyra LAN RPC (DraftReq/DraftResp,DomainHint).vetta-telemetry: lock-free ring buffer + background JSONL writer collecting:- per-layer MoE expert activation counts (Zipf curves) and
L -> L+1transition frequencies; - domain-tagged expert profiles (fed back to
PrefetchAdvisorfor NVMe Hot/Cold pre-warming); - speculative acceptance histograms (
acc[0..=K]),ms/tok, logit entropy, top1-top2 margin, cache hit/miss, DMA bandwidth.
- per-layer MoE expert activation counts (Zipf curves) and
vetta-hip: thin FFI tokernels/hip/(compiled via ROCmclang++ --offload-arch=gfx1150) with RAIIDeviceBuf/PinnedUmaBufbound to HIP events/fences, plus a CPU mock backend for CI/unit testing without a GPU.
3. Minimal Reusable HIP Microkernel Set (< 15 Primitives)
k_embed_bf16— BF16 embedding gatherk_rms_norm— fused RMSNorm (+ optional residual add /+1.0weight offset)k_quantize_x_g64— per-64 activation INT8 quantization (fusable with SwiGLU)k_gemm_q8_g64_t16— native RDNA 3.5 INT8 WMMA ([N/16, K/64, 4, 16, 16], FP16 scales)k_gemm_q4_g64_t16— SWAR 3-instruction INT4→INT8 WMMA (0.5625 B/param)k_gemm_nvfp4_mxfp8— direct Inkling NVFP4 / MXFP8 expert & trunk GEMMk_rope_kv_write— rotary embedding + FP8/FP16 KV cache write (SWA ring or linear)k_flash_gqa_wmma— fused FlashAttention-2 / GQA prefill (B >= 16) & Split-KV decode (B <= 2)k_gdn_chunkwise_wy— Chunkwise Parallel GDN (WY-representation) for250–350+ pptsprefillk_gdn_recurrent_step— 0-spill GDN decode + history snapshot for<1 msspeculative rollbackk_moe_route_bucket— 100% GPU MoE routing + bitonic coreset + NaN/mask-safe compaction (0host sync)k_moe_grouped_wmma— compacted active-expertw13(fused SwiGLU + quantize) &w2+k_moe_reducek_vit_flash_attn_wmma—64×64FP16 WMMA Vision encoder attentionk_gpu_penalties_topk— GPU penalties +top-64extraction (<= 512 BD2H per row instead of6–16 MBwithtemp > 0!)
4. Formal Contracts (proofs/slab_ring_dma.lean)
Verified with Lean 4.36.0 (0 sorryAx):
SlabRingDMA safety: mutual exclusion betweenio_uringhost DMA writes and GPU kernel reads, mandatory fence completion before slot reclaim, conservation of slot count.PrefixState& Checkpoint Grid: strict soundness of multi-turnRESUMEwith/without MTP (sc_mtp_hid_can never be read uninitialized), and guaranteed checkpoint trigger on non-aligned post-RESUMEprefill chunks.