Skip to content

附录 B:核心符号速查 ​

正文引用过的关键符号,按进程归属分组。行号以快照 commit bbc4ddeca9ece9851aad26f03afc4bab37c6e8df 为准。

API 进程 ​

符号职责定义位置主要调用者章节
EngineClient引擎抽象协议vllm/engine/protocol.py:43所有入口4
build_async_engine_client服务端引擎的 async 工厂vllm/entrypoints/launchers/api_server/entry.py:36vllm serve4
LLM离线推理门面vllm/entrypoints/llm.py:67Python 用户4
AsyncLLM在线异步引擎vllm/v1/engine/async_llm.py:80OpenAI server5
_run_output_handler输出恢复后台任务vllm/v1/engine/async_llm.py:791AsyncLLM 自身5
OutputProcessor输出反序列化与流式分发vllm/v1/engine/output_processor.py:464output handler5, 10
RequestOutputCollector每请求流式队列(覆盖写)vllm/v1/engine/output_processor.py:51AsyncLLM5, 10
IncrementalDetokenizer增量反词元化vllm/v1/engine/detokenizer.py:31OutputProcessor10

EngineCore 进程 ​

符号职责定义位置主要调用者章节
EngineCoreClient客户端抽象vllm/v1/engine/core_client.py:80AsyncLLM/LLMEngine5
MPClient / InprocClient跨进程 / 进程内实现core_client.py:556 / :343同上5
EngineCore调度大脑vllm/v1/engine/core.py:111—5
EngineCore.step一步调度+执行+收账core.py:633busy loop5
EngineCoreProc.run_busy_loopEngineCore 主循环core.py:1470进程入口5
preprocess_add_request请求预处理core.py:1049input 队列5
Scheduler调度器vllm/v1/core/sched/scheduler.py:79EngineCore6
Scheduler.schedule每步调度决策scheduler.py:557EngineCore.step6
Scheduler.update_from_output消费执行结果scheduler.py:1967EngineCore.step6
_preempt_request抢占重算scheduler.py:1539schedule6
SchedulerOutput每步施工图纸vllm/v1/core/sched/output.py:232schedule 产出6, 8
Request调度视角的请求vllm/v1/request.py:60EngineCore 全程5, 6
KVCacheManagerKV 账本vllm/v1/core/kv_cache_manager.py:131Scheduler7
KVCacheManager.get_computed_blocks前缀缓存查找kv_cache_manager.py:264schedule7
KVCacheManager.allocate_slots块分配kv_cache_manager.py:371schedule7
BlockPool物理块池vllm/v1/core/block_pool.py:134KVCacheManager7
hash_block_tokens块内容哈希vllm/v1/core/kv_cache_utils.py:649块登记7
FreeKVCacheBlockQueue空闲块队列kv_cache_utils.py:246BlockPool7
KVCacheSpec缓存形状声明vllm/v1/kv_cache_interface.py:156各 attention 层7, 9
StructuredOutputManager文法约束管理vllm/v1/structured_output/__init__.py:36EngineCore13
grammar_bitmask每步位掩码structured_output/__init__.py:314EngineCore.step13

Worker 进程 ​

符号职责定义位置主要调用者章节
Executor执行器抽象vllm/v1/executor/abstract.py:41EngineCore12
Executor.get_class后端选择abstract.py:52引擎构造12
MultiprocExecutor单机多卡执行器vllm/v1/executor/multiproc_executor.py:111默认多卡12
Worker单 GPU 容器vllm/v1/worker/gpu_worker.py:183执行器8
Worker.execute_modelPP 边界 + 前向gpu_worker.py:1198执行器8
GPUModelRunner持久批次与执行vllm/v1/worker/gpu_model_runner.py:479Worker8
_update_states批次增量同步gpu_model_runner.py:1192execute_model8
InputBatch请求元数据槽位vllm/v1/worker/gpu_input_batch.py:90runner8
BlockTable块表的 GPU 镜像vllm/v1/worker/block_table.py:57runner8
Sampler.forward采样管线vllm/v1/sample/sampler.py:72runner10
AttentionBackend后端抽象vllm/v1/attention/backend.py:58注册表9
get_attn_backend后端选择vllm/v1/attention/selector.py:105引擎初始化9
FlashAttentionBackend主力后端示例vllm/v1/attention/backends/flash_attn.py:283选择器9
take_draft_token_ids取回草稿 tokengpu_model_runner.py:4836EngineCore.post_step12

横向扩展点 ​

符号职责定义位置章节
Platform硬件抽象vllm/platforms/interface.py:13513
load_general_plugins插件发现vllm/plugins/__init__.py:7713
KVConnectorBase_V1KV 传输协议vllm/distributed/kv_transfer/kv_connector/v1/base.py:17813
get_num_new_matched_tokens外部 KV 查询钩子同上 :47513
GroupCoordinator通信原语vllm/distributed/parallel_state.py:42412
initialize_model_parallel通信组拓扑同上 :196712
get_model_loader加载器分派vllm/model_executor/model_loader/__init__.py:12311
NgramProposern-gram 提案者vllm/v1/spec_decode/ngram_proposer.py:1212
EagleProposerEagle 提案者vllm/v1/spec_decode/eagle.py:1012
最近更新