Skip to content

vllm.v1.kv_offload.config

Normalized configuration consumed by native offloading backends.

Classes:

Functions:

OffloadingParallelConfig dataclass

Attributes:

Source code in vllm/v1/kv_offload/config.py
@dataclass(frozen=True)
class OffloadingParallelConfig:
    # Worker index in [0, world_size). 0 on the scheduler side.
    rank: int
    # Total number of workers.
    world_size: int
    # Tensor parallel size.
    tp_size: int
    # Pipeline parallel size.
    pp_size: int
    # Prefill context parallel size.
    pcp_size: int
    # Decode context parallel size.
    dcp_size: int
    # Data parallel replica index of this engine.
    data_parallel_index: int
    # Number of data parallel replicas.
    data_parallel_size: int
    # Local rank of the data parallel group, set only in SPMD mode.
    data_parallel_rank_local: int | None
    # True when the bytes that will be persisted for a block are portable
    # across parallelism configurations: for the direct layout, concatenating
    # the block's data across all workers in rank order yields the same bytes
    # under any topology; for the canonical layout, the canonical page itself
    # is topology-free.
    is_parallelism_agnostic: bool
    # Workers of this engine on each node; world_size when unknown.
    local_world_size: int | None = None
    # False when the executor does not place workers by the configured node
    # count (Ray, external_launcher, executor classes): local_world_size then
    # says nothing about the nodes.
    placement_known: bool = True

    @property
    def spans_nodes(self) -> bool:
        """Whether workers may be on several nodes."""
        return workers_may_span_nodes(
            self.world_size, self.local_world_size, self.placement_known
        )

spans_nodes property

Whether workers may be on several nodes.

places_workers_by_nnodes(distributed_executor_backend)

Whether the executor places workers by the configured node count, so that local_world_size says which workers share a node.

Source code in vllm/v1/kv_offload/config.py
def places_workers_by_nnodes(distributed_executor_backend: object) -> bool:
    """Whether the executor places workers by the configured node count, so
    that local_world_size says which workers share a node."""
    return distributed_executor_backend in ("mp", "uni")

workers_may_span_nodes(world_size, local_world_size, placement_known)

Whether an engine's workers may be on several nodes: as the executor reports, or for any engine of several workers whose placement is unknown.

Source code in vllm/v1/kv_offload/config.py
def workers_may_span_nodes(
    world_size: int, local_world_size: int | None, placement_known: bool
) -> bool:
    """Whether an engine's workers may be on several nodes: as the executor
    reports, or for any engine of several workers whose placement is unknown."""
    if not placement_known:
        return world_size > 1
    return local_world_size is not None and local_world_size < world_size