[LD] FULL Inkling-2-Mini forward runs end-to-end (loop + controllers + MXFP8)

The complete 48-visit Inkling forward now runs on real weights on gfx1150:
prelude [0,6) -> core [6,18) x3 passes (bank rollback + cross-pass msgs +
gain/forget controllers on passes 1,2) -> coda [18,24) -> final depth mix +
unembed + softcap. Produces finite, softcap-bounded logits over vocab 201024
(argmax 120533, logit 19.219) in ~1.9s.

- k_mxfp8_gemv / vetta_mxfp8_gemv + ue8m0_to_f32: MXFP8 experts (layers 20..23
  are F8_E4M3 + UE8M0/32, NOT NVFP4). y[n] = sum_k e4m3(W[n,k]) *
  ue8m0(scale[n,k/32]) * x[k], no outer scale. Real layer-20 expert parity
  1.45e-4 vs CPU dequant oracle. This is the engine-side per-layer precision
  composition: layers 0..19 NVFP4, 20..23 MXFP8, dispatched transparently.
- packer: ExpertMatrix.mxfp8 flag + load_expert_matrix auto-detects the format
  (amax tensor presence) + expert_gemv dispatch.
- ld::layer: ControllerWeights/load_controllers + apply_controller (RMS pack ->
  down GEMM -> gain/forget GEMM -> gating); LoopMsgs; layer_forward_swa/full
  take Option<(&ControllerWeights,&LoopMsgs)> (has_msgs path: 3 separate
  controlled inputs for SWA, controllers before attn norm / after mlp norm).
- is_swa + load_msg_queries (stacked cross-pass queries) + run_layer (SWA/full
  dispatch, persistent per-layer state across passes) + forward_inkling (the
  proven schedule from proofs/inkling_loop.lean, incl. bank rollback).
- full_inkling_forward_logits test: whole-model forward -> finite bounded logits.

NOTE: the forward RUNS and is bounded; bit-parity of the generated token vs the
reference engine is the next verification step (no correctness claim yet).

Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (5 files) green; GPU 18/18 + MXFP8 real parity + full forward PASS
(--features hip, --ignored).
This commit is contained in:
adm committed 2026-12-01 15:14:05 +01:00
1 parent 38ac957b26
commit 3c870743fe
5 files changed
+354 -33

No files matched your search

+5
View File
@@ -79,6 +79,11 @@ int vetta_nvfp4_gemv(const uint8_t* packed, const uint8_t* scales,
float outer_scale, const float* x, float* y,
int N, int K, vetta_stream_t stream);
// k_mxfp8_gemv (M=1): MXFP8 experts (layers 20..23). y[N] = sum_k e4m3(W[n,k])
// * ue8m0(scale[n,k/32]) * x[k]. weights [N,K] F8_E4M3, scales [N,K/32] U8.
int vetta_mxfp8_gemv(const uint8_t* weights, const uint8_t* scales,
const float* x, float* y, int N, int K, vetta_stream_t stream);
// k_situ: SiTU double-softcapped MoE activation. gu=[gate;up] (2*inter) -> act.
int vetta_situ(const float* gu, float* act, int inter, float beta, float lb,
vetta_stream_t stream);