| # Chakra 1 — CH'ULLA-KALLPA: RESULT |
|
|
| ## Leader |
|
|
| **tinygrad** — https://github.com/tinygrad/tinygrad |
| License: **MIT** (the tiny corp) |
| Commit SHA: `1b779a9058b4a9acb12387133e7ded436ae3c0ca` |
| Absorbed: `tinygrad/device.py` lines 39–54 |
|
|
| ## Kernel (10 lines exactly) |
|
|
| ```python |
| import math, random |
| # KALLPA L1 dispatch — distilled from tinygrad/device.py lines 39-54 (MIT, tinygrad/tinygrad) |
| # NINA Butler-Volmer: i = i0*(exp(α·F·η/RT) - exp(-(1-α)·F·η/RT)); min-energy path wins |
| PATHS = ["CPU", "GPU", "QUANTIZED", "MOE"] |
| nina = lambda η,α=0.5,F=96485,RT=2478.96,i0=1e-6: abs(i0*(math.exp(α*F*η/RT)-math.exp(-(1-α)*F*η/RT))) |
| def dispatch(state, world, seed=0): |
| rng = random.Random(seed) |
| costs = {p: nina(rng.gauss(world.get(p, 0.0), 0.01)) for p in PATHS} |
| chosen = min(costs, key=costs.__getitem__) |
| return chosen, costs[chosen] |
| ``` |
|
|
| ## Design |
|
|
| The kernel maps directly onto tinygrad's dispatch primitive: |
|
|
| - `PATHS` ← `ALL_DEVICES` (tinygrad lines 15, 40) |
| - `min(costs)` ← `next(get_available_devices())` first-available → replaced with NINA-weighted minimum |
| - `world[path]` ← overpotential η signal per compute path (from environment state) |
| - `nina(η)` ← Butler-Volmer current magnitude = proxy energy cost at that operating point |
|
|
| **Input:** `(state: dict, world: dict[path→η_mean], seed: int)` |
| **Output:** `(chosen_path: str, energy_cost: float)` |
|
|
| ## Minimization |
|
|
| | Metric | Value | |
| |---|---| |
| | Leader total LOC | 420 | |
| | Kernel LOC | 10 | |
| | Reduction ratio | **42×** | |
| | Absorbed lines | 16 (lines 39–54) | |
|
|
| ## Replay (5×, seed=7) |
|
|
| **Canonical hash:** `34f8a0b2156390a3b372de1adeea8282e0bced09c9a75d8bcf12e59230b3a330` |
| All 5 runs byte-identical. Chosen path: `CPU`. Energy cost: `2.906363e-07`. |
|
|
| ## Rejected |
|
|
| - **BitNet** (MIT): dispatch in C++/CUDA, no honest Python dispatch loop ≤10 lines. |
| - **vLLM** (Apache-2.0): MoE routing spans ≥3 files, not honestly minimizable. |
|
|
| ## Blockers |
|
|
| None. |
|
|