Prhub

#28807 Clean up startup log noise

原始 PR 作者 merrymercy 合并时间 2026-06-21 06:02 文件变更 4 提交数 1 评论 0 代码增减 +3 / -21

执行摘要

清理启动日志噪声,移除冗余日志和 import

根据 PR body,目的是清理启动时的日志噪声("Remove noisy startup logs"),使日志更干净,便于用户阅读。具体涉及 custom allreduce v2、speculative decoding 和 finalized token capacity 处理。

该 PR 是低风险清理,可快速合并。建议关注是否有可能在调试时需要这些日志,若需可考虑改为 debug 级别而非直接移除。

讨论亮点

无 review 评论;仅 Gemini Code Assist 自动 review 提及无反馈。

实现拆解

  1. custom_all_reduce_v2.py:移除 log_info_on_rank0 import,在 __init__ 末尾移除初始化成功日志,在 _register_graph_inputs_ipc 末尾移除 IPC 注册地址数量和 cuda graph 地址日志。
  2. speculative_hook.py:在 _handle_eagle_family 函数中,移除了 else 分支中关于“Overlap spec v2 默认启用”的 warning 日志,仅保留 non-overlap 时的 warning。
  3. flashinfer_backend.py:移除 CUTLASS 因 TMA 描述符问题而禁用时的 info 日志,并将条件判断从 if check_... 取反为 if not check_...,保留 CUTLASS 回退行为但消除日志。
  4. model_runner_kv_cache_mixin.py:在 _resolve_max_num_reqs 方法中,移除 finalized token capacity 的 info 日志,仅保留 max_running_requests 被降低时的 warning 日志。
文件 模块 状态 重要度
python/sglang/srt/distributed/device_communicators/custom_all_reduce_v2.py 通信层 modified 5.31
python/sglang/srt/arg_groups/speculative_hook.py 参数配置 modified 5.39
python/sglang/srt/layers/attention/flashinfer_backend.py 注意力层 modified 5.85
python/sglang/srt/model_executor/model_runner_kv_cache_mixin.py 模型执行器 modified 5.18

关键符号

CustomAllReduceV2.__init__ CustomAllReduceV2._register_graph_inputs_ipc _handle_eagle_family FlashInferBackend.__init__ _resolve_max_num_reqs

关键源码片段

python/sglang/srt/distributed/device_communicators/custom_all_reduce_v2.py dependency-wiring

移除了 log_info_on_rank0 import 和两条信息性日志(初始化成功、IPC 注册地址数),减少启动噪声。

# python/sglang/srt/distributed/device_communicators/custom_all_reduce_v2.py
# 移除 log_info_on_rank0 导入,仅保留 is_sm100_supported
# from sglang.srt.utils import is_sm100_supported, log_info_on_rank0 # 移除 log_info_on_rank0
from sglang.srt.utils import is_sm100_supportedclass CustomAllReduceV2:
    def __init__(self, ...):
        # ... 初始化逻辑 ...
        self._post_init_obj()
        self.disabled = False
        # log_info_on_rank0(logger, "Custom allreduce v2 initialized successfully") # 已移除
​
    def _register_graph_inputs_ipc(self):
        # ... 注册逻辑 ...
        self.obj.register_inputs(result)
        # log_info_on_rank0(logger, f"Registered {len(pairs)} cuda graph addresses via IPC") # 已移除
python/sglang/srt/arg_groups/speculative_hook.py core-logic

移除了 `_handle_eagle_family` 中 `disable_overlap_schedule` 为 False 时的 warning 日志("Overlap spec v2 is enabled by default"),仅保留 non-overlap 时的 warning。

# python/sglang/srt/arg_groups/speculative_hook.py
# 在 _handle_eagle_family 函数中
if server_args.disable_overlap_schedule:
    logger.warning(
        "Non-overlap (synchronous) spec v2 is used for eagle/eagle3/standalone "
        "speculative decoding."
    )
# else: # 已删除
# logger.warning( # 已删除
# "Overlap spec v2 is enabled by default for eagle/eagle3/standalone speculative decoding." # 已删除
# ) # 已删除
python/sglang/srt/layers/attention/flashinfer_backend.py core-logic

简化了 SM100 上 CUTLASS 后端选择的逻辑,移除 CUTLASS 禁用的 info 日志,同时将条件判断取反,保持相同行为。

# python/sglang/srt/layers/attention/flashinfer_backend.py
# 在 FlashInferBackend.__init__ 方法中
fmha_backend = "auto"
if is_sm100_supported():
    # 当 piecewise cuda graph 启用时禁用 CUTLASS 后端,
    # 因为 B200 上存在 TMA 描述符初始化问题。
    if not check_cuda_graph_backend(Phase.PREFILL, Backend.TC_PIECEWISE):
        fmha_backend = "cutlass"
    # 之前版本使用 if check_... 然后 log,现在简化为 if not check_... 直接设置

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

风险极低。所有变更均为移除日志语句或简化条件判断,不改变运行时逻辑。flashinfer_backend 中的条件判断从 if A: log; else: set 改为 if not A: set,行为与之前完全一致。custom_all_reduce_v2 的 log_info_on_rank0 import 移除后确认无其他使用。

影响范围小,只影响启动时日志输出,不改变任何运行时行为或性能。用户将看到更简洁的启动日志,但可能失去一些调试信息(如 custom allreduce 初始化成功、IPC 注册数量等)。对生产环境无负面影响。

低风险清理

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论