Files
foxhunt/crates/ml/src/gpu
jgrusewski a454a26a5c feat(ml): GPU saturation backlog — PPO rollout sync, VRAM-aware dims, KAN GPU splines
Three remaining GPU bottlenecks from the saturation backlog:

1. PPO rollout GPU sync stalls (3→1 per step):
   - Merged sample_action to return (action_idx, probs_vec), eliminating
     duplicate to_vec1 sync on action probabilities
   - Batched critic forward after rollout loop — single GPU→CPU sync
     replaces per-step critic.forward() calls (2048 syncs → 1)
   - Safe indexing throughout (clippy deny rules)

2. VRAM-aware default network dimensions:
   - Added detect_vram_mb() with GPU_MEMORY_MB env var override for K8s
   - Added vram_scaled_hidden_dims() with 4 tiers (CPU/<8GB/16GB/40GB+)
   - DQN: [256,256] → [2048,1024,512] on L40S/H100
   - PPO: hidden_dim_base 128 → 1024 on L40S/H100
   - Wired into train_baseline_rl.rs for non-hyperopt training runs

3. KAN B-spline GPU lookup table:
   - Pre-compute basis values on 1024-point grid at layer construction
   - GPU evaluation via gather + linear interpolation (replaces recursive
     Cox-de Boor CPU bounce: 32K recursive calls → 2 GPU gathers)
   - Fallback to CPU path when grid not pre-computed

5 files changed, +687/-43, 2476 tests pass, 0 clippy warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 15:41:23 +01:00
..