Files
foxhunt/docs
jgrusewski 423b36646f feat(dqn-v2): Plan 4 Task 1B-i — VSN kernel module landing (additive, no callers)
Two new CUDA kernel files registered in build.rs (kernel count 60 → 62,
all compile clean under nvcc sm_80). Module is additive — ZERO production
callers; consumers wired in 1B-ii/iii/iv.

vsn_feature_selection_kernel.cu (262 LOC, cubin 31,392 B):
- vsn_softmax_and_gate_forward: per-sample (B blocks × 256 threads)
  numerically-stable softmax over 6 feature groups + per-feature gate-
  multiply with passthrough for the 7-element padding tail.
- vsn_softmax_and_gate_backward: full softmax-over-groups Jacobian
  (d_logit[g] = mask[g] * (d_dot[g] - sum_h(mask[h] * d_dot[h]))) plus
  per-feature d_state via mask broadcast. Per-block shmem tree reduce
  for d_dot, no atomicAdd.

vsn_mask_ema_kernel.cu (78 LOC, cubin 6,688 B):
- vsn_mask_ema_update: single-block 256-thread reduction over the per-
  sample mask buffer → 6-element batch-mean → per-slot EMA into
  ISV[first..first+6). Mirrors h_s2_rms_ema_kernel.cu's shmem-reduce
  pattern exactly. Producer-only.

Caller-side cuBLAS GEMMs (Linear_1[g] / ReLU / Linear_2[g]) feed logits
to the forward kernel — mirrors gpu_grn.rs's contract pattern. Layout
row-major [B, state_dim_padded] for state, [B, num_groups] for the mask.
All reductions GPU-side per pearl_cold_path_no_exception_to_gpu_drives.md.

No checkpoint break, no fingerprint change, no new param tensors, no new
ISV slots in this commit. cargo check clean at 11 warnings (baseline
preserved); cargo build compiles 62/62 cubins clean (was 60). Smoke
deferred to 1B-iii where the forward orchestrator wire-in actually
validates something — multi_fold_convergence byte-identical to the post-
bottleneck-fix baseline (geom-mean 39.27 / per-fold 6.53 / 80.11 / 66.72).
2 new Orphan-by-design rows (will retire at 1B-iii).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 18:42:30 +02:00
..