Phase 2 of the worker decouple initiative.
Scope
Extract prefill batch selection + execution (worker:7132–7575 + parts of Phase Configuration, ~600 LOC) into batchgen/worker/prefill.py.
Design
class ModelExecutorBackend(Protocol):
def forward_prefill(self, batch) -> PrefillOutputs: ...
@dataclass(frozen=True)
class PrefillSchedulingRequest:
pending_uuids: tuple[str, ...]
available_gpu_kv_pages: int
max_input_length: int
class PrefillScheduler:
def __init__(self, *, executor: ModelExecutorBackend): ...
def plan(self, req: PrefillSchedulingRequest) -> PrefillPlan: ...
def execute(self, plan: PrefillPlan) -> PrefillResult: ...
3-PR plan
- PR-6.1 Port.
- PR-6.2 Dual-path gate + compare-mode.
- PR-6.3 Cleanup.
Pre-merge checklist (from scheduler-split Step 7 fix-up commits)
Design source reference
origin/tairan/scheduler-split:batchgen/worker/prefill.py (689 LOC).
Design: /Users/andrew/.claude/plans/the-task-for-this-declarative-melody.md (POIS-local). Builds on the Phase A/B/C cuda-graph contract pattern (PR #162/#163/#164, merged 2026-05-27).
Phase 2 of the worker decouple initiative.
Scope
Extract prefill batch selection + execution (worker:7132–7575 + parts of Phase Configuration, ~600 LOC) into
batchgen/worker/prefill.py.Design
3-PR plan
Pre-merge checklist (from
scheduler-splitStep 7 fix-up commits)self.model_configsynced to snapshot before each call.state.modelcleared atdeep_free_model_memoryboundary (Phase Crelease_contextpattern).Design source reference
origin/tairan/scheduler-split:batchgen/worker/prefill.py(689 LOC).Design:
/Users/andrew/.claude/plans/the-task-for-this-declarative-melody.md(POIS-local). Builds on the Phase A/B/C cuda-graph contract pattern (PR #162/#163/#164, merged 2026-05-27).