Repository navigation
atom: prefill one queued request during B1 remote-only decode (#253) - #285
Merged
Merged
Conversation
AtomBatcher(remote_prefetch=True) / serve_batched.py --pd-prefetch-next: with a single decode lane and remote-only PD, submit the next queued prompt to the producer while the current request decodes, so its KV is ready when the lane frees. One prefetch at a time; the source slot stays reserved until the owner has imported the KV (also after cancel or producer error). Off by default; rejected unless single-lane, remote-only, with a prefill worker. With a prefix cache the prefetched prompt is re-sent in full and overwrites the restored prefix (correct, but forfeits cache savings). From #255 (3e16c33), code and tests only. Refs #253 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 30, 2026
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
With B1 ATOM remote-only PD,
AtomBatcher._pd_stepsubmits a prompt to the prefill producer only once the single decode lane is free. Prefill of the next request and decode of the current one are serialized, so the producer sits idle during decode (#253).Changes
From #255 (branch
perf/253-atom-prefetch, commit 3e16c33), code and tests only. The diff was limited to these paths and applied cleanly onto currentoptimus-rm:opt_prime/opt_prime/accel/platforms/atom/batching.py:AtomBatcher(..., remote_prefetch=False)._prefetch_next()submits the next queued prompt (send_from=0, source slot 0) while the current request decodes.idlestays false while a prefetch is held, so an orphaned producer is still drained.ValueErrorunless lanes == 1, aprefill_workeris set, andlocal_prefill=False.opt_prime/examples/pd/serve_batched.py:--pd-prefetch-next.build()rejects it before model loading unless--backend atom --slots 1 --pd-remote-onlyand a PD prefill worker are set.opt_prime/tests/test_atom_batching.py:test_b1_prefetch_overlaps_decode_and_holds_source_until_import, parametrized over {success, cancel, error} x {cache off, on}.opt_prime/tests/test_serving_prefill_cache.py:test_next_prefill_rejects_unsupported_route_before_load(4 unsupported routes).Not taken:
examples/pd/http_matrix/*(the pipeline script,evidence253/, experiment record,STATUS.md,.research/) and the four exp commits.Verification
cd opt_prime && TORCH_DEVICE_BACKEND_AUTOLOAD=0 PYTHONPATH=$PWD python3 -m pytest -q tests/test_atom_batching.py tests/test_serving_prefill_cache.py: 35 passed.-k "prefetch or next_prefill") run against theoptimus-rmversions ofbatching.py/serve_batched.pygive 10 failed. With this change, all pass.Compatibility and limits
remote_prefetch=True/--pd-prefetch-nextis set.Related Issue
Refs #253
Supersedes #255
🤖 Generated with Claude Code