Adds grad_x[k] = sum_i d_pre[i] * W_in[i,k] computed by thread 0 of the cfc_step_backward kernel (after the existing __syncthreads in the shared-mem sd_pre relay). Required by the stacked Mamba2 -> CfC design: Mamba2.backward_from_h_enriched needs grad on h_enriched, which is the CfC's "x" input in the stacked topology. For the existing CfC-only PerceptionTrainer (x = snap_features, no upstream learnable layer), grad_x is computed but discarded into a preallocated buffer. backward_finite_diff tests still pass (4/4) — the new arg is the 14th positional kernel arg; existing callers updated. perception_ overfit smoke still passes (loss 0.5669 -> 0.0665 in 200 steps). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
5.8 KiB
5.8 KiB