fix: remove redundant temporal/ISV re-execution in reduce_current_q_stats
reduce_current_q_stats() re-ran 10 kernels (mamba2_step, predictive_coding, regime_dropout, ISV forward/gate/route, recursive_confidence, trade_plan, plan_noise, risk_budget) every training step OUTSIDE the graph replay. These ops already executed inside the graph — the logit buffers are current. The redundant execution added ~4s of GPU compute per step (matching the graph replay cost), doubling total epoch time. Fix: compute expected_q directly from the existing logit buffers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7256,35 +7256,8 @@ impl GpuDqnTrainer {
|
||||
let support_ptr = self.per_sample_support_ptr;
|
||||
let q_var_ptr = self.q_var_buf_trainer.raw_ptr();
|
||||
|
||||
// Mamba2: enrich h_s2 with temporal context before Q-value computation
|
||||
self.mamba2_step(batch_size)?;
|
||||
|
||||
// G12: Predictive coding — temporal smoothness on enriched trunk
|
||||
self.compute_predictive_coding_loss(batch_size)?;
|
||||
|
||||
// G9: Regime-conditioned dropout on h_s2 (training path only)
|
||||
self.apply_regime_dropout(batch_size, true)?;
|
||||
|
||||
// ISV forward: encoder MLP → branch gate + gamma mod
|
||||
self.launch_isv_forward()?;
|
||||
|
||||
// ISV temporal routing: update per-feature temporal_weight for next mamba2 call
|
||||
// One-step lag (mamba2 already ran above), same pattern as ISV signals.
|
||||
self.launch_isv_temporal_route()?;
|
||||
|
||||
// ISV feature gate: modulate h_s2 features based on ISV regime embedding
|
||||
self.launch_isv_feature_gate(batch_size)?;
|
||||
|
||||
// Recursive confidence: predict own TD-error from h_s2
|
||||
self.launch_recursive_confidence_forward(batch_size)?;
|
||||
|
||||
// Trade plan forward: h_s2 → plan_params [B, 6]
|
||||
self.launch_trade_plan_forward(batch_size)?;
|
||||
// Plan noise: ±5% temporal diversity on plan_params
|
||||
self.launch_plan_noise_inject(batch_size)?;
|
||||
|
||||
// Risk budget forward: h_s2 → risk_budget R ∈ (0,1) before Q-value computation
|
||||
self.risk_budget_forward(batch_size)?;
|
||||
// All temporal/ISV ops already ran inside the graph replay.
|
||||
// Logit buffers (on_v_logits, on_b_logits) are current — just compute Q-stats.
|
||||
|
||||
unsafe {
|
||||
self.stream
|
||||
|
||||
Reference in New Issue
Block a user