feat(sp22-vnext): Phase A4 — aux_trade_outcome loss reduce kernel
K=3 sparse cross-entropy reduce over the trade-outcome softmax tile produced by `aux_trade_outcome_forward` (Phase A3). Mirrors the K=2 sibling `aux_next_bar_loss_reduce` structurally: single-block shmem-tree reduce, two parallel partial strips (loss_numer + valid_count) reduced lockstep, fmaxf(p_tgt, 1e-30) numerical floor, fmaxf(valid, 1.0) all- skip-batch guard, valid_count_out[1] save-for-backward. Kept as SEPARATE kernel from the K=2 sibling: - Diagnostic isolation (distinct HEALTH_DIAG slot, distinct cubin in profiles for clean per-loss-source attribution) - Sparse-label semantic clarity (~95-99% mask=-1 vs ~50-100% valid for the K=2 next-bar head) - Future per-class weighting headroom (Profit/Stop/Timeout 3:1-10:1 imbalance will likely need class-weighted CE — surgical mod here without touching the K=2 head's contract) Phase A4 (this commit) is dead code — no Rust launcher yet. Phase A5 lands backward; Phase B wires the full forward→loss→backward chain. Discipline: feedback_no_atomicadd (single-block tree-reduce), feedback_ cpu_is_read_only (pure GPU), pearl_first_observation_bootstrap (sentinel 0 valid_count produces zero gradients gracefully on cold start). Audit: docs/dqn-wire-up-audit.md Phase A4 section. Cubin: aux_trade_outcome_loss_reduce_kernel.cubin (9.9 KB) compiles clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -812,6 +812,15 @@ fn main() {
|
||||
// `docs/plans/2026-05-14-sp22-h6-vNext-trade-outcome-aux.md` for
|
||||
// the full vNext architecture spec.
|
||||
"aux_trade_outcome_forward_kernel.cu",
|
||||
// SP22 H6 vNext Phase A4 (2026-05-13): sparse cross-entropy reduce
|
||||
// over the K=3 softmax tile from `aux_trade_outcome_forward`.
|
||||
// Mirrors `aux_next_bar_loss_reduce`'s single-block shmem-tree
|
||||
// pattern: mean over B_valid (skip label=-1 rows), fmaxf(p, 1e-30)
|
||||
// numerical floor, saved valid_count for backward. Dead code until
|
||||
// Phase A5 (backward) + Phase B (Rust launcher wireup) land. Kept
|
||||
// separate from the K=2 sibling for diagnostic isolation, sparse-
|
||||
// label semantic clarity, and future per-class weighting headroom.
|
||||
"aux_trade_outcome_loss_reduce_kernel.cu",
|
||||
// SP22 H6 (2026-05-12): per-env p_up extractor that copies
|
||||
// `aux_softmax[env, 1]` → `prev_aux_dir_prob[env]` after each aux
|
||||
// forward. The cache buffer is read by `experience_state_gather`
|
||||
|
||||
Reference in New Issue
Block a user