[Diffusion][HunyuanImage3] Add request paged prefix caching (#7719)
Signed-off-by: zwhzzz0821 <2831474076@qq.com>
This commit is contained in:
1 parent
9a1a05facd
commit
205aa01c7b
49 files changed
+2889
-127
No files matched your search
@@ -12,11 +12,12 @@ from vllm_omni.diffusion.sched.interface import (
|
||||
DiffusionRequestStatus,
|
||||
DiffusionSchedulerOutput,
|
||||
RequestBatchSamplingParamsKey,
|
||||
SchedulerRequestState,
|
||||
_AdmissionWaitDecision,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm_omni.diffusion.worker.utils import RunnerOutput
|
||||
from vllm_omni.diffusion.worker.utils import BaseRunnerOutput
|
||||
|
||||
# LoRA identity is derived from `sampling.lora_request`, not a same-named field
|
||||
# on sampling params, so it must be resolved separately from the bulk lookup.
|
||||
@@ -32,7 +33,7 @@ def _normalize_explicit_sample_solver(value: object | None) -> str | None:
|
||||
return str(value).strip().lower()
|
||||
|
||||
|
||||
def _normalize_explicit_flow_shift(value: object | None) -> float | None:
|
||||
def _normalize_explicit_flow_shift(value: float | str | None) -> float | None:
|
||||
"""Normalize an explicitly provided flow shift without selecting a default."""
|
||||
if value is None:
|
||||
return None
|
||||
@@ -59,6 +60,18 @@ def build_request_batch_sampling_params_key(request: OmniDiffusionRequest) -> Re
|
||||
class RequestScheduler(BaseScheduler):
|
||||
"""Scheduler for static request waves, including admission coalescing."""
|
||||
|
||||
def _can_schedule_waiting(self, state: SchedulerRequestState) -> bool:
|
||||
if not super()._can_schedule_waiting(state):
|
||||
return False
|
||||
manager = self._diffusion_kv_manager
|
||||
if not self._running or manager is None or not manager.has_request(state.request_id):
|
||||
return True
|
||||
# The request-level runner uses one first-step query boundary per wave.
|
||||
# The Manager already aligns all CFG sequences within each request.
|
||||
current = manager.get_metadata(self._running[0]).sequences[0].cached_prefix_len
|
||||
candidate = manager.get_metadata(state.request_id).sequences[0].cached_prefix_len
|
||||
return candidate == current
|
||||
|
||||
def get_admission_wait_decision(
|
||||
self,
|
||||
*,
|
||||
@@ -98,7 +111,7 @@ class RequestScheduler(BaseScheduler):
|
||||
def _build_sampling_params_key(self, request: OmniDiffusionRequest) -> RequestBatchSamplingParamsKey:
|
||||
return build_request_batch_sampling_params_key(request)
|
||||
|
||||
def update_from_output(self, sched_output: DiffusionSchedulerOutput, output: RunnerOutput) -> set[str]:
|
||||
def update_from_output(self, sched_output: DiffusionSchedulerOutput, output: BaseRunnerOutput) -> set[str]:
|
||||
scheduled_request_ids = sched_output.scheduled_request_ids
|
||||
if not scheduled_request_ids and not sched_output.finished_req_ids:
|
||||
return set()
|
||||
|
||||
Reference in new issue
Block a user