Files
foxhunt/crates
jgrusewski fb346a3cad diag(ml-alpha): scan Mamba2 L1 fwd between projections and SSM kernel
Add labels 43-46 inside Mamba2Block::forward_train_seq_into, scanned
BETWEEN the three projection cuBLAS GEMMs (w_in, w_a, w_b) and the
SSM scan kernel launch (mamba2_alpha_scan_fwd_seq). The scan kernel
ONLY reads a_proj/b_proj/w_c/h_s2 and ONLY writes h_enriched_seq -
it cannot retroactively corrupt its read-only inputs, so a NaN
observed here pinpoints the projection cuBLAS path (PROJ verdict)
vs the scan kernel itself (SCAN verdict, requires labels 43-46
clean AND existing labels 36/37 still firing).

Plumbed via the existing NanScanHook installed from IntegratedTrainer::new
on mamba2_l1 only (L2 left unhooked - scope is the L1 forward path
established as the failure window by labels 36/37). Hook source
identical to the perception trainer's hook (shared cubin handle +
ISV step counter pointer); per-launch dispatch is a no-op when
FOXHUNT_NAN_SCAN is unset, so production training pays zero cost.

  43 - mamba2_l1_fwd_a_proj_pre_scan (post w_a, pre scan)
  44 - mamba2_l1_fwd_b_proj_pre_scan (post w_b, pre scan)
  45 - mamba2_l1_fwd_x_pre_scan      (post w_in)
  46 - mamba2_l1_fwd_h_s2_pre_scan   (zero-init residual sanity)

Refs pearl_atomicadd_masks_v_instability.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 10:26:48 +02:00
..