Prhub

#26544 [AMD] Fix aiter checkout (rocm dockerfile)

原始 PR 作者 bingxche 合并时间 2026-05-28 14:25 文件变更 1 提交数 1 评论 1 代码增减 +6 / -1

执行摘要

修复 ROCm Dockerfile 中 AITER git checkout 失败

任何从源码构建 docker/rocm.Dockerfile 的流程(如 --build-from-dockerfile、nightly 镜像重建、手动 docker build)在 2026-05-27 后都会因 ROCm/aiter#3370 引入的 .gitattributes 导致 git checkout 失败,报错本地修改会被覆盖。已有预构建镜像不受影响。

建议快速合并。这是一个清晰的 Docker 构建修复,根因定位准确,改动量极小。

讨论亮点

无 review 讨论。PR 由 yctseng0211 批准提交。

实现拆解

  1. 在 docker/rocm.Dockerfile 中,将 AITER 克隆后的 git checkout 命令添加 -f 标志,变为 git checkout -f ${AITER_COMMIT},强制覆盖由 .gitattributes 行尾规范化导致的脏工作树。
  2. 添加详细注释说明根因:AITER 的 .gitattributes 将 CSV 文件规范化到 LF,导致 git status 显示修改,checkout 到旧 commit 时 git 拒绝覆盖。
文件 模块 状态 重要度
docker/rocm.Dockerfile 部署脚本 modified 3.13

关键源码片段

docker/rocm.Dockerfile infrastructure

包含 AITER checkout 命令,唯一修改文件。添加 -f 标志以忽略 .gitattributes 导致的脏工作树。

# Use `checkout -f` so the smudge-filter-induced "dirty" working tree from
# AITER's .gitattributes (*.csv text eol=lf, added in ROCm/aiter#3370) does not
# block switching to commits that predate that rule (e.g. the current default
# AITER_COMMIT_DEFAULT). The working tree was just produced by a fresh
# `git clone` above, so there are no real user changes to preserve.
RUN git clone ${AITER_REPO} \
    && cd aiter \
    && git checkout -f ${AITER_COMMIT} \
    && git cherry-pick --no-commit b639cb63bcac4672dce33a731fad042a65cb3649 \
    && git submodule update --init --recursive \
    && pip install -r requirements.txt

评论区精华

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

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

风险与影响

风险极低。改动仅在 git checkout 时增加 -f 标志,且紧跟在 git clone 之后,工作树无用户修改。不会影响已有镜像。

仅影响 ROCm Docker 构建流程。修复后所有需要从源码编译 AITER 的构建都能正常通过。

关联 Issue

#3370 Normalize CSV line endings for cleaner diffs

完整报告

参与讨论