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 Source # PROTOCOL: same-machine head-to-head, Qwen3.6-35B-A3B on one DGX Spark (bar P0) Predeclared before any timed run. This file is committed and pushed before the first arm starts; any later change to it is a separate, dated commit listed in section 10, and results say which protocol commit they were taken under. ## 1. Question On one DGX Spark (GB10, sm_121, driver 580.173.02, 121 GiB unified LPDDR5x), serving the same model to the same prompts over the same HTTP API, how do three stacks compare end to end? - OURS: `aien-serve-http`, binary `bin-19173f9e`, run from its directory with the live cmdline. - VLLM: vLLM `0.29.0+5013de39.dev` from NVIDIA's NGC container `nvcr.io/nvidia/vllm:26.09-py3`, digest `sha256:557747337846eecf34486866f3d992383c6f8af869fdb0e365b5093fcaee02c2` (torch 2.14.0a0 nv26.09, CUDA 13.4), pulled with `docker pull`; no system install. - LLAMA: llama.cpp `b11913` (commit `7aca0d2ea8d92b56911233b822db01f9fbb1ae50`), the ggml-org CI release asset `llama-b11913-bin-ubuntu-cuda-13.4-arm64.tar.gz` (sha256 `55ee2ae4…18f4`) run with its companion `cudart-llama-b11913-bin-ubuntu-cuda-13.4-arm64.tar.gz` (sha256 `f6a5a023…599a`) first on `LD_LIBRARY_PATH`. The release carries sm_121a machine code. Every number in this repo is end to end: an HTTP client on the same host, timestamps taken in the client. **No chip-only number (kernel time, GPU timer, per-launch microbenchmarks) appears in the results table.** Numbers from other repos are not mixed in. ## 2. Model and weights - Checkpoint: `Qwen/Qwen3.6-35B-A3B-FP8` revision `95a723d08a9490559dae23d0cff1d9466213d989`, local `~/models/qwen3.6-35b-a3b-fp8-95a723d0`, sha256 list `qwen3.6-35b-a3b-fp8-95a723d0.sha256` (56 files verified 2026-10-20). FP8 e4m3, block-wise scales, dynamic activation scales. - OURS and VLLM load this folder directly (read-only). - LLAMA cannot load safetensors. A GGUF is converted from the same folder with `convert_hf_to_gguf.py` at the same llama.cpp commit, `--outtype q8_0`. Quantization difference, labeled on every LLAMA row: Q8_0 (int8, one fp16 scale per 32 weights, FP8 weights dequantized first and re-quantized) is not the FP8 e4m3 block-128 format the other two arms run. Agreement numbers against LLAMA therefore mix engine and quantization effects. If the converter refuses the FP8 checkpoint, LLAMA is NOT_RUN with the converter error quoted; no GGUF from other weights (e.g. a third-party GGUF) is substituted. - Text only. Vision tower and MTP heads are not used by any arm (no speculative decoding anywhere). ## 3. API and request shape (identical for all arms) `POST /v1/chat/completions`, one user message, `stream: true`, `stream_options.include_usage: true`, `temperature: 0`, `top_p: 1`, `seed: 0`, `chat_template_kwargs.enable_thinking: false` (OURS also runs `--thinking off`). The client is `bench/bench.py` (Python 3 stdlib, `http.client`, one thread per stream, a barrier releases concurrent streams together). One JSON row per request is written to `results/raw/`. Timestamps (client `time.monotonic()`): `t_send` before the request is written; `t_first` at the first SSE chunk carrying non-empty `content` or `reasoning_content`; `t_last` at the last such chunk. Token counts come from the server's `usage` (prompt_tokens, completion_tokens). If an arm reports no usage, the count is re-derived by tokenizing the returned text with the checkpoint's `tokenizer.json` and the row is labeled `count=retokenized`. ## 4. Prompts (`prompts/`, generated by `bench/make_prompts.py`, committed before runs) - `decode.jsonl`: 16 distinct short instructions asking for long prose (≈30-60 prompt tokens). - `prefill.jsonl`: three documents of deterministic synthetic prose (seeded generator) plus one closing question, calibrated with the checkpoint tokenizer so that the chat-rendered prompt is ≈256, ≈2048, ≈8192 tokens. Actual `prompt_tokens` are reported per arm. - Agreement reuses `decode.jsonl` (all 16). ## 5. Metrics ID Metric Cell Definition M1 TTFT decode c=1 `t_first - t_send`, short prompt M2 decode tok/s, 1 stream decode c=1, max_tokens 256 `(completion_tokens - 1) / (t_last - t_first)` 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 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) 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) 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 A nonce line (`Request id . Ignore this line.`) is prepended to every prefill prompt so that no arm's prefix cache can hit. Decode prompts carry no nonce (they are short; prefix caching of 40 tokens does not change decode rate; TTFT on a repeated short prompt is labeled as such in M1). Concurrency is what the arm is configured for as deployed: OURS runs the live `--batch-slots 8`. At c=16, OURS refuses requests beyond 8 with HTTP 503 `server_busy` ("retry shortly"); the client retries those every 50 ms with the clock running from the first send (amendment A1), and the retry count is stored per row. That is part of the end-to-end result and is stated beside it. ## 6. Arm configuration - OURS: cwd `~/.local/state/aien-q36/bin-19173f9e`; `./aien-serve-http --engine omega --model-dir ~/models/qwen3.6-35b-a3b-fp8-`95a723d0` --port 18190 --max-context 49152 --max-tokens-cap 16384 --thinking off --batch-slots 8`; env `AIEN_Q36_STROKE=1 Q36_BATCH_BIN=bin-`19173f9e` AIEN_SERVE_GPU_LOCK=/tmp/aien-serve-18190.lock AIEN_GB10_LOCK_HELD=1`(the harness holds`/tmp/aien-gb10.lock` for the whole session). Identical to the 2026-10-27T01:11:57Z live snapshot except port and lock path. - VLLM: `docker run --rm --runtime nvidia --gpus all --ipc host --network host --cpuset-cpus -v :/model:ro image@digest vllm serve /model --served-model-name q36 --host 127.0.0.1 --port 18191 --max-model-len 49152 --max-num-seqs 32 (A3; was 16) --gpu-memory-utilization --language-model-only`. Everything else default (CUDA graphs, prefix cache, chunked prefill as the image ships them). `` is the smallest of 0.50/0.60/0.70 that starts; the value used is recorded. - LLAMA: `llama-server -m q36-q8_0.gguf --host 127.0.0.1 --port 18192 -ngl 999 -fa on -c 393216 -np 32 --jinja`(A3; was`-c 196608 -np 16`: 12288 tokens per slot either way). Everything else default. - Ports 18190-18193 only. Port 18091 is never touched. - CPU pinning (A2): cpus 5-9 and 15-19 are Cortex-X925 (`/proc/cpuinfo` CPU part 0xd85), cpus 0-4 and 10-14 are Cortex-A725 (0xd87). Every server arm gets the identical X925 set `5-9,15-17,19` (core 18 excluded: the nvidia-modeset kthread sits there). OURS and llama-server via `taskset -c`, VLLM via `--cpuset-cpus`. `bench.py` runs on A725 cores `12-13`. Both lists are stored in every row (`server_cpus`, `client_cpus`). VLLM uses host networking so no docker-proxy sits in the path. - LLAMA16 (A2, optional BF16 reference arm): same llama-server and flags as LLAMA on port 18193, with `q36-35b-a3b-bf16.gguf` (converted from the same checkpoint with `--outtype bf16`, i.e. the FP8 weights dequantized to BF16) and `--no-mmap` (a 70 GB file mapped beside 70 GB of device buffers would not fit in 121 GiB of unified memory). ## 7. Schedule, repetitions, statistics - Two rounds, interleaved by arm: R1 = OURS, VLLM, LLAMA; R2 = LLAMA, VLLM, OURS. Then, only if the night's quiet window still has room, LLAMA16 R1 and R2 (A2). - One model in memory at a time. Between arms: server stopped, process gone, `nvidia-smi --query-compute-apps` empty, MemAvailable back to within 2 GiB of the pre-launch baseline. - Per arm session, cells in this order, each with 2 warmup batches then 3 measured batches: decode c=1, c=4, c=8, c=16; prefill 256, 2k, 8k. Then the agreement cell (16 prompts, once each, no warmup). So each timing cell has 6 measured batches per arm across R1+R2. - Reported per cell: median and IQR over the measured values (6 batch values for aggregate metrics; all per-stream values for per-stream metrics, count stated). Computed with Wolfram Language `Median` and `InterquartileRange` (Wolfram's default quartile definition); the query and result are kept in `results/wolfram/`. If the Wolfram MCP is not mounted, only exact counts and the raw rows are published and the table says so. - No significance tests. A difference is called a win/loss only when the IQRs do not overlap; otherwise "overlapping". ## 8. Load and GPU-lock gates - (A2) A session starts only when, over a 60 s window, no process outside the harness used more than 20% of one CPU and `load1 < 6` (`bench/quiet.py`). Not gated, but recorded in every check: the nvidia-modeset kthread and the `omp` agent-harness process that hosts this lane (it averages ~38% of one core while other agents run; gating on it would never start). Before every cell the same foreign-process check runs over 10 s with no load threshold (the arm's own server is excluded). Every check is stored in `results/logs/-/quiet.jsonl`; `vmstat -t 1` and `load1` (per row) are recorded for every session. A cell that ran after the gate timed out (50 min into the session) is labeled LOADED and excluded from the headline table. - (A2) The nvidia-modeset kthread (pid 1671, affinity 0-19, not pinned) has its `psr` (field 39 of `/proc/1671/stat`) sampled every 1 s in `mem.tsv` (5th column) and logged at session start and end. A cell during which any sample shows it on a server core is VOID: its id goes to `results/voids.jsonl`, its rows stay in the raw file but are dropped by `extract.py`, and the cell is re-run (at most 3 tries). The void count is reported. - GPU: each arm session runs inside `flock -w 900 /tmp/aien-gb10.lock`, at most 60 minutes, with BOARD lines at START, T-5 (55 min) and END. The harness kills its own server at 60 min. No module reloads, no reboots, `/dev/nvidia-modeset` is never opened by the harness. - An arm that cannot start (unsupported model, OOM, converter refusal) is recorded NOT_RUN with the exact error and log; it is not retried with different weights. ## 9. Publication Everything is published even if OURS loses: `results/RESULTS.md` (table), `results/raw/*.jsonl` (every request row incl. warmups), `results/logs/` (server stdout/stderr, memory samples, BOARD lines, versions), `bench/` (exact commands). Evidence label of every number: MEASURED, end to end, on this one Spark, on the stated date and load. ## 10. Amendments - A1 (2026-10-27, before any timed run, found with OURS `--engine stub` on port 18199, no GPU): OURS answers HTTP 503 `server_busy` when every generation slot is taken instead of queueing. `bench.py` now retries 429/503 every 50 ms (bounded by the 1800 s request timeout), keeps `t_send` at the first attempt, and records `busy_retries`. Section 5 updated. Server launches read `/dev/null` as stdin (OURS exits silently when started in the background without it). - A2 (2026-10-27, before any timed run, Main's decision): `load1 < 4` is unreachable on this host (the nvidia-modeset kthread holds one core permanently; other lanes' short bursts dominate load1 while the CPU is ~68% idle). The gate is replaced by the 20%-CPU foreign-process check plus `load1 < 6` (section 8), servers and client are pinned to fixed cores (section 6), VLLM uses host networking, and vmstat is logged per session. Other lanes are in a declared quiet window (no local builds or tests). Additionally (Main, same day): (a) The core sets of section 6: identical Cortex-X925 server set minus core 18 for every arm, client on Cortex-A725, core lists in every row. The split is recorded in `results/env/cpu.txt` from sysfs `cpu_capacity` (X925 997-1024, A725 718-731) and `/proc/cpuinfo` CPU part. Rule: P cores are those with `cpu_capacity >= 990`; minus core 18 that is `5-9,15-17,19` (9 cores). (b) The kthread `psr` sampling and void/re-run rule of section 8. (c) Environment fact: nobody renices or pins the nvidia-modeset kthread during the study, so the machine state is the same for every arm. (d) Optional reference arm LLAMA16 (section 6). Cost: two more sessions of at most 60 min each, during which the quiet window keeps blocking other lanes; they run last and are dropped (listed as a follow-up, NOT_RUN) if the window closes first. If it runs, M6 also reports each arm's agreement against LLAMA16, named as **llama.cpp b11913 with BF16 weights dequantized from the FP8 checkpoint**. It is a reference engine, not ground truth: no arm runs the model unquantized, and the checkpoint itself is FP8. Pairwise agreement between OURS, VLLM and LLAMA is labeled as mixing engine and quantization effects. - A3 (2026-10-27, before any timed run; Main, after a second outside audit Drake adopted): (a) More arms. SGLANG: the official SGLang server, run like VLLM (container, host network, same X925 core set, port 18194, `--context-length 49152 --max-running-requests 32 --mem-fraction-static 0.50`, raised 0.60/0.70 like VLLM if it does not start), only if an image with an arm64 manifest that runs on sm_121 exists; the exact image digest is recorded in `bench/arms.conf`. 4-bit arms, one per engine, each labeled **different numeric format from the FP8 checkpoint OURS runs**: VLLM4 / SGLANG4 on a published NVFP4 checkpoint of the same model (repo id and revision recorded), LLAMA4 on an MXFP4 (else Q4_K_M) GGUF produced with `llama-quantize` b11913 from the BF16 GGUF of A2. An arm whose image or weights are not available is NOT_RUN with the reason; nothing third-party is substituted silently. (b) Grid, added to every session after the existing cells: N = 1, 8, 32 concurrent streams × prompts `p512` (502 chat tokens, added to `prefill.jsonl`; the other prompts are byte-identical) and `p8k` (8184), 256 new tokens, nonce prefix per stream, 1 warmup + 3 measured runs. Reported: TTFT; TPOT = `(t_last - t_first) / (completion_tokens - 1)` per stream, p50 and p99 over all measured streams of a cell (Wolfram `Quantile`, count stated; the client records first/last token times, not every token, so p99 is over streams, not tokens); aggregate tok/s as M3; peak memory as M5. To serve N = 32, VLLM runs `--max-num-seqs 32` and llama-server `-np 32 -c 393216` (still 12288 tokens per slot); OURS stays at its deployed `--batch-slots 8` with the A1 retry. (c) Order and cost. The 8-bit arm of every engine runs first, interleaved (R1 forward, R2 reversed); then LLAMA16 (A2), then the 4-bit arms, queued in `bench/schedule.txt`. Each session is at most 60 min of GPU lock with the quiet window blocking other lanes: SGLANG +2 sessions; VLLM4 +2; SGLANG4 +2; LLAMA4 +2, plus about 15 min of CPU quantization before them (no GPU). The grid cells are last in each session, so a session that reaches 60 min loses grid cells first; missing cells are listed as NOT_RUN (timeout). Arms that do not fit tonight's window stay queued and are reported as follow-up, NOT_RUN. (d) Published Spark figures for this model from other parties are quoted in the README as context only, with their source and numeric format. The only claims are same-box results from this protocol. (e) GPU-lock priority (Main, 2026-10-27): after HeadToHead's FP8 sessions, OmegaVfio and the C1 lanes take the lock before any queued A2/A3 arm. - **A4 (2026-10-27, HeadToHead after restart; written before any OURS/LLAMA cell and before any VLLM number was read):** (a) In-cell foreign-process check. During every timed cell `bench/coremon.py` (pinned to A725 core 11) samples the server cores every second; a process outside the session's trees with more than 20% of one server core over the cell voids it, like the kthread rule of section 8. Only a coremon summary that names offenders voids a cell. A monitor that wrote no summary makes that cell's foreign check NOT_RUN (logged in `session.log`), not a void. (b) Harness defects found, with their effect. OURS R1 attempt 1 (02:09:51Z) never started a server: `run_arm.sh` ran `env VARS... exec taskset ...`, and `exec` is a shell builtin (`env: 'exec': No such file or directory`). No GPU work, no rows; log kept in `results/logs/attempts/OURS-R1-a1-launch-bug/`. Fixed to `exec env VARS... taskset ...` and OURS R1 re-runs after VLLM R1 (the only change in session order). The VLLM R1 session ran from a snapshot in which `MON_CPU` was unset: `taskset -c python3 coremon.py` failed with exit 1, so every VLLM R1 try was written to `voids.jsonl` with an empty foreign-process reason. Those records are not voids under (a); `extract.py` honours a void record only when its reason names the kthread or a non-empty offender list. The session was not killed (rule: a running session is never disturbed); its foreign check is NOT_RUN for every cell, and that is stated in RESULTS. (c) One try per cell. When re-runs leave several non-void tries of one cell, only the lowest numbered non-void try is used; the others stay in the raw file. (d) Order and lock priority (A3(e)). The FP8 sessions OURS, VLLM, LLAMA x R1, R2 run; LLAMA16 (A2) and the A3 arms are not started tonight. They are reported NOT_RUN (deferred: GPU-lock priority for OmegaVfio W0 and C1 per A3(e)), with the BF16 GGUF kept for a later window. (e) Server core set per session. At 02:17Z, 6.5 min into VLLM R1, the nvidia-modeset kthread moved from core 18 to server core 17 and stayed there, so the A2 rule voided every try of VLLM R1's cells (`mem.tsv` column 5). From OURS R1 on, each session takes the 10 X925 cores minus the one the kthread is on when the session takes the GPU lock (core 18 if it is on an A725 core): always 9 X925 cores, the set logged in `session.log` and stored in every row. The kthread is still never pinned or reniced (A2(c)); the A2 void rule is unchanged. (f) Session re-run. A session in which any cell ended void after its 3 tries is re-run once in full after the other FP8 sessions; the re-run replaces it, and the first stays under `results/logs/attempts/` and `results/raw/attempts/`. - A5 (2026-10-27 ~02:48Z, HeadToHead after the second restart; before any OURS/LLAMA cell): (a) Accidental stop. At about 02:45Z Main relayed a STOP-all order that was a misread of Drake's instruction (Drake afterwards: "I didn't mean to stop everything. Just keep them going."). The driver was killed and the `h2h-vllm` container stopped with `docker stop` during VLLM R1's grid cell `p8k-n1` (last memory sample 02:45:55Z; the server log shows the shutdown with 7 requests running). No other session was running; OURS R1 had not started. (b) Effect. None on any result: VLLM R1 attempt 1 was already void in every cell under A4(e) (kthread on server cores 17, then 16) and had been scheduled for a full re-run under A4(f). Its raw file, logs and void records move to `results/raw/attempts/VLLM-R1-a1.jsonl`, `results/raw/attempts/VLLM-R1-a1-voids.jsonl` and `results/logs/attempts/VLLM-R1-a1-kthread-void-stopped/`; none of its numbers is reported. (c) Order. `bench/schedule.txt` now reads OURS R1, LLAMA R1, LLAMA R2, VLLM R2, OURS R2, VLLM R1 (the re-run last, per A4(f)). Apart from (d), nothing changes: same cells, server core rule and void rules. (d) Quiet window and client cores. Other lanes resumed after the stop; their builds run on A725 cores 10-14 only (Main's rule), which held the client (12-13) and coremon (11). From OURS R1 on, the client runs on A725 cores 0-1 and coremon on A725 core 2 (`run_arm.sh`), so builds never share a core with the measurement side; every row still records its core lists. The A2 gate and the A4(a) in-cell foreign-process check on the server cores are unchanged. (e) GPU-lock wait. Other lanes take `/tmp/aien-gb10.lock` between sessions. A session whose `flock -w 900` times out never took the GPU and ran no cell; `run_all.sh` now moves its pre-lock logs to `results/logs/attempts/--lockwait-