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.
50 lines
2.2 KiB
TOML
50 lines
2.2 KiB
TOML
[package]
|
|
name = "fly-session"
|
|
version.workspace = true
|
|
edition = "2024"
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
publish = false
|
|
description = "The lockstep session coordinator, its phase machine and a synthetic composition over flybus."
|
|
|
|
[lib]
|
|
name = "fly_session"
|
|
path = "src/lib.rs"
|
|
|
|
# One binary, one role per subcommand. `implementation.md` section 2 allows worker
|
|
# executables to be subcommands of one binary rather than separate crates, and the launcher
|
|
# starts this one with `agent` or `environment` for a participant in its own process.
|
|
[[bin]]
|
|
name = "fly-session"
|
|
path = "src/bin/fly-session.rs"
|
|
|
|
[features]
|
|
# The LIF tick on the GPU (GPU-02), a passthrough to `flybrain-core/cuda`. Compiling it in does not
|
|
# turn it on: the agent worker attaches the backend only when `FLY_LIF_CUDA=1` reaches it.
|
|
cuda = ["flybrain-core/cuda"]
|
|
|
|
[dependencies]
|
|
# The domain contract (scalars, payloads, canonical digests, the trace format) and the bus.
|
|
# Everything else this crate needs is std or Tokio.
|
|
fly-session-types = { path = "../fly-session-types" }
|
|
flybus = { path = "../flybus" }
|
|
# AGENT-01: the legacy agent worker is an adapter over the existing neural core (LIF kernel,
|
|
# plasticity, retina, fixed readout, checkpoint chunks). Pure Rust, no emulator.
|
|
# ENV-01: the legacy Game Boy environment worker drives the binjgb emulator through
|
|
# flybrain-gb's safe wrapper, and flybrain-core's frozen envelope layout reads and writes the
|
|
# world's half of a FLYSIM01 checkpoint.
|
|
flybrain-core = { path = "../flybrain-core" }
|
|
flybrain-gb = { path = "../flybrain-gb" }
|
|
# The toy connectome fixture is written as gzipped `.binz` arrays, the dataset loader's format.
|
|
flate2 = { workspace = true }
|
|
# STATE-02: the FLYSIM01 store and the sugar journal, the same code the legacy loop writes with.
|
|
flysim-store = { path = "../flysim-store" }
|
|
|
|
serde_json = { workspace = true }
|
|
# `rt-multi-thread` is not only for the tests: a worker process and a dedicated-thread
|
|
# worker each build their own runtime sized to the launcher's thread allocation.
|
|
tokio = { version = "1", features = ["rt", "rt-multi-thread", "sync", "time", "macros", "io-util"] }
|
|
|
|
[dev-dependencies]
|
|
tempfile = "3"
|
|
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] }
|