Files
foxhunt/crates
jgrusewski e5a69a589b perf(rl): amortize spectral norm + eliminate hot-path sync/device_ptr/alloc
- Spectral norm: every 100 steps (843us/step -> 8.4us amortized)
  via Weyl's inequality (sigma_max shifts <= ||DW||_2 per Adam step)
- Replace train_stream.synchronize() with event-based GPU-side wait
  (train_done_event record/wait pattern, no host stall)
- Convert dqn_replay_step Q-loss readback to deferred one-step-delayed
  pattern: async DtoD into scalar_staging, read previous value via
  volatile read (eliminates sync + device_ptr per replay iteration)
- Delete dead read_scalar_via_staging (last caller removed)

Steady-state hot path (steps 3+) now has:
  - 1 synchronize (step_synthetic batched loss, unavoidable)
  - 0 device_ptr() calls
  - 0 per-step allocs
  - 0 read_scalar_via_staging
  - Spectral norm: 3 launches / 100 steps (was 3 / step)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 11:15:43 +02:00
..