[Core][Refactor][Diffusion] refactor request scheduler's admission wait policy (#5843)

Signed-off-by: Huang, Zeyu <11222265+fhfuih@users.noreply.github.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
Zeyu Huang | 黃澤宇andHongsheng Liu authored and GitHub committed 2026-08-10 15:06:27 +08:00
1 parent c588208cc6
commit 33dd9a5a3e
13 files changed
+253 -54

No files matched your search

@@ -21,6 +21,7 @@ from vllm_omni.diffusion.sched.interface import (
RequestBatchSamplingParamsKey,
SchedulerRequestState,
StepBatchSamplingParamsKey,
_AdmissionWaitDecision,
)
from vllm_omni.diffusion.worker.utils import RunnerOutput
@@ -158,6 +159,27 @@ class BaseScheduler(ABC):
def num_running_requests(self) -> int:
return len(self._running)
def get_admission_wait_decision(
self,
*,
now: float,
dp_concurrent: bool = False,
) -> _AdmissionWaitDecision:
"""Return the admission-delay policy for the next scheduling wave."""
del now, dp_concurrent
return _AdmissionWaitDecision(should_wait=False)
def should_end_admission_wait(
self,
decision: _AdmissionWaitDecision,
*,
now: float,
stable_since: float,
) -> bool:
"""Return whether an active admission delay should end."""
del decision, now, stable_since
return True
def get_request_state(self, request_id: str) -> SchedulerRequestState | None:
return self._request_states.get(request_id)
+10
View File
@@ -31,6 +31,16 @@ class DiffusionRequestStatus(enum.IntEnum):
return status >= DiffusionRequestStatus.FINISHED_COMPLETED
@dataclass(frozen=True)
class _AdmissionWaitDecision:
"""Internal scheduler policy for delaying the next admission wave."""
should_wait: bool
deadline: float | None = None
stable_window_s: float = 0.0
max_batch: int = 1
@dataclass(frozen=True, eq=True)
class StepBatchSamplingParamsKey:
"""Denoise step level Batch-compatibility key derived from ``OmniDiffusionSamplingParams``.
+38 -1
View File
@@ -12,6 +12,7 @@ from vllm_omni.diffusion.sched.interface import (
DiffusionRequestStatus,
DiffusionSchedulerOutput,
RequestBatchSamplingParamsKey,
_AdmissionWaitDecision,
)
if TYPE_CHECKING:
@@ -35,7 +36,43 @@ def build_request_batch_sampling_params_key(request: OmniDiffusionRequest) -> Re
class RequestScheduler(BaseScheduler):
"""Diffusion scheduler with vLLM-style waiting/running queues."""
"""Scheduler for static request waves, including admission coalescing."""
def get_admission_wait_decision(
self,
*,
now: float,
dp_concurrent: bool = False,
) -> _AdmissionWaitDecision:
assert self.od_config is not None
max_wait_ms = self.od_config.request_batch_max_wait_ms
if max_wait_ms <= 0.0 or self.max_num_running_reqs <= 1:
return _AdmissionWaitDecision(should_wait=False)
if self.num_running_requests() > 0:
return _AdmissionWaitDecision(should_wait=False)
max_wait_s = max_wait_ms / 1000.0
stable_window_s = min(0.3, max_wait_s / 2.0) if dp_concurrent else min(0.05, max_wait_s / 5.0)
return _AdmissionWaitDecision(
should_wait=True,
deadline=now + max_wait_s,
stable_window_s=stable_window_s,
max_batch=self.max_num_running_reqs,
)
def should_end_admission_wait(
self,
decision: _AdmissionWaitDecision,
*,
now: float,
stable_since: float,
) -> bool:
waiting = self.num_waiting_requests()
return (
waiting >= decision.max_batch
or (waiting > 0 and now - stable_since >= decision.stable_window_s)
or (decision.deadline is not None and now >= decision.deadline)
)
def _build_sampling_params_key(self, request: OmniDiffusionRequest) -> RequestBatchSamplingParamsKey:
return build_request_batch_sampling_params_key(request)