Network-on-Chip for AI: Building an OS Interconnect Between Cognitive Subsystems
LEO implemented a Network-on-Chip inspired communication bus for its cognitive subsystems, providing P2P, multicast, and broadcast messaging with traffic management (flow control, congestion control, backpressure), QoS, reliability, and a dead-letter queue.
- Reference
- L013
- Project
- LEO
- Status
- Completed
- Evidence
- high
- Source
- 013-interconnect-network-on-chip-for-ai.md
Context
In microservices, components communicate via HTTP or message queues. In LEO's OS model, subsystems are peer processes within the same runtime that need to communicate without bypassing the communication fabric.
Engineering Rule 5 in docs/05_ENGINEERING_RULES.md states:
Zero-Bypass Communication: All inter-subsystem communication must occur via the Interconnect. Direct method calls between isolated subsystems are forbidden.
The Question
How do you implement a zero-bypass communication fabric for OS subsystems that provides reliability guarantees, QoS, and traffic management without relying on external message queues?
Initial Approach
The CognitiveInterconnect (backend/app/cognition/kernel/interconnect/core.py) wraps the PlatformEventBus and adds NoC-style routing on top:
Components:
RuntimeRegistry+DiscoveryManager— runtime registration and discoveryRoutingTable+MessageRouter— resolves destination runtimes for a given target nameBackpressureManager— detects and signals backpressure from overloaded sendersCongestionController— manages global congestion stateFlowController— token-bucket or rate-limit flow controlPriorityManager+QoSManager— priority-based scheduling and quality-of-serviceReliabilityManager+DeadLetterQueue— retry logic; failed messages go to DLQPointToPointManager— P2P unicast deliveryMulticastManager— deliver to a group of named destinationsBroadcastManager— deliver to all registered runtimes
Message Routing: The send() method:
- Publishes
INTERCONNECT_MESSAGE_SENTevent for observability - Checks backpressure — throttles if sender is overloaded
- Routes to destination(s) via
MessageRouter - On route failure: publishes
INTERCONNECT_ROUTE_FAILEDevent + adds to DLQ - Dispatches via P2P, multicast, or broadcast based on
RoutingType
What Happened
The CognitiveInterconnect was fully implemented. The component registered in the boot sequence (main.py: CognitiveInterconnectComponent).
The interconnect is tested indirectly through the broader OS certification tests (backend/app/cognition/kernel/).
The interconnect certification audit (backend/audit_interconnect_certification.py) and the production audit (backend/audit_interconnect_prod.py) exist as dedicated test files, suggesting the interconnect was specifically stress-tested for correctness and production readiness.
Evidence
backend/app/cognition/kernel/interconnect/core.py— fullCognitiveInterconnectimplementationbackend/app/cognition/kernel/interconnect/router.py,traffic.py,qos.py,reliability.py,delivery.py— component implementationsbackend/app/main.pyline 25 —CognitiveInterconnectComponentin boot registrationdocs/05_ENGINEERING_RULES.md— Rule 5: Zero-Bypass Communicationbackend/audit_interconnect_certification.py(13002 bytes) — certification testbackend/audit_interconnect_prod.py(7409 bytes) — production audit
Diagnosis
Established: The interconnect is architecturally complete with 10 specialized components. The design mirrors NoC concepts from computer architecture — routing tables, QoS, flow control, congestion control, dead-letter queues. All components are present in the source tree.
Likely: The backpressure system uses sender-based throttling (backpressure.should_throttle(message.sender)). The current implementation notes in core.py line 92-93 indicate the throttling logic was advisory rather than hard blocking: "we allow it but it might hit FlowControl limits downstream" — suggesting the backpressure enforcement was partially implemented.
Unknown: Whether the reliability manager's retry logic was tested under network partition conditions. Whether the DLQ was monitored in practice.
What Changed
No documented changes — this was the implemented architecture from Phase 26.8.
What I Learned
Applying Network-on-Chip concepts (routing, QoS, backpressure, dead-letter queues) to in-process AI subsystem communication is a principled way to build a zero-bypass communication fabric. The design separates concerns cleanly: routing is separate from delivery, which is separate from QoS, which is separate from reliability.
The advisory backpressure approach (allowing throttled messages through) is a practical tradeoff — hard blocking would risk deadlock in synchronous execution paths.
Broader Principle
Zero-bypass communication in an AI OS requires a communication fabric that: (a) all subsystems register with, (b) provides routing, QoS, and reliability guarantees, and (c) is observable (publishes events for every send, route, and failure). Without observability, the communication fabric is a black box.
Technical References
backend/app/cognition/kernel/interconnect/core.pybackend/app/cognition/kernel/interconnect/delivery.pybackend/app/cognition/kernel/interconnect/traffic.pybackend/app/cognition/kernel/interconnect/reliability.pydocs/05_ENGINEERING_RULES.md(Rule 5)backend/audit_interconnect_certification.py
Failure sequence
On the record- Attempt
- The `CognitiveInterconnect` (`backend/app/cognition/kernel/interconnect/core.py`) wraps the `PlatformEventBus` and adds NoC-style routing on top: **Components:** 1. `RuntimeRegistry` + `DiscoveryManager` — runtime registration and discovery 2. `RoutingTable` + `MessageRouter` — resolves destination runtimes for a given target name 3. `BackpressureManager` — detects and signals backpressure from overloaded senders 4. `CongestionController` — manages global congestion state 5. `FlowController` — token-bucket or rate-limit flow control 6. `PriorityManager` + `QoSManager` — priority-based scheduling and quality-of-service 7. `ReliabilityManager` + `DeadLetterQueue` — retry logic; failed messages go to DLQ 8. `PointToPointManager` — P2P unicast delivery 9. `MulticastManager` — deliver to a group of named destinations 10. `BroadcastManager` — deliver to all registered runtimes **Message Routing:** The `send()` method: 1. Publishes `INTERCONNECT_MESSAGE_SENT` event for observability 2. Checks backpressure — throttles if sender is overloaded 3. Routes to destination(s) via `MessageRouter` 4. On route failure: publishes `INTERCONNECT_ROUTE_FAILED` event + adds to DLQ 5. Dispatches via P2P, multicast, or broadcast based on `RoutingType`
- Failure
- The CognitiveInterconnect was fully implemented. The component registered in the boot sequence (`main.py`: `CognitiveInterconnectComponent`). The interconnect is tested indirectly through the broader OS certification tests (`backend/app/cognition/kernel/`). The interconnect certification audit (`backend/audit_interconnect_certification.py`) and the production audit (`backend/audit_interconnect_prod.py`) exist as dedicated test files, suggesting the interconnect was specifically stress-tested for correctness and production readiness.
- Diagnosis
- **Established:** The interconnect is architecturally complete with 10 specialized components. The design mirrors NoC concepts from computer architecture — routing tables, QoS, flow control, congestion control, dead-letter queues. All components are present in the source tree. **Likely:** The backpressure system uses sender-based throttling (`backpressure.should_throttle(message.sender)`). The current implementation notes in `core.py` line 92-93 indicate the throttling logic was advisory rather than hard blocking: "we allow it but it might hit FlowControl limits downstream" — suggesting the backpressure enforcement was partially implemented. **Unknown:** Whether the reliability manager's retry logic was tested under network partition conditions. Whether the DLQ was monitored in practice.
- Lesson
- Applying Network-on-Chip concepts (routing, QoS, backpressure, dead-letter queues) to in-process AI subsystem communication is a principled way to build a zero-bypass communication fabric. The design separates concerns cleanly: routing is separate from delivery, which is separate from QoS, which is separate from reliability. The advisory backpressure approach (allowing throttled messages through) is a practical tradeoff — hard blocking would risk deadlock in synchronous execution paths.
- Next iteration
- No documented changes — this was the implemented architecture from Phase 26.8.