ExpertArena loads a whole layer expert tensor in ONE contiguous device buffer
(the safetensors already store [n_exp,N,K/2] NVFP4 / [n_exp,N,K] MXFP8), with a
per-expert outer_scale array. The indirect GEMV indexes expert id from a DEVICE
buffer (ids[slot]) => static launch params, no host ids round-trip.
Add MXFP8 f16 indirect kernel (mirrors NVFP4: shared device body + direct +
indirect wrappers). expert_arena_gemv_f16 dispatches NVFP4/MXFP8.
Parity on REAL weights: arena-indirect BIT-EXACT vs per-expert direct for layer 0
(NVFP4) and layer 20 (MXFP8), 4 routed experts each. Additive — forward default
unchanged (wiring into the device-resident MoE path is the next brick).
Verified: ld GPU 19 + hip GPU 19 green, workspace CPU -D warnings green, 6 Lean
proofs 0 sorryAx.
Bug: serve_gen called WeightCache::new(&eng.ar) PER REQUEST, creating empty
memoization maps each turn -> every request re-read ~15-23 GiB of weights from
NVMe and re-uploaded to device (the 'resident' comment was contradicted by the
per-request instantiation). Federico spotted the symptom: model only loaded at
the first message, unlike the reference which loads at boot.
Fix:
- WeightCache now owns Arc<SafetensorsArchive> (was &'a borrow) so ONE cache lives
resident in InklingEngine across all requests; loaded once, never re-read.
- WeightCache::prewarm(d, n_layers) eagerly loads the whole model (trunk + every
SWA/full layer + core controllers + all expert matrices). run_serve calls it at
boot by DEFAULT (model ~23 GiB <= 80 GiB full-UMA-residency policy); READY is
emitted only after residency. VETTA_LAZY_LOAD=1 defers to first use (still
resident across requests once loaded).
- Arc deref coercion keeps all CPU-oracle test reads (&ar) unchanged.
Verified (gfx1150, Inkling-2-Mini, FP16 KV): eager VRAM 23.60 GiB at READY before
any message, boot 3.6s, STABLE across 3 requests (no reload/growth), clean release
0.34 GiB on QUIT; lazy option 0.34 GiB at boot. Parity EXACT preserved: CPU 91 +
ld GPU 18 + gw GPU 5 green.
Concept ported from strata --auto-ckpt, adapted to vetta's contiguous per-pass
KV + ShortConv history (proofs/prefix_cache.lean, restore_equiv). serve_gen now
restores the longest cached STRICT prefix of a prompt and prefills only the new
suffix tokens; the final logits still come from a real forward of the last prompt
token. Checkpoints save at pos (prompt + generated non-EOS tokens) so the next
turn reuses the full prior context. Pinned anchors {512,1024} never evicted (I3),
LRU at cap 6; KV snapshots unpooled (freed on eviction). VETTA_NO_PREFIX_CACHE
forces cold prefill for A/B.
Device-to-device copy FFI (vetta_buf_copy / vetta_buf_copy2d) + DeviceBuf
copy_from/copy2d_from; LayerState snapshot/restore (pitched KV prefix + hist).
Verified: CPU 91 + gw GPU 5 + hip GPU 18 + ld GPU 18 green; Lean 0 sorryAx.
Multi-turn parity EXACT (restore == cold re-prefill), both prewarm- and
decode-state checkpoints. Measured (gfx1150, Inkling-2-Mini, FP16 KV, greedy):
605-token prompt, 600-token cached prefix -> prefill 132.5s cold vs 2.29s warm
(57.8x), end-to-end 133.2s vs 3.2s (41.8x).
Federico saw VRAM grow ~7 GiB per agent step (44.9/48 GiB, near OOM). Root cause:
the KV cache scales with max_seq=prompt+max_new (varies per request) and the
exact-size DeviceBuf pool retained every distinct KV size, so a multi-turn chat
accumulated KV without bound. The full-attn flash scores scratch (n_win grows per
token) leaked similarly.
- DeviceBuf gains a 'pooled' flag + alloc_unpooled(): always hipFree on drop,
never pooled. KV (k_cache/v_cache) uses it -> freed at request end, no
accumulation. Per-token fixed-size intermediates stay pooled (decode speed).
- flash_scores_scratch buckets the allocation to a power of two so the pool
reuses it as cur_pos grows (kernel still strides by actual n_win <= bucket).
- KV dtype: FP16 for the resident serve (exact strata KvDtype::FP16 default,
parity-verified EXACT, half the VRAM of F32). Safe process-wide switch
set_kv_f16(); InklingEngine::new opts in. The ld CPU-oracle parity tests keep
the F32 default (VETTA_F32_KV=1 also forces F32).
Measured (new binary, 3 requests of 200/400/600 prompt tokens): VRAM 7.66 ->
8.07 -> 8.33 GiB (small bounded expert lazy-load growth, NOT +7 GiB/step);
clean release to 0.34 GiB on QUIT. Parity EXACT (16 tok); 18 ld + 18 hip + 5 gw
GPU green; workspace -D warnings green; 5 Lean 0 sorryAx.
End-to-end verified: strata-ctl --serve spawns vetta-infer and serves the
OpenAI-compatible API. Live: 'capital of France' -> Paris (finish stop), and
Italian multi-turn context -> Napoli. Two wire-compat gaps closed:
- accept '--serve <dir>' alias (strata-ctl engine_argv prepends --serve).
- emit the EOS token as 'T <eos>' before 'DONE ... stop', matching the
reference strata-inkling --serve (strata-ctl's dialect decoder reads the
end-of-sampling channel token). chat parity now EXACT incl. EOS.
GPU test isolation (the 5th full-model test OOM'd): HIP-visible VRAM is 48 GiB
(model 18 GiB; one live instance peaks ~15 GiB and releases cleanly). The OOM
was the harness, not a leak: the thread-local DeviceBuf pool retains buffers
for each libtest worker thread's lifetime, so 5 engines' weights accumulated
past 48 GiB. Fix: gw gpu_isolated() runs heavy tests under a serial lock with
the pool disabled via a new safe hip::set_buf_pool_enabled (no env mutation,
gw stays unsafe-free), so every drop hipFrees between tests.
KV sizing: LayerState.k_cache/v_cache are now Vec sized to the passes a layer
actually runs (core 3, prelude/coda 1) instead of 3 for every layer, removing
~1.6 GiB of unused KV at max context. Parity unchanged (EXACT 16 tok).
Suite: workspace -D warnings green; 18 ld + 18 hip + 5 gw GPU; 5 Lean 0 sorryAx.
Two root causes found by bisecting the pos-27/28 forward against strata-inkling
(per-visit cur-norm dumps, STRATA_INK_NORM/POS, reverted after):
1. KV cache was shared across the 3 core loop passes. The reference assigns a
DISTINCT KV pool per visit (visit_kv_slot: 40 SWA + 8 global), so each core
pass reads its own KV history. Sharing one cache corrupted multi-token
attention from the first core visit (visit6) onward. LayerState.k_cache/
v_cache are now [DeviceBuf; 3] indexed by pass (prelude/coda use pass 0).
2. Served/logit vocab used the PADDED size (201024). Padding tokens >= the
unpadded vocab (200058) carry arbitrary logits and outranked real tokens
(e.g. 200193 beat end_message 200010). Engine now uses unpadded_vocab,
matching strata k_unembed_softcap V = vocab_unpadded.
Verified: chat parity EXACT vs reference for 16 and 40 greedy tokens, both
F32 (default) and FP16 KV. pos-28 per-visit norms now agree to ~3e-3 (was
diverging by 50-80). Added serve_gen_multi_token_parity GPU regression.
Suite: workspace -D warnings green; 18 ld + 18 hip + 4 gw GPU; 5 Lean 0 sorryAx.
strata stores K/V in FP16 by default (KvDtype::FP16, 'default lossless FP16');
vetta used F32. Add k_kv_store_f16 (RNE round to u16 cache) + k_flash_swa_gqa_decode_f16
(f32 attention math over FP16 KV), FFI/wrappers, and a new_state/forward branch
gated by VETTA_F16_KV=1 (F32 stays the CPU-oracle baseline). New GPU parity test
fp16_kv_store_and_flash_parity: stored K == cast_f32_f16 bits, attention over the
decoded FP16 KV matches a CPU oracle fed the same values (18 hip GPU green).
MEASURED honestly: FP16 KV does NOT fix the chat token-2+ divergence (still
~3.6 logit gap vs reference, robust also to VETTA_F16_EXPERT and -ffp-contract=off).
The gap is a systematic multi-token accumulation difference, not KV precision;
kept as faithful opt-in infrastructure, not claimed as a parity fix.
Gated (VETTA_PROF=1) timing of embed/prelude/core/coda/final plus a thread-local
expert-time accumulator, to locate decode hotspots without perturbing the normal
path. Used to measure the M2 perf increment.
Root cause of the residual argmax gap (tok100: 220 vs ref 68014). Per-visit norm bisection vs the reference localized it: prelude + core pass 0 matched (~1e-4), but pass 1/2 diverged ~3x. Stage dump at visit 18 (ip6 pass1) showed attention matched (q/k_cv/v_cv/aout/cur_after_attn ~1e-3) while mlpin diverged 2.8% and y_part 2.85x (router top-k flip).
The reference (ink_hip_backend.hip.cpp ~5049) applies the mlp loop controller to the RAW depth-mix THEN rms_norm: run_attnres -> run_loop_ctrl(mlpin,3) -> k_rms_norm_rows. vetta applied it AFTER rms_norm (to the normalized mlpin). Swapped order in both layer_forward_swa and layer_forward_full: apply_controller(&mix,...) before rms_norm.
MEASURED after fix: tok100 argmax = 68014 EXACT reference match (logit 18.371). All 48 per-visit cur norms now match reference to ~1e-3 (pass1/2 + coda restored). Generation 'The capital of France is' -> first 5 tokens [152717,13,68014,32,13] EXACT reference (was 2); coherent continuation ' Paris.\n\nA. True\nB. False\nAnswer A. True'.
Verified: 18 ld GPU + 17 hip GPU + workspace (-D warnings) green, 5 Lean files 0 sorryAx. Reference debug patch reverted + rebuilt clean.
Add the exact strata B=1 FP16 expert path as verified kernels: k_cast_f32_f16 (RNE), k_nvfp4_gemv_f16 / k_mxfp8_gemv_f16 (FP16 activations, group partial dot then scale-fma, fdot2 order), k_situ_f16 (SiTU f32 -> stored FP16). Rust wrappers + expert_gemv_f16 dispatch.
Refactor the duplicated SWA/full expert loops into ld::layer::run_experts. Default stays all-f32 (verified parity baseline); VETTA_F16_EXPERT=1 selects the FP16 path.
MEASURED A/B (tok100): f32 argmax 220 (23.074) / 68014 22.643; fp16 argmax 220 (23.069) / 68014 22.632. FP16 shifts logits ~0.01 but does NOT flip the near-tie: the residual gap vs reference is the core-loop pass 1/2, NOT expert precision. FP16 kept opt-in for once the loop is fixed.
New real_expert_nvfp4_gemv_f16_parity (GPU fp16 vs CPU oracle over same fp16-rounded x) green. Verified: workspace -D warnings, 18 ld GPU + 17 hip GPU green.
Root cause found by reading strata run_sconv: the ShortConv history pool is
indexed by GLOBAL VISIT (hist_pool_all + rec_visit*stride), so each core pass
has its OWN history ring -- history does NOT carry across the 3 passes for the
same token. The previous shared-per-layer history made pass 1 read pass 0's
input as history (wrong). LayerState now holds hist_k/v/a/m as [DeviceBuf;3]
indexed by pass; layer_forward_swa/full + run_layer take a pass index (prelude/
coda=0, core=0/1/2). For a fresh token every visit reads zero history, matching
the reference. Single-token argmax moved (8->183618), confirming history matters.
Verified: cargo test --workspace + hip 17/17 + lean 0 sorryAx green.
Reference comparison (strata-inkling --serve ground truth) exposed a systematic
precision bug: vetta truncated f32->bf16 (>>16) while the reference f32_to_bf16
rounds to nearest even (0x7FFF + ((u>>16)&1)). Truncation bias accumulates over
the 48-visit loop and drifts the residual stream.
- k_cast_f32_bf16: round-to-nearest-even (was truncation).
- k_ctrl_pack: packed cur/msg bf16 now round-to-nearest-even.
- k_shortconv4_decode / k_shortconv4_dyn_decode: history ring rounded through
bf16 between steps (exact strata "Round through BF16 between steps"), via a
new bf16_round device helper.
- CPU oracles updated to match (packer bf16_trunc, hip f32_to_bf16 + the
shortconv/controller test history shifts).
Effect on the full forward (single token 100, reference argmax 68014):
argmax moved 100 -> 8 and logit[68014] rose 8.6 -> 11.1 (toward the reference),
confirming the rounding fix is real and directional. Generation from "The
capital of France is" (prompt ids verified identical to the reference) now
produces structured text but the argmax still diverges from the reference
" Paris" — further precision/composition parity is in progress (reference uses
fp16 KV cache + fp16 expert input; candidate next mismatches).
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
GPU 17/17 (--features hip, --ignored) green with the rounded oracles;
lean proofs (5 files) green.
Reference-ground-truth debugging continues (strata-inkling --serve gives the
correct continuations). Added diagnostics to isolate the remaining divergence:
- real_full_attn_layer_end_to_end: full CPU oracle for the full-attn layer
(ip=5): 3-query mix split + separate q/k/v norms + distinct-input projections
+ dyn ShortConv (reversed taps) + global attention + MoE. Currently FAILS
(max_rel_err 5.876) with IDENTICAL expert selection GPU==CPU — so the bug is
downstream of routing, in the attention-output -> MoE-input path, not a
router tie-flip. Kept as an #[ignore] diagnostic tracking the open bug.
- full_attn_bisect: stage-by-stage GPU-vs-CPU comparison (mix/norm/projections/
dyn-shortconv) reporting max_rel + max_abs + rel-on-large-values. Findings:
mix/norm match (~1e-6); GEMM absolute error ~1e-3 (benign bf16 rounding, the
large max_rel is an artifact of the 1e-3 floor on near-zero outputs).
- sconv_dyn_step CPU helper; env-gated VETTA_DBG_NORM (residual/block norms)
and VETTA_DBG_IDS (selected experts) taps in the layer forwards.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (5 files) green. The full-attn parity diagnostic is #[ignore] and
known-failing (open correctness bug under investigation).
Added a reference-ground-truth debugging loop: drove the strata-inkling
reference engine (--serve, GEN protocol) on the same prompts to obtain the
correct continuations, then compared against vetta's forward.
- tokenizers crate (fancy-regex) added to vetta-infer-ld for real BPE
encode/decode from tokenizer.json.
- forward_inkling_with_state: stateful variant exposing the persistent
per-layer KV cache + shortconv history across decode positions, enabling
autoregressive prefill + generation. forward_inkling wraps it with fresh state.
- generate_continuation_real_prompt test: encode prompt -> token-by-token
prefill -> greedy sampling via the hardened abi sampler -> decode.
TWO REAL BUGS FOUND via reference comparison (reference: "The capital of
France is" -> " Paris."; single token 100 -> argmax 68014):
1. embed_token omitted embed_norm: the reference k_embed_lookup fuses gather +
RMS-normalize with embed_norm.weight. Fixed (gather then rms_norm).
2. full-attn ShortConv static_w transpose had REVERSED tap order: reference
upload_sc uses kt[c*4+(3-lag)] = kw[lag*kv_dim+c]; fixed to match.
NOTE: generation is still divergent after these two fixes (single-token argmax
moved 120533 -> 100, reference 68014); further correctness debugging is in
progress. These two fixes are verified-correct against the reference semantics.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (5 files) green; generation + full-forward tests run
(--features hip, --ignored).
- k_softcap / vetta_softcap: logits = cap*tanh(x/cap), the final logit
softcapping (Inkling cap=30). Parity vs CPU 9.7e-8; bounds |logits| <= cap.
- ld::layer::final_logits: the CORRECT final output path extracted from the
reference — the final norm is itself an AttnRes depth mix over the block
snapshots + cur with the learned output_query, then norm + unembed + softcap:
h_norm = norm(attn_res_mix(blocks, cur, output_query))
logits = softcap(unembed(h_norm), 30)
(The earlier unembed_logits used a plain rms_norm(cur), missing the final
depth mix; final_logits fixes that.)
- multi_layer_prelude_forward now uses final_logits: argmax token 128538
(logit 19.16, bounded by 30). The token shifts vs the plain-norm path,
confirming the final output mix materially affects the result.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; GPU softcap + multi-layer final PASS
(--features hip, --ignored).
- ld::layer: embed_token (real BF16 embed table gather), unembed_logits
(final norm -> cast -> unembed GEMM over vocab 201024), forward_swa_layers
(run a schedule of SWA layer steps over an embedded token, threading the
shared depth-block residual stream across layers).
- multi_layer_prelude_forward test: layers 0..4 composed end-to-end on real
weights + final norm + unembed -> finite logits, argmax token 183248
(logit 23.94). Asserts the cross-layer depth-block cadence (prelude 0..4
snapshots only at ip=0 -> exactly one block). Proves the verified layers
compose across the deep-residual stream, not just in isolation.
This is a partial (prelude, single-pass) forward — a real multi-layer run
producing logits, NOT yet correct generation. Remaining for a correct first
token: full-attn layers {5,11,17,23} (3-query mix split + tau + dyn shortconv +
global attention), loop controllers (gain/forget/down) for the 3x core passes,
multi-pass bank rollback (prelude/core/coda), final logit softcap + sampling.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; multi-layer prelude forward PASS
(--features hip, --ignored).
- ld::layer (feature hip): LayerWeights (load_layer reads all attention + MoE
weights + learned depth-mix queries for a physical step ip), LayerState
(persistent KV cache + ShortConv history rings, new_state), Dims, and
layer_forward_swa — a complete SWA layer step composing the verified
microkernels with the exact Inkling deep-residual cadence:
ip==0: in0=attn_norm(cur); ip>0: in0=attn_norm(mix(blocks,cur,attn_query))
attention block -> asc; ip%block_size==0: snapshot cur->blocks, cur=asc
else cur+=asc
mlpin=mlp_norm(mix(blocks,cur,mlp_query)); MoE block; cur+=mlp_sconv(moeout)
The depth-block snapshots are owned by the caller (the forward residual
stream); experts loaded on demand (zero requantization).
- Refactored real_full_layer_end_to_end to drive the GPU side through
layer_forward_swa; the unchanged full CPU oracle still verifies it
(max_rel_err 6.6e-4, identical experts) AND asserts the ip=0 block snapshot.
This is the reusable foundation for the multi-layer forward.
Scope: SWA layers without loop controllers (prelude). Full-attn 3-query split,
loop controllers (gain/forget/down) and multi-pass bank rollback come next.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; real full layer via reusable fn PASS
(--features hip, --ignored).
- real_full_layer_end_to_end test: a complete Inkling layer-0 (SWA, ip=0) runs
end-to-end on real weights with the EXACT deep-residual cadence:
in0 = attn_norm(cur) (ip==0: no attention mix)
asc = attention block(in0) (projections..flash SWA..O-proj..sconv)
ip%block_size(6)==0: block0 <- cur; cur = asc (snapshot + replace)
mlpin = mlp_norm(attn_res_mix([block0], cur, mlp_queries[0]))
moeout = MoE block(mlpin) (router..8 NVFP4 experts..reduce)
cur += mlp_sconv(moeout) (MoE residual is a plain add)
- Extracted the exact residual rules from the reference: the AttnRes block
snapshot/replace applies ONLY to the attention output (ip%6==0 snapshots cur
then cur=asc, else cur+=asc); the MoE output is always a plain residual add.
The MoE input is a learned AttnRes mix over block snapshots + cur (mlp_queries).
- Parity vs a full CPU oracle (incl. the block-mix softmax over depth states):
max_rel_err 6.6e-4, router experts [116,69,124,72,18,64,106,0]. A complete
real Inkling layer now composes correctly — the deep residual is not a plain
add but the learned block mixture, reproduced exactly.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; real full layer PASS
(--features hip, --ignored).
- real_attention_block_end_to_end test: the attention half of a real Inkling
layer-0 (SWA) runs end-to-end on real weights, composing the verified kernels:
attn_norm -> cast -> 6 projections (wq_du/wk_dv/wv_dv/wr_du/gate_attn/
attn_sink_proj via gemm_bf16) -> ShortConv4 K/V -> Q/R/K L2-clip (qk_clip
22.627, rel_clip 8.0, tau off for SWA) -> relpos bias projection -> KV store
(K clipped, V RMS-normalized) -> flash SWA GQA (window 1024 + relpos + sink +
sigmoid gate) -> cast -> O-proj (wo_ud) -> attn ShortConv4.
- Run T=3 sequential decode steps so the KV cache + shortconv history rings
grow autoregressively; parity vs a FULL CPU oracle at every step:
max_rel_err 2.9e-6 / 3.9e-6 / 5.1e-6. The bf16 cast boundaries (input norm ->
projections, attn out -> O-proj) are handled explicitly.
- With the real MoE block (5.6e-4), BOTH halves of a real Inkling layer now
compose correctly on real data. Next: join them into a full layer with the
AttnRes block-mix residual cadence (block_size=6), then loop controllers +
multi-layer forward + lowering + sampling.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; real attention block PASS
(--features hip, --ignored).
- real_moe_block_end_to_end test: the MoE half of a real Inkling layer runs
end-to-end on real layer-0 weights, composing the verified kernels:
mlp_norm (rms_norm) -> cast f32->bf16 -> router GEMM (gate.weight [128,2304]
BF16) -> sigmoid top-8 router (gate.bias, route_scale=8) -> 8 real NVFP4
experts (w13 GEMV -> SiTU beta4/lb25 -> w2 GEMV, outer=amax/denominator) ->
weighted reduce.
- Parity vs a FULL CPU oracle (rms_norm + bf16-truncate cast + BF16 router GEMM
+ sigmoid top-8 + per-expert NVFP4 dequant GEMV + SiTU + reduce): router ids
match exactly ([31,124,0,7,69,121,14,2]), output max_rel_err 5.6e-4.
- This is the integration milestone: the individually-verified kernels compose
into a correct real MoE block on real data, with the bf16 cast boundary
handled explicitly (the dtype-mismatch bug class). The MoE half of a real
Inkling layer now runs correctly; the attention half is next.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; real MoE block PASS
(--features hip, --ignored).
- ld::packer: ExpertMatrix + load_expert_matrix(layer, e, "w13"|"w2") loads a
real NVFP4 expert from safetensors with ZERO requantization — packed E2M1
[N,K/2] + E4M3 group scales [N,K/16] to device as-is, outer_scale =
amax[e] / denominator (denominator tensor read, default 2688 = 448*6 when
absent — exact strata ink_safetensors_loader semantics).
- Real-weight parity test: layer-0 expert-0 w13 [2304,2304] loaded from the
real archive, nvfp4_gemv on GPU vs a CPU dequant oracle over the real
packed bytes + scales + outer_scale. max_rel_err 2.8e-4 (f32 accumulation
order over K=2304; math identical). Confirms the expert scaling + layout
against real Inkling data — the key brick for the layered MoE forward.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; real expert NVFP4 parity PASS
(--features hip, --ignored).
- ld::packer (feature hip): load_raw (tensor bytes -> DeviceBuf, dtype
preserved) + load_bf16_as_f32 (BF16 norm weights upcast to f32 for the
rms_norm kernel, matching the reference). The bridge from canonical IR to
GPU-resident weights; the seam where the per-layer loading/precision policy
(engine-side composition) will be applied.
- FIRST REAL-WEIGHT GPU RUN: load the real Inkling trunk (~1.85 GB: embed +
unembed [201024,2304] BF16, embed_norm + final_norm) and run embed ->
embed_norm -> final_norm -> cast -> unembed on gfx1150, producing real
logits over vocab 201024 + argmax token (20612, logit 27.77, all finite).
Trunk-only skip-layer baseline — proves packer + executor + sampling on
real data end-to-end. The full layered forward + Inkling parity refinements
(AttnRes block-mix etc.) come next for correct generation.
- ld: optional hip + rt deps, feature-gated (default workspace stays
host-independent).
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; real-weight trunk run PASS
(--features hip, --ignored).
- ld::inkling_plan: physical_schedule() unrolls the looped core (verified
against the reference logical->physical mapping; Inkling = 6 + 3x12 + 6 =
48 physical steps over 24 logical layers). scratch_layout()/scratch_plan()
lay out the decode activation arenas (residual/q/k/v/attn_out/moe/logits),
4 KiB-aligned with checked offsets, validated by abi::arena.
- ld::inkling_graph: GraphBuilder accumulates arena decls (scratch=0,
weights=1, inputs=2) + a flat op sequence and validates the whole plan
(no overlap, checked bounds, no use-before-write) via abi::arena.
emit_trunk() emits the first complete sub-graph: embed(+embed_norm fused)
-> final norm -> unembed, arena-validated. The per-layer k1->k4 body plugs
into the same builder next.
- abi::vplan: add GemmBf16 opcode (BF16 trunk/unembed GEMM).
- docs/inkling-forward-design.md: forward blueprint grounded in the strata
reference (k1->k4 stage order from kernel numbering, real scratch buffer
set, loop structure, two forward paths main-LLM + MTP DSpark).
Verified live: RUSTFLAGS="-D warnings" cargo test --workspace = 96/96 PASS;
4 ignored live tests pass; lean proofs (4 files, 42 theorems) green.