feat(alpha): phase_e_kill_criteria producer kernel (slots 539-542)

Phase E.0 Task 9. Single-block, single-thread CUDA producer that writes 4
raw scalar observations into a contiguous scratch_out[0..4] block:

  scratch_out[0] → ISV[539] Q_SPREAD_EMA          (kill: ≥ 0.05)
  scratch_out[1] → ISV[540] ACTION_ENTROPY_EMA    (kill: ≥ 0.5·ln(9) ≈ 1.10)
  scratch_out[2] → ISV[541] RETURN_VS_RANDOM_EMA  (kill: ≥ 0, i.e. ≥ random)
  scratch_out[3] → ISV[542] EARLY_Q_MOVEMENT_EMA  (kill: ≥ 0.01, learned)

Downstream `apply_pearls_ad_kernel` (n_slots=4) chained on the same stream
applies Pearl A first-observation bootstrap + Pearl D Wiener-α smoothing —
composes with the canonical val_sharpe_delta_compute_kernel pattern rather
than reimplementing Wiener math (per feedback_no_cpu_compute_strict — one
Wiener implementation in the codebase, the GPU one).

Inputs:
  q_values[batch, n_actions]   most-recent Q forward output (device)
  action_counts[n_actions]     empirical action histogram (device)
  scalar_inputs[3]             [rollout_R_mean, q_init_norm, q_early_norm]
                               via mapped-pinned (host writes between rollouts)
  isv                          reads slots 547 + 548 (random baseline
                               mean/std — populated once by Task 7c,
                               TrainingPersist)

No atomicAdd (per feedback_no_atomicadd), no host branches
(per pearl_no_host_branches_in_captured_graph), no CPU compute
(per feedback_cpu_is_read_only). __threadfence_system() before exit for
the chained Pearls applicator's visibility guarantee.

Cubin produced: target/release/build/ml-*/out/phase_e_kill_criteria.cubin
(16.8 KB).

Launcher integration is Task 11 (separate commit so this task can stand
alone for cubin validation). Audit doc docs/isv-slots.md updated per
Invariant 7.
This commit is contained in:
jgrusewski
2026-05-15 14:07:41 +02:00
parent 4f71ab32ae
commit d493b729bf
3 changed files with 184 additions and 0 deletions

View File

@@ -1588,6 +1588,13 @@ fn main() {
// the two land atomically with the production wire-up + audit
// / spec / plan amendments per `feedback_no_partial_refactor`.
"sp20_aggregate_inputs_kernel.cu",
// Phase E.0 Task 9 (2026-05-15): kill-criteria diagnostic producer.
// Single-block, single-thread; writes 4 scalar observations
// (Q-spread, action entropy, return-vs-random, early-Q-movement)
// into scratch[N..N+4]. Chained `apply_pearls_ad_kernel` (n_slots=4)
// smooths into ISV[539..543) — see alpha_isv_slots.rs. Slot 547/548
// (random baseline mean/std) are read directly from ISV by index.
"phase_e_kill_criteria.cu",
];
// ALL kernels get common header (BF16 types + wrappers)