omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / docs / gpu / PI_DRIVE_27B_SPARK.md
| 1 | # Driving Qwen3.8-27B-FP8 on DGX Spark GB10 from Raspberry Pi 5 (Pure Seeded Omega) |
| 2 | |
| 3 | **Date:** 2026-11-19 |
| 4 | **Status:** `PASS` (live end-to-end Pi → Spark 27B inference over encrypted SSH loopback tunnel + AArch64 `seed/out/omc` GB20B host test suite on Pi). |
| 5 | **Scope boundary (honesty check):** Today's live 27B run still uses Linux + `aien-serve-http` (`omega-qwen38` engine) on Spark, offloading all driving/client/compiler userspace to the Raspberry Pi 5 so Spark dedicates its unified memory to the 27B model. Bare-metal Aienux with zero Linux userspace on Spark remains `NOT_RUN` until the Aienux UEFI/PCIe/GB20B/SASS stack completes bring-up. |
| 6 | |
| 7 | --- |
| 8 | |
| 9 | ## 1. Live Measured Run: Pi 5 Pure-Omega Client → Spark GB10 27B |
| 10 | |
| 11 | ### Client (Raspberry Pi 5 `hub`, `aarch64 GNU/Linux`) |
| 12 | - **Source:** `seed/net/http.om` + `seed/net/notls.om` + `tools/pi-drive-27b/pi_drive.om` |
| 13 | - **Build command (native on Pi AArch64, zero C / Python / curl / libc):** |
| 14 | ```bash |
| 15 | { printf 'om2\n'; cat seed/net/http.om seed/net/notls.om tools/pi-drive-27b/pi_drive.om; } | ./seed/out/omc > pi_drive |
| 16 | chmod +x pi_drive |
| 17 | ``` |
| 18 | - **Binary:** `68 KB` static AArch64 ELF (`ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked`) |
| 19 | - **Measured Pi footprint (`/usr/bin/time -v ~/pi-drive-27b/pi_drive < /dev/null`):** |
| 20 | - **Max RSS:** `400 KB` (`0.4 MB`) |
| 21 | - **CPU time:** `0.00 s` user / `0.00 s` system (`0%` CPU) |
| 22 | - **End-to-end wall clock (`/health` + `/v1/chat/completions`):** `5.06 s` |
| 23 | - **Exit status:** `0` |
| 24 | |
| 25 | ### Server (DGX Spark GB10, `121 GiB` unified LPDDR5x) |
| 26 | - **Binary:** `~/.local/state/aien-q36/bin-cc45f45e/aien-serve-http` (`SHA256SUMS` verified `OK`) |
| 27 | - **Model:** `~/models/specialist-transfer/qwen3.8-27b-fp8-017b9c7a` (`64` layers, `omega-qwen38` engine) |
| 28 | - **Launcher:** `tools/pi-drive-27b/run-spark-27b.sh` (loopback-only `127.0.0.1:18099`, `--max-context 131072`, `--max-tokens-cap 16384`, `--thinking off`, `CLAIM`/`RELEASE` on `BOARD.md`, guaranteed `EXIT` trap shutdown) |
| 29 | - **Measured Spark load & memory:** |
| 30 | - **Engine load time:** `50.9 s` (`READY` in `49 s`) |
| 31 | - **Context window:** `131,072` tokens (engine `attn256` ceiling) |
| 32 | - **Weights resident:** `26.92 GB` | **KV cache:** `8.59 GB` | **Server RSS:** `38.55 GB` (`37,649,508 KiB`) |
| 33 | - **Spark `MemAvailable` before load:** `109,923 MiB` (`107 GiB`) |
| 34 | - **Spark `MemAvailable` with 27B + 128k KV loaded:** `71 GiB` free |
| 35 | - **Measured inference output:** |
| 36 | - `/health`: `{"busy":false,"engine":"omega-qwen38","model":"qwen3.8-27b-fp8","status":"ok","uptime_s":11}` |
| 37 | - Completion ID: `chatcmpl-18e97c6dcb707cbf0000` (`40` prompt tokens, `36` completion tokens, `76` total tokens, `finish_reason: "stop"`) |
| 38 | - **Post-run cleanup:** `aien-serve-http` stopped cleanly; `spark-window status` = `no window open`, `gb10 lock holders:` empty, `nvidia-smi` = 0 compute processes. |
| 39 | |
| 40 | --- |
| 41 | |
| 42 | ## 2. Pure-Omega GB20B Host Tests Verified on Pi AArch64 (`seed/out/omc`) |
| 43 | |
| 44 | Compiled and executed natively on `hub` (`Linux hub 7.0.0-1023-raspi aarch64 GNU/Linux`) with pinned `seed/out/omc`: |
| 45 | |
| 46 | | Suite | Verdict | Output | |
| 47 | |---|---|---| |
| 48 | | `logdec_trace` (`logdec.om` + `logdec_trace.om`) | **`PASS`** (`rc=0`) | `LOGDEC TEST PASS 12/12` | |
| 49 | | `bootfs_trace` (`bootfs.om` + `bootfs_trace.om`) | **`PASS`** (`rc=0`) | `BOOTFS TEST PASS 9/9` | |
| 50 | | `irqcc_trace` (`logdec.om` + `irqsim.om` + `irq.om` + `irqcc.om` + `irqcc_trace.om`) | **`PASS`** (`rc=0`) | `IRQCC TEST PASS 6/6` | |
| 51 | | `compute_trace` (13-unit GB20B compute bring-up stack) | **`PASS`** (`rc=0`) | `PASS compute_trace` | |
| 52 | | `chan_trace` (`dma/gmmu/mem/chan/sim` + `chan_trace.om`) | **`PASS`** (`rc=0`) | `rc=0` | |
| 53 | |
| 54 | ### OM-1 `omc` Fixes Applied During Native AArch64 Verification |
| 55 | - `gpu/driver/gsp/arena.om`: split compound `or` in Profile 2 size check (`arbuild`) to stay within OM-1's 16-register pool (`error 12`). |
| 56 | - `gpu/driver/gsp/logdec.om`: cast `uchar` to `ulong` and split `kind`/`loc` check in `lgtabparse` (`error 12`). |
| 57 | - `gpu/driver/gsp/compute.om`: split `get cbrblob` temp before `put rqpay` (`error 12`). |
| 58 | - `gpu/driver/tests/bootfs_trace.om` & `gpu/driver/tests/logdec_trace.om`: typed bare arithmetic literals with `ulong` (`error 11`). |
| 59 | |
| 60 | --- |
| 61 | |
| 62 | ## 3. Back-to-Back 3-Way Live Stress Benchmark (2026-11-19) |
| 63 | |
| 64 | All three trials ran back-to-back on the exact same DGX Spark GB10 (`580.173.02`), same model (`qwen3.8-27b-fp8-017b9c7a`), and byte-identical `.om` codebase prompts (`pi_drive.om` bumped to `512 KiB` request buffer, still `68 KB` static ELF). |
| 65 | |
| 66 | | Metric / Stage | Trial 1: Pi 5 (68 KB `.om`) → Spark Omega | Trial 2: Spark-Local → Spark Omega | Trial 3: CUDA + PyTorch (`torch 2.14.0+cu130`, `transformers 5.17.0`) | |
| 67 | |---|---:|---:|---:| |
| 68 | | **Model Load Time** | **`51.4 s`** (`READY 47 s`) | **`47 s`** | **`171.8 s`** (3.5× slower) | |
| 69 | | **Memory at Load** | `38.55 GB` RSS (incl. 128k KV; `71 GiB` free) | `38.55 GB` RSS (incl. 128k KV) | `29.47 GB` CUDA + `0.69 GiB` RSS (0 KV allocated) | |
| 70 | | **Client Footprint** | **`68 KB` ELF, `512–640 KB` RSS, `0.00 s` CPU** | Local Python process | Python + PyTorch + HF venv | |
| 71 | | **S1 (`45` in / `37` out)** | **`5.22 s`** (`8.05 tok/s` decode) | **`5.21 s`** (`8.04 tok/s` decode) | **CRASH** (`ImportError: finegrained-fp8 kernel unavailable`, 0 tok) | |
| 72 | | **S2 (`3,264` in / `128` out)** | **`31.99 s`** (`7.88 tok/s` decode) | **`31.54 s`** (`7.89 tok/s` decode) | Not reached (crashed on S1) | |
| 73 | | **S3 (`13,127` in / `64` out)** | **`72.72 s`** (`7.36 tok/s` decode) | **`72.36 s`** (`7.39 tok/s` decode) | Not reached | |
| 74 | | **S4 (`39,820` in / `32` out)** | **`215.68 s`** (`6.40 tok/s` decode) | **`214.43 s`** (`6.42 tok/s` decode) | Not reached | |
| 75 | | **S5 (~99K tok / 240 KB JSON)** | Hit `420 s` client timeout in prefill (no OOM/crash; `68 GiB` free) | — | — | |
| 76 | |
| 77 | ### Live GB10 Telemetry During Trial 1 (364 samples @ 2 s) |
| 78 | - **GPU Utilization:** max `96%`, active average `64.6%` (`362/364` active samples) |
| 79 | - **SM Clock:** `208 MHz` idle → **`2,502 MHz`** peak |
| 80 | - **Temperature:** `41°C` idle → **`74°C`** peak |
| 81 | - **Power Draw:** `4.73 W` idle → **`48.81 W`** peak |
| 82 | - **Spark `MemAvailable` after 40K+ token stress:** **`68 GiB`** still free (zero swap, zero OOM) |
| 83 | - **Pi 5 remote overhead vs. Spark-local:** **< 1%** (`+0.01 s` at 45 tok; `+1.25 s` / `+0.6%` at 40K tok). |
| 84 | |
| 85 | --- |
| 86 | |
| 87 | ## 4. Spark CPU + GPU Co-Execution: Live Benchmark & Pure-Omega Modules (2026-11-19) |
| 88 | |
| 89 | ### Live Spark Overlap & Warm-Prefix Reuse Benchmark (`bin-cc45f45e`) |
| 90 | Tested `AIEN_OMEGA_Q38_OVERLAP_AB=1`, `AIEN_OMEGA_Q38_BUF_CACHED=1`, `AIEN_OMEGA_GDN_STATE_CACHED=1`, `AIEN_OMEGA_DGRAPH_PREFETCH=1`, `--prefill-device-host on`: |
| 91 | - **Warm-prefix reuse (`S2_warm_3k`, `reuse Live(3392)`, 30 new tok):** prefill dropped from **`15,477 ms` → `502 ms` (`30.8× faster`)**, total wall `3.47 s`, decode `7.77 tok/s`. |
| 92 | - **Env overlap flags vs default:** cold prefill and decode were within ~1% of default (`7.95` vs `8.04 tok/s`, `15.48 s` vs `15.31 s` at 3.2K, `63.19 s` vs `63.69 s` at 13K), confirming `bin-cc45f45e` defaults are already optimal and that the largest CPU+GPU wins come from **prefix-pool reuse**, **L2-resident CPU speculative drafting**, and **mid-decode OM-1 grammar guarding**. |
| 93 | |
| 94 | ### Pure-Omega CPU Co-Execution Modules (Verified Live on Pi ARM64 `seed/out/omc`) |
| 95 | | Module | Size / Footprint | Live AArch64 Verdict | Purpose on Grace ARM64 Cores | |
| 96 | |---|---|---|---| |
| 97 | | `tools/pi-drive-27b/specdraft.om` + `specdraft_trace.om` | `12 KB` ELF, `400 KB` RSS, `0.00 s` | **`PASS`** (`SPECDRAFT TEST PASS 8/8`, `rc=0`) | L2-resident (`64.17 KiB` state, 0 DRAM contention) 4/3/2/1-gram prompt-lookup speculative drafter + exact verification/rollback (`1..8` tokens/step) | |
| 98 | | `tools/pi-drive-27b/omguard.om` + `omguard_trace.om` | `20 KB` ELF, `400 KB` RSS, `0.00 s` | **`PASS`** (`OMGUARD TEST PASS 8/8`, `rc=0`) | Incremental mid-decode OM-1 syntax/register guard (`0x`, `>6` params, `>16` locals / `error 12`, missing `bound`, unbalanced `end`) + 64-slot FNV-1a unified-RAM prefix-pool index with LRU eviction | |
| 99 | | `tools/pi-drive-27b/tree20.om` (live across all 20 Spark ARM64 cores `0..19`) | `2.6 KB` ELF, `1,640 KB` RSS | **`PASS`** (`20/20` cores, `2,000,000` cand. tok in `1.52 s` = **`1,314,134 tok/s`** / `65,707` 20-tok trees/s) | 20-core parallel L2-resident (`64 KiB/core`) speculative 20-node token-tree + `20x20` causal attention mask generator (`~15 us/tree` vs `128 ms` GPU step) | |
| 100 | |
| 101 | |
| 102 | |
| 103 | --- |
| 104 | |
| 105 | ## 5. Server-side CPU+GPU levers for the 27B: integration and live GPU gate (2026-11-19) |
| 106 | |
| 107 | Source: `aien-sovereign-core-mv`, branch `feat/q38-integ` @ `0fe20f567` on the Spark git store (`~/git/aien-sovereign-core-mv.git`), merging four tracks with no conflicts. Receipts on the Spark: `~/work/q38-gate/`. |
| 108 | |
| 109 | | Track | Host gate | GPU gate | Verdict | |
| 110 | |---|---|---|---| |
| 111 | | Speculative decoding (`AIEN_SERVE_SPEC=ngram`, default off) | 14/14 stub tests incl. 2 negative controls | **FAIL.** Golden prompt 24/24 identical, but a 3,929-token code-edit prompt diverges from plain greedy at generated index 41 in all 3 runs | Do not enable. Verify uses a host `lm_head` argmax, not the chip's two-pass head, so it is not bit-exact once drafts are accepted or rolled back | |
| 112 | | Speculative decoding speed (temp 0, 128 tok, 3 runs each) | | plain **7.92 tok/s** (16.1 s decode), spec **5.68 tok/s** (22.5 s decode) = **28% slower** (177 vs 127 ms/token) | Slower and wrong. No acceptance counter is logged | |
| 113 | | Batch door (`--batch-slots`, off by default) | 13/13 incl. 3 negative controls | NOT_RUN | Batched dense decode is **BLOCKED**: the pinned `libomega_gpu.a` has a single-head dense graph and lacks `omega_gpu_q38_graph_create_heads`, `_set_head_state`, `_stroke`. A serialized fallback exists. 8 slots x 128k context do not fit in memory | |
| 114 | | Prefix pool (64 sessions, FNV-1a chain, LRU) | 7/7 incl. collision negative control | NOT_RUN | Pool is built and tested; the engine hook (`put`/`lookup`) is not wired. Snapshot = 156,893,184 B + 65,536 B/token | |
| 115 | | Device argmax | docs only | NOT_RUN | Already present and used: `Q38Graph::token` (`gen_argmax`), greedy path has no logit readback. The sampled path still copies about 1 MB/token and no device sampler exists | |
| 116 | |
| 117 | Unchanged from earlier: plain 27B decode is 7.9 to 8.1 tok/s at short context (about 0.79 of the 10.15 tok/s DRAM ceiling). The remaining gap is Omega kernel bandwidth in down-proj and lm_head, which needs work in the Omega repository, not the server. |
| 118 | |
| 119 | The pure-Omega drafters in `tools/pi-drive-27b/` (`specdraft.om`, `tree20.om`, `omguard.om`) pass their own AArch64 tests, but the live engine gate above shows the Rust port is not yet usable. `tree20.om`'s 1.31M candidate tok/s figure is draft generation only; no draft was accepted by the 27B in that measurement. |
| 120 | |
| 121 | --- |
| 122 | |
| 123 | ## 6. Follow-Up: Multi-Head Batched Dense Decode & Exact Two-Pass Head on GB10 (2026-11-19) |
| 124 | |
| 125 | The missing `libomega_gpu.a` multi-head dense graph APIs (`omega_gpu_q38_graph_create_heads`, `_set_head_state`, `_stroke`, `_set_batch`, `K <= 32768` FP8 GEMM for `17408` `down_proj`) and the HUM L314 exact two-pass `lm_head` (`H = 5120`, `XBOUND` parameterized up to width `8192`) were subsequently implemented in `omega-mv` (`f7d147c21`, `799adb6d8`), bound in `aien-sovereign-core-mv` (`feat/q38-integ` @ `572a9142`), and qualified on live GB10 silicon (`gpu_q38_graph_test` `24/24 PASS`, `gpu_q38_stroke_exact_test` `71/71 PASS`, `gpu_q38_stress_bench` `134/134 PASS`). Full scaling, PTIMER, output-head, and hardware telemetry metrics are published in [Q38_27B_GB10_STRESS_20261119.md](Q38_27B_GB10_STRESS_20261119.md). |