-
Notifications
You must be signed in to change notification settings - Fork 2
4 Sparse Maps and Channel Routing
Relevant source files
The following files were used as context for generating this wiki page:
The sparse maps and channel routing subsystem provides an optional, self-contained routing fabric and memory-efficient Compressed Sparse Row (CSR) storage utilities. While the core runtime orchestrator (SynapticMesh) handles dense mesh propagation and axonal delay ring buffers, the optional router (ChannelRouter) and sparse matrix utilities (SparseSynapticMap) allow applications to dynamically route signals across channels and scale network topologies without prohibitive VRAM overhead.
For details, see the child pages:
Sources: src/router.rs:1-16, src/sparse.rs:3-18
The ChannelRouter implementation in src/router.rs provides a domain-agnostic spiking neural network router. It integrates signal pulses across a bank of internal neuromodulatory units (NeuromodNeuron) to produce a sparse routing mask. The behavior and bounds of the router are governed by RouterConfig, which validates channel counts up to MAX_ROUTER_CHANNELS and execution timesteps up to MAX_ROUTING_TIMESTEPS src/router.rs:27-40, src/router.rs:121-140.
The routing pipeline supports standard signal routing via route as well as modulated execution via route_modulated, incorporating fatigue, lateral inhibition through signed cross-weights, and dynamic gain adaptation src/router.rs:121-178.
For details, see ChannelRouter and RouterConfig.
graph TD
RC["RouterConfig"] --> CR["ChannelRouter"]
CR --> NN["NeuromodNeuron"]
CR --> RT["route / route_modulated"]
RT --> MASK["Routing Mask Output"]
subclassDef default fill:none,stroke:#000,stroke-width:1px;
Sources: src/router.rs:27-140
Sources: src/router.rs:5-40, src/router.rs:121-140
Neuromodulation in the routing subsystem is driven by NeuromodState and integration neurons that respond to global neuromodulatory levels such as dopamine, cortisol, and serotonin. These modulators alter effective membrane thresholds, leak rates, and synaptic weights dynamically.
The subsystem implements use-it-or-lose-it plasticity, where inactive channels experience weight decay towards a baseline, while active channels undergo dopamine-gated potentiation. Feedback mechanisms allow external systems to reinforce or inhibit specific channel pathways src/router.rs:8-11, src/router.rs:173-178.
For details, see Neuromodulation and Plasticity.
graph TD
NS["NeuromodState"] -->|Modulates| NN["NeuromodNeuron"]
NN -->|Integrates Stimulus| INT["integrate()"]
INT -->|Fires| FIRE["check_fire()"]
FIRE -->|Applies Feedback| FB["apply_feedback()"]
subclassDef default fill:none,stroke:#000,stroke-width:1px;
Sources: src/router.rs:48-119
Sources: src/router.rs:8-11, src/router.rs:40-120
To support networks exceeding standard dense matrix constraints, src/sparse.rs implements SparseSynapticMap<N>. Storing synaptic weights in Compressed Sparse Row (CSR) format reduces VRAM consumption significantly (e.g., a 20× reduction for large sparse configurations) by maintaining row_ptr, col_indices, and values vectors rather than a dense
The module offers builders like try_from_dense and try_from_adjacency, weight pruning utilities, out-of-bounds safety checks, and target address validation bounded by MAX_SPARSE_NEURONS src/sparse.rs:23-162.
For details, see SparseSynapticMap (CSR).
graph TD
SSM["SparseSynapticMap"] --> RP["row_ptr Vec:usize"]
SSM --> CI["col_indices Vec:u16"]
SSM --> VAL["values Vec:f32"]
SSM --> BUILD["try_from_dense / try_from_adjacency"]
subclassDef default fill:none,stroke:#000,stroke-width:1px;
Sources: src/sparse.rs:35-162
Sources: src/sparse.rs:3-54
- 1. Overview
- 1.1. Getting Started & Public API
- 1.2. Release History and Versioning
- 2. Core Runtime: SynapticMesh
- 2.1. Propagation APIs and Tick Semantics
- 2.2. Spike Delay Buffer (Ring Buffer)
- 2.3. Core Types and Error Model
- 2.4. Checkpointing and Serde State Restoration
- 3. Topology Subsystem
- 3.1. SynapticGraph and CSR Representation
- 3.2. Topology Generators
- 3.3. Wiring Rules, Dale's Law and Delay Assignment
- 3.4. Topology Digest
- 4. Sparse Maps and Channel Routing
- 4.1. ChannelRouter and RouterConfig
- 4.2. Neuromodulation and Plasticity
- 4.3. SparseSynapticMap (CSR)
- 5. Testing, Benchmarks and Quality Gates
- 5.1. Propagation Contract Tests
- 5.2. Checkpoint Resume Property Suite
- 5.3. Benchmarks and Unit Test Module
- 6. Build, CI and Project Tooling
- 6.1. Cargo Manifest, Profiles and Dependencies
- 6.2. CI Workflows and Packaging Validation
- 6.3. Code Quality, Licensing and Review Gates
- 7. Glossary