Commit c774295
PR-E1b (ADR 0008 \u00a76.5): gRPC long-session bench + server CLI
PR-E1's deferred sibling, per the scope split documented in PR-E1's
description. Ships everything needed to validate the two ADR 0008
\u00a77 GA gates the deprecated HTTP shim's bench cannot answer:
* memory bounded: agg.kv_bounded
* prefill bounded: agg.prefill_bounded
The HTTP shim's bench_long_session.py fails on prefill-bounded by
architecture (every /v1/chat/completions request re-prefills the
full conversation history). The session-bound gRPC contract makes
prefill cost depend only on the size of each new user message,
regardless of how long the conversation is. PR-E1b measures this
empirically.
What ships
----------
inference_engine/bench/ (new package)
__init__.py
session_long_run.py [56 stmts, 100% covered]
Pure-Python aggregation helpers split out of the CLI script so
they can be unit-tested under the Linux 100% coverage gate.
Exposes:
_percentile linear-interpolated, no numpy dep
_kv_bounded tolerance band on KV-bytes series
_prefill_bounded tail-vs-head p50 latency drift gate
_latency_drift_p50_s drift in seconds
_bucketize_10min 10-minute bucket breakdown for long runs
aggregate_run the full report builder
scripts/start_grpc_runtime_server.py (new, CLI)
Boots a real Qwen3 verifier (CPU or MLX), wires it through
SessionStore + AppendTokensCoordinator + GenerationCoordinator,
serves the v0.3 gRPC RuntimeService. Pulls slab dims (num_layers,
num_kv_heads, head_dim) from the verifier's HF config so
GetSessionInfo.kv_live_bytes reports physically meaningful bytes.
Symmetric to scripts/serve.py for the deprecated HTTP shim. CLI
plumbing exempt from coverage by the same convention.
scripts/bench_agentic/bench_session_long_run.py (new, CLI)
Walks ONE gRPC session through many turns, recording per-turn
latency and session.info().kv_live_bytes. Tokenizes ONLY the
new user message per turn (the whole point of session-bound
runtime: prefill cost is O(new_user_message), not O(history)).
Writes JSON via atomic os.replace + 10-min partial checkpoints
so a host reboot mid-run doesn't lose evidence.
tests/inference_engine/bench/test_session_long_run.py (new, 35 tests)
Covers the aggregator to 100%: _percentile (5 tests), _kv_bounded
(5), _prefill_bounded (5), _latency_drift_p50_s (3), _bucketize_10min
(6), aggregate_run (7) including empty / all-error / mixed /
bounded / unbounded / custom-threshold paths.
scripts/review_pr_e1b_on_mac.sh (new, executable)
Default invocation: 30-min smoke. Boots the gRPC server in the
background, runs the bench against it, kills the server, prints
the headline KPIs. Two helper subcommands print the bare server
and 4-hour bench commands for separate-terminal manual runs:
bash scripts/review_pr_e1b_on_mac.sh --print-server-cmd
bash scripts/review_pr_e1b_on_mac.sh --print-4h-cmd
CI wiring
---------
.github/workflows/ci.yaml
+ tests/inference_engine/bench/ in the Linux pytest gate
+ --cov=inference_engine.bench in the coverage gate
Local verification (Linux VM, py3.12)
-------------------------------------
Linux CI gate (extended path set + new bench tests):
730 passed, 100% coverage on 1750 stmts (was 682 / 1660 stmts).
+35 new tests under tests/inference_engine/bench/.
CLI scripts:
py_compile passes on both new scripts. Runtime validation
happens on Mac M4 via review_pr_e1b_on_mac.sh.
Per ADR 0008 \u00a79
----------------
This PR ships CLI plumbing + a pure-Python aggregator. The
aggregator is fully covered on Linux. The CLI scripts that drive
real model weights are platform-agnostic Python but only validated
end-to-end on Mac M4. Reviewer pushes the 30-min smoke JSON to the
PR branch; the 4-hour evidence run is committed separately when
wall-clock budget allows.
Sequence for the 4-hour evidence run (per user spec, exactly):
1. Start gRPC server (Mac mini local, Qwen3-0.6B):
PYTHONPATH=.:sdks/python python3 \
scripts/start_grpc_runtime_server.py \
--backend cpu --verifier-id Qwen/Qwen3-0.6B \
--bind 127.0.0.1:50051 \
--capacity 1 --sink 4 --window 64
2. Run bench:
PYTHONPATH=.:sdks/python python3 \
scripts/bench_agentic/bench_session_long_run.py \
--grpc-address 127.0.0.1:50051 \
--tokenizer-id Qwen/Qwen3-0.6B \
--duration-s 14400 --turn-spacing-s 30 \
--output results/platform-tests/bench_session_4h_$(date +%s).json
3. Commit JSON to branch.
Stack
-----
PR-E1b is independent of PR-D1 (#49) and PR-E1 (#50) at the file
level. Branched off main directly. Can merge in any order with
the others.
Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>1 parent 0642902 commit c774295
8 files changed
Lines changed: 1266 additions & 0 deletions
File tree
- .github/workflows
- inference_engine/bench
- scripts
- bench_agentic
- tests/inference_engine/bench
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
0 commit comments