Skip to content

vllm.v1.worker.cp_utils

Functions:

should_skip_dcp_context_attention(context_kv_lens_cpu)

Whether DCP context attention can be skipped for this batch.

Must be computed from rank-invariant inputs only (the global context lengths, NOT this rank's local share from get_dcp_local_seq_lens): the non-skip path in _forward_with_dcp issues DCP collectives (query all-gather + LSE combine), so every DCP rank must take the same branch. A rank can hold zero local context tokens while other ranks still hold context for the same batch.

split_dcp_context_queries(query_start_loc, seq_lens_cpu_upper_bound, max_query_len, num_actual_tokens)

Split reordered DCP context queries into decode and extend regions.