Refactor / Unify event loop across PD-Disagg, Overlap, DP-Attn cases (#12839)

Co-authored-by: cctry <17473714+cctry@users.noreply.github.com>
This commit is contained in:
Liangsheng Yin
2025-11-10 00:42:50 +08:00
committed by GitHub
co-authored by cctry
parent f5b3ccd9a5
commit 4f65a64666
11 changed files with 142 additions and 144 deletions
@@ -20,7 +20,7 @@ from sglang.srt.managers.schedule_batch import (
RequestStage,
ScheduleBatch,
)
from sglang.srt.tracing.trace import trace_slice
from sglang.srt.tracing.trace import trace_slice, trace_slice_batch, trace_slice_end
from sglang.srt.utils.common import ceil_div
if TYPE_CHECKING:
@@ -42,6 +42,26 @@ class SchedulerOutputProcessorMixin:
We put them into a separate file to make the `scheduler.py` shorter.
"""
def process_batch_result_prebuilt_extend(self: Scheduler, batch: ScheduleBatch):
assert self.disaggregation_mode == DisaggregationMode.DECODE
for req in batch.reqs:
for req in batch.reqs:
req.check_finished()
if req.finished():
req.time_stats.forward_entry_time = (
req.time_stats.completion_time
) = time.perf_counter()
trace_slice_end(
RequestStage.DECODE_QUICK_FINISH,
req.rid,
thread_finish_flag=True,
)
self.tree_cache.cache_finished_req(req)
# Note: Logprobs should be handled on the prefill engine.
trace_slice_batch(RequestStage.DECODE_FAKE_OUTPUT, batch.reqs)
self.stream_output(batch.reqs, batch.return_logprob)
def process_batch_result_prefill(
self: Scheduler,
batch: ScheduleBatch,