Repository navigation
One harness for furiosa-llm and rngd-pd on one RNGD card (#14 phase 1) - #18
Merged
Merged
Conversation
This was referenced Oct 22, 2026
gspark-etri
added a commit
that referenced
this pull request
Oct 22, 2026
## Background The repository had no CI, so PRs had no checks to wait for and the NPU-free tests ran only by hand (#19). Needed now by #18 and the delta-load PRs for #17. ## Changes - `.github/workflows/ci.yml`: on every pull request and every push to `main`, Ubuntu with Python 3.10, installs `numpy pytest pyzmq` and runs: - `tests/test_devices.py`; - `tests/native_v4`, without `test_serve.py`, which needs the serving stack (httpx, fastapi); - `tests/swap` when it exists (#17). ## Verification - This PR's own `ci / tests` run (see Checks). - The same command locally: 39 passed, 1 skipped (with `tests/swap` from the #17 branch). ## Compatibility and limits - Workflow only, no code change. - Nothing that needs an NPU SDK (furiosa, rebel, vllm) runs here; those tests stay on the NPU node. ## Related Issue Closes #19. Part of #17. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 22, 2026
bench/vendor_sweep.py now drives any OpenAI-style /v1/completions server the same way: exactly-P token-ID prompts with fresh random heads, P x concurrency bursts, ignore_eos, TTFT/TPOT from stream timestamps, tok/s, card power and utilisation from furiosa-smi, and a --greedy mode that records outputs for token-equality checks. The one-card solo worker serves /v1/completions itself, with streaming: the continuous scheduler hands each token to the caller as it is produced. bench/serve_sweep_job.sh and deploy/k8s/serve-sweep-job.yaml run one engine and the sweep in a Job with one card. prebake.py can bake prefill widths card-free (prefill_graph_spec shares the key with the engine). Phase-1 results: bench/harness_furiosa_llm.jsonl and bench/harness_rngd_pd_phase1.jsonl; bench/harness_report.py prints the gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gspark-etri
force-pushed
the
feat/14-one-harness
branch
from
October 22, 2026 11:58
df70e10 to
0159ac8
Compare
gspark-etri
added a commit
that referenced
this pull request
Oct 22, 2026
…14) (#23) ## Background Phase 2 of #14 ([diagnosis comment](#14 (comment))) found the biggest single loss outside the engine. The one-card worker produces a token every 39.8 ms in-process (S=1024, B=16), but the client sees 70.9 ms over HTTP. The SSE handler writes one small chunk per token with Nagle's algorithm on, so each chunk after the first waits for the client's delayed ACK. #18 (the phase-1 harness) is merged; this PR is rebased onto `main`. ## Changes - `serving/cluster.py`: `disable_nagle_algorithm = True` on the worker's HTTP handler (TCP_NODELAY on every accepted connection). - `bench/profile_solo.py`, the phase-2 profiler. It builds the serving `SoloWorker` and times the following with perf_counter (2026.2.0 module calls are synchronous): - prefill: the group calls, the finish, and the lane write; - one decode step: input building and uploads, group calls, lm_head, logits download, and argmax; - the scheduler in-process at 1, 4 and 16 streams. Results are in `bench/profile_solo_*.json`. - `bench/vendor_sweep.py --greedy`: a fixed set of 12 varied prompts, plus N sweep-style prompts per P. `bench/greedy_compare.py` compares two runs token by token. It compares text when the server streams no token IDs, as with furiosa-llm. - Greedy references: `bench/greedy_furiosa_llm.jsonl`, `bench/greedy_rngd_pd_base_S{1024,2048}.jsonl` (rngd-pd before any change). ## Verification On npu-node-1, 2026-10-22: a Job with one card (namespace `rngd-perf`), S=1024, B=16, decode group 8, prefill buckets 128/256/512, the same harness as phase 1. Raw data: `bench/harness_rngd_pd_nodelay_S1024.jsonl`. | P | conc | TPOT ms before → after | tok/s before → after | TTFT ms before → after | furiosa-llm TPOT / tok/s | |--:|--:|--:|--:|--:|--:| | 128 | 1 | 70.9 → **44.8** | 14.0 → **22.3** | 102 → 45 | 17.4 / 56.9 | | 128 | 4 | 74.4 → **45.4** | 44.1 → **72.8** | 610 → 338 | 18.7 / 203.8 | | 128 | 16 | 83.0 → **48.5** | 92.4 → **150.9** | 3197 → 2030 | 21.7 / 651.4 | | 512 | 1 | 70.8 → **42.5** | 13.9 → **23.2** | 135 → 77 | 17.7 / 54.8 | | 512 | 16 | 87.8 → **50.9** | 87.2 → **148.1** | 3709 → 2083 | 26.5 / 460.3 | - The served TPOT now matches the in-process scheduler step (38.7–42.7 ms) to within a few ms. Throughput is up 1.6–1.7× at every point. - Greedy: `python bench/greedy_compare.py bench/greedy_rngd_pd_base_S1024.jsonl bench/greedy_rngd_pd_nodelay_S1024.jsonl` gives **12/12 identical**, token for token. - rngd-pd's agreement with furiosa-llm is unchanged: 10 of 13 by text. The base also diverges late on three prompts, at characters 38, 92 and 258, from bf16 numerics. - Unit tests: `PYTHONPATH=src python -m pytest -q tests/test_solo_openai.py tests/test_continuous_backlog.py tests/test_devices.py` → 18 passed. ## Compatibility and limits - TCP_NODELAY applies to every role served by `cluster.py`'s handler (worker, gateway). Small responses now go out without coalescing. Nothing waits on that coalescing. - The #14 target is still far: the decode step itself (~40 ms against ~17–22 ms) and serialised prefill under load remain. Those are the next PRs. - CI (`tests`) passed on the rebased branch. ## Related Issue Part of #14 (phase 2 diagnosis; phase 3 change 1). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
gspark-etri
added a commit
that referenced
this pull request
Oct 22, 2026
## Background Phase 2 of #14 found that a burst of prompts reaches its first tokens slowly. With one stream decoding, every new prompt is *staged*: four of its 16 layer-group calls run per scheduler iteration, between ~40 ms decode steps. Sixteen prompts at once therefore waited 1.8–2.9 s for a first token, while furiosa-llm takes 155 ms at P=128. Separately, each 16-wide decode step spent 3.4–4.1 ms on the host widening 128256×16 logits to float32 numpy for argmax. #18 and #23 are merged; this PR is rebased onto `main`. ## Changes - `serving/cluster.py`, `_ContinuousScheduler`: - `RNGD_ADMIT=block` admits every waiting prompt back to back before the next decode step, with no staging. The default stays `stage`, so existing deployments do not change behaviour. - Admission now produces, writes and seats one stream at a time. A stream's first token leaves as soon as its own cache is in, and only one stream's cache is in flight instead of all of them. This applies to both policies. - `engines/decode_batch.py`: `greedy_tokens()` uses `torch.argmax` on the bf16 lm_head output. The bf16→float32 widening is exact and both functions return the first maximum, so the token is the same. - `deploy/k8s/serve-sweep-job.yaml`: the benchmark Job sets `RNGD_ADMIT=block`. - `bench/vendor_sweep.py --greedy-together` sends the greedy prompts all at once, to check batch invariance. `serve_sweep_job.sh` passes `GREEDY_TOGETHER`. - `tests/test_admission.py`: a burst is not staged, every stream finishes with its own tokens, and a burst member's first token goes out before the last prefill of the burst ends. ## Verification All runs: npu-node-1, 2026-10-22, a Job with one card, S=1024, B=16, decode group 8, prefill buckets 128/256/512, the phase-1 harness. | P | conc | TTFT ms (#23 → this) | TPOT ms (#23 → this) | tok/s (#23 → this) | furiosa-llm TTFT / TPOT / tok/s | |--:|--:|--:|--:|--:|--:| | 128 | 1 | 44.7 → 43.2 | 44.8 → 42.4 | 22.3 → 23.6 | 26.3 / 17.4 / 56.9 | | 128 | 4 | 338 → **126** | 45.4 → 42.3 | 72.8 → **91.1** | 78.6 / 18.7 / 203.8 | | 128 | 16 | 2030 → **361** | 48.5 → 47.2 | 150.9 → **305.9** | 155.4 / 21.7 / 651.4 | | 512 | 4 | 502 → **220** | 44.5 → 43.1 | 70.5 → **87.0** | 178.9 / 19.3 / 180.6 | | 512 | 16 | 2083 → **634** | 50.9 → 52.1 | 148.1 → **260.5** | 453.9 / 26.5 / 460.3 | Raw data: `bench/harness_rngd_pd_block_S1024.jsonl`. - **Greedy, sequential**: `bench/greedy_compare.py bench/greedy_rngd_pd_nodelay_S1024.jsonl bench/greedy_rngd_pd_block_S1024.jsonl` → **14/14 identical** token for token. That covers 12 varied prompts plus P=128/512, and includes the torch argmax change. - **Greedy, all at once**: rngd-pd → **14/14 identical** to its sequential run (`greedy_rngd_pd_together_S1024.jsonl`), so its 16-wide decode is batch-invariant. For comparison, furiosa-llm changes 4 of its 13 continuations when the same prompts arrive together (`greedy_furiosa_llm_together.jsonl`, all late: characters 38–258). - Unit tests: `PYTHONPATH=src python -m pytest -q tests/test_admission.py tests/test_solo_openai.py tests/test_continuous_backlog.py tests/test_devices.py` → 20 passed. ## Compatibility and limits - `block` trades the TPOT of streams that are already decoding for the burst's TTFT. Running streams pause for the burst's prefills, about 31 ms each at P=128. In this burst benchmark, TPOT p50 did not move. Under steady arrivals, `stage` may be preferable, which is why it stays the default. - TPOT is still ~2.3× furiosa-llm's (~42 ms vs ~17–22). That is the cost of the 16-wide decode graph itself (35–43 ms per step). It is the remaining gap and is discussed on #14: narrower graphs or a cheaper KV path change bf16 rounding. - CI: `tests/test_admission.py` is added to the NPU-free set. The `tests` check passed on the rebased branch (53 passed). ## Related Issue Part of #14 (phase 3, change 2). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
#14 compares rngd-pd's own engine with furiosa-llm
serveon one RNGD card (Llama-3.1-8B). The earlier numbers came from two different harnesses:bench/sweep_vendor.jsonlfromvendor_sweep.py, andbench/rpt_sweep_S512.jsonlthrough the non-streaming gateway. They cannot be compared point for point. This PR is phase 1 of #14: one harness, both engines, the same card type, and the gap table.Changes
bench/vendor_sweep.pyis now an engine-neutral client for any OpenAI-style/v1/completionsserver:concurrencysimultaneous requests, after one untimed warm-up per P.ignore_eosand exactlymax_tokens(64) tokens.--greedy Nrecords outputs for fixed prompts, for the token-equality check in phase 3.serving/cluster.py: the one-card worker (--role solo) servesPOST /v1/completionsitself, with SSE streaming, text or token-ID prompts,stream_options.include_usage, and a 400 for prompts that do not fit. The continuous scheduler hands each token to the caller as it is produced (_emit). Other roles are unchanged.bench/serve_sweep_job.sh+deploy/k8s/serve-sweep-job.yamlrun one engine and the sweep in a Job:furiosa.ai/rngd: 1and sets a deadline and a TTL.rngd_pd.devices).~/rngd-perf-out.engines/prefill_full.py:prefill_graph_spec()(key + build in one place).bench/prebake.py --prefill C[,C]now bakes prefill widths without a card.bench/harness_report.pyprints the gap table from two runs.bench/harness_furiosa_llm.jsonl,bench/harness_rngd_pd_phase1.jsonl.Verification
PYTHONPATH=src python -m pytest -q tests/test_solo_openai.py tests/test_continuous_backlog.py tests/test_devices.py→ 18 passed. CI on the rebased branch: 51 passed (NPU-free set + these two files). The new tests drive the real scheduler and HTTP handler with a fake engine throughvendor_sweep.stream_once. They check one chunk per token, text and token-ID prompts, the 400 response, and concurrent streams.rngd-perfwith one card, deleted after it finished.llama8b-pfbatchartifact (the one behindsweep_vendor.jsonl). furiosa-llm 2026.4's CLI accepts only a native.fxb, and no 8B.fxbwith comparable buckets exists on the node.memory explosion(UnsupportedOpError). New graphs were baked on the host without a card.All 20 points of each engine completed with 0 errors. The full table is printed by
python bench/harness_report.py bench/harness_furiosa_llm.jsonl bench/harness_rngd_pd_phase1.jsonl. rngd-pd misses the #14 target on every point. The largest gap is TPOT, about 4× at every load, so a B=16 step costs ~70 ms where furiosa-llm's costs ~17–22 ms. Phase 2 profiles why.RNGD_MAX_SHAPES=8 python bench/prebake.py --B 16 --S 1024 --group 8,--prefill 1024,2048 --no-decode, and so on), then apply the Job once per engine/S withENGINE,S,C,RNGD_BUCKETS,CONTEXTSandDECODE_GROUPset.Compatibility and limits
vendor_sweep.pychanges defaults:max_tokens64 (was 16) and--outis now required. TPOT is per-request (last − first)/(n − 1) instead of the median gap, and utilisation is the mean instead of the max, so its rows are not directly comparable withbench/sweep_vendor.jsonl.finish_reasonis alwayslength) and needs prompt + max_tokens ≤ S. It refuses anything else with a 400.ci.yml, CI: run the NPU-free tests on every PR #20): this PR addstests/test_continuous_backlog.pyandtests/test_solo_openai.pyto the NPU-free set. Thetestscheck passed on the rebased branch (51 passed).Related Issue
Part of #14 (phase 1).
🤖 Generated with Claude Code