Skip to content

[CI] Upgrade H-Coverage to Python 3.12#79203

Merged
SigureMo merged 14 commits into
PaddlePaddle:developfrom
ShigureNyako:ci/h-coverage-python312
Jun 1, 2026
Merged

[CI] Upgrade H-Coverage to Python 3.12#79203
SigureMo merged 14 commits into
PaddlePaddle:developfrom
ShigureNyako:ci/h-coverage-python312

Conversation

@ShigureNyako

@ShigureNyako ShigureNyako commented May 31, 2026

Copy link
Copy Markdown
Contributor

PR Category

Environment Adaptation

PR Types

Improvements

Description

本 PR 仅将 H-Coverage (CI-H) 流水线从 Python 3.10 升级到 Python 3.12,不修改 Linux-CPU / NPU / 普通 Coverage 等其它流水线。

主要改动:

  • H-Coverage.yml:build / test / Fleet 相关 job 的 PY_VERSION 改为 "3.12",并同步更新显式 cmake -DPY_VERSION=3.12
  • H-Coverage 相关容器统一使用已验证可用的 Python 3.12 CUDA 12.9 镜像:
    ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:ubuntu24-cuda129-py312-dev
  • H-Coverage 产物和下游消费路径从 cp310-cp310 改为 cp312-cp312,包含 Paddle GPU wheel 和 PaddleFleet ops wheel。
  • 删除此前为旧镜像临时添加的容器内 Python setup / get-pip / symlink / pinned setuptools / PEP 668 workaround,直接使用镜像内置 Python 3.12 环境。

与已有 Python CI 升级工作的关系:

风险:

  • 真实兼容性风险会在 H-Coverage build/test/Fleet 相关 CI 中暴露,我会继续跟进 required CI,区分 Python 3.12 兼容问题、approval/coverage gate 与 infra/flaky。

本地验证:

  • git diff --check -- .github/workflows/H-Coverage.yml
  • Ruby YAML parse
  • pre-commit run --files .github/workflows/H-Coverage.yml
  • rg 'setup_target_python|deadsnakes|get-pip\.py|break-system-packages|SETUPTOOLS_USE_DISTUTILS|setuptools==68\.2\.0|ubuntu24-cuda129-dev|cuda129-coverage-test|3\.10|cp310' .github/workflows/H-Coverage.yml 无匹配

@SigureMo PTAL.

是否引起精度变化

Co-authored-by: Codex <noreply@openai.com>
@paddle-bot

paddle-bot Bot commented May 31, 2026

Copy link
Copy Markdown

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot Bot added the contributor External developers label May 31, 2026

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已完成首轮代码审查,未发现需要阻塞合入的问题。H-Coverage 中 Python 版本、wheel tag 以及 Fleet 相关下载/安装路径已同步到 3.12;当前仍以后续 CI 最终结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复查时看到 H-Coverage build 已出现与本次 Python 3.12 切换直接相关的失败,详细证据和建议放在 inline review comment 里。建议先修复该问题后再继续观察后续 CI。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

Comment thread .github/workflows/H-Coverage.yml Outdated
Comment on lines +194 to +197
python_bin=$(command -v python${PY_VERSION}) || exit 1
pip_bin=$(command -v pip${PY_VERSION}) || exit 1
ln -sf ${python_bin} /usr/local/bin/python
ln -sf ${pip_bin} /usr/local/bin/pip

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 优先级:P1

这里直接假设 cuda129-coverage-test 容器内已经有 python3.12/pip3.12,但当前 H-Coverage Coverage build 已在这组新增检查处失败:日志在 flashattn URL 检查后没有进入 pip install/cmake,随后退出 1(见 https://github.com/PaddlePaddle/Paddle/actions/runs/26721401586/job/78749573286)。这会让 H-Coverage build/test/Fleet 下游全部跳过,属于合入前必须修复的 CI 破坏。

请先让 H-Coverage 使用的镜像或步骤显式提供目标解释器,再切换 PY_VERSION=3.12;同样的处理需要覆盖后面 test/Fleet job 里复用的 symlink 逻辑。建议形态如下:

if ! command -v "python${PY_VERSION}" >/dev/null || ! command -v "pip${PY_VERSION}" >/dev/null; then
  # 更新 cuda129-coverage-test / ubuntu24-cuda129-dev 镜像,或在容器内安装 Python ${PY_VERSION} 与 pip 后再继续。
  echo "python${PY_VERSION}/pip${PY_VERSION} is required by H-Coverage" >&2
  exit 1
fi
python_bin=$(command -v "python${PY_VERSION}")
pip_bin=$(command -v "pip${PY_VERSION}")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修复,见 commit e3afaf1

处理方式:

  • 覆盖 Coverage build/test 和 Fleet build/single/multi 五处容器内 Python 设置逻辑。
  • 先 source 现有 proxy,再尝试 /opt/_internal/cpython-${PY_VERSION}.0/bin;如果目标解释器或 pip 仍不存在,则在容器内通过 apt 安装 python${PY_VERSION} / python${PY_VERSION}-dev,必要时添加 deadsnakes PPA,并用 get-pip.py 补齐 pip。
  • 最后再把 /usr/local/bin/python / pip 指向目标版本,并打印版本,避免再次静默失败。

本地验证:

  • git diff --check -- .github/workflows/H-Coverage.yml
  • Ruby YAML parse
  • pre-commit run --files .github/workflows/H-Coverage.yml
  • rg '3\.10|cp310' .github/workflows/H-Coverage.yml 无匹配

我会继续观察新提交触发的 CI-H build/test 结果。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查 e3afaf1333,这个线程里的阻塞点代码层面已解决:Build 步骤现在先 source proxy 再做 flashattn cache 检查,并且 setup_target_python 会在目标 python${PY_VERSION} / pip${PY_VERSION} 不存在时补齐安装,后续 Coverage test 与 Fleet 三个入口也覆盖了同样的设置逻辑。

我这边没有发现新的行级阻塞问题。当前新一轮 Coverage build 还在运行中,最终仍以 CI 结果为准。

Co-authored-by: Codex <noreply@openai.com>

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查 e3afaf1333,之前关于 H-Coverage 容器缺少 Python 3.12 的阻塞点在代码层面已解决;未发现新的行级阻塞问题。当前新一轮 Coverage build 仍在运行中,最终仍以 CI 结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

/re-run all-failed

Co-authored-by: Codex <noreply@openai.com>
@ShigureNyako

Copy link
Copy Markdown
Contributor Author

继续跟进 CI-H build 的新失败,已在 commit 00e0bf14b3 修复。

现象:e3afaf1333 已能成功进入 Python 3.12 build,但在 wheel packing 阶段失败:

ModuleNotFoundError: No module named 'distutils'

原因是 Python 3.12 环境会 fallback 到系统 /usr/lib/python3/dist-packages/setuptools,该 setuptools 仍依赖已移除的 distutils

处理:在五处 H-Coverage Python 3.12 setup helper 中,补充用目标解释器安装 setuptools==68.2.0wheel,并设置 SETUPTOOLS_USE_DISTUTILS=local,确保 wheel packing 使用 Python 3.12 对应的 setuptools local distutils。

本地验证:

  • git diff --check -- .github/workflows/H-Coverage.yml
  • Ruby YAML parse
  • pre-commit run --files .github/workflows/H-Coverage.yml
  • rg '3\.10|cp310' .github/workflows/H-Coverage.yml 无匹配

新一轮 CI 已触发,我会继续跟进。

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查 00e0bf14b3 的新增改动:五处 H-Coverage Python 3.12 setup helper 都补充了 setuptools==68.2.0/wheel 安装以及 SETUPTOOLS_USE_DISTUTILS=local,上一轮关于容器内 Python 3.12 provisioning 的阻塞点仍保持解决状态。未发现新的行级阻塞问题。

当前 H-Coverage build 仍在运行中,最终仍以 CI 结果为准;已看到的 Windows-GPU 失败发生在 CI-Windows workflow,和本 PR 修改的 .github/workflows/H-Coverage.yml 暂未见直接关联。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

Co-authored-by: Codex <noreply@openai.com>
@ShigureNyako

Copy link
Copy Markdown
Contributor Author

继续跟进 CI-H 的新进展:00e0bf14b3 已让 CI-H / Coverage build 通过,说明 Python 3.12 wheel packaging 的 distutils 问题已解决。

新的失败出现在 Build Fleet whl

python -m pip install --upgrade pip wheel setuptools
error: externally-managed-environment

这是 Ubuntu 24 / Python 3.12 的 PEP 668 限制,发生在 H-Coverage Fleet 容器内的后续 pip 安装步骤。

已在 commit 2c569991e0 修复:

  • 五处 H-Coverage Python 3.12 setup helper 中设置 pip config set global.break-system-packages true,让后续同容器内 pip 安装不再被 PEP 668 阻断。
  • Fleet build 的 python -m pip install --upgrade ... 改为固定 setuptools==68.2.0 并带 --break-system-packages fallback。

本地验证:

  • git diff --check -- .github/workflows/H-Coverage.yml
  • Ruby YAML parse
  • pre-commit run --files .github/workflows/H-Coverage.yml
  • rg '3\.10|cp310' .github/workflows/H-Coverage.yml 无匹配

新一轮 CI 已触发,我会继续跟进。

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查 2c569991e0 的新增改动:五处 H-Coverage Python 3.12 setup helper 都增加了 pip config set global.break-system-packages true,Fleet build 里后续的 python -m pip install --upgrade ... 也保留了 --break-system-packages fallback,并继续固定 setuptools==68.2.0。上一轮关于 Python 3.12 provisioning / distutils 的问题仍保持解决状态,未发现新的行级阻塞问题。

当前新一轮 H-Coverage 相关检查仍在运行中,最终仍以 CI 结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

继续跟进最新一轮 CI-H:commit 2c569991e0CI-H / Coverage buildBuild Fleet whl 都已通过,说明 Python 3.12 provisioning、distutils 以及 Fleet PEP 668 修复已生效。

新的失败出现在 CI-H / Coverage test 的测试依赖安装阶段:

error: uninstall-distutils-installed-package
Cannot uninstall blinker 1.4

这是 Python 3.12 / Ubuntu 24 环境里 pip 安装 python/unittest_py/requirements.txt 时尝试卸载系统 distutils 安装的 blinker 导致的。由于依赖安装未完成,后续又出现了 opt_einsum / pytest 缺失:

ModuleNotFoundError: No module named 'opt_einsum'
/usr/local/bin/python: No module named pytest

已在 commit 8b31c9132f 修复:

  • Coverage test 中安装 python/requirements.txt + python/unittest_py/requirements.txt,补齐 Python 3.12 新环境里 wheel --no-deps 后缺少的运行时依赖。
  • 使用 --ignore-installed 避免 pip 尝试卸载 Ubuntu 系统 distutils 包。
  • 显式安装 pytest,并继续固定 setuptools==68.2.0,避免 setuptools 版本漂移。

本地验证:

  • git diff --check -- .github/workflows/H-Coverage.yml
  • Ruby YAML parse
  • pre-commit run --files .github/workflows/H-Coverage.yml
  • rg '3\.10|cp310' .github/workflows/H-Coverage.yml 无匹配

已推送新一轮 CI,我会继续跟进。

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查 8b31c9132f 的新增改动:Coverage test 现在在安装 wheel 后同时安装 python/requirements.txtpython/unittest_py/requirements.txt,并使用 --ignore-installed 避免尝试卸载 Ubuntu 系统 distutils 包;同时显式补齐 pytest 并继续固定 setuptools==68.2.0。上一轮关于 Python 3.12 provisioning、distutils 和 PEP 668 的问题仍保持解决状态,未发现新的行级阻塞问题。

当前新一轮 H-Coverage 相关检查仍在运行中,最终仍以 CI 结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

继续跟进 CI-H:commit 8b31c9132fCoverage buildBuild Fleet whlCoverage test 均已通过,说明前面的 Python 3.12 provisioning / PEP 668 / test dependency 修复已被验证。

新的问题出现在 Fleet Unit test (single card):该 job 在 50 分钟 step timeout 后被 cancel。查看 job log,测试过程中大量 Fleet GPU 用例落到 CPU:

UserWarning: You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default.
ValueError: The device type Place(cpu) is not expected.

根因是 Fleet single/multi card 测试步骤里重新设置了:

LD_LIBRARY_PATH=/usr/local/cuda-12.9/targets/x86_64-linux/lib:/usr/local/cuda/lib64

这会覆盖容器运行时原本注入的 NVIDIA driver library path,也没有包含 /usr/local/cuda-12.9/compat,导致 Python 3.12 Fleet 测试进程无法正确发现 CUDA device。

已在 commit 249f9a5db0 修复:

  • Fleet single-card 和 multi-card 的 install / install paddle whl / test 三类步骤均保留原始 $LD_LIBRARY_PATH
  • 同时补充 /usr/local/cuda-12.9/compat,与 H-Coverage build / Fleet build 中的 CUDA 12.9 兼容库设置保持一致。

本地验证:

  • git diff --check -- .github/workflows/H-Coverage.yml
  • Ruby YAML parse
  • pre-commit run --files .github/workflows/H-Coverage.yml
  • rg '3\.10|cp310' .github/workflows/H-Coverage.yml 无匹配

已推送新一轮 CI,我会继续跟进。

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查 249f9a5db0 的新增改动:Fleet single-card 和 multi-card 的 install、安装 Paddle wheel、测试步骤现在都会保留原始 LD_LIBRARY_PATH,并补充 /usr/local/cuda-12.9/compat,避免覆盖容器运行时注入的 NVIDIA driver library path。上一轮关于 Python 3.12 provisioning、distutils、PEP 668 和 Coverage test 依赖安装的问题仍保持解决状态,未发现新的行级阻塞问题。

当前新一轮 H-Coverage 相关检查仍在运行中,最终仍以 CI 结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

继续跟进 CI-H Fleet:commit 249f9a5db0Coverage buildCoverage testBuild Fleet whl 均已通过,但 Fleet 单卡/多卡测试仍失败。

失败指纹仍是测试进程无法正确发现 CUDA device:

UserWarning: You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default.
LAUNCH ERROR ... Device not found 0 from 0,1,2,3...
ValueError: The device type Place(cpu) is not expected.

进一步核对日志发现,249f9a5db0 保留的是容器内已有 CUDA 路径,但实际展开后仍只有 /usr/local/cuda-* 路径,没有 NVIDIA container runtime 常见的 driver library 路径:

LD_LIBRARY_PATH=/usr/local/cuda-12.9/compat:/usr/local/cuda-12.9/targets/x86_64-linux/lib:/usr/local/cuda/lib64:...

已在 commit 7903ab4b80 继续修复:

  • Fleet single-card / multi-card 的 install、安装 Paddle whl、测试步骤中,显式加入:
    • /usr/local/nvidia/lib
    • /usr/local/nvidia/lib64
    • /usr/lib/x86_64-linux-gnu
  • 同时保留 CUDA 12.9 compat/lib 路径和原始 $LD_LIBRARY_PATH

本地验证:

  • git diff --check -- .github/workflows/H-Coverage.yml
  • Ruby YAML parse
  • pre-commit run --files .github/workflows/H-Coverage.yml
  • rg '3\.10|cp310' .github/workflows/H-Coverage.yml 无匹配

已推送新一轮 CI,我会继续跟进。

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查 7903ab4b80 的新增改动:Fleet single-card 和 multi-card 的 install、安装 Paddle wheel、测试步骤现在在保留 CUDA 12.9 compat/lib 路径和原始 LD_LIBRARY_PATH 的基础上,补充了 /usr/local/nvidia/lib/usr/local/nvidia/lib64/usr/lib/x86_64-linux-gnu,用于覆盖上一轮 Fleet 测试进程找不到 CUDA device 的场景。之前关于 Python 3.12 provisioning、distutils、PEP 668、Coverage test 依赖安装以及 Fleet LD_LIBRARY_PATH 覆盖的问题仍保持解决状态,未发现新的行级阻塞问题。

当前新一轮 H-Coverage 相关检查仍在运行中,最终仍以 CI 结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@SigureMo

SigureMo commented Jun 1, 2026

Copy link
Copy Markdown
Member

@ShigureNyako 注意 PaddleFleet 那边镜像 ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:ubuntu24-cuda129-py312-dev 是能跑的,所以是不是整体可以参考用这个镜像?很多比如安装 Python 的 hack 就可以删掉了?

https://github.com/PaddlePaddle/PaddleFleet/blob/develop/.github/workflows/Test-release.yml

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

@SigureMo 已按这个方向调整,commit 744cdd6a28

这次把 H-Coverage 里的 PaddleFleet 三个 job 都切到:

ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:ubuntu24-cuda129-py312-dev

并删除了 Fleet 部分之前为了旧镜像补 Python 3.12 的逻辑,包括 setup_target_python、deadsnakes/get-pip、Python/pip 软链、pinned setuptools、以及前一轮临时加的 Fleet CUDA/driver LD_LIBRARY_PATH workaround。现在 Fleet 部分直接使用镜像内的 Python 3.12,只保留 python --version / pip --version 诊断。

Coverage build / Coverage test 仍保留现有 Python 3.12 setup 逻辑,因为这两段还在使用 H-Coverage 专用的 cuda129-coverage-test 镜像,未在这次 review fix 里改动覆盖率构建镜像。

本地检查已通过:

  • git diff --check -- .github/workflows/H-Coverage.yml
  • Ruby YAML parse
  • pre-commit run --files .github/workflows/H-Coverage.yml
  • 已确认没有旧的 ubuntu24-cuda129-dev / cp310 / 3.10 引用

新一轮 CI 已触发,我继续跟进结果。

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查 744cdd6a28 的新增改动:H-Coverage 中 PaddleFleet build、single-card 和 multi-card 三个 job 都已切到 ubuntu24-cuda129-py312-dev 镜像,并删除了 Fleet 部分临时补 Python 3.12、软链 pip/python、固定 setuptools 以及手动拼 CUDA/driver LD_LIBRARY_PATH 的 workaround;当前只保留版本诊断并继续使用 cp312 wheel。之前关于 Python 3.12 provisioning、distutils、PEP 668、Coverage test 依赖安装和 Fleet CUDA device 发现的问题在当前代码层面仍保持解决状态,未发现新的行级阻塞问题。

当前新一轮 H-Coverage 相关检查仍在运行中,最终仍以 CI 结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

Comment thread .github/workflows/H-Coverage.yml Outdated
mkdir -p ${CFS_DIR}/.ccache/coverage
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.9/compat
source ${{ github.workspace }}/../../../proxy
setup_target_python() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

关键在于,把这种 hack 清理掉啊,怎么没清?

@ShigureNyako ShigureNyako Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实,这里我上一版只清掉了 Fleet job 里的安装逻辑,没有把 H-Coverage build/test 里同样的 setup_target_python 清掉,处理得不彻底。

已在 commit ce5bf4d485 继续清理:

  • Coverage build / Coverage test 也切到已带 Python 3.12 的镜像:
    ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:ubuntu24-cuda129-py312-dev
  • 删除 H-Coverage build/test 里残留的 setup_target_python、deadsnakes/get-pip、Python/pip 软链、break-system-packages、pinned setuptools 等安装 hack。
  • Coverage test 恢复成更接近原始流程:安装构建出的 whl 后只安装 python/unittest_py/requirements.txt,不再额外用 --ignore-installed / pinned setuptools。

本地检查:

  • git diff --check -- .github/workflows/H-Coverage.yml
  • Ruby YAML parse
  • pre-commit run --files .github/workflows/H-Coverage.yml
  • rg 'setup_target_python|deadsnakes|get-pip\.py|break-system-packages|SETUPTOOLS_USE_DISTUTILS|setuptools==68\.2\.0|ubuntu24-cuda129-dev|cuda129-coverage-test|3\.10|cp310' .github/workflows/H-Coverage.yml 无匹配

新一轮 CI 已触发,我继续盯 CI-H。

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

@swgu98 看了下,这次 CI-H 的 Coverage test 挂在 FA Test 的第一段 test_flashmask_ci.py

  • pytest / einops 已经正常安装;不是依赖缺失。
  • 失败集中在 sparse-mask 的 FlashMask V3 backward:chunks_per_seg should be at least 1, but got: 0. Check whether WITH_NVSHMEM is on for this Paddle compile.
  • 也就是说当前 H-Coverage 镜像里这条 FlashMask V3 sparse backward 路径没有 NVSHMEM/对应编译支持。之前 run.sh 没有 set -e,这类失败会被后面的命令覆盖;旧 head 上 test_flashmask_ci.py 还因为缺 einops 没实际跑起来,所以这次加上依赖和 fail-fast 后才暴露出来。

已推了一个最小修复 420d682c17:保留 set -e,只在 flashmask_get_unique_id() 返回全 0(表示当前环境无 NVSHMEM 支持)时 skip FlashMask V3 的 sparse-mask backward 用例;无 mask 的 backward 用例仍继续跑,sparse-mask forward 仍由 test_fwd_md5sum.py 覆盖。

接下来等新一轮 CI-H 验证这个修复。

@SigureMo

SigureMo commented Jun 1, 2026

Copy link
Copy Markdown
Member

也就是说当前 H-Coverage 镜像里这条 FlashMask V3 sparse backward 路径没有 NVSHMEM/对应编译支持。之前 run.sh 没有 set -e,这类失败会被后面的命令覆盖;旧 head 上 test_flashmask_ci.py 还因为缺 einops 没实际跑起来,所以这次加上依赖和 fail-fast 后才暴露出来。

那按我理解这个问题很久之前就存在?你确定一下?比如找出在半个月 / 一个月前的失败日志

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

更新一下:新 head 420d682c17 上 FA Test 部分已经通过了:

  • test_flashmask_ci.py: 119 passed, 697 skipped
  • test_fwd_md5sum.py: 300 passed
  • test_flashmask_group.py: 5 passed, 5 skipped

这次 Coverage test job 仍失败,是前面的 h-test.shtest_parallel_dygraph_sparse_embedding_over_height 挂了,日志里是 exit 137,并伴随 uv__finish_close assertion / core dump。这个失败不在本 PR 修改范围内,也不是 Python 3.12 / FA Test 改动导致。我先触发失败项重跑。

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

@SigureMo 我补查后更正一下:这里不能说「一个月/半个月前就存在」。更准确是:

  • test_fwd_md5sum.py 的 64x64 md5 旧基线问题在一个月/半个月前已经存在,并被 run.sh 最后一个 pytest 的退出码覆盖。
  • 但这次 FlashMask V3 sparse backwardchunks_per_seg ... WITH_NVSHMEM 问题,我目前只能追到 5/27 左右;5/24 及更早的 CI-H 旧配置里没有复现。

查到的日志:

  1. 一个月前:2026-05-03,CI-H run https://github.com/PaddlePaddle/Paddle/actions/runs/25281333389/job/74125537837
    • 旧配置:cuda129-coverage-test + Python 3.10.12
    • test_flashmask_ci.py: 799 passed, 17 skipped,没有 chunks_per_seg
    • 后续 test_fwd_md5sum.py: 72 failed, 228 passed,但 workflow 最终仍 success
  2. 半个月前:2026-05-16,CI-H run https://github.com/PaddlePaddle/Paddle/actions/runs/25966573455/job/76374037125
    • 同样 test_flashmask_ci.py: 799 passed, 17 skipped,没有 chunks_per_seg
    • test_fwd_md5sum.py: 72 failed, 228 passed,最终仍 success
  3. 5/24:CI-H run https://github.com/PaddlePaddle/Paddle/actions/runs/26363497559/job/77610674339
    • 仍然没有 chunks_per_segtest_flashmask_ci.py: 799 passed, 17 skipped
  4. 5/27:CI-H run https://github.com/PaddlePaddle/Paddle/actions/runs/26517485374/job/78108606142
    • 旧配置仍是 cuda129-coverage-test + Python 3.10.12
    • 开始出现 ValueError: chunks_per_seg should be at least 1 ... Check whether WITH_NVSHMEM is on
  5. 已合入 PR [API compatibility] Align torch.LayerNorm #79135 的 5/28 CI-H run https://github.com/PaddlePaddle/Paddle/actions/runs/26573226694/job/78294133482
    • 同样能看到 chunks_per_seg ... WITH_NVSHMEM,但由于旧 run.sh 没有 set -e,最终被后续命令覆盖成 success。

所以结论是:set -e 这次只是把之前被覆盖的失败暴露出来;不过 sparse backward/NVSHMEM 这个具体问题不是长期(一月/半月)存在,能确认是在本 PR 之前、约 5/27 开始的旧 CI-H 配置下已经存在。

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

/re-run all-failed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

开始出现 ValueError: chunks_per_seg should be at least 1 ... Check whether WITH_NVSHMEM is on

这个文件的改动回退掉吧,基本可以确定是 #78720 更新 FA 缓存时候编译的 .so 忘记开 WITH_NVSHMEM,有人正在编译,你先回退,后面等上传好了 rerun 即可

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已按要求回退 test/test_flashmask_ci/test_flashmask_ci.py 里的改动,commit 175d43b729

这次把 420d682c17 加的 sparse backward skip/helper/import 都撤掉了,文件已恢复到 420d682c17^ 的版本。已本地验证:

  • python3 -m py_compile test/test_flashmask_ci/test_flashmask_ci.py
  • pre-commit run ruff-check --files test/test_flashmask_ci/test_flashmask_ci.py
  • commit hook

新 head 的 CI-H 已重新开始跑:https://github.com/PaddlePaddle/Paddle/actions/runs/26753849003

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

补充说明一下保留项:

  • test/test_flashmask_ci/test_flashmask_ci.py 的 skip 逻辑已回退,不再绕过 sparse backward / NVSHMEM 问题。
  • run.shset -e 和 H-Coverage 里 pytest einops 依赖安装先保留;前者只保证 FA Test 失败会正确让 CI 失败,后者只保证测试能正常 collection/运行,不改变测试语义。
  • 我不会再通过改测试逻辑来绕过这次 FA cache .so / WITH_NVSHMEM 问题。现在等待新的 cache 上传/当前新 head CI-H 结果;如果仍是同一 cache 问题,就等上传后再 rerun。

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@umiswing

umiswing commented Jun 1, 2026

Copy link
Copy Markdown
Member

LGTM

@risemeup1 risemeup1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SigureMo

SigureMo commented Jun 1, 2026

Copy link
Copy Markdown
Member

@ShigureNyako 为啥咱们升级完 single cardmulti-card 时长变长了?比如你对比下升级前 https://github.com/PaddlePaddle/Paddle/actions/runs/26742854883/job/78849255526?pr=79107 再对比下 PaddleFleet 那边比如 https://github.com/PaddlePaddle/PaddleFleet/actions/runs/26761272832/job/78877130649?pr=1088 变慢的挺明显的,你分析下吧

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

@SigureMo 更新一下:当前 head 175d43b729 的 CI-H 最新 run attempt 5 已全绿:https://github.com/PaddlePaddle/Paddle/actions/runs/26753849003

  • Coverage build
  • Build Fleet whl
  • Coverage test
  • Fleet Unit test (single card)
  • Fleet Unit test (multi-card)

之前 attempt 4 的 Fleet 单卡失败是 test_autocudagraph.py::TestEndToEndPerformance::test_resnext50_accuracy_and_speed 的性能断言偶发,重跑已通过。

按 review 意见,test/test_flashmask_ci/test_flashmask_ci.py 的 skip 改动已在 175d43b729 回退;当前 PR diff 只剩:

  • .github/workflows/H-Coverage.yml
  • test/test_flashmask_ci/run.sh
  • test/test_flashmask_ci/flashmask_gt.json

方便时请再复查一下,解除 CHANGES_REQUESTED

@SigureMo

SigureMo commented Jun 1, 2026

Copy link
Copy Markdown
Member

@ShigureNyako 为啥咱们升级完 single cardmulti-card 时长变长了?比如你对比下升级前 https://github.com/PaddlePaddle/Paddle/actions/runs/26742854883/job/78849255526?pr=79107 再对比下 PaddleFleet 那边比如 https://github.com/PaddlePaddle/PaddleFleet/actions/runs/26761272832/job/78877130649?pr=1088 变慢的挺明显的,你分析下吧

如果你觉得是机器问题,我可以再 rerun 下

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

@SigureMo 我对比了一下,慢的主要不在 docker / install,而是在 Fleet test 本身的 Python 进程启动、pytest collection / paddle.distributed.launch 启动阶段。

几个时间点:

具体日志里比较明显的点:

  1. 单卡很多小 pytest 文件在 py312 下 collection 明显变慢。例如 tests/single_card_tests/ai_edited_test/transformer/test_ai_transformer_block_2.py
    • 升级前:4 passed in 1.99s
    • 当前 PR:4 passed in 22.52s,其中从 pytest session start 到 collected 大约 21s
  2. 多卡每个 case 都单独 coverage run -m paddle.distributed.launch ...,当前 PR 从 Running multi-card test 到第一条 LAUNCH INFO 经常约 21s;升级前通常 13s,PaddleFleet py312 nightly wheel 那边大多约 34s。
    • 例如 test_ai_parallel_state.py:当前 PR 16:09:04 -> 16:09:26,升级前 12:42:24 -> 12:42:25,PaddleFleet 14:48:46 -> 14:48:50

所以目前结论是:这次升级后 H-Coverage 的 Fleet 用例变慢,主要是 cp312 H-Coverage 自建 Paddle wheel 在 Fleet 测试里的 import / collection / launcher 启动开销放大,再叠加 Fleet 单卡按文件逐个 pytest、多卡按 case 逐个 launch 的执行方式;不是这次 PR 新增的 pytest/einopsset -e 或 docker/install 步骤导致。

@ShigureNyako

Copy link
Copy Markdown
Contributor Author

@SigureMo 我再补充修正一下:刚才只拿 attempt 5 跟升级前 / PaddleFleet 对比,还不够充分。

我又看了同一 head 175d43b729 的 attempt 4:

  • single-card attempt 4(runner paddle-5-1567435)里 test_autocudagraph.py 的 pytest collection 很快:14:58:07 session start,14:58:08 collected;没有 attempt 5 那种约 20s collection 开销。
  • multi-card attempt 4(runner paddle-11-1567435)第一条 paddle.distributed.launch 也很快:15:27:06 Running,15:27:08LAUNCH INFO;同一个 runner 的 attempt 5 才出现约 20s 的 launch 启动开销。

所以更准确地说:attempt 5 的时长变长更像 runner / 当次机器状态噪声,而不是 Python 3.12 升级后稳定复现的代码路径变慢。当前 CI-H 已全绿,代码侧我先不改。如果需要用耗时再确认一下,可以帮忙 rerun Fleet 单/多卡或整条 CI-H。

@SigureMo SigureMo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

问题不大,我看 420d682 的 fleet 单测也是很快的,而随后的 175d43b 其实并不会影响 fleet 单卡/多卡单测,但仍然变慢了,更像是环境、机器问题

@SigureMo

SigureMo commented Jun 1, 2026

Copy link
Copy Markdown
Member

@ShigureNyako 这个 PR 等会就合,喵子你也别闲着,去给 PaddleFleet 把 PR 级别的 3.10 编包逻辑删掉吧,应该是一条非 required 流水线,以及其对应的合入后上传的逻辑都清理掉,因为那边是专门给 Paddle 这边的 Python 3.10 的 fleet 流水线加的

@SigureMo SigureMo merged commit 197d63d into PaddlePaddle:develop Jun 1, 2026
118 of 124 checks passed
@SigureMo SigureMo deleted the ci/h-coverage-python312 branch June 1, 2026 18:05
@risemeup1111

Copy link
Copy Markdown
Contributor

❌ Cherry-pick failed: Conflicts detected when cherry-picking to release/3.4. Please resolve manually.

@SigureMo

SigureMo commented Jun 1, 2026

Copy link
Copy Markdown
Member

❌ Cherry-pick failed: Conflicts detected when cherry-picking to release/3.4. Please resolve manually.

@ShigureNyako 你来 cherry-pick 吧,解决下冲突,另外 PR 只做 cherry-pick,不要做多余的事

@SigureMo

SigureMo commented Jun 4, 2026

Copy link
Copy Markdown
Member

@ShigureNyako 你再去帮忙看看 https://github.com/PaddlePaddle/Paddle/actions/runs/26894176567/job/79334513960?pr=79233 吧,为啥稳定报错,和你之前遇到的问题一样吗?后续直接在 #79233 回复和跟进

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants