[HIP] SiTU interleaved gate/up + F32 router: generation matches reference

Root-cause fixes that make Inkling-2-Mini generation match strata-inkling:

- k_situ: w13 rows are INTERLEAVED gate/up (row 2j=gate[j], 2j+1=up[j]), exact strata k_moe_direct_w13_situ. Was reading block layout gu[j]/gu[inter+j] -> sign-flipped y_part. Now gu[2j]/gu[2j+1].

- k_router_gemv (new): B=1 router reads F32 mlpin @ bf16 gate promoted to f32 (strata launch_f32_linear). bf16-rounding the router input flipped top-k expert selection. Used in both layer_forward_swa/full.

- situ_cpu oracle + situ_parity_vs_cpu updated to interleaved.

- real_full_layer/full_attn CPU oracle: router reads F32 mlpin (was bf16) -> experts now match GPU exactly.

- real_attention_block parity: allclose (atol 2e-3 + rtol 3e-3). Stage bisection proved aout matches CPU to <1e-6 abs; pure-relative metric exploded only at near-cancellation O-proj elements after bf16 cast (benign accumulation artifact).

- gated VETTA_DBG_NORM per-visit norm dumps for future bisection.

Verified: 'The capital of France is' -> ' Paris.' (152717, exact ref). cargo test --workspace green (-D warnings), 17 ld GPU + 17 hip GPU green, 5 Lean files 0 sorryAx.
This commit is contained in:
adm committed 2026-12-01 16:31:18 +01:00
1 parent df120e6f5f
commit 08514e81b1
5 files changed
+114 -22

No files matched your search

+5
View File
@@ -45,6 +45,11 @@ int vetta_embed_bf16_gather(const uint16_t* table, const int32_t* tokens,
int vetta_gemm_bf16(const uint16_t* x, const uint16_t* w, float* y,
int M, int N, int K, vetta_stream_t stream);
// k_router_gemv (M=1): y[N] = x_f32[K] @ w_bf16[N,K]^T, f32 accumulate. The
// router reads F32 mlpin (exact strata B=1 launch_f32_linear), not bf16.
int vetta_router_gemv(const float* x, const uint16_t* w, float* y,
int N, int K, vetta_stream_t stream);
// k_flash_gqa_decode (base): single-token GQA attention over a f32 KV cache.
int vetta_flash_gqa_decode(const float* q, const float* k, const float* v,
float* out, int n_head, int n_kv, int seq,