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
141 changes: 141 additions & 0 deletions .github/workflows/amd3.6-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Copyright 2025- FlagOS Contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

name: Amd3.6-Build-And-Test

on:
push:
branches: [ "main", "triton_v3.6.x" ]
pull_request:
branches: [ "main", "triton_v3.6.x" ]
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read
pull-requests: read

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

jobs:
amd36x-unit-test:
runs-on: amd3.6
if: ${{ github.repository == 'flagos-ai/flagtree' && github.event.pull_request.draft == false }}
steps:
- name: Setup environment
shell: bash
run: |
source ~/env.sh
env | grep -E '^(http_proxy|https_proxy|all_proxy|no_proxy)=' >> $GITHUB_ENV || true

- name: Smart Checkout
uses: flagos-ai/FlagTree/.github/actions/smart-checkout@main
with:
checkout_version: 'v6'

- name: Check if backend-relevant files changed
id: check_backend
uses: flagos-ai/FlagTree/.github/actions/check-backend-changed@main
with:
backend: amd

- name: Cleanup FlagTree Environment
if: ${{ steps.check_backend.outputs.should_skip != 'true' }}
uses: flagos-ai/FlagTree/.github/actions/cleanup-flagtree-env@main

- name: Detect Target Branch
shell: bash
run: |
set -x
if [ "${{ github.event_name }}" = "pull_request" ]; then
TARGET_BRANCH="${{ github.base_ref }}"
else
TARGET_BRANCH="${{ github.ref_name }}"
fi
echo "TARGET_BRANCH=$TARGET_BRANCH" >> $GITHUB_ENV
echo "TARGET_BRANCH=$TARGET_BRANCH"

- name: Build FlagTree
if: ${{ steps.check_backend.outputs.should_skip != 'true' }}
shell: bash
run: |
set -x
source ~/env-3.6.sh
MAX_JOBS=32 python3 -m pip install . --no-build-isolation -v

- name: Clear cache if ClearCache label present
if: steps.check_backend.outputs.should_skip != 'true'
id: clear_cache
uses: flagos-ai/FlagTree/.github/actions/clear-cache-if-labeled@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
backend: amd

- name: Unit Test
if: ${{ steps.check_backend.outputs.should_skip != 'true' }}
shell: bash
run: |
set -x
source ~/env.sh
## python tutorials
python3 python/tutorials/01-vector-add.py --only_unit_test
python3 python/tutorials/02-fused-softmax.py --only_unit_test
python3 python/tutorials/03-matrix-multiplication.py --only_unit_test
python3 python/tutorials/04-low-memory-dropout.py --only_unit_test
python3 python/tutorials/05-layer-norm.py --only_unit_test
# python3 python/tutorials/06-fused-attention.py --only_unit_test
python3 python/tutorials/07-extern-functions.py --only_unit_test
python3 python/tutorials/08-grouped-gemm.py --only_unit_test
# python3 python/tutorials/09-persistent-matmul.py --only_unit_test
# python3 python/tutorials/11-programmatic-dependent-launch.py --only_unit_test
# python3 python/tutorials/12-fused_inv_rope_fp8_quant_reorder.py --only_unit_test
## python unit test
python3 -m pytest -s python/test/unit/cuda
python3 -m pytest -s python/test/unit/instrumentation
python3 -m pytest -s python/test/unit/language \
-k "not test_typeconvert_upcast and \
not test_typeconvert_downcast" \
--ignore=python/test/unit/language/test_core.py \
--ignore=python/test/unit/language/test_line_info.py
python3 -m pytest -s --first-parameter-only \
python/test/unit/language/test_core.py \
-k "not test_sum_dtype and \
not test_dot_multidim"
python3 -m pytest -s python/test/unit/runtime
if [ -d "python/test/operators" ]; then
python3 -m pytest -s python/test/operators
fi
## flagtree tle python tutorials
python3 python/tutorials/tle/01-fft.py
# python3 python/tutorials/tle/02-moe_align_block_size.py
python3 python/tutorials/tle/03-topk.py
# python3 python/tutorials/tle/04-cluster-gemm.py
# python3 python/tutorials/tle/deepseek_v32/01-topk_selector.py
# python3 python/tutorials/tle/deepseek_v32/02-sparse-mla.py
## flagtree tle python unit test
python3 -m pytest -s python/test/tle/integration \
--ignore=python/test/tle/integration/test_tle_distributed.py \
--ignore=python/test/tle/integration/test_tle_tma_copy.py
python3 -m pytest -s python/test/tle/unit \
--ignore=python/test/tle/unit/test_tle_distributed_d2d.py \
--ignore=python/test/tle/unit/test_tle_get_local_pe.py \
--ignore=python/test/tle/unit/test_tle_d2d_barrier.py \
--ignore=python/test/tle/unit/test_tle_get_node_rank.py
183 changes: 183 additions & 0 deletions .github/workflows/amd3.6-delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# Copyright 2025- FlagOS Contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

name: CD-Amd3.6

permissions:
contents: write

on:
workflow_dispatch:
inputs:
WHL_VER:
description: '0.6.0.dev1 < 0.6.0a1 < 0.6.0b1 < 0.6.0rc1 < 0.6.0 < 0.6.0.post1'
required: true
default: '0.6.0'
PYTHON_VER:
required: true
default: '3.12'
PLATFORM:
required: true
default: 'x86_64'
BRANCH:
required: true
default: 'main'
TRITON:
required: true
default: '3.6'
BACKEND:
required: true
default: 'amd'
FLAGTREE_PYPI_KEY:
required: false
workflow_call:
inputs:
WHL_VER:
type: string
required: true
default: '0.6.0'
PYTHON_VER:
type: string
required: true
default: '3.12'
PLATFORM:
type: string
required: true
default: 'x86_64'
BRANCH:
type: string
required: true
default: 'main'
TRITON:
type: string
required: true
default: '3.6'
BACKEND:
type: string
required: true
default: 'amd'
FLAGTREE_PYPI_KEY:
type: string
required: false

concurrency:
group: ${{ github.workflow }}-${{ inputs.WHL_VER }}-${{ inputs.PYTHON_VER }}-${{ inputs.PLATFORM }}
cancel-in-progress: true

jobs:
delivery:
runs-on: amd3.6-cd
if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }}
steps:
- name: Check branch
shell: bash
run: |
TARGET_BRANCH="${{ github.ref_name }}"
if [[ ! "$TARGET_BRANCH" =~ ^(${{ inputs.BRANCH }})$ ]]; then
echo "❌ This workflow must be run from branch '${{ inputs.BRANCH }}', but got '${TARGET_BRANCH}'"
exit 1
fi
echo "TARGET_BRANCH=$TARGET_BRANCH" >> $GITHUB_ENV
echo "✅ Branch check passed: ${TARGET_BRANCH}"

- name: Setup environment
shell: bash
run: |
source ~/env.sh
env | grep -E '^(http_proxy|https_proxy|all_proxy|no_proxy)=' >> $GITHUB_ENV || true

- name: Smart Checkout
uses: flagos-ai/FlagTree/.github/actions/smart-checkout@main
with:
checkout_version: 'v6'

- name: FlagTree bdist_wheel
if: ${{ env.TARGET_BRANCH == inputs.BRANCH }}
shell: bash
run: |
set -x
CHIP=""
TRITON_VER=${{ inputs.TRITON }}
source ~/env-${TRITON_VER}.sh # amd
unset FLAGTREE_BACKEND # amd
WHL_VER=${{ inputs.WHL_VER }}
PYTHON_VER=${{ inputs.PYTHON_VER }}
export FLAGTREE_WHEEL_VERSION="${WHL_VER}+${FLAGTREE_BACKEND}${CHIP}${TRITON_VER}"

RES="--index-url=https://resource.flagos.net/repository/flagos-pypi-hosted/simple"
if python${PYTHON_VER} -m pip download --no-deps "flagtree===${FLAGTREE_WHEEL_VERSION}" -d . $RES >/dev/null 2>&1; then
echo "❌ flagtree===${FLAGTREE_WHEEL_VERSION} already exists!"
exit 1
else
echo "✅ flagtree===${FLAGTREE_WHEEL_VERSION} does not exist, proceed to build"
fi

rm -rf ./build ./*.egg-info
{ export FLAGTREE_PYPI_KEY=${{ inputs.FLAGTREE_PYPI_KEY }}; } 2>/dev/null
# export TRITON_APPEND_CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release"
MAX_JOBS=32 python${PYTHON_VER} setup.py bdist_wheel -d ~/dist-flagtree
env | grep -E '^(FLAGTREE_WHEEL_VERSION)=' >> $GITHUB_ENV || true

- name: FlagTree push tag
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
TAG="${FLAGTREE_WHEEL_VERSION}"
git config user.name "flagtree-bot"
git config user.email "flagtree_ai@163.com"
if git rev-parse "${TAG}" >/dev/null 2>&1; then
echo "⚠️ Tag '${TAG}' already exists, force moving to current commit"
git tag -f -a "${TAG}" -m "pypi ${TAG}"
else
git tag -a "${TAG}" -m "pypi ${TAG}"
fi
MAX_RETRY=100
RETRY_INTERVAL=10
success=false
for i in $(seq 1 $MAX_RETRY); do
echo "Attempt ${i}/${MAX_RETRY}:"
if git push --force origin "${TAG}"; then
success=true
break
fi
echo "Push failed, retrying in ${RETRY_INTERVAL}s..."
sleep $RETRY_INTERVAL
done
if [ "$success" != "true" ]; then
echo "git push failed after $MAX_RETRY attempts"
exit 1
fi

- name: FlagTree upload whl
shell: bash
run: |
set -x
PLATFORM=${{ inputs.PLATFORM }}
PYTHON_VER=${{ inputs.PYTHON_VER }}
CP_VER=$(printf '%s' "$PYTHON_VER" | tr -d '.')
FLAGTREE_WHL="flagtree-${FLAGTREE_WHEEL_VERSION}-cp${CP_VER}-cp${CP_VER}-linux_${PLATFORM}.whl"
pushd ~/dist-flagtree
twine check ${FLAGTREE_WHL}
echo "Upload ${FLAGTREE_WHL}"
bash upload_flagtree_whl.sh "${FLAGTREE_WHL}"
popd
2 changes: 1 addition & 1 deletion .github/workflows/nvidia3.6-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
python3 python/tutorials/tle/01-fft.py
python3 python/tutorials/tle/02-moe_align_block_size.py
python3 python/tutorials/tle/03-topk.py
# python3 python/tutorials/tle/04-cluster-gemm.py # TODO: sometimes failed
python3 python/tutorials/tle/04-cluster-gemm.py
python3 python/tutorials/tle/deepseek_v32/01-topk_selector.py
python3 python/tutorials/tle/deepseek_v32/02-sparse-mla.py
## flagtree tle python unit test
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Some backends support multiple Triton versions; only the latest version is shown

|Branch |Vendor|Backend|Triton<br>version|Installation|
|:-------|:-----|:------|:----------------|:-----------|
|[main](https://github.com/flagos-ai/flagtree/tree/main)|NVIDIA<br>NVIDIA TileIR<br>AMD<br>Enflame(燧原)<br>ILUVATAR(天数智芯)<br>HYGON(海光信息)<br>Moore Threads(摩尔线程)<br>DAMO ACADEMY(阿里达摩院)<br>Huixi(辉羲智能)<br>MetaX(沐曦股份)<br>Sunrise(曦望芯科)<br>KLX<br>T-Head(平头哥)<br>SpacemiT(进迭时空)|[nvidia](/third_party/nvidia/)<br>[tileir](/third_party/tileir/)<br>[amd](/third_party/amd/)<br>[enflame](/third_party/enflame/)<br>[iluvatar](/third_party/iluvatar/)<br>[hcu](/third_party/hcu/)<br>[mthreads](/third_party/mthreads/)<br>[damoacademy](/third_party/thrive/)<br>[rpu](/third_party/rpu/)<br>[metax](/third_party/metax/)<br>[sunrise](/third_party/sunrise/)<br>[xpu](/third_party/xpu/)<br>[ppu](/third_party/ppu/)<br>[spacemit](/third_party/spacemit/)|3.6|[install nvidia](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-nvidia)<br>[install tileir](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-tileir)<br>-<br>[install enflame](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-enflame)<br>[install iluvatar](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-iluvatar)<br>[install hcu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-hcu)<br>[install mthreads](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-mthreads)<br>-<br>[install rpu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-rpu)<br>[install metax](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-metax)<br>[install sunrise](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-sunrise)<br>[install xpu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-xpu)<br>[install ppu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-ppu)<br>[install spacemit](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-spacemit)|
|[main](https://github.com/flagos-ai/flagtree/tree/main)|NVIDIA<br>NVIDIA TileIR<br>AMD<br>Enflame(燧原)<br>ILUVATAR(天数智芯)<br>HYGON(海光信息)<br>Moore Threads(摩尔线程)<br>DAMO ACADEMY(阿里达摩院)<br>Huixi(辉羲智能)<br>MetaX(沐曦股份)<br>Sunrise(曦望芯科)<br>KLX<br>T-Head(平头哥)<br>SpacemiT(进迭时空)|[nvidia](/third_party/nvidia/)<br>[tileir](/third_party/tileir/)<br>[amd](/third_party/amd/)<br>[enflame](/third_party/enflame/)<br>[iluvatar](/third_party/iluvatar/)<br>[hcu](/third_party/hcu/)<br>[mthreads](/third_party/mthreads/)<br>[damoacademy](/third_party/thrive/)<br>[rpu](/third_party/rpu/)<br>[metax](/third_party/metax/)<br>[sunrise](/third_party/sunrise/)<br>[xpu](/third_party/xpu/)<br>[ppu](/third_party/ppu/)<br>[spacemit](/third_party/spacemit/)|3.6|[install nvidia](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-nvidia)<br>[install tileir](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-tileir)<br>[install amd](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-amd)<br>[install enflame](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-enflame)<br>[install iluvatar](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-iluvatar)<br>[install hcu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-hcu)<br>[install mthreads](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-mthreads)<br>-<br>[install rpu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-rpu)<br>[install metax](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-metax)<br>[install sunrise](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-sunrise)<br>[install xpu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-xpu)<br>[install ppu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-ppu)<br>[install spacemit](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-spacemit)|
|[triton_v3.5.x](https://github.com/flagos-ai/flagtree/tree/triton_v3.5.x)|Huawei Ascend(华为昇腾)|[ascend](https://github.com/flagos-ai/FlagTree/blob/triton_v3.5.x/third_party/ascend/)|3.5|[install ascend](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-ascend)|
|[triton_v3.3.x](https://github.com/flagos-ai/flagtree/tree/triton_v3.3.x)|ARM China(安谋科技)<br>Tsingmicro(清微智能)<br>ARM64 cpu<br>x86_64 cpu|[aipu](https://github.com/flagos-ai/FlagTree/tree/triton_v3.3.x/third_party/aipu/)<br>[tsingmicro](https://github.com/flagos-ai/FlagTree/tree/triton_v3.3.x/third_party/tsingmicro/)<br>[cpu](https://github.com/flagos-ai/FlagTree/tree/triton_v3.3.x/third_party/cpu/)<br>[triton-shared](https://github.com/microsoft/triton-shared)|3.3|[install aipu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-aipu)<br>[install tsingmicro](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-tsingmicro)<br>[install cpu](https://github.com/flagos-ai/FlagTree/wiki/User-manual-for-cpu)<br>-|
|[triton_v3.2.x](https://github.com/flagos-ai/flagtree/tree/triton_v3.2.x)|Cambricon(寒武纪)|[cambricon](https://github.com/flagos-ai/FlagTree/tree/triton_v3.2.x/third_party/cambricon/)|3.2|-|
Expand Down Expand Up @@ -92,6 +92,7 @@ The following uses the mm operator under some shapes called in the Qwen model as

## Latest News

* 2026/08/21 [amd](/third_party/amd/) backend support for TLE and added CI/CD.
* 2026/08/18 Added the [spacemit](/third_party/spacemit/) backend integration (based on Triton 3.6) and added CI/CD.
* 2026/08/04 Added the [ppu](/third_party/ppu/) backend integration (based on Triton 3.6) and added CI/CD.
* 2026/07/07 Added the NVIDIA [tileir](/third_party/tileir/) backend integration (based on Triton 3.6) and added CI/CD.
Expand Down
Loading
Loading