Prhub

#50590 [UX] Reduce startup log noise

原始 PR 作者 mgoin 合并时间 2026-08-01 04:04 文件变更 9 提交数 1 评论 1 代码增减 +36 / -50

执行摘要

精简启动日志噪音,统一 info_once/debug 分级

PR title 为 [UX] Reduce startup log noise,目标是减少 vLLM 启动时默认 INFO 日志的噪音。PR body 明确说明:remove the default asynchronous-scheduling status log、emit repeated configuration and warmup messages once per process、move routine backend-selection, registration, and no-op details to DEBUG、preserve warnings whose content may differ by rank,并强调 This only changes logging; serving behavior and model outputs are unchanged。作者(mgoin)在 review 自评中补充:异步调度默认开启,默认打印 enabled 状态没有信息量,禁用场景已有其他日志覆盖。

值得快速浏览以了解 vLLM logger 的 once 语义(info_once/warning_once/debug_once)及其对参数可哈希的要求;该 PR 可作为后续日志降噪类变更的模板。无需逐文件精读,重点看 cutedsl_warmup.py 与 flashinfer_all_reduce.py 的注释示例即可掌握模式。

讨论亮点

唯一的实质性 review 评论来自作者 mgoin 本人,针对 vllm/config/vllm.py 第 1148 行被删除的 async scheduling 状态日志,他解释:Async scheduling is on by default, so no need to say it is enabled. Disabled behavior is covered in other logs。该评论对应的删除已在提交中完成,属于自我确认的删因说明。claude[bot] 因 PR 来自 fork 未做自动审核;tlrmchlsmth 与 yewentao256 均 APPROVED,yewentao256 评论 LGTM, thanks for the work!。

实现拆解

  1. 删除默认状态日志(vllm/config/vllm.py):在 VLLMConfig.__post_init__ 中删除 Asynchronous scheduling is enabled/disabled 的 info_once 日志(异步调度默认开启,该日志无信息量);同时把约 15 处 logger.warning/info 统一改为 warning_once/info_once,覆盖 enforce_eager、TORCH_COMPILE_DISABLE、Inductor 禁用、cudagraph 模式覆盖、Sequence Parallelism 需要 TP>1、Whisper fork 警告、KV cache events 警告等分支。

  2. 预热路径降噪(vllm/model_executor/warmup/cutedsl_warmup.py、kernel_warmup.py):cutedsl_warmup() 中非 CUDA 平台与无 compile units 的跳过消息由 info 降为 debug;“Warming up CuTeDSL compile_units=...” 改为 info_once,并把 unit_names 从 list 转为 tuple 以保持可哈希;同时删除“compiled X units in Y s”计时日志与 import time。kernel_warmup() 中 ll_bf16 无 shapes 的跳过消息降为 debug_once,FlashInfer warmup/autotune 相关消息改为 info_once/warning_once,skip_ops 由 sorted(list) 改为 tuple(sorted(...)) 保证可哈希。

  3. 例行细节降为 DEBUG(分布式与工具模块):flashinfer_all_reduce.py 的 _resolve_fi_ar_backend() 中显式指定与自动选择后端的两条日志由 info_once 降为 debug_once,并顺手把 f-string 改为 %s 格式化;custom_all_reduce.py 中 register_graph_buffers() 的 “Registering %d cuda graph addresses” 由 info 降为 debug,missing library 与 unsupported world size 改为 info_once/warning_once;system_utils.py 的 Windows ulimit 跳过日志、vllm/v1/attention/backends/utils.py 的 _KV_CACHE_LAYOUT_OVERRIDE 日志均降为 debug。

  4. 多进程去重(vllm/v1/worker/gpu/model_runner.py、vllm/v1/attention/selector.py):GPUModelRunner.load_model() 中 “Loading model from scratch...” 由 info 改为 info_once,selector.py 中 “Using %s KV cache layout for %s backend.” 由 info 改为 info_once,确保每个进程内相同路径只打印一次。

  5. 测试与验证:本次未新增测试文件;PR body 说明通过 pre-commit(Ruff、mypy、config validation),并运行 tests/test_config.py::test_async_scheduling_with_pipeline_parallelism_is_allowed 与 tests/kernels/attention/test_attention_selector.py,结果为 30 passed、10 skipped。

文件 模块 状态 重要度
vllm/model_executor/warmup/cutedsl_warmup.py 预热模块 modified 5.84
vllm/config/vllm.py 配置解析 modified 5.27
vllm/model_executor/warmup/kernel_warmup.py 预热模块 modified 5.24
vllm/distributed/device_communicators/custom_all_reduce.py 通信模块 modified 4.22
vllm/v1/worker/gpu/model_runner.py 模型加载 modified 4.13
vllm/distributed/device_communicators/flashinfer_all_reduce.py 通信模块 modified 4.1
vllm/utils/system_utils.py 系统工具 modified 3.83
vllm/v1/attention/backends/utils.py 注意力后端 modified 3.83
vllm/v1/attention/selector.py 注意力后端 modified 3.92

关键符号

cutedsl_warmup VLLMConfig.__post_init__ kernel_warmup flashinfer_autotune _warmup_ll_bf16_router_gemm CustomAllreduce.__init__ CustomAllreduce.register_graph_buffers GPUModelRunner.load_model _resolve_fi_ar_backend set_ulimit get_kv_cache_layout _cached_get_attn_backend

关键源码片段

vllm/model_executor/warmup/cutedsl_warmup.py core-logic

预热路径降噪的核心文件:跳过消息降为 DEBUG、预热消息改为 info_once、删除计时日志与 import time,体现了本 PR 的日志分级模式。

# vllm/model_executor/warmup/cutedsl_warmup.py(head 版本,日志降噪后)
@instrument(span_name="CuTeDSL warmup")
def cutedsl_warmup() -> None:
    """运行所有注册的 CuTeDSL 编译预热单元。"""
    if not current_platform.is_cuda():
        # 非 CUDA 平台属于例行跳过分支,默认日志级别下不再打扰用户
        logger.debug("Skipping CuTeDSL warmup on non-CUDA platform.")
        return
​
    compile_units = _collect_unique_compile_units(_iter_cutedsl_warmup_compile_units())
    if not compile_units:
        # 未请求任何 compile unit 同样是常见且无信息量的路径,降为 DEBUG
        logger.debug("Skipping CuTeDSL warmup because no compile units were requested.")
        return
​
    # info_once 保证多进程场景下每个进程只打印一次;
    # 名称列表转为 tuple 以保持可哈希,供 once 去重逻辑使用
    logger.info_once(
        "Warming up CuTeDSL compile_units=%d names=%s.",
        len(compile_units),
        tuple(dict.fromkeys(unit.name for unit in compile_units)),
    )
    _compile_cutedsl_warmup_units(compile_units)
vllm/distributed/device_communicators/flashinfer_all_reduce.py core-logic

FlashInfer allreduce 后端选择日志从 info_once 降为 debug_once,属例行 backend-selection 信息,同时顺手改为 %s 格式化。

# vllm/distributed/device_communicators/flashinfer_all_reduce.py(head 版本)
def _resolve_fi_ar_backend() -> tuple[str, bool]:
    """解析当前环境适用的 flashinfer allreduce 后端。
​
    返回 ``(backend, allow_trtllm_fallback)``;``allow_trtllm_fallback``
    仅在 ``auto`` 模式选中 mnnvl 且为单节点时置 True,便于在无 NVSwitch
    多播的单节点拓扑上回退到 trtllm。
    """
    backend = envs.VLLM_FLASHINFER_ALLREDUCE_BACKEND
    if backend != "auto":
        # 用户显式指定的后端属于例行信息,只需在 DEBUG 级别可见
        logger.debug_once("Using flashinfer allreduce backend: %s", backend)
        return backend, False
​
    # 默认单双节点都用 mnnvl;trtllm 不支持多节点 allreduce
    backend = "mnnvl"
    allow_trtllm_fallback = get_node_count() == 1
​
    # 自动选择结果不再是启动日志的固定内容,降为 DEBUG 减少噪音
    logger.debug_once("Auto-selected flashinfer allreduce backend: %s", backend)
    return backend, allow_trtllm_fallback

评论区精华

删除默认 async scheduling 状态日志的理由 设计

mgoin 在 vllm/config/vllm.py 第 1148 行被删除的日志位置留言:Async scheduling is on by default, so no need to say it is enabled. Disabled behavior is covered in other logs。

结论:采纳该自评结论,删除此默认状态日志;PR 合入时该改动已包含在提交中。 · 已解决

风险与影响

  1. 日志可见性变化:register_graph_buffers 的 CUDA graph 地址注册数、FlashInfer 后端选择、_KV_CACHE_LAYOUT_OVERRIDE、Windows ulimit 跳过等原先 INFO 的例行信息降为 DEBUG,排障时需设置 VLLM_LOGGING_LEVEL=DEBUG 才能看到,可能增加部分问题定位成本。
  2. 预热计时观测点丢失:cutedsl_warmup.py 删除了“compiled X units in Y s”的 INFO 日志,默认日志下无法再直接看到 CuTeDSL 预热耗时。
  3. once 去重对参数可哈希的依赖:*_once 去重需要日志参数可哈希,本次已把 list/sorted() 结果改为 tuple,但未来若有新的不可哈希参数传入 *_once,可能触发异常;且该行为无测试覆盖。
  4. 无新增测试:若 CI 或下游测试断言了旧日志文本(例如 “Asynchronous scheduling is ...”),可能因日志被删除而失败;PR body 只验证了 2 个测试文件。
  5. 长期进程去重副作用:info_once/warning_once 使同一进程内相同路径只打印一次,若用户在超长运行进程中动态改变配置,相关提示不会再次出现,需重启进程才能恢复可见。

影响范围是启动体验:默认启动日志显著变短,多进程/流水线并行场景下重复的配置与预热消息被去重;按 rank 不同的 warning 得以保留,避免掩盖分布式问题。对依赖默认 INFO 日志的运维监控与文档,部分细节需开启 DEBUG 才能获取。团队层面,该 PR 确立了“例行与重复信息默认不打印、仅保留有效告警”的日志分级模式,可作为后续日志清理工作的模板。整体影响面广但程度轻,属于低风险正向优化。

日志可见性降低 无测试覆盖 once 去重依赖参数可哈希 预热计时观测点移除

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论