Files
foxhunt/docs
jgrusewski 774d7552a0 diag(sp11): instrument reward chain to find the 5000x inflater
Smoke smoke-test-gwfn8 on fd24b5383 showed mean(|reward|) hitting
5054 at F0 ep2 despite all known multiplicative modifiers being
structurally bounded (conviction in (0,1) via sigmoid at line 7579,
cf_flip in +/-1, drawdown in [-5*w_dd,0], shaping_scale in [0,1]). The
inflater is somewhere in the pre-composition or modifier chain that
isn't currently visible in HEALTH_DIAG.

Adds 12 per-sample diagnostic buffers + reduction kernel + HEALTH_DIAG
emit for min/mean/max at every checkpoint in the reward chain:
  - per-component (r_popart, r_trail, r_micro, r_opp_cost, r_bonus)
  - r_weighted (post-composition, pre-modifier)
  - post-modifier sequential (post_dd, post_inv, post_churn, post_conv)
  - sanity checks (position_abs, conviction)

Implementation:
  - 12 new per-sample CudaSlice<f32> buffers in gpu_experience_collector
    (alloc_episodes * alloc_timesteps each); zero-init at every (i,t)
    in the kernel entry block before any early-return; written at
    each checkpoint with NULL-tolerant guards.
  - new reward_chain_diag_reduce_kernel.cu: single-block 256-thread
    block-tree-reduce over the 12 buffers, three lockstep reductions
    (sum/min/max) per buffer in shared memory; outputs 36 floats
    (3 stats x 12 buffers) to a 36-slot mapped-pinned scratch buffer
    on the trainer; no atomicAdd per feedback_no_atomicadd, pure GPU
    compute per feedback_no_cpu_compute_strict, mapped-pinned host
    visibility per feedback_no_htod_htoh_only_mapped_pinned.
  - trainer: cubin load, mapped-pinned 36-f32 output, set_sp11_reward_
    chain_diag_bufs setter, launch_sp11_reward_chain_diag_reduce
    launcher, read_sp11_reward_chain_diag host accessor.
  - training_loop.rs: wires the 12 collector buffers post-construction
    (mirror of the popart-component wire-up); HEALTH_DIAG `reward_
    chain_diag` emit added immediately after `reward_split` — launches
    reduction kernel, syncs stream, reads the 36 floats.
  - build.rs: adds reward_chain_diag_reduce_kernel.cu to the cubin
    manifest.
  - docs/dqn-wire-up-audit.md: new section documenting the
    instrumentation scope, additions, exclusions (no ISV slots, no
    state-reset registry entries), and removal plan.

No state-reset registry entry: this is a transient diagnostic, not
persistent state — buffers reset to 0 every step via the kernel
entry-block default writes (same pattern as the other per-sample
diagnostic buffers like trail_triggered_per_sample). No ISV slots
are added: the host reads the mapped-pinned scratch directly to keep
this lightweight and avoid permanent ISV growth.

Will be removed in a follow-up commit once the inflater is identified
and properly fixed per pearl_bounded_modifier_outputs_require_
structural_activation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 13:55:03 +02:00
..