Prhub

#25509 [misc] Throw error when single batch overlap is enabled on Hopper

原始 PR 作者 Fridge003 合并时间 2026-05-19 05:51 文件变更 1 提交数 1 评论 2 代码增减 +5 / -0

执行摘要

Hopper GPU 上禁用 SBO 特性

PR #25491 将后续重新支持该特性,当前在 Hopper GPU 上启用 SBO 会导致问题,因此需要提前报错引导用户。

PR 改动小且明确,建议合并。

讨论亮点

无 review 讨论。

实现拆解

  1. python/sglang/srt/layers/moe/utils.pyinitialize_moe_config 函数中,在 IS_SBO_ENABLED 赋值之后,添加运行时检查:如果 IS_SBO_ENABLED 为真且 CUDA 可用,则通过 torch.cuda.get_device_capability()[0] == 9 检测是否为 SM90(Hopper)架构。
  2. 若条件成立,抛出 ValueError,提示用户移除 --enable-single-batch-overlap 参数。
文件 模块 状态 重要度
python/sglang/srt/layers/moe/utils.py MoE 配置 modified 5.5

关键符号

initialize_moe_config

关键源码片段

python/sglang/srt/layers/moe/utils.py core-logic

核心文件,在 initialize_moe_config 中添加了 SBO 在 Hopper 上的运行时检查。

# python/sglang/srt/layers/moe/utils.pydef initialize_moe_config(server_args: ServerArgs):
    global MOE_A2A_BACKEND, MOE_RUNNER_BACKEND
    global SPECULATIVE_MOE_RUNNER_BACKEND, SPECULATIVE_MOE_A2A_BACKEND
    global DEEPEP_MODE, DEEPEP_CONFIG
    global IS_TBO_ENABLED, IS_SBO_ENABLED
    global TBO_TOKEN_DISTRIBUTION_THRESHOLD
    global DISABLE_FLASHINFER_CUTLASS_MOE_FP4_ALLGATHER
    global MOE_QUANTIZATION
​
    # ... 其他初始化 ...
​
    IS_TBO_ENABLED = server_args.enable_two_batch_overlap
    IS_SBO_ENABLED = server_args.enable_single_batch_overlap
​
    # 新增:如果启用了 SBO 且 GPU 为 SM90(Hopper),则报错
    if IS_SBO_ENABLED and torch.cuda.is_available():
        if torch.cuda.get_device_capability()[0] == 9:
            raise ValueError(
                "SBO (single batch overlap) is not supported on SM90 GPUs "
                "with latest sgl-deep-gemm wheel. Please try removing "
                "--enable-single-batch-overlap argument."
            )
​
    TBO_TOKEN_DISTRIBUTION_THRESHOLD = server_args.tbo_token_distribution_threshold
    # ... 后续配置 ...

评论区精华

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

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

风险与影响

变更仅 5 行新增代码,风险极低。仅影响 Hopper GPU 上使用 SBO 的用户,会提前失败并给出清晰错误信息。

用户影响:在 Hopper GPU 上使用 --enable-single-batch-overlap 的用户将遇到 ValueError 启动时错误,需移除该参数。系统影响:不会影响其他 GPU 架构或不使用 SBO 的场景。

启动时错误抛出

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论