memkit-co 0.2.0-beta.1

CPU-GPU memory coordination for the memkit ecosystem
<div align="center">

# ◈ MEMKIT CO ◈


### `[ HETEROGENEOUS MEMORY COORDINATION ENGINE ]`


[![Crates.io](https://img.shields.io/badge/crates.io-v0.2.0--beta.1-00ff9f?style=for-the-badge&labelColor=0d1117)](https://crates.io/crates/memkit-co)
[![Documentation](https://img.shields.io/badge/docs.rs-memkit--co-ff00ff?style=for-the-badge&labelColor=0d1117)](https://docs.rs/memkit-co)
[![License](https://img.shields.io/badge/license-MPL--2.0-ff6b35?style=for-the-badge&labelColor=0d1117)](../LICENSE.md)

---

```
 ██████╗  ██████╗ 
██╔════╝ ██╔═══██╗
██║      ██║   ██║
██║      ██║   ██║
╚██████╗ ╚██████╔╝
 ╚═════╝  ╚═════╝ 
```

> *"The bridge between deterministic logic and hardware execution."*

**The coordination engine of the Memkit ecosystem. Seamlessly synchronizes CPU allocations with GPU resource lifecycles through automated staging and pipelined buffering.**

[`◈ QUICK START`](#◈-quick-start) • [`◈ ADVANTAGE`](#◈-the-coordination-advantage) • [`◈ ARCHITECTURE`](#◈-architecture)

</div>

---

## ◈ THE COORDINATION ADVANTAGE


| Feature | Manual Sync | Memkit CO | Impact |
|:--------|:-----------:|:---------:|:-------|
| **Transfers** | Ad-hoc / Risky | **Batched** | Zero stalls |
| **Buffering** | Custom boiler | **Native Triple** | Max throughput |
| **Safety** | Sync barriers | **Async-Lockfree** | Thread safety |
| **Workflow** | Fragile | **Structured** | Logic-focused |

---

## ◈ FEATURES


```
┌─────────────────────────────────────────────────────────────────────────┐
│  ◆ PIPELINING   │  Native support for double and triple buffering.      │
│                │  Smooth frame delivery without CPU/GPU contention.      │
├─────────────────────────────────────────────────────────────────────────┤
│  ◆ TELEPORT     │  Allocations on the CPU frame arena can be "staged"    │
│                │  for automatic mirroring to GPU device memory.          │
├─────────────────────────────────────────────────────────────────────────┤
│  ◆ SCHEDULING   │  Automated transfer coalescing. Minimizes driver       │
│                │  overhead by batching many small uploads.               │
└─────────────────────────────────────────────────────────────────────────┘
```

---

## ◈ QUICK START


```rust
use memkit_co::{MkCoordinator, CoordinatorConfig, BufferingMode};
use memkit_gpu::DummyBackend;

// Initialize Triple Buffering Coordinator
let config = CoordinatorConfig {
    buffering: BufferingMode::Triple,
    ..Default::default()
};
let mut coordinator = MkCoordinator::new(DummyBackend::new(), config);

// Single-call "Upload & Forget"
let vertices: &[f32] = &[0.0, 0.5, 1.0, -0.5, -0.5, 1.0];
let gpu_buffer = coordinator.upload_slice(vertices).unwrap();

// Structured Frame Workflow
coordinator.begin_frame();
{
    let transform = coordinator.frame_alloc::<[f32; 16]>();
    *transform = [1.0; 16];
    
    // Automatically stage for GPU at end of frame
    coordinator.stage_for_upload(transform);
}
coordinator.end_frame().unwrap(); // Batch transfers & rotate buffers
```

---

## ◈ ARCHITECTURE


```mermaid
graph LR
    CPU([memkit Core]) --> Manager[memkit-co Manager]
    Manager --> GPU([memkit-gpu Backend])
    GPU -- Completion --> Manager
    Manager -- Stats --> CPU
```

---

## ◈ LICENSE


Licensed under the **Mozilla Public License 2.0**.

---

<div align="center">

**[ Part of the ◈ MEMKIT ◈ Ecosystem ]**

</div>