Repository navigation
[Spec] Allow speculative workers to stage prefill shared reads - #38554
Merged
Qiaolin-Yu merged 2 commits intoSep 14, 2026
Merged
Qiaolin-Yu merged 2 commits into
Qiaolin-Yu merged 2 commits into
Conversation
paulzhang-tm
requested review from
Fridge003,
Ying1123,
hnyls2002,
ispobock and
merrymercy
as code owners
September 8, 2026 18:58
Qiaolin-Yu
approved these changes
Sep 10, 2026
4 of 5 tasks
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.
Motivation
Speculative workers with later draft-prefill readers cannot publish the early prefill read-done event, even when those reads can be staged before target replay. Add an optional callback so workers can opt in after staging their shared reads.
Modifications
ModelRunner.prefill_shared_read_stager: Optional[Callable[[ForwardBatch], bool]], defaulting toNone. The speculative worker installs the callback for its forward call and returnsTrueonly after staging its shared reads before event recording.Accuracy Tests
python -m pytest -q test/registered/unit/model_executor/runner/test_prefill_shared_read_done.py— 12 passed. Covers staging before event creation, unsuccessful/missing staging, existing prefill gates, and DFLASH/DSPARK compatibility.Upstream pre-commit hooks passed for all three changed files.
Speed Tests and Profiling
No benchmark: this PR adds the hook without enabling it in an upstream worker. Model-specific staging and performance validation remain with the worker implementation.
-Robot
CI States
Latest PR Test (Base): ✅ Run #34534808195
Latest PR Test (Extra): ❌ Run #34534808017
Latest PR Test (AMD ROCm 10): ❌ Run #34534808235