Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
168 changes: 168 additions & 0 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Copyright (c) 2026 Hygon Information Technology Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause

name: pr-test

on:
pull_request:
branches:
- v2.12
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read

concurrency:
group: fastpt-pr-test-${{ github.event.pull_request.number }}
cancel-in-progress: true

env:
DTK_PKG_URL: ${{ vars.RESOURCE_SERVER_URL }}/dtk-pkg/dtk26.04/DTK-26.04-rc4-centos8-x86_64.tar.gz
PYPI_URL: ${{ vars.PYPI_URL }}
PYTORCH_REF: 2.12.0-dev
HIP_TORCH_PATH: ${{ github.workspace }}/pytorch-das

jobs:
test:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: self-hosted
timeout-minutes: 480
container:
image: ${{ vars.DTK2604_IMAGE_UBUNTU_PY310 }}
options: >-
--device=/dev/kfd --device=/dev/dri/ --group-add video
-v /opt/hyhal/:/opt/hyhal/:ro
--shm-size=80G
--cap-add=SYS_PTRACE
--security-opt seccomp=unconfined
--privileged=true

steps:
- name: Checkout PR with latest v2.12
uses: actions/checkout@v4

Check warning on line 42 in .github/workflows/pr-test.yml

View workflow job for this annotation

GitHub Actions / Checks / Repository & code quality

WORKFLOW.MUTABLE_USES

Workflow 使用可移动 Action 或 reusable workflow 引用;建议固定为组织审核通过的完整 40 位 Commit SHA;当前仅提示。
with:
fetch-depth: 0
submodules: recursive
persist-credentials: false

- name: Prepare logs and pip source
shell: bash
env:
PIP_INDEX: ${{ env.PYPI_URL }}/nightly/dtk2604/+simple/
run: |
set -euo pipefail
mkdir -p logs ~/.pip
TRUSTED_HOST="${PIP_INDEX#*://}"
TRUSTED_HOST="${TRUSTED_HOST%%/*}"
printf '%s\n' \
'[global]' \
"index-url = ${PIP_INDEX}" \
"trusted-host = ${TRUSTED_HOST}" \
> ~/.pip/pip.conf
echo "PIP_INDEX=${PIP_INDEX}" | tee logs/pip-source.log

- name: Install DTK
shell: bash
run: |
set -euo pipefail
{
cd /opt
wget -q "${DTK_PKG_URL}"
tar -xzf "$(basename "${DTK_PKG_URL}")"
rm -rf dtk
mv dtk-* dtk
} 2>&1 | tee "${GITHUB_WORKSPACE}/logs/install-dtk.log"

- name: Install AICC
shell: bash
env:
RESOURCE_SERVER_URL: ${{ vars.RESOURCE_SERVER_URL }}
run: |
set -euo pipefail
{
wget "${RESOURCE_SERVER_URL}/ai_cc/Nightly/hcu_llvm_installer.sh"
bash hcu_llvm_installer.sh --major 1.0.0
} 2>&1 | tee logs/install-aicc.log

- name: Install latest Torch 2.12 wheel
shell: bash
run: |
set -eo pipefail
export ROCM_PATH=/opt/dtk
source /opt/dtk/env.sh
source /opt/dtk/cuda/env.sh
set -u
{
python3 -m pip index versions torch
python3 -m pip install --no-cache-dir numpy==1.24.3 wheel setuptools cmake ninja
python3 -m pip install --no-cache-dir --upgrade --force-reinstall 'torch==2.12.0'
python3 -c 'import torch; print(f"torch={torch.__version__}"); print(f"torch.hip={torch.version.hip}")'
} 2>&1 | tee logs/torch-wheel.log

- name: Checkout PyTorch 2.12 source
uses: actions/checkout@v4

Check warning on line 103 in .github/workflows/pr-test.yml

View workflow job for this annotation

GitHub Actions / Checks / Repository & code quality

WORKFLOW.MUTABLE_USES

Workflow 使用可移动 Action 或 reusable workflow 引用;建议固定为组织审核通过的完整 40 位 Commit SHA;当前仅提示。
with:
repository: HYGON-AI/pytorch-das
ref: ${{ env.PYTORCH_REF }}
path: pytorch-das
fetch-depth: 1
persist-credentials: false
token: ${{ secrets.PYTORCH_READ_TOKEN }}

- name: Build FastPT wheel
shell: bash
env:
FASTPT_CTEST: "1"
run: |
set -eo pipefail
export ROCM_PATH=/opt/dtk
source /opt/dtk/env.sh
source /opt/dtk/cuda/env.sh
set -u
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
git config --global --add safe.directory "${HIP_TORCH_PATH}"
export TORCH_PATH="$(python3 -c 'import os, torch; print(os.path.dirname(torch.__file__))')"
{
echo "FastPT commit: $(git rev-parse HEAD)"
echo "PyTorch source: $(git -C "${HIP_TORCH_PATH}" rev-parse HEAD)"
echo "TORCH_PATH=${TORCH_PATH}"
echo "HIP_TORCH_PATH=${HIP_TORCH_PATH}"
python3 --version
cat /opt/dtk/.info/rocm_version 2>/dev/null || true
git submodule update --init --recursive
rm -rf build dist fastpt.egg-info torch-mocker/build
python3 setup.py bdist_wheel
ls -lh dist/*.whl
} 2>&1 | tee logs/build.log

- name: Install and verify FastPT
shell: bash
run: |
set -eo pipefail
export ROCM_PATH=/opt/dtk
source /opt/dtk/env.sh
source /opt/dtk/cuda/env.sh
set -u
{
python3 -m pip install --no-deps --force-reinstall dist/fastpt-*.whl
python3 -c 'import fastpt; print(fastpt.__version__)'
fastpt.hipify.file --help
} 2>&1 | tee logs/install-verify.log

- name: Run CTest
shell: bash
run: |
set -eo pipefail
export ROCM_PATH=/opt/dtk
source /opt/dtk/env.sh
source /opt/dtk/cuda/env.sh
set -u
export TORCH_PATH="$(python3 -c 'import os, torch; print(os.path.dirname(torch.__file__))')"
export LD_LIBRARY_PATH="${PWD}/torch-mocker/build:${TORCH_PATH}/lib:${LD_LIBRARY_PATH:-}"
ctest --test-dir torch-mocker/build --output-on-failure -j1 \
2>&1 | tee logs/ctest.log

- name: Clean workspace
if: always()
shell: bash
run: rm -rf "${GITHUB_WORKSPACE}"/* "${GITHUB_WORKSPACE}"/.[!.]* || true
21 changes: 21 additions & 0 deletions .github/workflows/quality-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Quality Gate

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- v2.12

permissions:
contents: read

concurrency:
group: fastpt-pr-gate-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
gate:
name: Checks
uses: HYGON-AI/quality-gate/.github/workflows/pr-quality-gate.yml@v2.0.3

Check warning on line 19 in .github/workflows/quality-gate.yml

View workflow job for this annotation

GitHub Actions / Checks / Repository & code quality

WORKFLOW.MUTABLE_USES

Workflow 使用可移动 Action 或 reusable workflow 引用;建议固定为组织审核通过的完整 40 位 Commit SHA;当前仅提示。
permissions:
contents: read
203 changes: 203 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# Copyright (c) 2026 Hygon Information Technology Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause

name: release-pypi

on:
push:
branches:
- v2.12
workflow_dispatch:

permissions:
contents: read
pull-requests: read
checks: read

env:
DTK_PKG_URL: ${{ vars.RESOURCE_SERVER_URL }}/dtk-pkg/dtk26.04/DTK-26.04-rc4-centos8-x86_64.tar.gz
PYPI_URL: ${{ vars.PYPI_URL }}
PYTORCH_REF: 2.12.0-dev
HIP_TORCH_PATH: ${{ github.workspace }}/pytorch-das

jobs:
compile-test-release:
concurrency:
group: fastpt-release-${{ github.ref }}-torch2.12
cancel-in-progress: true
runs-on: self-hosted
timeout-minutes: 480
container:
image: ${{ vars.DTK2604_IMAGE_UBUNTU_PY310 }}
options: >-
--device=/dev/kfd --device=/dev/dri/ --group-add video
-v /opt/hyhal/:/opt/hyhal/:ro
--shm-size=80G
--cap-add=SYS_PTRACE
--security-opt seccomp=unconfined
--privileged=true

steps:
- name: Checkout
uses: actions/checkout@v4

Check warning on line 42 in .github/workflows/release-pypi.yml

View workflow job for this annotation

GitHub Actions / Checks / Repository & code quality

WORKFLOW.MUTABLE_USES

Workflow 使用可移动 Action 或 reusable workflow 引用;建议固定为组织审核通过的完整 40 位 Commit SHA;当前仅提示。
with:
fetch-depth: 0
submodules: recursive

- name: Prepare logs and pip source
shell: bash
env:
PIP_INDEX: ${{ env.PYPI_URL }}/nightly/dtk2604/+simple/
run: |
set -euo pipefail
mkdir -p logs ~/.pip
TRUSTED_HOST="${PIP_INDEX#*://}"
TRUSTED_HOST="${TRUSTED_HOST%%/*}"
printf '%s\n' \
'[global]' \
"index-url = ${PIP_INDEX}" \
"trusted-host = ${TRUSTED_HOST}" \
> ~/.pip/pip.conf
echo "PIP_INDEX=${PIP_INDEX}" | tee logs/pip-source.log

- name: Install DTK
shell: bash
run: |
set -euo pipefail
{
cd /opt
wget -q "${DTK_PKG_URL}"
tar -xzf "$(basename "${DTK_PKG_URL}")"
rm -rf dtk
mv dtk-* dtk
} 2>&1 | tee "${GITHUB_WORKSPACE}/logs/install-dtk.log"

- name: Install AICC
shell: bash
env:
RESOURCE_SERVER_URL: ${{ vars.RESOURCE_SERVER_URL }}
run: |
set -euo pipefail
{
wget "${RESOURCE_SERVER_URL}/ai_cc/Nightly/hcu_llvm_installer.sh"
bash hcu_llvm_installer.sh --major 1.0.0
} 2>&1 | tee logs/install-aicc.log

- name: Install latest Torch 2.12 wheel
shell: bash
run: |
set -eo pipefail
export ROCM_PATH=/opt/dtk
source /opt/dtk/env.sh
source /opt/dtk/cuda/env.sh
set -u
{
python3 -m pip index versions torch
python3 -m pip install --no-cache-dir numpy==1.24.3 wheel setuptools cmake ninja
python3 -m pip install --no-cache-dir --upgrade --force-reinstall 'torch==2.12.0'
python3 -c 'import torch; print(f"torch={torch.__version__}"); print(f"torch.hip={torch.version.hip}")'
} 2>&1 | tee logs/torch-wheel.log

- name: Checkout PyTorch 2.12 source
uses: actions/checkout@v4

Check warning on line 102 in .github/workflows/release-pypi.yml

View workflow job for this annotation

GitHub Actions / Checks / Repository & code quality

WORKFLOW.MUTABLE_USES

Workflow 使用可移动 Action 或 reusable workflow 引用;建议固定为组织审核通过的完整 40 位 Commit SHA;当前仅提示。
with:
repository: HYGON-AI/pytorch-das
ref: ${{ env.PYTORCH_REF }}
path: pytorch-das
fetch-depth: 1
persist-credentials: false
token: ${{ secrets.PYTORCH_READ_TOKEN }}

- name: Build FastPT wheel
shell: bash
env:
FASTPT_CTEST: "1"
run: |
set -eo pipefail
export ROCM_PATH=/opt/dtk
source /opt/dtk/env.sh
source /opt/dtk/cuda/env.sh
set -u
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
git config --global --add safe.directory "${HIP_TORCH_PATH}"
export TORCH_PATH="$(python3 -c 'import os, torch; print(os.path.dirname(torch.__file__))')"
{
echo "FastPT commit: $(git rev-parse HEAD)"
echo "PyTorch source: $(git -C "${HIP_TORCH_PATH}" rev-parse HEAD)"
echo "TORCH_PATH=${TORCH_PATH}"
echo "HIP_TORCH_PATH=${HIP_TORCH_PATH}"
python3 --version
cat /opt/dtk/.info/rocm_version 2>/dev/null || true
git submodule update --init --recursive
rm -rf build dist fastpt.egg-info torch-mocker/build
python3 setup.py bdist_wheel
ls -lh dist/*.whl
} 2>&1 | tee logs/build.log

- name: Install and verify FastPT
shell: bash
run: |
set -eo pipefail
export ROCM_PATH=/opt/dtk
source /opt/dtk/env.sh
source /opt/dtk/cuda/env.sh
set -u
{
python3 -m pip install --no-deps --force-reinstall dist/fastpt-*.whl
python3 -c 'import fastpt; print(fastpt.__version__)'
fastpt.hipify.file --help
} 2>&1 | tee logs/install-verify.log

- name: Run CTest
shell: bash
run: |
set -eo pipefail
export ROCM_PATH=/opt/dtk
source /opt/dtk/env.sh
source /opt/dtk/cuda/env.sh
set -u
export TORCH_PATH="$(python3 -c 'import os, torch; print(os.path.dirname(torch.__file__))')"
export LD_LIBRARY_PATH="${PWD}/torch-mocker/build:${TORCH_PATH}/lib:${LD_LIBRARY_PATH:-}"
ctest --test-dir torch-mocker/build --output-on-failure -j1 \
2>&1 | tee logs/ctest.log

- name: Apply DAS local version to wheel
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
set -eo pipefail
export ROCM_PATH=/opt/dtk
source /opt/dtk/env.sh
source /opt/dtk/cuda/env.sh
set -u
{
python3 -m pip install --no-cache-dir ciupload
DTK_VER="$(echo "${DTK_PKG_URL}" | grep -oP 'dtk\K[0-9]+\.[0-9]+' | tr -d '.')"
TORCH_VERSION="$(python3 -c 'import torch; print(torch.__version__.split("+")[0])')"
WHEEL_COMMIT_SHA="$(git rev-parse HEAD)"
CIUpload REPAIR \
--dtk_version "${DTK_VER}" \
--torch_version "${TORCH_VERSION}" \
--git_commit "${WHEEL_COMMIT_SHA}" \
--outputdir output \
-f dist/fastpt-*.whl
} 2>&1 | tee logs/ciupload-repair.log

- name: Upload NIGHTLY
if: ${{ github.event_name == 'push' }}
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
CIUpload NIGHTLY \
--devpi_url "${PYPI_URL}" \
--password "${{ secrets.PYPI_PASSWORD }}" \
--dtk_pkg_name "$(basename "${DTK_PKG_URL}")" \
-f output/*.whl \
--record 2>&1 | tee logs/ciupload-nightly.log

- name: Clean workspace
if: always()
shell: bash
run: rm -rf "${GITHUB_WORKSPACE}"/* "${GITHUB_WORKSPACE}"/.[!.]* || true
Loading