[Diffusion] Add Worker contracts and RPC plumbing for Scheduler-managed paged KV cache (#5550)

Signed-off-by: Acerak01-fy <wfy2003324@163.com>
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
Wang fuyinandHongsheng Liu authored and GitHub committed 2026-08-11 14:55:42 +08:00
1 parent 322600bfb2
commit af3faa6c1e
10 files changed
+622 -13

No files matched your search

@@ -0,0 +1,57 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Scheduler-to-Worker allocation payloads for diffusion KV.
Like native vLLM's SchedulerOutput DTOs, these classes carry trusted internal
Scheduler results. Cache geometry and block-table validation stay with the
native cache builders and Worker installation path.
"""
from __future__ import annotations
from dataclasses import dataclass
@dataclass
class DiffusionKVContextMetadata:
"""Request-scoped Worker allocation for an independent K/V context.
``context_id`` identifies this allocation within the enclosing
:class:`DiffusionKVMetadata`.
"""
context_id: str
cache_role: str
num_tokens: int
block_ids: tuple[list[int], ...]
@dataclass
class DiffusionKVSequenceMetadata:
"""Worker allocation for one Scheduler-owned diffusion sequence.
``context_ids`` reference request-scoped context allocations from the
enclosing :class:`DiffusionKVMetadata`.
"""
sequence_id: int
prefix_len: int
target_len: int
seq_len: int
block_ids: tuple[list[int], ...]
context_ids: tuple[str, ...] = ()
@dataclass
class DiffusionKVMetadata:
"""Scheduler allocation sent with a newly scheduled public request.
Independent contexts live once at request scope so multiple sequences can
reference the same allocation.
"""
request_id: str
allocation_generation: int
sequences: tuple[DiffusionKVSequenceMetadata, ...]
contexts: tuple[DiffusionKVContextMetadata, ...] = ()