flybrain/services/flysim/crates/flybrain-core/tests
acamilo 7d817d8cee GPU-02: the session steps a frame per call, the CUDA backend keeps its state on the device
LifNetwork::step_frame runs a game frame's ticks in one call and ORs every
tick's spikes into the transition's bitset. On the CPU it is exactly the
one-tick loop the session ran; on the GPU it is one batch, with membrane
and refractory left on the device (device-owned state): per frame only the
noise draws, visual drive and plastic gains go up and the spike lists come
down, instead of 1.4 MB per tick (about 24 MB per frame) with the old
step(1) loop and per-batch host sync.

- LifBackend (cpu / cuda:<ordinal>) from FLY_LIF_CUDA / FLY_LIF_CUDA_DEVICE,
  set_backend, configure_sweep (set_sweep_plan without the test hook),
  sync_host, host_state_current, try_step, take_backend_fault.
- export_state downloads the device arrays itself while the host copy is
  stale, so no capture can read old values; the session syncs before
  State.Capture.
- A CUDA failure detaches the backend: if the host state was current the
  frame continues bit-exactly on the CPU, otherwise the agent fails and a
  restore in that worker runs on the CPU. Warm-up no longer panics.
- The legacy agent worker picks its backend explicitly and refuses a GPU it
  cannot have (no feature, no device) at Agent.Initialize instead of
  running the CPU under a GPU label. The FLY_LIF_CUDA hook in
  set_sweep_plan stays for the golden suite and the legacy loop.
- cuda passthrough features on fly-session and fly-legacy-session, so
  FLY_CARGO_FEATURES=cuda reaches flysim-session, fly-shadow, fly-session.
- Tests: step_frame vs the one-tick loop (state and bitset, 1 and 3
  threads), the backend switch; cuda_exact frame mode; a cuda-feature
  session test (FAFB, rollback, restore, checkpoints) against the CPU
  reference.
2026-10-02 07:49:17 +00:00
..
common flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
agent.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
decoder.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
envelope.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
golden_agent.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
golden_math.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
golden_platformer.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
golden_real.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
golden_restore.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
golden_toy.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
golden_versions.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
macro_roles.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
placement.rs session: pin the sweep workers one per cpu in flysim-session (PERF-02) 2026-10-01 12:16:59 +00:00
plasticity.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
retina.rs flybrain v0.4.0: public tree (history retained privately) 2026-09-21 15:09:46 +00:00
tick_spikes.rs GPU-02: the session steps a frame per call, the CUDA backend keeps its state on the device 2026-10-02 07:49:17 +00:00