diff --git a/crates/ml/src/cuda_pipeline/gpu_dqn_trainer.rs b/crates/ml/src/cuda_pipeline/gpu_dqn_trainer.rs index aad9eca7c..df32d48dc 100644 --- a/crates/ml/src/cuda_pipeline/gpu_dqn_trainer.rs +++ b/crates/ml/src/cuda_pipeline/gpu_dqn_trainer.rs @@ -2079,6 +2079,13 @@ impl GpuDqnTrainer { Ok(()) } + /// ISV signal update — safe to call inside graph capture. + /// Reads pinned device-mapped scalars (loss, grad_norm, Q-mean) + /// written by Adam, updates ISV signal vector [12] + history. + pub(crate) fn submit_isv_signal_update(&self) -> Result<(), MLError> { + self.update_isv_signals() + } + /// ISV encoder MLP forward: temporal decay → MLP → branch gate + gamma mod. /// Reads ISV signals/history (pinned), ISV encoder weights from param buffer. /// Writes isv_embedding_buf [ISV_EMB_DIM=8], branch_gate_buf [4], gamma_mod_buf [1]. @@ -7883,6 +7890,16 @@ impl GpuDqnTrainer { self.launch_trade_plan_forward(batch_size)?; } + // ── 1c. Temporal pipeline (enriches h_s2 before loss) ── + { + let batch_size = self.config.batch_size; + self.mamba2_step(batch_size)?; + self.compute_predictive_coding_loss(batch_size)?; + self.apply_regime_dropout(batch_size, true)?; + self.launch_isv_temporal_route()?; + self.risk_budget_forward(batch_size)?; + } + // ── 2+3. Loss + gradient (blended MSE + C51 via c51_alpha ramp) ─ self.launch_curiosity_inference()?; diff --git a/crates/ml/src/trainers/dqn/fused_training.rs b/crates/ml/src/trainers/dqn/fused_training.rs index dae4fd7e4..ad65239b3 100644 --- a/crates/ml/src/trainers/dqn/fused_training.rs +++ b/crates/ml/src/trainers/dqn/fused_training.rs @@ -950,11 +950,8 @@ impl FusedTrainingCtx { } // ── Step 2b: Temporal pipeline ──── - // TODO: temporal ops (mamba2, regime_dropout, isv_temporal_route, - // risk_budget, predictive_coding) corrupt graph_aux replay when run - // ungraphed between graph_forward and graph_aux. Will be addressed - // in the cuBLAS aux rewrite — either inside graph_temporal or - // by eliminating graph_aux dependency. + // Temporal ops now run inside submit_forward_ops_main() (step 1c), + // captured in the cuBLAS training graph. // ── Step 2c: HER donor computation (outside graph_aux) ─────────── if let Some(ref mut her) = self.gpu_her {