Skip to content

vllm.v1.worker.gpu.pcp_manager

Classes:

PCPBatchMetadata dataclass

Per-step metadata of a PCP rank-local batch.

PCPManager

MRV2 PC batch manager.

The model runner keeps the global scheduled batch. This manager rewrites only the per-step InputBatch into rank-local DualChunkSwap rows and keeps the global-batch view private to restore to the global batch shape before sampling/postprocess.

Methods:

_iter_rank_chunks(rank, num_scheduled_tokens, is_prefilling)

Yield (request index, query offset, length) for one PCP rank.

PCP=4 partitions each prefill into eight chunks:

full:  | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
rank 0:  0                           7
rank 1:      1                   6
rank 2:          2           5
rank 3:              3   4

Decodes, and prefills too short to fill all eight, are replicated instead.

_reorder_segments(segments, is_prefilling) staticmethod

Order this rank's rows decodes-first, then prefills, canonically.

get_draft_input_buffers(input_buffers, num_tokens)

Return draft inputs and their MoE routing padding mask.

get_num_tokens_for_dispatch(num_scheduled_tokens, is_prefilling)

Return the largest real rank-local batch before graph padding.

moe_is_padding(is_padding)

Expand a capture/dummy padding mask, identical on every PCP rank, to the rows the MoE routes.

prepare_inputs_for_capture_or_profile(input_batch)

Stage a capture or dummy batch in persistent PCP input buffers.

replicated_requests(num_scheduled_tokens, is_prefilling)

Per global request, whether every PCP rank gets the whole query.

set_block_tables(block_tables)

Attach the KV block tables, which only exist after KV cache init.

sync_drafts(draft_tokens, idx_mapping, draft_logits)

Broadcast PCP rank 0's drafts and draft logits.

Replicated drafts are not bitwise identical across PCP ranks, but every rank must verify the same proposal and distribution.