Files
foxhunt/crates/ml
jgrusewski 937bbabb84 perf: indirect pointer upload + graph ALL remaining ops
Batch upload:
- Added indirect pad_states + indirect copy kernels to cubin
- Batch source pointers uploaded as 8 x u64 via async HtoD to batch_ptr_buf
- Kernels read source addresses from device indirection buffer
- upload_batch_gpu replaced with upload_batch_ptrs → graph-captured indirect kernels
- 8 ungraphed DtoD/kernel launches → 0 (captured in graph_forward)

HER relabel (Random strategy):
- Captured as graph_her (random_donors + inplace_relabel)
- Uses stable addresses: donor_indices (pre-allocated), batch_ptr_buf[1] (indirect)
- 2 ungraphed launches → 1 graph replay

PER priority update:
- Captured in graph_adam (after regime_scale)
- Kernel changed to read indices/priorities from batch_ptr_buf[6..8] (indirect)
- PER pointers uploaded via upload_per_ptrs before graph_adam replay
- 1 ungraphed launch → 0 (captured in graph_adam)

New CUDA kernels:
- pad_states_indirect_kernel: reads src ptr from device buffer
- indirect_copy_f32_kernel: f32 copy with indirect src
- indirect_copy_i32_kernel: i32 copy with indirect src
- per_update_priorities_kernel: changed to indirect indices/priorities

Per-step operation count:
  9 graph replays (forward, adam, ema, attention, iql, iqn, her)
  + 1 async HtoD (8 batch pointers, 64 bytes)
  + 1 async HtoD (tau, 4 bytes)
  + 1 async HtoD (adam_step, 4 bytes)
  + 1 async HtoD (iqn tau, 4 bytes)
  + 1 async HtoD (per ptrs, 16 bytes)
  = 9 graph replays + 5 async HtoD (92 bytes total)

Zero ungraphed kernel launches in the per-step hot path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:28:18 +02:00
..

ml

10-model ML ensemble for the Foxhunt HFT system, built on Candle v0.9.1.

Models

  • DQN (Rainbow) — deep Q-network with prioritized replay, dueling heads, noisy nets
  • PPO — proximal policy optimization with GAE, LSTM policies, clip-higher
  • TFT — temporal fusion transformer for multi-horizon forecasting
  • Mamba2 — state space model for sequence prediction
  • Liquid Networks — biologically inspired networks for non-stationary data
  • TLOB — transformer-based limit order book analysis
  • KAN — Kolmogorov-Arnold networks
  • xLSTM — extended LSTM architecture
  • TGGN — temporal graph neural network
  • Diffusion — diffusion-based generative model

Key Modules

  • ensemble — model ensemble coordination and confidence aggregation
  • hyperopt — PSO-based hyperparameter optimization with per-model adapters
  • trainers — unified training loops (DQN, PPO, supervised)
  • inferenceInferenceAdapter trait for prediction
  • checkpoint — model checkpointing and restoration
  • evaluation — walk-forward evaluation pipeline

Usage

use ml::dqn::DQN;
use ml::ppo::PpoTrainer;