fn main() {
println!("===============================================================");
println!(" Pepita: Sovereign AI Kernel Interfaces Demo");
println!("===============================================================\n");
println!("+-------------------------------------------------------------+");
println!("| Section 1: Design Principles (Iron Lotus Framework) |");
println!("+-------------------------------------------------------------+\n");
println!(" Pepita follows the Iron Lotus Framework:");
println!();
println!(" 1. First-Principles Rust");
println!(" - Zero external dependencies in kernel mode");
println!(" - All data structures defined from scratch");
println!();
println!(" 2. Pure Rust Sovereignty");
println!(" - 100% auditable codebase");
println!(" - Zero C/C++ dependencies");
println!(" - no_std compatible core");
println!();
println!(" 3. Toyota Way Quality");
println!(" - Jidoka: Built-in quality (stop on error)");
println!(" - Poka-yoke: Error prevention");
println!(" - Genchi Genbutsu: Go and see for yourself");
println!();
println!(" 4. EXTREME TDD");
println!(" - 417 tests covering all modules");
println!(" - 95% coverage, 80% mutation score");
println!();
println!("+-------------------------------------------------------------+");
println!("| Section 2: Kernel Interfaces (no_std compatible) |");
println!("+-------------------------------------------------------------+\n");
println!(" io_uring - Linux Async I/O");
println!(" ─────────────────────────────────────────");
println!(" Eliminates syscall overhead by batching I/O operations.");
println!(" One syscall can submit hundreds of operations.");
println!();
println!(" ```rust");
println!(" use pepita::io_uring::{{IoUringSqe, IoUringCqe}};");
println!();
println!(" // Submission queue entry");
println!(" let sqe = IoUringSqe::new(op, fd, addr, len);");
println!();
println!(" // Completion queue entry");
println!(" let cqe: IoUringCqe = /* from kernel */;");
println!(" assert_eq!(cqe.res, 0); // Success");
println!(" ```");
println!();
println!(" ublk - Userspace Block Devices");
println!(" ─────────────────────────────────────────");
println!(" Implement virtual disks entirely in userspace.");
println!();
println!(" ```rust");
println!(" use pepita::ublk::{{UblkCtrlCmd, UBLK_U_CMD_ADD_DEV}};");
println!();
println!(" let cmd = UblkCtrlCmd::new(UBLK_U_CMD_ADD_DEV, dev_id);");
println!(" ```");
println!();
println!(" blk_mq - Multi-Queue Block Layer");
println!(" ─────────────────────────────────────────");
println!(" Parallel I/O queues for NVMe-style storage.");
println!();
println!(" Key types: TagSetConfig, Request, RequestOp");
println!();
println!("+-------------------------------------------------------------+");
println!("| Section 3: Sovereign Infrastructure |");
println!("+-------------------------------------------------------------+\n");
println!(" zram - Compressed RAM Block Device");
println!(" ─────────────────────────────────────────");
println!(" 3-4x compression ratio with LZ4. Zero-page optimization.");
println!();
println!(" ```rust");
println!(" use pepita::zram::{{ZramDevice, ZramConfig}};");
println!();
println!(" let config = ZramConfig::with_size(1024 * 1024 * 1024)");
println!(" .compressor(ZramCompressor::Lz4);");
println!(" let device = ZramDevice::new(config)?;");
println!();
println!(" device.write_page(0, &data)?;");
println!(" println!(\"Compression: {{:.2}}x\", device.stats().compression_ratio());");
println!(" ```");
println!();
println!(" MicroVM - KVM-based Runtime");
println!(" ─────────────────────────────────────────");
println!(" Hardware-level isolation with sub-100ms boot time.");
println!(" Docker replacement for serverless workloads.");
println!();
println!(" ```rust");
println!(" use pepita::vmm::{{MicroVm, VmConfig}};");
println!();
println!(" let config = VmConfig::builder()");
println!(" .vcpus(2)");
println!(" .memory_mb(256)");
println!(" .kernel_path(\"/boot/vmlinuz\")");
println!(" .build()?;");
println!();
println!(" let vm = MicroVm::create(config)?;");
println!(" vm.start()?;");
println!(" ```");
println!();
println!(" virtio - VM Device Communication");
println!(" ─────────────────────────────────────────");
println!(" Standard interface for high-performance VM I/O.");
println!();
println!(" Key types: VirtQueue, VirtioVsock, VirtioBlock");
println!();
println!("+-------------------------------------------------------------+");
println!("| Section 4: Distributed Computing |");
println!("+-------------------------------------------------------------+\n");
println!(" Work-Stealing Scheduler (Blumofe-Leiserson)");
println!(" ─────────────────────────────────────────");
println!(" Each worker has a deque - pushes/pops from bottom,");
println!(" thieves steal from top. Provably optimal load balancing.");
println!();
println!(" ```rust");
println!(" use pepita::scheduler::Scheduler;");
println!(" use pepita::task::{{Task, Priority}};");
println!();
println!(" let scheduler = Scheduler::with_workers(4);");
println!();
println!(" let task = Task::builder()");
println!(" .binary(\"./compute\")");
println!(" .priority(Priority::High)");
println!(" .build()?;");
println!();
println!(" scheduler.submit(task).await?;");
println!(" ```");
println!();
println!(" SIMD Operations");
println!(" ─────────────────────────────────────────");
println!(" Auto-detects AVX-512/AVX2/SSE4.1/NEON.");
println!();
println!(" ```rust");
println!(" use pepita::simd::{{SimdCapabilities, SimdOps}};");
println!();
println!(" let caps = SimdCapabilities::detect();");
println!(" println!(\"Best width: {{}}-bit\", caps.best_vector_width());");
println!();
println!(" let ops = SimdOps::new();");
println!(" ops.vadd_f32(&a, &b, &mut c); // SIMD accelerated");
println!(" let dot = ops.dot_f32(&a, &b); // dot product");
println!(" ```");
println!();
println!("+-------------------------------------------------------------+");
println!("| Section 5: Sovereign Stack Integration |");
println!("+-------------------------------------------------------------+\n");
println!(" pepita provides low-level primitives for:");
println!();
println!(" ┌────────────────────────────────────────────────────────────┐");
println!(" │ Library │ Uses pepita for │");
println!(" ├────────────────────────────────────────────────────────────┤");
println!(" │ repartir │ SIMD executor, MicroVM backend │");
println!(" │ trueno-zram │ ZRAM compression primitives │");
println!(" │ trueno-ublk │ Block device interfaces │");
println!(" │ realizar │ Inference isolation via MicroVMs │");
println!(" └────────────────────────────────────────────────────────────┘");
println!();
println!("+-------------------------------------------------------------+");
println!("| Section 6: Comparison with Alternatives |");
println!("+-------------------------------------------------------------+\n");
println!(" ┌───────────┬────────┬──────┬─────────────┬────────┐");
println!(" │ Feature │ pepita │ QEMU │ Firecracker │ Docker │");
println!(" ├───────────┼────────┼──────┼─────────────┼────────┤");
println!(" │ Language │ Rust │ C │ Rust │ Go/C │");
println!(" │ Isolation │ VM │ VM │ VM │ Cgroup │");
println!(" │ Boot time │ <100ms │ secs │ ~100ms │ ~500ms │");
println!(" │ Deps │ 0 │ many │ few │ many │");
println!(" │ Pure Rust │ Yes │ No │ Partial │ No │");
println!(" │ no_std │ Yes │ No │ No │ No │");
println!(" └───────────┴────────┴──────┴─────────────┴────────┘");
println!();
println!("+-------------------------------------------------------------+");
println!("| Section 7: Sovereign AI Use Cases |");
println!("+-------------------------------------------------------------+\n");
println!(" 1. Serverless Inference");
println!(" - MicroVMs provide <100ms cold start");
println!(" - Hardware isolation per request");
println!(" - No container escape vectors");
println!();
println!(" 2. High-Performance Storage");
println!(" - ublk for custom storage backends");
println!(" - zram for compressed working memory");
println!(" - io_uring for async I/O batching");
println!();
println!(" 3. Distributed Training");
println!(" - Work-stealing scheduler for GPU tasks");
println!(" - SIMD-accelerated gradient computation");
println!(" - virtio for efficient VM communication");
println!();
println!(" 4. Edge Deployment");
println!(" - no_std core for embedded systems");
println!(" - Zero external dependencies");
println!(" - Minimal resource footprint");
println!();
println!("===============================================================");
println!(" Demo Complete");
println!("===============================================================");
println!();
println!("For more information:");
println!(" - crates.io: https://crates.io/crates/pepita");
println!(" - docs.rs: https://docs.rs/pepita");
println!(" - GitHub: https://github.com/paiml/pepita");
}
#[cfg(test)]
mod tests {
#[test]
fn test_pepita_demo_runs() {
super::main();
}
}