interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / docs / adr / 0005-unified-memory-c1-cow-and-reservation-accounting.md

23 lines · 2046 bytes Raw Blame History Rendered
1# ADR 0005: Unified Memory C1 Copy-On-Write and Reservation Accounting
2
3Status: accepted by the operator, 2026-09-23.
4Governing: [ARCHITECTURE.md §2, §7](../ARCHITECTURE.md), [BLUEPRINT.md §9, §10, §28](../BLUEPRINT.md), [MILESTONES.md Phase 4, 5](../MILESTONES.md).
5Specification: [PHASE_3_TO_5_SPECIFICATION.md §4](../PHASE_3_TO_5_SPECIFICATION.md#4-phase-5-native-hardware-acceleration-hardware-bound-c1-compute).
6
7## Context
8
9On architectures with unified physical memory between CPU and GPU (such as NVLink-C2C on NVIDIA DGX Spark), address spaces are physically unified. Without explicit ownership and strict accounting, multi-branch agent reasoning can exhaust memory mid-step, corrupt shared KV cache prefixes, or allow memory churn across speculative branches to starve core system processes.
10
11## Decision
12
13Hardware unified addressability (NVLink-C2C on DGX Spark) does not mean unstructured ownership: AIENOS explicitly owns, tracks, and accounts for every physical inference KV block with distinct memory budgets (System, Model, KV Pool, Agent State, Cortex).
14
15Branches hold block tables mapping to shared physical prefix blocks (`refcount > 1`, immutable) and private blocks (`refcount == 1`). Multi-branch divergence is managed via transactional KV reservations prior to step admission to prevent out-of-memory mid-step corruption.
16
17Under memory pressure, physical state is reclaimed according to a value-preserving hierarchy (completed private state -> suspended private suffixes -> suspended shared prefix leases -> reconstructible state); logical agent identity and token lineage survive indefinitely while physical state is reconstructed from canonical history if evicted.
18
19## Consequences
20
21- Prefix sharing achieves sublinear physical memory scaling across concurrent reasoning branches.
22- Physical memory exhaustion causes transactional admission denial or graceful eviction, never corrupted state or lost agent identity.
23- Explicit refcounting prevents child branch mutations from corrupting parent or sibling KV state.