Skip to content

One harness for furiosa-llm and rngd-pd on one RNGD card (#14 phase 1) - #18

Merged
gspark-etri merged 1 commit into
mainfrom
feat/14-one-harness
Oct 22, 2026
Merged

gspark-etri merged 1 commit into
mainfrom
feat/14-one-harness

Conversation

@gspark-etri

@gspark-etri gspark-etri commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Background

#14 compares rngd-pd's own engine with furiosa-llm serve on one RNGD card (Llama-3.1-8B). The earlier numbers came from two different harnesses: bench/sweep_vendor.jsonl from vendor_sweep.py, and bench/rpt_sweep_S512.jsonl through 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.py is now an engine-neutral client for any OpenAI-style /v1/completions server:
    • Prompts are exactly P token IDs, sent as a token-ID list, so both servers see identical input. Each prompt starts with BOS and eight fresh random tokens, so no prefix cache applies.
    • Grid: P ∈ {128, 512, 1024, 2048} × concurrency ∈ {1, 2, 4, 8, 16}. Each point runs 2 bursts of concurrency simultaneous requests, after one untimed warm-up per P.
    • Generation is greedy with ignore_eos and exactly max_tokens (64) tokens.
    • TTFT is measured from send to the first streamed token. TPOT is (last − first) / (n − 1) per request. tok/s is generated tokens / burst wall time. The harness also reports p50/p90, ITL p99, errors, and furiosa-smi power and utilisation for the card in use.
    • --greedy N records outputs for fixed prompts, for the token-equality check in phase 3.
  • serving/cluster.py: the one-card worker (--role solo) serves POST /v1/completions itself, 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.yaml run one engine and the sweep in a Job:
    • The Job requests furiosa.ai/rngd: 1 and sets a deadline and a TTL.
    • It runs privileged because furiosa-torch cannot open the card otherwise. The allocated card comes from the kubelet checkpoint (rngd_pd.devices).
    • Outputs go to ~/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.py prints the gap table from two runs.
  • Data: 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 through vendor_sweep.stream_once. They check one chunk per token, text and token-ID prompts, the 400 response, and concurrent streams.
  • On npu-node-1, 2026-10-22. Each run was a Job in namespace rngd-perf with one card, deleted after it finished.
    • furiosa-llm: 2026.3.0 with the llama8b-pfbatch artifact (the one behind sweep_vendor.jsonl). furiosa-llm 2026.4's CLI accepts only a native .fxb, and no 8B .fxb with comparable buckets exists on the node.
    • rngd-pd: solo worker, B=16 continuous, furiosa-torch 2026.2.0, prefill buckets 128…C. A worker has one context length S. S was chosen per P the way furiosa-llm picks its decode bucket: S=1024 for P ≤ 512, 2048 for P = 1024, 4096 for P = 2048. The decode layer group was 8 at S=1024 and 4 at S=2048/4096: group 8 at S ≥ 2048 (and at S=1152/2176) fails to compile with memory explosion (UnsupportedOpError). New graphs were baked on the host without a card.
P conc TTFT ms furiosa-llm / rngd-pd x TPOT ms x tok/s x
128 1 26.3 / 102.5 3.90 17.41 / 70.89 4.07 56.9 / 14.0 0.25
128 4 78.6 / 609.5 7.75 18.65 / 74.39 3.99 203.8 / 44.1 0.22
128 16 155.4 / 3197.2 20.6 21.73 / 82.99 3.82 651.4 / 92.4 0.14
512 1 51.6 / 134.9 2.61 17.71 / 70.77 4.00 54.8 / 13.9 0.25
512 16 453.9 / 3708.6 8.17 26.54 / 87.82 3.31 460.3 / 87.2 0.19
1024 1 98.5 / 177.6 1.80 17.89 / 102.59 5.73 52.2 / 9.6 0.18
1024 16 911.8 / 3665.6 4.02 32.90 / 85.21 2.59 321.7 / 87.3 0.27
2048 1 208.1 / 407.6 1.96 18.09 / 81.93 4.53 47.4 / 11.5 0.24
2048 16 1858.5 / 6444.9 3.47 45.21 / 129.13 2.86 201.2 / 57.9 0.29

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.

  • To reproduce: bake the graphs (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 with ENGINE, S, C, RNGD_BUCKETS, CONTEXTS and DECODE_GROUP set.

Compatibility and limits

  • vendor_sweep.py changes defaults: max_tokens 64 (was 16) and --out is 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 with bench/sweep_vendor.jsonl.
  • The solo endpoint is greedy only, has no stop condition (finish_reason is always length) and needs prompt + max_tokens ≤ S. It refuses anything else with a 400.
  • The Job is privileged and mounts the kubelet device-plugin checkpoint read-only. It uses only the card allocated to it.
  • CI (ci.yml, CI: run the NPU-free tests on every PR #20): this PR adds tests/test_continuous_backlog.py and tests/test_solo_openai.py to the NPU-free set. The tests check passed on the rebased branch (51 passed).

Related Issue

Part of #14 (phase 1).

🤖 Generated with Claude Code

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>
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
gspark-etri merged commit 14df3f4 into main Oct 22, 2026
1 check passed
@gspark-etri
gspark-etri deleted the feat/14-one-harness branch October 22, 2026 11:59
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant