feagi-runtime
Runtime abstraction traits for cross-platform FEAGI neural processing
Part of FEAGI - Framework for Evolutionary AGI
Overview
feagi-runtime defines the trait abstraction layer that enables FEAGI's burst engine to run on different platforms without code changes.
This crate contains ONLY trait definitions - no concrete implementations.
Supported Platforms (via runtime implementations)
| Runtime | Platform | Storage | Target |
|---|---|---|---|
feagi-runtime-std |
Desktop/Server | Vec<T> (dynamic) |
x86_64, ARM64 |
feagi-runtime-embedded |
ESP32, Arduino, STM32 | [T; N] (fixed) |
Embedded |
feagi-runtime-cuda |
NVIDIA GPU | CudaSlice<T> (GPU VRAM) |
CUDA |
feagi-runtime-wasm |
Browser | Float32Array (typed) |
WASM |
Core Traits
1. Runtime Trait
Defines platform capabilities and creates storage:
2. NeuronStorage Trait
Abstracts System-of-Arrays (SoA) for neurons:
3. SynapseStorage Trait
Abstracts System-of-Arrays (SoA) for synapses:
Usage
For Platform Implementers
Implement these traits for your platform:
use ;
// Your platform-specific storage
// Your runtime
;
For Application Developers
Use concrete runtime implementations:
use StdRuntime;
use RustNPU;
use Arc;
// Desktop runtime
let runtime = new;
let npu = new?;
npu.process_burst?;
Design Principles
1. Zero-Cost Abstractions
Traits compile to direct function calls (monomorphization):
// Generic code
// Compiles to platform-specific code (no vtables)
process; // → Vec-based code
process; // → array-based code
2. Platform-Agnostic Burst Engine
Same burst processing code works everywhere:
// feagi-burst-engine works with any Runtime
// Used on desktop
let desktop_npu = new;
// Same code, different platform
let embedded_npu = new;
3. Type Safety
Compile-time guarantees for platform compatibility:
// This won't compile - embedded runtime has fixed capacity
let embedded = EmbeddedRuntime;
embedded.create_neuron_storage?; // ❌ Compile error
// This is correct
const MAX_NEURONS: usize = 10_000;
embedded.create_neuron_storage?; // ✅ OK
Trait Contract
NeuronStorage Contract
All implementations MUST guarantee:
- ✅ Slice lengths match
count()(notcapacity()) - ✅ Thread-safe (Send + Sync)
- ✅ Mutable slices are exclusive (Rust borrow checker enforces)
- ✅
add_neuron()incrementscount() - ✅ Coordinates stored as flat array:
[x0, y0, z0, x1, y1, z1, ...]
SynapseStorage Contract
All implementations MUST guarantee:
- ✅ Slice lengths match
count() - ✅ Thread-safe (Send + Sync)
- ✅
source_neurons[i]andtarget_neurons[i]are valid neuron IDs - ✅ Weights and PSPs are 0-255 (u8 range)
Testing
Trait contracts are tested in each runtime implementation:
# Test std runtime
&&
# Test embedded runtime
&&
# Test CUDA runtime
&&
Related Crates
| Crate | Purpose |
|---|---|
feagi-runtime (this crate) |
Trait definitions |
feagi-runtime-std |
Desktop/server implementation |
feagi-runtime-embedded |
ESP32/embedded implementation |
feagi-runtime-cuda |
NVIDIA GPU implementation |
feagi-runtime-wasm |
Browser/WASM implementation |
feagi-burst-engine |
Uses Runtime trait |
Implementation Checklist
When implementing a new runtime:
- Create new crate
feagi-runtime-{platform} - Implement
NeuronStoragetrait - Implement
SynapseStoragetrait - Implement
Runtimetrait - Add unit tests (all trait methods)
- Add integration tests (with feagi-burst-engine)
- Add benchmarks (vs CPU baseline)
- Document platform limitations
- Update this README with new runtime
Contributing
New runtime implementations welcome! See CONTRIBUTING.md
Platforms we'd love to support:
- FreeRTOS (real-time embedded)
- Distributed (MPI/gRPC clusters)
- Apple Neural Engine (ANE)
- Google TPU (Edge TPU)
License
Licensed under Apache License 2.0
Copyright © 2025 Neuraville Inc.