c-infer · Architecture Specification

Zero-Allocation Neural Inference Runtime

Offline model topology serialization in Python paired with a deterministic, allocation-free execution engine in pure C11.

c-infer Architecture Diagram Architecture showing PyTorch offline export, C11 static memory arena initialization, forward-pass dispatch engine, and PyTorch parity test gate. 1. OFFLINE EXPORT 2. C11 RUNTIME CORE 3. PARITY VERIFICATION cinf_load() float out[] PyTorch Trained Module torch.nn.Module (Conv2D, Linear) exporter/export.py Topology & weight extraction Binary packing (little-endian) Binary Model (.cinf) Magic header + Layer count Float32 tensor weights blob Static Memory Arena cinf_arena_t (0 heap) Pre-allocated memory pool All activations fit in footprint Tensor Descriptors cinf_tensor_t (shape, strides) Contiguous 1D float pointer C11 Forward Dispatch Loop (cinf_forward) Linear · Conv2D · MaxPool2D · Flatten ReLU · Sigmoid · Numerically-Stable Softmax Deterministic sequence · No BLAS · <math.h> only PyTorch Baseline Feed Fixed test vectors & seeds Golden float output arrays Delta Tolerance Gate Linear / Conv2D: < 1e-5 abs MaxPool / Flatten: bit-exact Verification Passed ✓ ALL 8 TESTS PASS Zero runtime allocation confirmed

Guarantees

Zero Heap at Runtime

Memory required for activations, layers, and tensor ping-ponging is computed once during initialization. Hot forward passes perform 0 allocations.

Portability

No Heavy Dependencies

Runs on microcontrollers, RTOS, or POSIX systems with standard C11. Avoids massive BLAS or matrix libraries by implementing vector operations natively.

Rigor

Strict Parity Testing

Every single layer (Linear, Conv2D, MaxPool, activations) is verified against reference PyTorch tensors within 1e-5 floating point deviation.