Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/gpu-head-to-head/blob/main/PROTOCOL.md # gpu-head-to-head aien-dev/gpu-head-to-head Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `gpu-head-to-head / PROTOCOL.md` 466 lines · 35798 bytes Raw Blame History Rendered 1 # PROTOCOL: same-machine head-to-head, Qwen3.6-35B-A3B on one DGX Spark (bar P0) 2 3 Predeclared before any timed run. This file is committed and pushed before the first arm starts; any 4 later change to it is a separate, dated commit listed in section 10, and results say which protocol 5 commit they were taken under. 6 7 ## 1. Question 8 9 On one DGX Spark (GB10, sm_121, driver 580.173.02, 121 GiB unified LPDDR5x), serving the same model 10 to the same prompts over the same HTTP API, how do three stacks compare **end to end**? 11 12 - **OURS**: `aien-serve-http`, binary `bin-`19173f9e``, run from its directory with the live cmdline. 13 - **VLLM**: vLLM `0.29.0+`5013de39`.dev` from NVIDIA's NGC container `nvcr.io/nvidia/vllm:26.09-py3`, 14 digest `sha256:`557747337846eecf34486866f3d992383c6f8af869fdb0e365b5093fcaee02c2`` (torch 15 2.14.0a0 nv26.09, CUDA 13.4), pulled with `docker pull`; no system install. 16 - **LLAMA**: llama.cpp `b11913` (commit ``7aca0d2ea8d92b56911233b822db01f9fbb1ae50``), the 17 ggml-org CI release asset `llama-b11913-bin-ubuntu-cuda-13.4-arm64.tar.gz` (sha256 ``55ee2ae4`…18f4`) 18 run with its companion `cudart-llama-b11913-bin-ubuntu-cuda-13.4-arm64.tar.gz` (sha256 19 ``f6a5a023`…599a`) first on `LD_LIBRARY_PATH`. The release carries sm_121a machine code. 20 21 Every number in this repo is end to end: an HTTP client on the same host, timestamps taken in the 22 client. **No chip-only number (kernel time, GPU timer, per-launch microbenchmarks) appears in the 23 results table.** Numbers from other repos are not mixed in. 24 25 ## 2. Model and weights 26 27 - Checkpoint: `Qwen/Qwen3.6-35B-A3B-FP8` revision ``95a723d08a9490559dae23d0cff1d9466213d989``, 28 local `~/models/qwen3.6-35b-a3b-fp8-`95a723d0``, sha256 list `qwen3.6-35b-a3b-fp8-`95a723d0`.sha256` 29 (56 files verified 2026-10-20). FP8 e4m3, block-wise scales, dynamic activation scales. 30 - OURS and VLLM load this folder directly (read-only). 31 - LLAMA cannot load safetensors. A GGUF is converted from **the same folder** with 32 `convert_hf_to_gguf.py` at the same llama.cpp commit, `--outtype q8_0`. 33 **Quantization difference, labeled on every LLAMA row:** Q8_0 (int8, one fp16 scale per 32 34 weights, FP8 weights dequantized first and re-quantized) is not the FP8 e4m3 block-128 format the 35 other two arms run. Agreement numbers against LLAMA therefore mix engine and quantization effects. 36 If the converter refuses the FP8 checkpoint, LLAMA is NOT_RUN with the converter error quoted; no 37 GGUF from other weights (e.g. a third-party GGUF) is substituted. 38 - Text only. Vision tower and MTP heads are not used by any arm (no speculative decoding anywhere). 39 40 ## 3. API and request shape (identical for all arms) 41 42 `POST /v1/chat/completions`, one user message, `stream: true`, 43 `stream_options.include_usage: true`, `temperature: 0`, `top_p: 1`, `seed: 0`, 44 `chat_template_kwargs.enable_thinking: false` (OURS also runs `--thinking off`). 45 The client is `bench/bench.py` (Python 3 stdlib, `http.client`, one thread per stream, a barrier 46 releases concurrent streams together). One JSON row per request is written to `results/raw/`. 47 48 Timestamps (client `time.monotonic()`): `t_send` before the request is written; `t_first` at the first 49 SSE chunk carrying non-empty `content` or `reasoning_content`; `t_last` at the last such chunk. 50 Token counts come from the server's `usage` (prompt_tokens, completion_tokens). If an arm reports no 51 usage, the count is re-derived by tokenizing the returned text with the checkpoint's 52 `tokenizer.json` and the row is labeled `count=retokenized`. 53 54 ## 4. Prompts (`prompts/`, generated by `bench/make_prompts.py`, committed before runs) 55 56 - `decode.jsonl`: 16 distinct short instructions asking for long prose (≈30-60 prompt tokens). 57 - `prefill.jsonl`: three documents of deterministic synthetic prose (seeded generator) plus one 58 closing question, calibrated with the checkpoint tokenizer so that the **chat-rendered** prompt is 59 ≈256, ≈2048, ≈8192 tokens. Actual `prompt_tokens` are reported per arm. 60 - Agreement reuses `decode.jsonl` (all 16). 61 62 ## 5. Metrics 63 64 | ID | Metric | Cell | Definition | 65 |----|--------|------|------------| 66 | M1 | TTFT | decode c=1 | `t_first - t_send`, short prompt | 67 | M2 | decode tok/s, 1 stream | decode c=1, max_tokens 256 | `(completion_tokens - 1) / (t_last - t_first)` | 68 | M3 | decode tok/s at 4/8/16 concurrent | decode c=4/8/16, max_tokens 256 | per batch: aggregate = `sum(completion_tokens) / (max(t_last) - min(t_send))`; also per-stream M2 | 69 | M4 | prefill tok/s at 256/2k/8k | prefill, max_tokens 1, nonce prefix | `prompt_tokens / (t_first - t_send)` (end-to-end: includes HTTP, template, tokenizer, first sampled token) | 70 | M5 | peak memory | whole arm session | `MemAvailable(baseline, before launch) - min(MemAvailable during session)` from `/proc/meminfo` at 1 Hz; plus peak summed `VmRSS` of the server process tree (host-side view; on GB10 device allocations are system memory) | 71 | M6 | output agreement | agree c=1, 16 prompts, max_tokens 128 | per prompt, tokenize both outputs with `tokenizer.json`; matched = common-prefix length; rate = Σ matched / Σ max(len_a, len_b); also count of byte-identical outputs out of 16; pairs OURS–VLLM, OURS–LLAMA, VLLM–LLAMA; plus within-arm R1 vs R2 | 72 73 A nonce line (`Request id . Ignore this line.`) is prepended to every prefill prompt so that no 74 arm's prefix cache can hit. Decode prompts carry no nonce (they are short; prefix caching of 40 tokens 75 does not change decode rate; TTFT on a repeated short prompt is labeled as such in M1). 76 77 Concurrency is what the arm is configured for as deployed: OURS runs the live `--batch-slots 8`. At 78 c=16, OURS refuses requests beyond 8 with HTTP 503 `server_busy` ("retry shortly"); the client 79 retries those every 50 ms with the clock running from the first send (amendment A1), and the retry 80 count is stored per row. That is part of the end-to-end result and is stated beside it. 81 82 ## 6. Arm configuration 83 84 - OURS: cwd `~/.local/state/aien-q36/bin-`19173f9e``; 85 `./aien-serve-http --engine omega --model-dir ~/models/qwen3.6-35b-a3b-fp8-`95a723d0` --port 18190 86 --max-context 49152 --max-tokens-cap 16384 --thinking off --batch-slots 8`; 87 env `AIEN_Q36_STROKE=1 Q36_BATCH_BIN=bin-`19173f9e` AIEN_SERVE_GPU_LOCK=/tmp/aien-serve-18190.lock 88 AIEN_GB10_LOCK_HELD=1` (the harness holds `/tmp/aien-gb10.lock` for the whole session). 89 Identical to the 2026-10-27T01:11:57Z live snapshot except port and lock path. 90 - VLLM: `docker run --rm --runtime nvidia --gpus all --ipc host --network host --cpuset-cpus 91 -v :/model:ro vllm serve /model --served-model-name q36 --host 127.0.0.1 --port 18191 92 --max-model-len 49152 --max-num-seqs 32 (A3; was 16) --gpu-memory-utilization 93 --language-model-only`. Everything else default (CUDA graphs, prefix 94 cache, chunked prefill as the image ships them). `` is the smallest of 0.50/0.60/0.70 that starts; 95 the value used is recorded. 96 - LLAMA: `llama-server -m q36-q8_0.gguf --host 127.0.0.1 --port 18192 -ngl 999 -fa on 97 -c 393216 -np 32 --jinja` (A3; was `-c 196608 -np 16`: 12288 tokens per slot either way). Everything else default. 98 - Ports 18190-18193 only. Port 18091 is never touched. 99 - CPU pinning (A2): cpus 5-9 and 15-19 are Cortex-X925 (`/proc/cpuinfo` CPU part 0xd85), cpus 0-4 100 and 10-14 are Cortex-A725 (0xd87). Every server arm gets the identical X925 set `5-9,15-17,19` 101 (core 18 excluded: the nvidia-modeset kthread sits there). OURS and llama-server via `taskset -c`, 102 VLLM via `--cpuset-cpus`. `bench.py` runs on A725 cores `12-13`. Both lists are stored in every row 103 (`server_cpus`, `client_cpus`). VLLM uses host networking so no docker-proxy sits in the path. 104 - LLAMA16 (A2, optional BF16 reference arm): same llama-server and flags as LLAMA on port 18193, 105 with `q36-35b-a3b-bf16.gguf` (converted from the same checkpoint with `--outtype bf16`, i.e. the 106 FP8 weights dequantized to BF16) and `--no-mmap` (a 70 GB file mapped beside 70 GB of device 107 buffers would not fit in 121 GiB of unified memory). 108 109 ## 7. Schedule, repetitions, statistics 110 111 - Two rounds, interleaved by arm: **R1 = OURS, VLLM, LLAMA; R2 = LLAMA, VLLM, OURS.** Then, only if 112 the night's quiet window still has room, LLAMA16 R1 and R2 (A2). 113 - One model in memory at a time. Between arms: server stopped, process gone, `nvidia-smi 114 --query-compute-apps` empty, MemAvailable back to within 2 GiB of the pre-launch baseline. 115 - Per arm session, cells in this order, each with **2 warmup batches then 3 measured batches**: 116 decode c=1, c=4, c=8, c=16; prefill 256, 2k, 8k. Then the agreement cell (16 prompts, once each, 117 no warmup). So each timing cell has 6 measured batches per arm across R1+R2. 118 - Reported per cell: **median and IQR** over the measured values (6 batch values for aggregate 119 metrics; all per-stream values for per-stream metrics, count stated). Computed with Wolfram 120 Language `Median` and `InterquartileRange` (Wolfram's default quartile definition); the query and 121 result are kept in `results/wolfram/`. If the Wolfram MCP is not mounted, only exact counts and the 122 raw rows are published and the table says so. 123 - No significance tests. A difference is called a win/loss only when the IQRs do not overlap; 124 otherwise "overlapping". 125 126 ## 8. Load and GPU-lock gates 127 128 - (A2) A session starts only when, over a 60 s window, no process outside the harness used more than 129 20% of one CPU and `load1 < 6` (`bench/quiet.py`). Not gated, but recorded in every check: the 130 nvidia-modeset kthread and the `omp` agent-harness process that hosts this lane (it averages ~38% 131 of one core while other agents run; gating on it would never start). Before every cell the same 132 foreign-process check runs over 10 s with no load threshold (the arm's own server is excluded). 133 Every check is stored in `results/logs/-/quiet.jsonl`; `vmstat -t 1` and `load1` (per 134 row) are recorded for every session. A cell that ran after the gate timed out (50 min into the 135 session) is labeled LOADED and excluded from the headline table. 136 - (A2) The nvidia-modeset kthread (pid 1671, affinity 0-19, not pinned) has its `psr` (field 39 of 137 `/proc/1671/stat`) sampled every 1 s in `mem.tsv` (5th column) and logged at session start and 138 end. A cell during which any sample shows it on a server core is VOID: its id goes to 139 `results/voids.jsonl`, its rows stay in the raw file but are dropped by `extract.py`, and the cell 140 is re-run (at most 3 tries). The void count is reported. 141 - GPU: each arm session runs inside `flock -w 900 /tmp/aien-gb10.lock`, at most 60 minutes, with 142 BOARD lines at START, T-5 (55 min) and END. The harness kills its own server at 60 min. 143 No module reloads, no reboots, `/dev/nvidia-modeset` is never opened by the harness. 144 - An arm that cannot start (unsupported model, OOM, converter refusal) is recorded NOT_RUN with the 145 exact error and log; it is not retried with different weights. 146 147 ## 9. Publication 148 149 Everything is published even if OURS loses: `results/RESULTS.md` (table), `results/raw/*.jsonl` 150 (every request row incl. warmups), `results/logs/` (server stdout/stderr, memory samples, BOARD 151 lines, versions), `bench/` (exact commands). Evidence label of every number: MEASURED, end to end, 152 on this one Spark, on the stated date and load. 153 154 ## 10. Amendments 155 156 - **A1 (2026-10-27, before any timed run, found with OURS `--engine stub` on port 18199, no GPU):** 157 OURS answers HTTP 503 `server_busy` when every generation slot is taken instead of queueing. 158 `bench.py` now retries 429/503 every 50 ms (bounded by the 1800 s request timeout), keeps `t_send` 159 at the first attempt, and records `busy_retries`. Section 5 updated. Server launches read 160 `/dev/null` as stdin (OURS exits silently when started in the background without it). 161 - **A2 (2026-10-27, before any timed run, Main's decision):** `load1 < 4` is unreachable on this 162 host (the nvidia-modeset kthread holds one core permanently; other lanes' short bursts dominate 163 load1 while the CPU is ~68% idle). The gate is replaced by the 20%-CPU foreign-process check plus 164 `load1 < 6` (section 8), servers and client are pinned to fixed cores (section 6), VLLM uses host 165 networking, and vmstat is logged per session. Other lanes are in a declared quiet window (no local 166 builds or tests). 167 Additionally (Main, same day): 168 (a) The core sets of section 6: identical Cortex-X925 server set minus core 18 for every arm, 169 client on Cortex-A725, core lists in every row. The split is recorded in `results/env/cpu.txt` 170 from sysfs `cpu_capacity` (X925 997-1024, A725 718-731) and `/proc/cpuinfo` CPU part. Rule: P cores 171 are those with `cpu_capacity >= 990`; minus core 18 that is `5-9,15-17,19` (9 cores). 172 (b) The kthread `psr` sampling and void/re-run rule of section 8. 173 (c) Environment fact: nobody renices or pins the nvidia-modeset kthread during the study, so the 174 machine state is the same for every arm. 175 (d) Optional reference arm LLAMA16 (section 6). Cost: two more sessions of at most 60 min each, 176 during which the quiet window keeps blocking other lanes; they run last and are dropped (listed as 177 a follow-up, NOT_RUN) if the window closes first. If it runs, M6 also reports each arm's agreement 178 against LLAMA16, named as **llama.cpp b11913 with BF16 weights dequantized from the FP8 179 checkpoint**. It is a reference engine, not ground truth: no arm runs the model unquantized, and 180 the checkpoint itself is FP8. Pairwise agreement between OURS, VLLM and LLAMA is labeled as mixing 181 engine and quantization effects. 182 - **A3 (2026-10-27, before any timed run; Main, after a second outside audit Drake adopted):** 183 (a) **More arms.** SGLANG: the official SGLang server, run like VLLM (container, host network, 184 same X925 core set, port 18194, `--context-length 49152 --max-running-requests 32 185 --mem-fraction-static 0.50`, raised 0.60/0.70 like VLLM if it does not start), only if an image 186 with an arm64 manifest that runs on sm_121 exists; the exact image digest is recorded in 187 `bench/arms.conf`. 4-bit arms, one per engine, each labeled **different numeric format from the 188 FP8 checkpoint OURS runs**: VLLM4 / SGLANG4 on a published NVFP4 checkpoint of the same model 189 (repo id and revision recorded), LLAMA4 on an MXFP4 (else Q4_K_M) GGUF produced with 190 `llama-quantize` b11913 from the BF16 GGUF of A2. An arm whose image or weights are not available 191 is NOT_RUN with the reason; nothing third-party is substituted silently. 192 (b) **Grid**, added to every session after the existing cells: N = 1, 8, 32 concurrent streams × 193 prompts `p512` (502 chat tokens, added to `prefill.jsonl`; the other prompts are byte-identical) 194 and `p8k` (8184), 256 new tokens, nonce prefix per stream, 1 warmup + 3 measured runs. Reported: 195 TTFT; TPOT = `(t_last - t_first) / (completion_tokens - 1)` per stream, p50 and p99 over all 196 measured streams of a cell (Wolfram `Quantile`, count stated; the client records first/last token 197 times, not every token, so p99 is over streams, not tokens); aggregate tok/s as M3; peak memory as 198 M5. To serve N = 32, VLLM runs `--max-num-seqs 32` and llama-server `-np 32 -c 393216` (still 199 12288 tokens per slot); OURS stays at its deployed `--batch-slots 8` with the A1 retry. 200 (c) **Order and cost.** The 8-bit arm of every engine runs first, interleaved (R1 forward, R2 201 reversed); then LLAMA16 (A2), then the 4-bit arms, queued in `bench/schedule.txt`. Each session 202 is at most 60 min of GPU lock with the quiet window blocking other lanes: SGLANG +2 sessions; 203 VLLM4 +2; SGLANG4 +2; LLAMA4 +2, plus about 15 min of CPU quantization before them (no GPU). 204 The grid cells are last in each session, so a session that reaches 60 min loses grid cells first; 205 missing cells are listed as NOT_RUN (timeout). Arms that do not fit tonight's window stay queued 206 and are reported as follow-up, NOT_RUN. 207 (d) Published Spark figures for this model from other parties are quoted in the README as context 208 only, with their source and numeric format. The only claims are same-box results from this 209 protocol. 210 (e) GPU-lock priority (Main, 2026-10-27): after HeadToHead's FP8 sessions, OmegaVfio and the C1 211 lanes take the lock before any queued A2/A3 arm. 212 - **A4 (2026-10-27, HeadToHead after restart; written before any OURS/LLAMA cell and before any 213 VLLM number was read):** 214 (a) **In-cell foreign-process check.** During every timed cell `bench/coremon.py` (pinned to 215 A725 core 11) samples the server cores every second; a process outside the session's trees with 216 more than 20% of one server core over the cell voids it, like the kthread rule of section 8. 217 Only a coremon summary that names offenders voids a cell. A monitor that wrote no summary makes 218 that cell's foreign check NOT_RUN (logged in `session.log`), not a void. 219 (b) **Harness defects found, with their effect.** OURS R1 attempt 1 (02:09:51Z) never started a 220 server: `run_arm.sh` ran `env VARS... exec taskset ...`, and `exec` is a shell builtin (`env: 221 'exec': No such file or directory`). No GPU work, no rows; log kept in 222 `results/logs/attempts/OURS-R1-a1-launch-bug/`. Fixed to `exec env VARS... taskset ...` and OURS 223 R1 re-runs after VLLM R1 (the only change in session order). The VLLM R1 session ran from a 224 snapshot in which `MON_CPU` was unset: `taskset -c python3 coremon.py` failed with exit 1, so 225 every VLLM R1 try was written to `voids.jsonl` with an empty foreign-process reason. Those 226 records are not voids under (a); `extract.py` honours a void record only when its reason names 227 the kthread or a non-empty offender list. The session was not killed (rule: a running session is 228 never disturbed); its foreign check is NOT_RUN for every cell, and that is stated in RESULTS. 229 (c) **One try per cell.** When re-runs leave several non-void tries of one cell, only the lowest 230 numbered non-void try is used; the others stay in the raw file. 231 (d) **Order and lock priority (A3(e)).** The FP8 sessions OURS, VLLM, LLAMA x R1, R2 run; LLAMA16 232 (A2) and the A3 arms are not started tonight. They are reported NOT_RUN (deferred: GPU-lock 233 priority for OmegaVfio W0 and C1 per A3(e)), with the BF16 GGUF kept for a later window. 234 (e) **Server core set per session.** At 02:17Z, 6.5 min into VLLM R1, the nvidia-modeset kthread 235 moved from core 18 to server core 17 and stayed there, so the A2 rule voided every try of VLLM 236 R1's cells (`mem.tsv` column 5). From OURS R1 on, each session takes the 10 X925 cores minus the 237 one the kthread is on when the session takes the GPU lock (core 18 if it is on an A725 core): 238 always 9 X925 cores, the set logged in `session.log` and stored in every row. The kthread is 239 still never pinned or reniced (A2(c)); the A2 void rule is unchanged. 240 (f) **Session re-run.** A session in which any cell ended void after its 3 tries is re-run once 241 in full after the other FP8 sessions; the re-run replaces it, and the first stays under 242 `results/logs/attempts/` and `results/raw/attempts/`. 243 - **A5 (2026-10-27 ~02:48Z, HeadToHead after the second restart; before any OURS/LLAMA cell):** 244 (a) **Accidental stop.** At about 02:45Z Main relayed a STOP-all order that was a misread of 245 Drake's instruction (Drake afterwards: "I didn't mean to stop everything. Just keep them 246 going."). The driver was killed and the `h2h-vllm` container stopped with `docker stop` 247 during VLLM R1's grid cell `p8k-n1` (last memory sample 02:45:55Z; the server log shows the 248 shutdown with 7 requests running). No other session was running; OURS R1 had not started. 249 (b) **Effect.** None on any result: VLLM R1 attempt 1 was already void in every cell under 250 A4(e) (kthread on server cores 17, then 16) and had been scheduled for a full re-run under A4(f). 251 Its raw file, logs and void records move to `results/raw/attempts/VLLM-R1-a1.jsonl`, 252 `results/raw/attempts/VLLM-R1-a1-voids.jsonl` and 253 `results/logs/attempts/VLLM-R1-a1-kthread-void-stopped/`; none of its numbers is reported. 254 (c) **Order.** `bench/schedule.txt` now reads OURS R1, LLAMA R1, LLAMA R2, VLLM R2, OURS R2, 255 VLLM R1 (the re-run last, per A4(f)). Apart from (d), nothing changes: same cells, server core 256 rule and void rules. 257 (d) **Quiet window and client cores.** Other lanes resumed after the stop; their builds run on 258 A725 cores 10-14 only (Main's rule), which held the client (12-13) and coremon (11). From OURS 259 R1 on, the client runs on A725 cores 0-1 and coremon on A725 core 2 (`run_arm.sh`), so builds 260 never share a core with the measurement side; every row still records its core lists. The A2 261 gate and the A4(a) in-cell foreign-process check on the server cores are unchanged. 262 (e) **GPU-lock wait.** Other lanes take `/tmp/aien-gb10.lock` between sessions. A session whose 263 `flock -w 900` times out never took the GPU and ran no cell; `run_all.sh` now moves its pre-lock 264 logs to `results/logs/attempts/--lockwait-