State mirroring for GPU cluster replication with ternary consistency. {+1=consistent, 0=lagging, -1=diverged}. Sync tracking, divergence detection, repair.
State mirroring for GPU cluster replication with ternary consistency.
This crate is part of the Oxide Stack — a distributed GPU runtime built on five layers:
┌─────────────────┐
│ cudaclaw │ Persistent GPU kernels, warp consensus, SmartCRDT
├─────────────────┤
│ cuda-oxide │ Flux → MIR → Pliron → NVVM → PTX compiler
├─────────────────┤
│ flux-core │ Bytecode VM + A2A agent protocol
├─────────────────┤
│ pincher │ "Vector DB as runtime, LLM as compiler"
├─────────────────┤
│ open-parallel │ Async runtime (tokio fork)
└─────────────────┘
The key insight: ternary values {-1, 0, +1} map directly to GPU compute. They pack 16× denser than FP32, enable XNOR+popcount matmul, and conservation laws become compile-time checks.
Every value in this crate follows ternary algebra (Z₃):
| Value | Meaning | GPU Analog |
|---|---|---|
| +1 | Positive / Active / Healthy | Warp vote yes |
| 0 | Neutral / Pending / Balanced | Warp vote abstain |
| -1 | Negative / Failed / Overloaded | Warp vote no |
This isn't arbitrary — ternary is the natural encoding for:
- BitNet b1.58 (Microsoft) — ternary LLMs at 60% less power
- GPU warp voting — hardware ballot returns ternary consensus
- Conservation laws — {-1, 0, +1} preserves quantity
pub enum Consistency
pub struct MirrorEntry
pub struct MirrorNode
pub fn new
pub fn put
pub fn get
pub fn entry_count
pub struct MirrorManager
pub fn new
pub fn add_replica
pub fn write_primary
pub fn sync_replica[dependencies]
ternary-mirror = "0.1.0"use ternary_mirror::*;
// See src/lib.rs tests for complete working examplesgit clone https://github.com/SuperInstance/ternary-mirror.git
cd ternary-mirror
cargo test # 8 tests| Metric | Value |
|---|---|
| Tests | 8 |
| Lines of Rust | 196 |
| Public API | 16 items |
Apache-2.0