Skip to content

Conversation

@plusNew001
Copy link
Collaborator

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

Modifications

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

Copilot AI review requested due to automatic review settings January 7, 2026 12:00
@paddle-bot
Copy link

paddle-bot bot commented Jan 7, 2026

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Jan 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

本PR对XPU CI测试框架进行了重大重构,主要变更包括:

目的: 重构XPU CI流程,将原有的单一工作流拆分为模块化的可复用工作流,并新增大量测试用例。

主要改动:

  • 将CI工作流拆分为clone、build、4卡测试和8卡测试四个独立的可复用工作流
  • 新增pytest测试框架,包含4卡和8卡两套完整的测试用例
  • 添加conftest.py提供通用的测试辅助函数
  • 新增多种场景的测试用例:PD分离、EP并行、MTP模式、VL模型、logprobs等

Reviewed changes

Copilot reviewed 5 out of 18 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
.github/workflows/ci_xpu.yml 重构主工作流,改为编排调用子工作流,实现模块化CI流程
.github/workflows/_build_xpu.yml 新增XPU构建工作流,负责编译和上传wheel包
.github/workflows/_xpu_4cards_case_test.yml 新增4卡测试工作流,在XPU-P800-4Cards runner上执行测试
.github/workflows/_xpu_8cards_case_test.yml 新增8卡测试工作流,在XPU-P800-8Cards runner上执行测试
tests/xpu_ci/4cards_cases/conftest.py 新增4卡测试通用配置,提供进程管理、健康检查等辅助函数
tests/xpu_ci/8cards_cases/conftest.py 新增8卡测试通用配置,与4卡版本基本相同
tests/xpu_ci/4cards_cases/test_*.py 新增10个4卡测试用例,覆盖V1模式、W4A8量化、VL模型、MTP、EP并行、PD分离、logprobs等场景
tests/xpu_ci/8cards_cases/test_*.py 新增2个8卡测试用例,测试PD分离的TP4EP4和TP1EP4配置

'
- name: Package Upload
id: set_output
env:
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

语法错误:YAML文件中 env: 关键字后缺少值。第166行只有 env: 而没有定义任何环境变量,这会导致YAML解析错误。如果不需要环境变量,应该删除这一行;如果需要,应该添加相应的变量定义。

Suggested change
env:

Copilot uses AI. Check for mistakes.
Comment on lines 158 to 163
bash custom_ops/xpu_ops/download_dependencies.sh develop
export CLANG_PATH=$(pwd)/custom_ops/xpu_ops/third_party/xtdk
export XVLLM_PATH=$(pwd)/custom_ops/xpu_ops/third_party/xvllm
bash build.sh
ls ./dist/*.whl
'
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

代码块结束位置缺少右引号。第159行之后的bash脚本应该有对应的闭合引号 ',但是直接跳到了第163行。这会导致shell脚本执行错误。

Copilot uses AI. Check for mistakes.
@@ -1,86 +1,43 @@
name: CI_XPU

name: CI-XPU
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

PR描述信息不完整。根据项目规范,PR描述至少应该解释为什么要进行这些修改以及解决了什么问题。建议补充以下内容:

  1. 重构的背景和动机
  2. 主要改进点(例如:将单个工作流拆分为多个可复用的工作流、增加了测试用例等)
  3. 对CI流程的影响
  4. 测试验证情况

Copilot generated this review using guidance from repository custom instructions.
python ${push_file} fastdeploy*.whl ${target_path}
target_path_stripped="${target_path#paddle-github-action/}"
WHEEL_PATH=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/${fd_wheel_name}
echo "wheel_path=${WHEEL_PATH}" >> $GITHUB_OUTPUT No newline at end of file
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

缺少环境变量 GITHUB_OUTPUT 的存在性检查。如果在本地或非GitHub Actions环境中运行此脚本,$GITHUB_OUTPUT 可能未定义,导致脚本失败。建议添加环境变量检查或使用更健壮的输出方式。

Suggested change
echo "wheel_path=${WHEEL_PATH}" >> $GITHUB_OUTPUT
if [ -n "${GITHUB_OUTPUT:-}" ]; then
echo "wheel_path=${WHEEL_PATH}" >> "$GITHUB_OUTPUT"
else
# Fallback for non-GitHub Actions environments: print to stdout
echo "GITHUB_OUTPUT is not set. wheel_path=${WHEEL_PATH}"
fi

Copilot uses AI. Check for mistakes.
@@ -1,86 +1,43 @@
name: CI_XPU

name: CI-XPU
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

PR标题缺少必要的标签格式。根据项目规范,PR标题应该遵循 [标签]描述 的格式。建议修改为:[XPU][CI] XPU CI Refactor,明确标注这是XPU和CI相关的改动。

Copilot generated this review using guidance from repository custom instructions.
"""
停止所有相关进程(最小改动版,避免误杀 pytest)
"""
xpu_id = get_xpu_id() # noqa: F841
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

Variable xpu_id is not used.

Suggested change
xpu_id = get_xpu_id() # noqa: F841

Copilot uses AI. Check for mistakes.
# 真正 kill
for pid in safe_pids:
subprocess.run(f"kill -9 {pid}", shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except Exception:
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

'except' clause does nothing but pass and there is no explanatory comment.

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link

codecov-commenter commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@dc170e3). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5932   +/-   ##
==========================================
  Coverage           ?   67.36%           
==========================================
  Files              ?      347           
  Lines              ?    44612           
  Branches           ?     6869           
==========================================
  Hits               ?    30055           
  Misses             ?    12340           
  Partials           ?     2217           
Flag Coverage Δ
GPU 67.36% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings January 9, 2026 06:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 18 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

tests/xpu_ci/4cards_cases/conftest.py:367

  • 在函数名称后有一个多余的空格。应该是 os.path.dirname(os.path.dirname(os.path.dirname(current_dir))) 而不是 os.path.dirname (os.path.dirname(os.path.dirname(current_dir)))。这会影响代码的一致性和可读性。

"""获取scripts目录路径"""
# conftest.py在tests/xpu_ci_pytest/下,scripts在项目根目录下
current_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.dirname (os.path.dirname(os.path.dirname(current_dir)))
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

在函数名称后有一个多余的空格。应该是 os.path.dirname(os.path.dirname(os.path.dirname(current_dir))) 而不是 os.path.dirname (os.path.dirname(os.path.dirname(current_dir)))。这会影响代码的一致性和可读性。

Suggested change
project_root = os.path.dirname (os.path.dirname(os.path.dirname(current_dir)))
project_root = os.path.dirname(os.path.dirname(os.path.dirname(current_dir)))

Copilot uses AI. Check for mistakes.
Comment on lines 2 to +44

on:
pull_request:
branches:
- develop
- 'release/*'
workflow_dispatch:
types: [opened, synchronize]
branches: [develop, release/**]
permissions: read-all

concurrency:
group: ${{ github.event.pull_request.number }}-xpu-ci
group: ${{ github.event.pull_request.number }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
CI_XPU:
timeout-minutes: 60
runs-on: [self-hosted, XPU-P800-8Card]
steps:
- name: Print current runner name
run: |
echo "Current runner name: ${{ runner.name }}"
# Because the system version is lower than 2.23, the checkout cannot be used.
# - name: Checkout code
# uses: actions/checkout@v4
clone:
name: FD-Clone-Linux-XPU
uses: ./.github/workflows/_clone_linux.yml

- name: Code Checkout
env:
docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-xpu:ci
run: |
REPO="https://github.com/${{ github.repository }}.git"
FULL_REPO="${{ github.repository }}"
REPO_NAME="${FULL_REPO##*/}"
BASE_BRANCH="${{ github.base_ref }}"
# Clean the repository directory before starting
docker run --rm --net=host -v $(pwd):/workspace -w /workspace \
-e "REPO_NAME=${REPO_NAME}" \
-e "BASE_BRANCH=${BASE_BRANCH}" \
${docker_image} /bin/bash -c '
if [ -d ${REPO_NAME} ]; then
echo "Directory ${REPO_NAME} exists, removing it..."
rm -rf ${REPO_NAME}
fi
'
git config --global user.name "FastDeployCI"
git config --global user.email "[email protected]"
git clone ${REPO} ${REPO_NAME} -b ${BASE_BRANCH}
cd FastDeploy
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr/${{ github.event.pull_request.number }}
git merge pr/${{ github.event.pull_request.number }}
git log -n 3 --oneline
else
git checkout ${{ github.sha }}
git log -n 3 --oneline
fi
xpu_build_test:
name: xpu_build_test
needs: [clone]
uses: ./.github/workflows/_build_xpu.yml
with:
FASTDEPLOY_ARCHIVE_URL: ${{ needs.clone.outputs.repo_archive_url }}
DOCKER_IMAGE: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-xpu:ci

- name: Run CI unittest
env:
docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-xpu:ci
run: |
runner_name="${{ runner.name }}"
last_char="${runner_name: -1}"
xpu_4cards_case_test:
name: xpu_4cards_case_test
needs: [clone, xpu_build_test]
uses: ./.github/workflows/_xpu_4cards_case_test.yml
with:
FASTDEPLOY_ARCHIVE_URL: ${{ needs.clone.outputs.repo_archive_url }}
DOCKER_IMAGE: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-xpu:ci
FASTDEPLOY_WHEEL_URL: ${{ needs.xpu_build_test.outputs.wheel_path }}
MODEL_PATH: /ssd3/model

if [[ "$last_char" == "1" ]]; then
xpu_id="4"
else
xpu_id="0"
fi
PARENT_DIR=$(dirname "$WORKSPACE")
echo "PARENT_DIR:$PARENT_DIR"
docker run --rm --net=host --cap-add=SYS_PTRACE --privileged --shm-size=64G \
-v $(pwd):/workspace -w /workspace \
-v "/ssd3:/ssd3" \
-e "MODEL_PATH=/ssd3/model" \
-e "http_proxy=$(git config --global --get http.proxy)" \
-e "https_proxy=$(git config --global --get https.proxy)" \
-e "no_proxy=bcebos.com,mirrors.tuna.tsinghua.edu.cn,127.0.0.1,localhost" \
-e "XPU_ID=${xpu_id}" \
${docker_image} /bin/bash -c "
git config --global --add safe.directory /workspace/FastDeploy
cd FastDeploy
bash scripts/run_xpu_ci_pytest.sh
"
xpu_8cards_case_test:
name: xpu_8cards_case_test
needs: [clone, xpu_build_test]
uses: ./.github/workflows/_xpu_8cards_case_test.yml
with:
FASTDEPLOY_ARCHIVE_URL: ${{ needs.clone.outputs.repo_archive_url }}
DOCKER_IMAGE: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-xpu:ci
FASTDEPLOY_WHEEL_URL: ${{ needs.xpu_build_test.outputs.wheel_path }}
MODEL_PATH: /ssd3/model
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

PR描述不够完整。根据PR模板要求,描述信息至少应该包含:1) 为什么进行这些修改的动机;2) 具体做了哪些修改;3) 如何使用或运行相关命令。当前PR只填写了模板框架,没有实际内容。建议补充:重构XPU CI的原因、新的测试组织结构说明、以及如何运行这些测试用例的具体指令。

Copilot generated this review using guidance from repository custom instructions.
python3 ${push_file} fastdeploy*.whl ${target_path}
target_path_stripped="${target_path#paddle-github-action/}"
WHEEL_PATH=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/${fd_wheel_name}
echo "wheel_path=${WHEEL_PATH}" >> $GITHUB_OUTPUT No newline at end of file
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

在 shell 命令中使用了未引用的变量,这可能导致命令注入风险。例如在构建命令时直接拼接了变量值。虽然这些变量来自环境变量,但最好使用参数化的方式或确保对这些值进行适当的验证和转义,以避免潜在的安全问题。

Suggested change
echo "wheel_path=${WHEEL_PATH}" >> $GITHUB_OUTPUT
echo "wheel_path=${WHEEL_PATH}" >> "$GITHUB_OUTPUT"

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +73
except Exception:
pass
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

'except' clause does nothing but pass and there is no explanatory comment.

Suggested change
except Exception:
pass
except Exception as exc:
# Ignore errors during process cleanup to avoid breaking test teardown
print(f"[WARN] safe_kill_cmd failed for '{cmd}': {exc}")

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 9, 2026 07:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 18 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

tests/xpu_ci/4cards_cases/conftest.py:367

  • 代码中存在多余的空格。在函数名os.path.dirname和左括号之间有一个不必要的空格,应该移除。这会影响代码的规范性。

Comment on lines 121 to 182
${docker_image} /bin/bash -c '
echo "安装lsof工具..."
apt install -y lsof
# 设置XPU_VISIBLE_DEVICES
export XPU_VISIBLE_DEVICES="0,1,2,3,4,5,6,7"
echo "XPU_VISIBLE_DEVICES=$XPU_VISIBLE_DEVICES"
# 下载和安装xre
echo "下载和安装xre..."
mkdir -p /workspace/deps
cd /workspace/deps
if [ ! -d "xre" ]; then
wget -q https://klx-sdk-release-public.su.bcebos.com/xre/kl3-release/5.0.21.21/xre-Linux-x86_64-5.0.21.21.tar.gz
tar -zxf xre-Linux-x86_64-5.0.21.21.tar.gz && mv xre-Linux-x86_64-5.0.21.21 xre
fi
cd -
export PATH=/workspace/deps/xre/bin:$PATH
# 重启XPU卡
echo "重启XPU卡..."
xpu-smi -r -i $XPU_VISIBLE_DEVICES
xpu-smi
set -e
git config --global --add safe.directory /workspace/FastDeploy
cd FastDeploy
python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
python -m pip install -r requirements.txt
echo "安装PaddlePaddle..."
# 针对不同分支和tag使用不同的PaddlePaddle安装包
if [[ "${PADDLE_WHL_URL}" != "" ]];then
python -m pip install ${PADDLE_WHL_URL}
elif [[ "${PADDLEVERSION}" != "" ]];then
python -m pip uninstall paddlepaddle-xpu fastdeploy-xpu -y
python -m pip install paddlepaddle-xpu==${PADDLEVERSION} -i https://www.paddlepaddle.org.cn/packages/stable/xpu-p800/
else
python -m pip uninstall paddlepaddle-xpu fastdeploy-xpu -y
# python -m pip install --pre paddlepaddle-xpu -i https://www.paddlepaddle.org.cn/packages/nightly/xpu-p800/
python -m pip install https://paddle-whl.bj.bcebos.com/nightly/xpu-p800/paddlepaddle-xpu/paddlepaddle_xpu-3.4.0.dev20260107-cp310-cp310-linux_x86_64.whl
fi
echo "安装上游任务编译的fastdeploy-xpu..."
python -m pip install ${FASTDEPLOY_WHEEL_URL}
rm -rf fastdeploy
python -m pip install ${FASTDEPLOY_WHEEL_URL} --no-deps --target=/workspace/FastDeploy
echo "============================安装测试依赖============================"
python -m pip install openai -U
python -m pip uninstall -y triton
python -m pip install triton==3.3.0
python -m pip install pytest
python -m pip install pytest-timeout
echo "============================开始运行pytest测试============================"
export PYTHONPATH=/workspace/FastDeploy/
python -m pytest -v -s --tb=short tests/xpu_ci/8cards_cases/
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "============================8卡cases测试通过!============================"
else
echo "============================8卡cases测试失败,请检查日志!============================"
exit $exit_code
fi
' No newline at end of file
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

在工作流文件中,多次重复相同的代码块来处理环境准备、依赖安装等。例如,下载xre、安装PaddlePaddle、安装FastDeploy等步骤在_xpu_4cards_case_test.yml和_xpu_8cards_case_test.yml中几乎完全相同。建议将这些共同的步骤提取为一个单独的可复用的工作流或使用复合操作(composite action),以减少重复并提高可维护性。

Copilot uses AI. Check for mistakes.
else
python -m pip uninstall paddlepaddle-xpu fastdeploy-xpu -y
# python -m pip install --pre paddlepaddle-xpu -i https://www.paddlepaddle.org.cn/packages/nightly/xpu-p800/
python -m pip install https://paddle-whl.bj.bcebos.com/nightly/xpu-p800/paddlepaddle-xpu/paddlepaddle_xpu-3.4.0.dev20260107-cp310-cp310-linux_x86_64.whl
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

工作流文件中硬编码了特定日期的PaddlePaddle安装包URL(paddlepaddle_xpu-3.4.0.dev20260107)。这个硬编码的日期版本会使CI依赖于一个特定的nightly build,可能导致以下问题:1) 如果该版本被删除,CI将失败;2) 无法自动获取最新的修复和改进。建议使用更灵活的方式,比如使用官方的nightly channel或将版本号作为可配置参数。

Copilot uses AI. Check for mistakes.
Comment on lines +149 to +150
# python -m pip install --pre paddlepaddle-xpu -i https://www.paddlepaddle.org.cn/packages/nightly/xpu-p800/
python -m pip install https://paddle-whl.bj.bcebos.com/nightly/xpu-p800/paddlepaddle-xpu/paddlepaddle_xpu-3.4.0.dev20260107-cp310-cp310-linux_x86_64.whl
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

工作流文件中硬编码了特定日期的PaddlePaddle安装包URL(paddlepaddle_xpu-3.4.0.dev20260107)。这个硬编码的日期版本会使CI依赖于一个特定的nightly build,可能导致以下问题:1) 如果该版本被删除,CI将失败;2) 无法自动获取最新的修复和改进。建议使用更灵活的方式,比如使用官方的nightly channel或将版本号作为可配置参数。

Suggested change
# python -m pip install --pre paddlepaddle-xpu -i https://www.paddlepaddle.org.cn/packages/nightly/xpu-p800/
python -m pip install https://paddle-whl.bj.bcebos.com/nightly/xpu-p800/paddlepaddle-xpu/paddlepaddle_xpu-3.4.0.dev20260107-cp310-cp310-linux_x86_64.whl
python -m pip install --pre paddlepaddle-xpu -i https://www.paddlepaddle.org.cn/packages/nightly/xpu-p800/
# If a specific nightly wheel is required, please pass it via PADDLE_WHL_URL instead of hardcoding it here

Copilot uses AI. Check for mistakes.
"""获取scripts目录路径"""
# conftest.py在tests/xpu_ci_pytest/下,scripts在项目根目录下
current_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.dirname (os.path.dirname(os.path.dirname(current_dir)))
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

代码中存在多余的空格。在函数名os.path.dirname和左括号之间有一个不必要的空格,应该移除。这会影响代码的规范性。

Suggested change
project_root = os.path.dirname (os.path.dirname(os.path.dirname(current_dir)))
project_root = os.path.dirname(os.path.dirname(os.path.dirname(current_dir)))

Copilot uses AI. Check for mistakes.
Comment on lines +169 to +170
# python -m pip install --pre paddlepaddle-xpu -i https://www.paddlepaddle.org.cn/packages/nightly/xpu-p800/
python -m pip install https://paddle-whl.bj.bcebos.com/nightly/xpu-p800/paddlepaddle-xpu/paddlepaddle_xpu-3.4.0.dev20260107-cp310-cp310-linux_x86_64.whl
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

工作流文件中硬编码了特定日期的PaddlePaddle安装包URL(paddlepaddle_xpu-3.4.0.dev20260107)。这个硬编码的日期版本会使CI依赖于一个特定的nightly build,可能导致以下问题:1) 如果该版本被删除,CI将失败;2) 无法自动获取最新的修复和改进。建议使用更灵活的方式,比如使用官方的nightly channel或将版本号作为可配置参数。

Suggested change
# python -m pip install --pre paddlepaddle-xpu -i https://www.paddlepaddle.org.cn/packages/nightly/xpu-p800/
python -m pip install https://paddle-whl.bj.bcebos.com/nightly/xpu-p800/paddlepaddle-xpu/paddlepaddle_xpu-3.4.0.dev20260107-cp310-cp310-linux_x86_64.whl
python -m pip install --pre paddlepaddle-xpu -i https://www.paddlepaddle.org.cn/packages/nightly/xpu-p800/

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 9, 2026 11:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 18 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (4)

tests/xpu_ci/4cards_cases/conftest.py:367

  • 在conftest.py的第367行,括号前有一个多余的空格:os.path.dirname (os.path.dirname(...)。应该修改为os.path.dirname(os.path.dirname(...)以符合Python代码规范。
    tests/xpu_ci/8cards_cases/test_pd_21b_tp1ep4.py:140
  • 缺少空行。在第138行的cleanup_resources()之后、第139行的if not download_and_build_xdeepep():之前缺少空行,这影响了代码的可读性。根据PEP 8规范,在逻辑代码块之间应该有空行分隔。
    tests/xpu_ci/8cards_cases/test_pd_21b_tp4ep4.py:140
  • 在第138行和第139行之间缺少空行。第138行末尾有一个空行(第138行),但在第139行的if语句之前应该有空行分隔。这影响了代码的可读性。根据PEP 8规范,在不同的逻辑代码块之间应该有空行。
    tests/xpu_ci/4cards_cases/conftest.py:365
  • 注释内容包含错误的路径信息。在第365行的注释中写道"conftest.py在tests/xpu_ci_pytest/下",但实际上从文件路径来看,conftest.py应该在tests/xpu_ci/4cards_cases/目录下,而不是tests/xpu_ci_pytest/。这个注释会误导代码维护者。建议修改为准确的路径描述。

Comment on lines 2 to +7

on:
pull_request:
branches:
- develop
- 'release/*'
workflow_dispatch:
types: [opened, synchronize]
branches: [develop, release/**]
permissions: read-all
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

PR描述不完整。根据项目要求,PR描述至少需要说明为什么进行这些修改以及解决了什么问题。当前PR描述中的MotivationModifications部分都是空的。建议补充说明:1) 为什么要重构XPU CI;2) 具体做了哪些改动;3) 这些改动解决了什么问题或带来了什么改进。

Copilot generated this review using guidance from repository custom instructions.
model_id = data["data"][0].get("id", "unknown")
print(f"\n模型就绪!模型ID: {model_id}, 总耗时 {elapsed} 秒")
return True
except (json.JSONDecodeError, Exception) as e: # noqa: F841
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

代码中存在未使用的异常变量。在第190行,异常变量e被捕获但未使用,并带有# noqa: F841注释。建议移除未使用的异常变量,将代码改为except (json.JSONDecodeError, Exception):以符合Python最佳实践。

Suggested change
except (json.JSONDecodeError, Exception) as e: # noqa: F841
except (json.JSONDecodeError, Exception):

Copilot uses AI. Check for mistakes.
Comment on lines +475 to +476
os.system("sysctl -w kernel.msgmax=131072")
os.system("sysctl -w kernel.msgmnb=33554432")
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

使用os.system()执行系统命令存在安全风险。在第475-476行,直接使用os.system()执行sysctl命令。建议使用subprocess.run()替代os.system(),因为它提供更好的错误处理和安全性。应该修改为:

subprocess.run(["sysctl", "-w", "kernel.msgmax=131072"], check=False)
subprocess.run(["sysctl", "-w", "kernel.msgmnb=33554432"], check=False)
Suggested change
os.system("sysctl -w kernel.msgmax=131072")
os.system("sysctl -w kernel.msgmnb=33554432")
subprocess.run(["sysctl", "-w", "kernel.msgmax=131072"], check=False)
subprocess.run(["sysctl", "-w", "kernel.msgmnb=33554432"], check=False)

Copilot uses AI. Check for mistakes.
Comment on lines +340 to +352
result = subprocess.run("wget -q https://paddle-qa.bj.bcebos.com/xpu_third_party/xDeepEP.tar.gz", shell=True)
if result.returncode != 0:
print("下载xDeepEP失败")
return False

print("解压xDeepEP...")
result = subprocess.run("tar -xzf xDeepEP.tar.gz", shell=True)
if result.returncode != 0:
print("解压xDeepEP失败")
return False

print("编译xDeepEP...")
result = subprocess.run("cd xDeepEP && bash build.sh && cd -", shell=True)
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

shell命令注入风险。在第340、346、352行使用subprocess.run()执行shell命令时,shell=True参数可能导致命令注入风险。虽然当前代码使用的是硬编码的URL,但建议使用列表形式的参数而不是字符串+shell=True的方式,以提高安全性。例如,第340行可以改为:

result = subprocess.run(["wget", "-q", "https://paddle-qa.bj.bcebos.com/xpu_third_party/xDeepEP.tar.gz"])
Suggested change
result = subprocess.run("wget -q https://paddle-qa.bj.bcebos.com/xpu_third_party/xDeepEP.tar.gz", shell=True)
if result.returncode != 0:
print("下载xDeepEP失败")
return False
print("解压xDeepEP...")
result = subprocess.run("tar -xzf xDeepEP.tar.gz", shell=True)
if result.returncode != 0:
print("解压xDeepEP失败")
return False
print("编译xDeepEP...")
result = subprocess.run("cd xDeepEP && bash build.sh && cd -", shell=True)
result = subprocess.run(
["wget", "-q", "https://paddle-qa.bj.bcebos.com/xpu_third_party/xDeepEP.tar.gz"]
)
if result.returncode != 0:
print("下载xDeepEP失败")
return False
print("解压xDeepEP...")
result = subprocess.run(["tar", "-xzf", "xDeepEP.tar.gz"])
if result.returncode != 0:
print("解压xDeepEP失败")
return False
print("编译xDeepEP...")
result = subprocess.run(["bash", "build.sh"], cwd="xDeepEP")

Copilot uses AI. Check for mistakes.
"""
停止所有相关进程(最小改动版,避免误杀 pytest)
"""
xpu_id = get_xpu_id() # noqa: F841
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

代码中存在未使用的变量。在第50行,变量xpu_id被获取但带有# noqa: F841注释来抑制"未使用变量"的警告,这表明该变量确实未被使用。如果不需要这个变量,应该删除它;如果需要用于将来的功能,应该添加注释说明其用途。

Suggested change
xpu_id = get_xpu_id() # noqa: F841

Copilot uses AI. Check for mistakes.
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.

2 participants