test(alpha): kill-criteria GPU smoke matching hand-computed observations

Adds the second of the two Phase E.1 kernel smoke tests in
alpha_kernels.rs (companion to the munchausen_target smoke from
91d1a52b9). End-to-end exercises the alpha_kill_criteria_compute_kernel
launcher with synthetic inputs covering all 4 outputs:

  q_values = [[1, 2, 3], [5, 5, 5]]   →  q_spread        ≈ 0.2041
  action_counts = [10, 30, 60]        →  action_entropy  ≈ 0.8980
  rollout_R=100, isv[547]=-5185,
                 isv[548]=4953       →  return_vs_random ≈ 1.0670
  q_init=50, q_early=55              →  early_movement   = 0.1000

ISV buffer is sized to 552 floats with slots 547/548 populated using the
committed Task 7c baseline values — this exercises the production
slot-indexing path through the kernel's
`isv[random_baseline_mean_slot]` / `isv[random_baseline_std_slot]` reads,
not just isolated kernel arithmetic.

Does NOT chain apply_pearls_ad_kernel afterward — the smoothing path is
canonical SP4 applicator territory already covered elsewhere. This test
isolates the kill-criteria producer arithmetic.

Tolerance 0.01 on all four observations; passes on RTX 3050 Ti in <2s
including kernel JIT.

`cargo test -p ml --lib alpha_kernels`: 3 pass (compile witness + both
GPU smokes). Audit doc docs/isv-slots.md updated per Invariant 7.
This commit is contained in:
jgrusewski
2026-05-15 14:52:06 +02:00
parent 91d1a52b9c
commit 697bb586d0
2 changed files with 137 additions and 0 deletions

View File

@@ -605,3 +605,16 @@ Both launchers follow `launch_apply_pearls` (in `sp4_wiener_ema.rs`) — pre-loa
- `crates/ml/src/cuda_pipeline/mod.rs` — registers `pub(crate) mod alpha_kernels;`
**Tests:** `cargo test -p ml --lib alpha_kernels` — 1 compile-witness passes. Real GPU integration test lands in Phase E.1 Task 12 (kernel smoke binary).
## Phase E.1 — kill-criteria GPU smoke (2026-05-15)
`crates/ml/src/cuda_pipeline/alpha_kernels.rs::tests::kill_criteria_smoke_matches_hand_computation` exercises the `alpha_kill_criteria_compute_kernel` end-to-end on the local GPU with synthetic inputs covering all 4 outputs. Hand-math:
- `q_values = [[1, 2, 3], [5, 5, 5]]` → row 0 spread / |mean| = 0.4082; row 1 = 0 → batch mean = **0.2041**
- `action_counts = [10, 30, 60]` → H(p=[0.1, 0.3, 0.6]) = **0.8980** nats
- `rollout_R = 100`, `ISV[547] = -5185`, `ISV[548] = 4953``(100 + 5185) / 4953` = **1.0670** σ above random
- `q_init = 50`, `q_early = 55``5 / 50` = **0.1000**
ISV buffer is sized to 552 floats with the production slot indices populated using the committed Task 7c baseline values; this exercises the slot-indexing path through `isv[random_baseline_mean_slot]` / `isv[random_baseline_std_slot]` reads.
Companion to the `munchausen_target_smoke_matches_hand_computation` test (91d1a52b9). Both pass on RTX 3050 Ti.