Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
052cf3b
build: Set up CI Docker images and build pipeline aligned with PyTorc…
Jun 1, 2026
e9078c3
fix: use JSON array for workflow matrix instead of unsupported split …
Jun 1, 2026
9ba5904
cleanup: keep only aarch64 test images (A2/A3), remove builder and x8…
Jun 1, 2026
d3c0ef1
refactor: remove PyTorch from Docker image, split torch-dependent deps
Jun 1, 2026
86aff4a
build: switch Docker push to quay.io/kerer/pytorch and add build summary
Jun 2, 2026
afc5e81
build: add QUAY_USERNAME environment to build job for secret access
Jun 2, 2026
03c5dbf
build: remove pull_request trigger from Docker build workflow
Jun 2, 2026
d2309e9
ci: add PR-triggered build workflow for PyTorch + torch_npu
Jun 2, 2026
f978b05
fix: ignore SVE check on aarch64 build runner
Jun 2, 2026
1113cd1
build: add ccache, pip cache, and build improvements to _build.yml
Jun 2, 2026
a77ed30
build: use pip install -e instead of deprecated setup.py develop
Jun 2, 2026
33311a2
fix: add fetch-depth:0 for submodule checkout, install ccache in Dock…
Jun 2, 2026
7f7fd2d
fix: use CMAKE_C_COMPILER_LAUNCHER instead of CC/CXX wrapper for ccache
Jun 2, 2026
7a56183
fix: pre-update AOTInductor C shim headers for PyTorch version skew
Jun 2, 2026
f51e390
fix: handle missing op-plugin config dir in AOTI header pre-update
Jun 2, 2026
651e00e
fix: inject --update_aoti_c_shim via sed instead of manual codegen call
Jun 2, 2026
683dbdf
build: remove pre-codegen step, let ci/build.sh run unmodified
Jun 2, 2026
f7a7ede
build: remove concurrency group from test-build-trigger
Jun 2, 2026
155c175
feat: support --update_aoti_c_shim in ci/build.sh and generate_code.sh
Jun 3, 2026
5160b15
build: pull torch_npu from PR branch instead of hardcoded master
Jun 3, 2026
1beac52
fix: use PR head repo for downstream checkout in test-build-trigger
Jun 4, 2026
728f697
fix: update SavedVariable::unpack param type to intrusive_ptr for PyT…
Jun 4, 2026
cc50616
fix: migrate VariableFallbackKernel to intrusive_ptr for PyTorch 2.11…
Jun 4, 2026
d729c9c
fix: migrate VariableTypeManual Identity grad_fn to intrusive_ptr for…
Jun 4, 2026
9cdfece
fix: migrate reducer grad_accumulators_/hooks_ to intrusive_ptr for P…
Jun 4, 2026
bdcf7d4
fix: source CANN env before verifying torch_npu import
Jun 4, 2026
b9e16c6
ci: add wheel artifact upload and optimize checkout speed
Jun 4, 2026
9777a7c
fix: avoid slow chmod -R on ~/.cache with ccache data
Jun 4, 2026
3433ec9
perf: reduce ccache size to 5G and improve compression
Jun 4, 2026
34a1962
perf: use fetch-depth 1 for shallow checkout of both repos
Jun 4, 2026
b29bc57
fix: run torch import outside source dir to avoid import conflict
Jun 4, 2026
b30372e
perf: remove all cache steps — network download slower than recompile
Jun 4, 2026
155a52d
ci: upload generated c_shim_npu.h in build artifacts
Jun 4, 2026
0a049ef
ci: remove --update_aoti_c_shim from build step
Jun 4, 2026
5bd4d49
chore: sync c_shim_npu.h with CI-generated version
Jun 4, 2026
53a6e76
Merge remote-tracking branch 'ascend/master' into master_pr_compile
Jun 5, 2026
5655150
Merge remote-tracking branch 'ascend/master' into master_pr_compile
Jun 8, 2026
35b9ed4
fix: remove Dimname/NamedTensor references for PyTorch 2.13 compatibi…
Jun 8, 2026
60e85ee
Merge remote-tracking branch 'ascend/master' into master_pr_compile
Jun 9, 2026
676d929
Merge remote-tracking branch 'ascend/master' into master_pr_compile
Jun 9, 2026
baec558
ci: add diagnostic step to check installed torchgen for Dimname refer…
Jun 9, 2026
7459341
ci: align requirements-test.txt with upstream and add timestamp to do…
Aug 18, 2026
25f1072
fix: correct docker image detection in build-docker-images workflow
Aug 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .ci/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# torch-npu CI Docker Images

本目录管理 torch-npu 项目的测试镜像 (test),当前仅支持 aarch64 架构。

## 镜像类型

| 类型 | 基座 | 用途 |
|------|------|------|
| **test** | ubuntu:22.04 | CI 单元测试运行环境,包含 PyTorch nightly、CANN runtime、triton-ascend 和测试框架 |

## 目录结构

```
.ci/docker/
├── README.md
├── requirements-test.txt # Test 镜像 pip 依赖
├── docker_build.sh # 构建入口脚本
├── common/ # 共享安装脚本
│ ├── install_cann.sh # 安装 CANN toolkit (支持 A2/A3)
│ ├── install_triton.sh # 安装 triton-ascend
│ └── install_obs.sh # 安装华为 OBS util
└── test/
└── Dockerfile.aarch64
```

## 快速构建

```bash
./docker_build.sh torch-npu-test-aarch64-cann-a2-py3.10-torch-nightly
./docker_build.sh torch-npu-test-aarch64-cann-a3-py3.10-torch-nightly
```

## Tag 命名规范

```
torch-npu-test-aarch64-cann<CHIP>-py<PYTHON_VERSION>-torch-nightly
```

| 字段 | 可选值 |
|------|--------|
| CHIP | A2 (Ascend 910b), A3 |
| PYTHON_VERSION | 3.10 |

## CANN 芯片映射

| CANN_CHIP | 芯片 | CANN 版本 |
|-----------|------|----------|
| A2 | Ascend 910b | 9.1.0-beta.1 |
| A3 | Ascend A3 | 9.0.0-beta.2 |
109 changes: 109 additions & 0 deletions .ci/docker/common/install_cann.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/usr/bin/bash
# Install CANN toolkit for Ascend NPU.
# Usage: CANN_CHIP=A1 ./install_cann.sh
# CANN_CHIP: A1 (Ascend 910), A2 (Ascend 910b), A3 (Ascend A3)
# Automatically detects architecture (x86_64 / aarch64).

set -e

CANN_CHIP="${CANN_CHIP:-A1}"
ARCH=$(uname -m)

BASE_URL="https://pytorch-package.obs.cn-north-4.myhuaweicloud.com/pta/cann-package"
CANN_BASE_URL="https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%209.1.T1"

case "${ARCH}_${CANN_CHIP}" in
# x86_64
x86_64_A1)
TOOLKIT_URL="${BASE_URL}/20260513/Ascend-cann-toolkit_9.1.0_linux-x86_64.run"
OPS_URL="${BASE_URL}/20260513/Ascend-cann-910-ops_9.1.0_linux-x86_64.run"
NNAL_URL="${BASE_URL}/20260513/Ascend-cann-nnal_9.1.0_linux-x86_64.run"
OPS_GLOB="Ascend-cann-910*"
SET_ENV_PATH="/usr/local/Ascend/cann/set_env.sh"
;;
x86_64_A2)
TOOLKIT_URL="${CANN_BASE_URL}/Ascend-cann-toolkit_9.1.0-beta.1_linux-x86_64.run"
OPS_URL="${CANN_BASE_URL}/Ascend-cann-910b-ops_9.1.0-beta.1_linux-x86_64.run"
NNAL_URL="${CANN_BASE_URL}/Ascend-cann-nnal_9.1.0-beta.1_linux-x86_64.run"
OPS_GLOB="Ascend-cann-910b-ops*"
SET_ENV_PATH="/usr/local/Ascend/cann/set_env.sh"
;;
x86_64_A3)
TOOLKIT_URL="${CANN_BASE_URL}/Ascend-cann-toolkit_9.1.0-beta.1_linux-x86_64.run"
OPS_URL="${CANN_BASE_URL}/Ascend-cann-A3-ops_9.1.0-beta.1_linux-x86_64.run"
NNAL_URL="${CANN_BASE_URL}/Ascend-cann-nnal_9.1.0-beta.1_linux-x86_64.run"
OPS_GLOB="Ascend-cann-A3-ops*"
SET_ENV_PATH="/usr/local/Ascend/cann/set_env.sh"
;;
# aarch64
aarch64_A1)
TOOLKIT_URL="${BASE_URL}/20260302/Ascend-cann-toolkit_9.0.0-beta.1_linux-aarch64.run"
OPS_URL="${BASE_URL}/20260302/Ascend-cann-910b-ops_9.0.0-beta.1_linux-aarch64.run"
NNAL_URL="${BASE_URL}/20260302/Ascend-cann-nnal_9.0.0-beta.1_linux-aarch64.run"
OPS_GLOB="Ascend-cann-910b*"
SET_ENV_PATH="/usr/local/Ascend/cann/set_env.sh"
;;
aarch64_A2)
TOOLKIT_URL="${CANN_BASE_URL}/Ascend-cann-toolkit_9.1.0-beta.1_linux-aarch64.run"
OPS_URL="${CANN_BASE_URL}/Ascend-cann-910b-ops_9.1.0-beta.1_linux-aarch64.run"
NNAL_URL="${CANN_BASE_URL}/Ascend-cann-nnal_9.1.0-beta.1_linux-aarch64.run"
OPS_GLOB="Ascend-cann-910b-ops*"
SET_ENV_PATH="/usr/local/Ascend/cann/set_env.sh"
;;
aarch64_A3)
TOOLKIT_URL="${CANN_BASE_URL}/Ascend-cann-toolkit_9.1.0-beta.1_linux-aarch64.run"
OPS_URL="${CANN_BASE_URL}/Ascend-cann-A3-ops_9.1.0-beta.1_linux-aarch64.run"
NNAL_URL="${CANN_BASE_URL}/Ascend-cann-nnal_9.1.0-beta.1_linux-aarch64.run"
OPS_GLOB="Ascend-cann-A3-ops*"
SET_ENV_PATH="/usr/local/Ascend/cann/set_env.sh"
;;
*)
echo "Unsupported combination: ${ARCH} + ${CANN_CHIP}"
exit 1
;;
esac

echo "Installing CANN ${CANN_CHIP} for ${ARCH}..."

echo "=== Creating HwHiAiUser user and group ==="
groupadd -f HwHiAiUser
id -u HwHiAiUser >/dev/null 2>&1 || useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash

rm -rf cann
mkdir -p cann && cd cann

echo "=== Downloading CANN packages ==="
curl -O "${TOOLKIT_URL}"
curl -O "${OPS_URL}"
curl -O "${NNAL_URL}"
echo "Download complete."

chmod +x Ascend-cann*.run

echo "=== Installing CANN toolkit ==="
./Ascend-cann-toolkit*.run --full --quiet --install-path=/usr/local/Ascend
source "${SET_ENV_PATH}"
echo "toolkit install success"

echo "=== Installing CANN ops ==="
./${OPS_GLOB}.run --install --quiet --install-path=/usr/local/Ascend
echo "ops install success"

echo "=== Installing CANN nnal ==="
./Ascend-cann-nnal*.run --install --quiet --install-path=/usr/local/Ascend
source /usr/local/Ascend/nnal/atb/set_env.sh
echo "nnal install success"

# Some CANN versions install to versioned paths (e.g. cann-9.0.0-beta.2)
# instead of /usr/local/Ascend/cann/. Fix broken symlinks so runtime
# sourcing of set_env.sh works.
if [ ! -f /usr/local/Ascend/cann/set_env.sh ]; then
CANN_REAL_DIR=$(ls -d /usr/local/Ascend/cann-* 2>/dev/null | head -1)
if [ -n "${CANN_REAL_DIR}" ]; then
ln -sf "${CANN_REAL_DIR}" /usr/local/Ascend/cann
echo "Fixed: linked ${CANN_REAL_DIR} -> /usr/local/Ascend/cann"
fi
fi

rm -rf *
echo "CANN ${CANN_CHIP} installation complete."
21 changes: 21 additions & 0 deletions .ci/docker/common/install_obs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/bash
# Install Huawei OBS util for object storage access.

set -e

ARCH=$(uname -m)
case "${ARCH}" in
x86_64) OBS_ARCH="amd64" ;;
aarch64) OBS_ARCH="arm64" ;;
*) echo "Unsupported architecture: ${ARCH}"; exit 1 ;;
esac

OBS_URL="https://obs-community.obs.cn-north-1.myhuaweicloud.com/obsutil/current/obsutil_linux_${OBS_ARCH}.tar.gz"

wget -q "${OBS_URL}"
mkdir -p /usr/local/obsutil
tar -zxf "obsutil_linux_${OBS_ARCH}.tar.gz" -C /usr/local/obsutil/
rm -f "obsutil_linux_${OBS_ARCH}.tar.gz"
ln -sf /usr/local/obsutil/obsutil_linux_${OBS_ARCH}_*/obsutil /usr/local/bin/obsutil

echo "OBS util installed."
19 changes: 19 additions & 0 deletions .ci/docker/common/install_triton.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/bash
# Install triton-ascend for NPU.
# Usage: ./install_triton.sh <PYTHON_VERSION>
# PYTHON_VERSION: e.g. 3.10, 3.11, 3.12, 3.13

set -e

TRITON_VERSION="${TRITON_VERSION:-3.2.1}"
PYTHON_VERSION="${1:?Usage: $0 <PYTHON_VERSION> (e.g. 3.10)}"

ARCH=$(uname -m)
PY_SHORT=$(echo "${PYTHON_VERSION}" | tr -d '.')

TRITON_WHL="triton_ascend-${TRITON_VERSION}-cp${PY_SHORT}-cp${PY_SHORT}-manylinux_2_27_${ARCH}.manylinux_2_28_${ARCH}.whl"
TRITON_URL="https://gitcode.com/Ascend/triton-ascend/releases/download/v${TRITON_VERSION}/${TRITON_WHL}"

echo "Installing triton-ascend ${TRITON_VERSION} for Python ${PYTHON_VERSION} (${ARCH})..."
pip3 install --no-cache-dir "${TRITON_URL}"
echo "triton-ascend installed."
56 changes: 56 additions & 0 deletions .ci/docker/docker_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/bash
# Docker image build script for torch-npu CI test images (aarch64 only).
#
# Usage:
# ./docker_build.sh <IMAGE_TAG>
#
# Examples:
# ./docker_build.sh torch-npu-test-aarch64-cann-a2-py3.10-torch-nightly
# ./docker_build.sh torch-npu-test-aarch64-cann-a3-py3.10-torch-nightly

set -euo pipefail

BASE_TAG="${1:?Usage: $0 <IMAGE_TAG>}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_CONTEXT="${SCRIPT_DIR}"

case "$BASE_TAG" in
torch-npu-test-aarch64-cann-a2-py3.10-torch-nightly)
CANN_CHIP=A2
PYTHON_VERSION=3.10
;;
torch-npu-test-aarch64-cann-a3-py3.10-torch-nightly)
CANN_CHIP=A3
PYTHON_VERSION=3.10
;;
*)
echo "ERROR: Unknown image tag: $BASE_TAG"
echo ""
echo "Supported tags:"
echo " torch-npu-test-aarch64-cann-a2-py3.10-torch-nightly"
echo " torch-npu-test-aarch64-cann-a3-py3.10-torch-nightly"
exit 1
;;
esac

TIMESTAMP="$(date +%Y%m%d%H%M)"
TAG="${BASE_TAG}-${TIMESTAMP}"

DOCKERFILE="${SCRIPT_DIR}/test/Dockerfile.aarch64"

echo "=== Image Configuration ==="
echo " Architecture: aarch64"
echo " CANN Chip: ${CANN_CHIP}"
echo " Python: ${PYTHON_VERSION}"
echo " PyTorch: nightly"
echo " Full Tag: ${TAG}"

echo "=== Building test image: ${TAG} ==="
docker build \
--build-arg CANN_CHIP="${CANN_CHIP}" \
--build-arg PYTHON_VERSION="${PYTHON_VERSION}" \
--tag "${TAG}" \
--file "${DOCKERFILE}" \
"${BUILD_CONTEXT}"

echo "=== Image built successfully: ${TAG} ==="
11 changes: 11 additions & 0 deletions .ci/docker/requirements-post.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Python dependencies that require PyTorch to be pre-installed.
# Install AFTER PyTorch is built, before running tests.
# Uses PyTorch nightly index to resolve torch-dependent packages.

--index-url https://download.pytorch.org/whl/nightly/cpu
--extra-index-url https://pypi.org/simple
-f https://data.pyg.org/whl/torch-2.13.0+cpu.html

torchvision
torch_geometric==2.5.3
torch-scatter==2.1.2
Loading