Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8903b73
fix: import dense KV into hybrid GPU cache groups (#258)
gspark-etri Oct 23, 2026
42f59c3
feat: validate layer progress and reserve partial hybrid KV imports (…
gspark-etri Oct 23, 2026
8e0d271
feat: receive layer progress and import partial GPU cache safely
gspark-etri Oct 23, 2026
952f491
feat: connect source KV progress and opt-in serving flag
gspark-etri Oct 23, 2026
171e8c4
feat: stream validated four-model RNGD factories to GPU
gspark-etri Oct 23, 2026
b28408d
test: measure four-model long-context layer streaming
gspark-etri Oct 23, 2026
2e69570
feat: prefill one queued request during B1 ATOM decode (#253)
gspark-etri Oct 23, 2026
33d6cb0
feat: import streamed RNGD KV through ATOM owner (#265)
gspark-etri Oct 23, 2026
04b6abb
test: verify four-model streaming GPU fault isolation (#265)
gspark-etri Oct 23, 2026
69180aa
test: cover partial prefetch faults and Qwen4 ATOM timing (#265)
gspark-etri Oct 23, 2026
562b1c4
test: separate notification timing from KV path gains (#265)
gspark-etri Oct 23, 2026
e8345ca
test: verify four-model long-context ATOM streaming (#265)
gspark-etri Oct 23, 2026
5978c35
test: verify four-model c4 long-output streaming (#265)
gspark-etri Oct 23, 2026
b59e7fc
test: record four-model ATOM streaming fault isolation
gspark-etri Oct 24, 2026
515a404
test: validate four-model streaming with sixteen queued requests
gspark-etri Oct 24, 2026
501718a
docs: record Qwen HTTP c16 streaming comparisons
gspark-etri Oct 24, 2026
f3232ae
docs: record Gemma HTTP streaming and EOS comparisons
gspark-etri Oct 24, 2026
897373c
docs: complete four-model GPU HTTP streaming evidence
gspark-etri Oct 24, 2026
7646a31
docs: record ATOM streaming gains and retained KONI timeout
gspark-etri Oct 24, 2026
f1d9117
docs: retain KONI timeout and record long-wait native result
gspark-etri Oct 24, 2026
cb25ff6
docs: record KONI whole KV HTTP results and parity limits
gspark-etri Oct 24, 2026
eaf7daa
docs: complete KONI streaming HTTP evidence
gspark-etri Oct 24, 2026
03054a1
docs: fill four-model native GPU intermediate-length coverage
gspark-etri Oct 24, 2026
a06a36f
docs: qualify native GPU matrix with default HTTP module
gspark-etri Oct 24, 2026
a3497e5
docs: record four-model default HTTP PD intermediate coverage
gspark-etri Oct 24, 2026
162c2f6
fix: distinguish request and aggregate output lengths in serving evid…
gspark-etri Oct 30, 2026
ef8cc09
docs: verify final ATOM intermediate and GPU long-context serving con…
gspark-etri Oct 30, 2026
8f9f2a0
docs: verify four-model RNGD-to-GPU short and long HTTP controls
gspark-etri Oct 30, 2026
f52c413
docs: verify four-model ATOM short and long serving controls
gspark-etri Oct 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions opt_prime/examples/pd/STREAMING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Experimental RNGD layer streaming

`serve_batched.py --pd-prefill-stream-layers` enables validated partial KV reception
with a Torch or ATOM decoder. The subprocess must advertise progress support.
ATOM imports only into a reserved lane. B1 next-request prefetch may compute ahead,
but its partial data waits until the current decode releases the destination.
Multi-lane hybrid caches defer layer imports until final decode admission because
idle lanes may still write their local cache. SDK write failures poison the owner;
invalid source geometry fails only the request. Incomplete prompts never enter
the reusable prefix index.

## Code review map

This path uses same-host shared memory for KV payloads and subprocess pipe messages
for progress descriptors. The measured producer is the research factory engine
listed below. It uses the existing vendor SDK; this change does not expose the
closed native furiosa-llm engine's KV protocol or establish cross-host streaming.

| Responsibility | Code | Review invariant |
|---|---|---|
| Source export | [prefill_server.py](../../opt_prime/accel/pd/prefill_server.py), [factories](streaming_factories.py) | Copy each layer/group to SHM before notification; preserve layer arithmetic and head. |
| Transport and coverage | [pd_batching.py](../../opt_prime/accel/pd/pd_batching.py), [layer_progress.py](../../opt_prime/accel/pd/layer_progress.py) | Validate request IDs, nonoverlapping spans and complete coverage; serial writers keep published storage stable. |
| Torch destination | [paged.py](../../opt_prime/accel/pd/paged.py), [PDBatcher](../../opt_prime/accel/pd/pd_batching.py) | Map dense layers to cache groups, fence destination copies before page reuse, admit only complete KV. |
| ATOM destination | [batching.py](../../opt_prime/accel/platforms/atom/batching.py) | Reserve the lane before import; protect active B1/hybrid caches; never publish an incomplete prefix. |
| Serving switch | [serve_batched.py](serve_batched.py) | Explicit opt-in and a compatible subprocess producer; whole transfer remains the default. |

Per-layer source export is separate from destination notification timing. The
three-mode GPU control retains per-layer source/SHM work while delaying progress
notifications until source logits return. Much of the measured Qwen/KONI gain
persists under that control; early notification adds a smaller benefit in the
recorded workload. The control also retains per-layer destination import and
allows cross-request overlap, so it cannot assign the remaining gain to source
assembly alone. See the [control summary](http_matrix/evidence265/stream265-control-summary.json)
and experiment record for samples and limits.

The three factories in `streaming_factories.py` cover the four measured models:

| Factory | Model | Existing producer |
|---|---|---|
| `streaming_factories:qwen` | Qwen3-0.6B, Qwen3-4B | `long_width_variant.make_prefill` |
| `streaming_factories:gemma` | Gemma3-1B | `gemma_prefill.Prefill` |
| `streaming_factories:koni` | KONI-Llama3.1-8B | `koni_prefill.Prefill` |

Set the producer's `PYTHONPATH` to include this package, `examples/pd`, and the
existing `serving_matrix` and `qwen3_rngd` example directories from aicomp commit
`04dab7cb6961103f9404c99e9fcbcaadac14b098`, plus the compatible `rngd_pd` package.
These are explicit research dependencies; the adapters do not bundle the compiler
or model implementations. Exact measured source hashes are in evidence265.

The producer arguments are:

```text
--engine factory --engine-factory streaming_factories:qwen --width 128 --chip 0
```

Pass those through `--pd-prefill-args`, choose the corresponding factory, and use
`--pd-prefill-python` for the isolated Furiosa interpreter/registration wrapper.
Use local safetensors model checkpoints. Factory width is one compiled width and
must fit `--max-context`; the model-specific constructor also checks supported
widths and geometry. KONI's validated partitioned producer requires width512 or
larger in multiples of512.

Keep the same factory and omit only `--pd-prefill-stream-layers` for the whole-KV
control. That path calls the original producer's `prefill` method. Streaming
preserves its layer arithmetic and final head but exports each finished layer or
group before the next one runs. Published spans are copied to shared memory before
notification and must remain immutable until the serial producer finishes the
request. Decoder cache lengths and reusable prefix state are published only after
all requested suffix spans arrive and destination copies complete.

This is blocking per-group CPU export followed by incremental decoder import.
It can allow decoder import during later source computation, but does not imply
asynchronous RNGD download, device DMA overlap, or a serving speedup. Hardware
source parity has been checked at widths128/512 and8192. Recorded GPU timing
improvements apply only to the measured c2/fixed32, c4/fixed128 and c16/fixed128 workloads (c16 queues behind four execution slots). Four-model ATOM timing
and same-route parity are also verified for B1/two queued2K/8K prompts, fixed32
outputs, and prefetch off/on. Actual ATOM streaming faults pass all four models: cancellation/reuse after partial import, source death before admission, and prefetched source death preserving an active512-token decode. The retained16/512-token arrays match same-route references; see `http_matrix/experiments/2026-10-24-stream265-atom-faults.md`.
Notification-timing controls show that total improvement is not solely the effect
of early notification; source/host path changes and cross-request overlap remain. None establishes cross-backend
numerical equivalence. See the experiment record for exact cases,
failed attempts and the current verification scope.
Loading