Prhub

#49599 Update vllm to point to flash-attention commit that builds FA3 with torch stable API. (Retry)

原始 PR 作者 cleonard530 合并时间 2026-08-06 23:37 文件变更 2 提交数 7 评论 19 代码增减 +2 / -5

执行摘要

FA3 迁移 torch stable ABI 并收紧 CI 检查

PR body 说明这是 FA3 stable ABI 迁移的重新尝试,指向 flash-attention 仓库 PR #165 的顶提交,目的是在构建时只暴露 stable symbols,并通过 torch-abi-audit 验证 ABI 合规性。此前 #46644 的尝试因故失败,本次重试并最终完成迁移。

值得关注的是 ABI 迁移策略:通过外部项目 pin 提交并同步收紧 CI 检查,是一种低成本的渐进式迁移方式。建议阅读 .buildkite/check-torch-abi.py 的检查逻辑和 cmake/external_projects/vllm_flash_attn.cmake 的依赖管理方式,可作为后续其他扩展库迁移的参考。

讨论亮点

评论主要围绕 CI 流程:作者在 draft 状态下无法运行 CI(被提示需先开放 PR);mergify 多次提醒 merge conflict 需要 rebase;pre-commit 检查失败后作者修正了代码格式。Harry-Chen 在 FA3 仓库合并对应 PR 后更新了依赖 tag,并触发最终 CI。MatthewBonanni 重试了几个疑似 flaky 的测试后批准合并。

实现拆解

  1. 更新 cmake/external_projects/vllm_flash_attn.cmakeFetchContent_DeclareGIT_TAG,从 28e862d2... 改为 f3e1a4f7...,该提交对应 flash-attention 仓库中已合并的支持 stable ABI 的改动。
  2. .buildkite/check-torch-abi.py 中从 ALLOWED_UNSTABLE_LIBRARIES 元组中移除 "vllm_flash_attn/_vllm_fa3_C.abi3.so",使 CI 检查不再豁免 FA3 库,未来构建必须保持 stable ABI。
  3. 多次 rebase 同步 main 分支,解决 merge conflict,并修复 pre-commit 报错(调整 allowlist 写法以通过 lint)。
  4. CI 测试中出现若干 flaky 测试,MatthewBonanni 重试后请求强制合并。
文件 模块 状态 重要度
cmake/external_projects/vllm_flash_attn.cmake 构建配置 modified 3.01
.buildkite/check-torch-abi.py CI 检查 modified 4.73

关键符号

ALLOWED_UNSTABLE_LIBRARIES

关键源码片段

cmake/external_projects/vllm_flash_attn.cmake core-logic

核心改动:将 vllm-flash-attn 的 Git tag 更新到支持 stable ABI 的提交,是本次迁移的关键依赖变更。

# 从 flash-attention 仓库拉取支持 torch stable ABI 的提交
FetchContent_Declare(
    vllm-flash-attn
    GIT_REPOSITORY https://github.com/vllm-project/flash-attention.git
    GIT_TAG f3e1a4f74c99145c0717709860bf765de1703779 # 新提交:FA3 stable ABI 支持
    GIT_PROGRESS TRUE
    # Don't share the vllm-flash-attn build between build types
    BINARY_DIR ${CMAKE_BINARY_DIR}/vllm-flash-attn
)
.buildkite/check-torch-abi.py core-logic

CI 检查收紧:从 ALLOWED_UNSTABLE_LIBRARIES 中移除 FA3,确保后续构建必须保持 stable ABI。

# SPDX-License-Identifier: Apache-2.0
"""Audit vLLM compiled libraries for PyTorch stable ABI compliance."""import fnmatch
import sys
from pathlib import Pathfrom torch_abi_audit import inspect_package
from torch_abi_audit.report import ExtensionReport, PackageReport# 临时允许列表:仅剩 deep_gemm 未迁移,FA3 已达标并从列表移除
ALLOWED_UNSTABLE_LIBRARIES: tuple[str, ...] = ("third_party/deep_gemm/_C*.so",)
​
​
def _relative_path(lib: ExtensionReport, package_root: Path) -> str:
    try:
        return lib.path.relative_to(package_root).as_posix()
    except ValueError:
        return lib.path.name
​
​
def _is_torch_unstable(lib: ExtensionReport) -> bool:
    # 仅当扩展使用了 torch 且未标记 stable 时才视为不稳定
    return lib.error is None and lib.torch.uses_torch and not lib.torch.stable
​
​
def _matches_allowlist(rel_path: str, patterns: tuple[str, ...]) -> bool:
    return any(fnmatch.fnmatch(rel_path, pattern) for pattern in patterns)

评论区精华

Draft 状态下无法运行 CI question

cleonard530 尝试运行 /ci run 时被机器人提示:PR authors cannot run CI while the PR is a draft。

结论:作者被提示需先开放 PR;后续由维护者 Harry-Chen 帮忙触发 CI。 · 已解决

Merge conflict 反复出现 other

mergify[bot] 多次提醒 'This pull request has merge conflicts that must be resolved before it can be merged. Please rebase the PR'。

结论:作者多次 rebase 分支,最终解决冲突。 · 已解决

CI 失败疑似 main 上的 flaky 测试 测试

cleonard530 指出 'the failed test seem to be failing on main too',MatthewBonanni 回应 'Retried a couple of tests that looked like flakes. Will request force merge once those finish'。

结论:重试后通过,MatthewBonanni 请求强制合并。 · 已解决

风险与影响

风险较低但涉及构建链路:vllm_flash_attn.cmake 固定到新 commit,若该提交在特定平台(如 ROCm、特定 CUDA 版本)编译或运行出现问题,会影响所有使用 FA3 的后端;同时移除 allowlist 后,CI 会强制 FA3 库必须是 stable ABI,后续任何引入私有 API 的改动都会导致 CI 失败。当前 CI 已验证主要构建配置,但覆盖范围有限。

影响范围主要是构建与 CI 基础设施:FA3 库以 stable ABI 构建后,vLLM 对 PyTorch 版本的耦合降低,有利于跨版本兼容;CI 检查收紧意味着后续 FA3 改动必须遵循 stable ABI 约束。对最终用户无直接功能影响,但提升了整体发行包的 ABI 稳定性。

构建依赖 pin 变更 CI 检查收紧

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论