vllm-contract
vllm/vllm/v1/core/sched/output.py · ef9339e · L245–279 · 固定 commit 上游
这是固定版本源码的只读摘录;可在线阅读,也可通过上游链接查看原文件。
245class SchedulerOutput:
246 # list of the requests that are scheduled for the first time.
247 # We cache the request's data in each worker process, so that we don't
248 # need to re-send it every scheduling step.
249 scheduled_new_reqs: list[NewRequestData]
250 # list of the requests that have been scheduled before.
251 # Since the request's data is already cached in the worker processes,
252 # we only send the diff to minimize the communication cost.
253 scheduled_cached_reqs: CachedRequestData
254
255 # req_id -> num_scheduled_tokens
256 # Number of tokens scheduled for each request.
257 num_scheduled_tokens: dict[str, int]
258 # Total number of tokens scheduled for all requests.
259 # Equal to sum(num_scheduled_tokens.values())
260 total_num_scheduled_tokens: int
261 # req_id -> spec_token_ids
262 # If a request does not have any spec decode tokens, it will not be
263 # included in the dictionary.
264 scheduled_spec_decode_tokens: dict[str, list[int]]
265 # req_id -> encoder input indices that need processing.
266 # E.g., if a request has [0, 1], it could mean the vision encoder needs
267 # to process that the request's 0-th and 1-th images in the current step.
268 scheduled_encoder_inputs: dict[str, list[int]]
269
270 # Request IDs that are finished in between the previous and the current
271 # steps. This is used to notify the workers about the finished requests
272 # so that they can free the cached states for those requests.
273 finished_req_ids: set[str]
274 # list of mm_hash strings associated with the encoder outputs to be
275 # freed from the encoder cache.
276 free_encoder_mm_hashes: list[str]
277
278 # Request-local CPU payload updates: None releases a consumed input; a
279 # payload restores it for re-encoding after KV-load rollback. GPU embeddings