Prhub

#41098 [Bugfix] Exclude numa_bind fields from ParallelConfig DP hash

原始 PR 作者 esmeetu 合并时间 2026-04-28 15:52 文件变更 1 提交数 1 评论 2 代码增减 +8 / -0

执行摘要

修复 DP 哈希因 NUMA 自动检测不一致导致的配置检查失败

当同时满足以下条件时,启动会报错:RuntimeError: Configuration mismatch detected for engine N. All DP workers must have identical configurations for parameters that affect collective communication。原因在于 numa_bind=Truenuma_bind_nodes 未指定时,每个 rank 自动检测本地 NUMA 节点并写入配置,导致哈希值不同。详见 PR body 和 reviewer Harry-Chen 的评论。

值得快速合入,修复明确且安全。reviewer 建议补充触发条件到 PR 描述,已采纳。无需深层代码审查。

讨论亮点

reviewer Harry-Chen 指出该 bug 在以下组合条件下触发:--numa-bind auto detection 使用中,且不同 worker 看到不同的 GPU(通过 CUDA_VISIBLE_DEVICES 或在不同节点上)。并建议将该条件补充到 PR 描述中。另一位 reviewer youkaichao 直接批准。还有评论者 liuzijing2014 询问合并后是否还需要其 patch。

实现拆解

  1. vllm/config/parallel.pyParallelConfig.compute_hash 方法中,向 ignored_factors 集合添加三个 NUMA 相关字段:numa_bindnuma_bind_nodesnuma_bind_cpus
  2. 添加内联注释解释原因:NUMA 绑定仅影响主机端内存局部性,属于每个 rank 的本地设置,不影响集合通信语义,因此应排除在哈希计算之外。
  3. 该变更仅修改一个文件,共 8 行新增,无删除,功能高度集中。
文件 模块 状态 重要度
vllm/config/parallel.py 配置层 modified 5.1

关键源码片段

vllm/config/parallel.py core-logic

唯一修改的文件;在 `ParallelConfig.compute_hash` 的 `ignored_factors` 集合中新增三个 NUMA 相关字段,防止 DP 哈希因 NUMA 自动检测而不一致。

    def compute_hash(self) -> int:
        """
        Compute a hash based on the fields that affect collective
        communication to detect configuration mismatches between
        workers and prevent hangs.
        """
        ignored_factors = {
            # ... 其他忽略字段 ...
            "_api_process_count",
            "_api_process_rank",
            # NUMA binding is per-rank host-side memory locality; it does
            # not affect collective-communication semantics. When numa_bind
            # is enabled with auto-detection, each DP rank stores its own
            # NUMA node in numa_bind_nodes (see vllm/utils/numa_utils.py
            # `_get_numa_node`), which would otherwise diverge the DP hash.
            "numa_bind",
            "numa_bind_nodes",
            "numa_bind_cpus",
        }
​
        from vllm.config.utils import get_hash_factors, hash_factors
​
        factors = get_hash_factors(self, ignored_factors)
        return hash_factors(factors)

评论区精华

触发条件补充 documentation

reviewer Harry-Chen 指出该 bug 在以下组合条件下触发:`--numa-bind` auto detection 使用中,且不同 worker 看到不同的 GPU(通过 `CUDA_VISIBLE_DEVICES` 或在不同节点上),建议补充到 PR 描述。

结论:PR 作者已将该触发条件信息补充到 PR 描述中。 · 已解决

是否保留 numa_bind 到忽略列表 设计

评论者 Harry-Chen 提议或许可以保留 `numa_bind` 在哈希中,因为该选项在所有 worker 上应保持一致。

结论:最终 PR 仍将 `numa_bind` 加入忽略列表,因为自动检测场景下该值也可能因 rank 不同而不同(尽管通常应一致),保持一致性的需求已通过启动参数统一保证。 · 已解决

风险与影响

风险极低:变更仅在 compute_hash 的忽略集合中添加三个字段,不影响其他逻辑。NUMA 绑定确实与集合通信无关,排除是合理的。未引入新依赖或功能分支。

影响范围明确且有限:仅修复使用 --numa-bind 且未指定 --numa-bind-nodes 的多 DP rank 场景(如 GB300 4 NUMA 节点、DP=4)。修复后这些配置可以正常启动。对不使用 NUMA 绑定的用户无影响。

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论