Files
foxhunt/crates
jgrusewski 25f8d514b1 perf(ml): batched GPU inference for hyperopt backtest evaluation
Replace per-bar GPU forward passes with chunked batch inference (1024 bars
per chunk). This reduces ~90K individual CUDA kernel launches to ~88 batched
forward passes — ~1000× fewer GPU round-trips.

Changes:
- Add DQN::batch_greedy_actions(&self) for immutable batched forward+argmax
- Add RegimeConditionalDQN::batch_greedy_actions with per-regime-head batching
- Add DQNTrainer::convert_to_state_vec (CPU-only, skips GPU tensor allocation)
- Add PortfolioTracker::set_position_direct for backtest state sync
- Rewrite hyperopt backtest loop: chunked batching with portfolio state
  updates between chunks (1024-bar granularity ≈ 17h of 1-min data)

Portfolio features (last 3 of 54 dims) are refreshed between chunks via
set_portfolio_for_backtest(), keeping position/PnL/exposure accurate at
chunk boundaries while batching inference within each chunk.

2640 tests pass, 0 clippy warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 13:37:12 +01:00
..