Skip to content

Commit 08756df

Browse files
committed
Record warm-load serving impact and complete CI dependencies
1 parent 87120f4 commit 08756df

4 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎.github/workflows/swap.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
with:
1212
python-version: '3.11'
1313
- run: python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
14-
- run: python -m pip install numpy pytest httpx fastapi uvicorn transformers
14+
- run: python -m pip install numpy pytest httpx fastapi uvicorn transformers pyzmq
1515
- name: Run swap and existing serving tests without an NPU SDK
1616
env:
1717
PYTHONPATH: src

‎docs/delta-swap.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ raw decoder runtime; `generate()` drives greedy generation with the matching
9797
batch width. `select()` provides the same queue-depth policy hook as RNGD.
9898

9999
For an independently compiled bundle, register another `AtomBundle` and call
100-
`future = engine.prepare_async(variant, "other")`. Current requests keep running
101-
while one background thread loads it. After `future.result()`,
100+
`future = engine.prepare_async(variant, "other")`. Loading runs in a background
101+
thread without taking the request lock. The vendor runtime can still serialize
102+
native loading and execution; this does not guarantee uninterrupted latency.
103+
After `future.result()`,
102104
`engine.swap(variant, "other", require_ready=True)` selects it without loading
103105
weights on that call. A failed preparation leaves the active bundle usable.
104106
`release("main")` releases an inactive bundle; `allocations()` reports the SDK's

‎src/rngd_pd/swap/atom.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def _load(self, name):
7878
runtimes = {v: model.model[names.index(f"decoder_batch_{v.B}")]
7979
for v in self.bundles[name].variants}
8080
return dict(model=model, runtimes=runtimes,
81-
prepare_s=time.perf_counter() - start)
81+
prepare_s=time.perf_counter() - start,
82+
prepared_at_s=time.perf_counter())
8283

8384
def prepare_async(self, variant, bundle=None):
8485
"""Start a separate bundle's full load; failures stay on the Future.

‎src/rngd_pd/swap/bench_atom.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def main(argv=None):
8787
pending = not future.done()
8888
active = e.active
8989
t_serving = time.perf_counter()
90-
during_tokens = e.generate(_prompts(active.B), a.tokens)
90+
during_tokens, during_ttft = e.generate(_prompts(active.B), a.tokens, timed=True)
9191
serving_s = time.perf_counter() - t_serving
9292
prepared = future.result()
9393
info = e.swap(vs[0], "warm", require_ready=True)
@@ -96,6 +96,9 @@ def main(argv=None):
9696
background_prepare_s=prepared["prepare_s"],
9797
prepare_pending_before_serving=pending,
9898
serving_during_prepare_s=serving_s,
99+
serving_during_prepare_ttft_s=during_ttft,
100+
token_before_prepare_completed=(
101+
t_serving + during_ttft < prepared["prepared_at_s"]),
99102
during_prepare_tokens_equal_fresh=(
100103
during_tokens == result["fresh"][active.name]["tokens"]),
101104
tokens_equal_fresh=tokens == result["fresh_warm"]["tokens"],

0 commit comments

Comments
 (0)