[HIP] AttnRes block-mix kernel — Inkling deep-residual parity (last defining mechanism)

- k_attn_res_mix / vetta_attn_res_mix: exact strata k1_attn_res_mix semantics.
  For each learned query q and token m, mix n_states = n_blocks+1 depth states
  (block snapshots + current): per state inv_rms = rsqrt(mean(x^2)+eps),
  score = (x.q)*inv_rms/sqrt(D); softmax over scores -> w; final weight =
  w*inv_rms; out = sum_s weight[s]*state_s (RMS-normalized depth mix). This is
  Inkling's deep residual that replaces the standard additive residual stream.
  Contiguous blocks [n_blocks,M,D] snapshot buffer (FFI-friendly vs ptr array).
- Parity test vs CPU oracle (nb=3, M=2, nq=2, D=64): max_rel_err 1.0e-5.

With this, ALL defining Inkling mechanisms are verified kernels: ShortConv4,
flash SWA GQA (window+relpos+sink+gate), AttnRes block-mix, NVFP4 experts +
SiTU + sigmoid router. The kernel parity foundation is complete; what remains
is integration (lowering the full graph + wiring a complete layer + loop
controllers + KV store + projections).

Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; GPU 13/13 (--features hip).
This commit is contained in:
adm committed 2026-12-01 14:30:10 +01:00
1 parent aea1c437d4
commit 61c0b21a93
3 files changed
+142

No files matched your search

+6
View File
@@ -93,6 +93,12 @@ int vetta_shortconv4_decode(const float* cur, const float* static_w, float* hist
float* out, const int32_t* slot_ids, int M, int C,
vetta_stream_t stream);
// k_attn_res_mix: Inkling AttnRes deep-residual block-mix. blocks [n_blocks,M,D]
// snapshots + cur [M,D] -> out [M,n_queries,D] (RMS-normalized depth mix).
int vetta_attn_res_mix(const float* blocks, const float* cur, const float* queries,
float* out, int n_blocks, int M, int n_queries, int D,
float eps, vetta_stream_t stream);
// Core <15 microkernel entry points (implemented progressively in M1 & M2):
// 1. k_embed_bf16
// 2. k_rms_norm