diff --git a/.github/workflows/aipu-build-and-test.yml b/.github/workflows/aipu-build-and-test.yml index 50383b94c..c3f93e62c 100644 --- a/.github/workflows/aipu-build-and-test.yml +++ b/.github/workflows/aipu-build-and-test.yml @@ -5,6 +5,7 @@ on: branches: [ "triton_v3.3.x" ] pull_request: branches: [ "triton_v3.3.x" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -24,6 +25,8 @@ jobs: - name: Checkout code (attempt 1) id: checkout1 uses: actions/checkout@v6 + with: + fetch-depth: 0 continue-on-error: true - name: Sleep before checkout2 @@ -36,6 +39,8 @@ jobs: id: checkout2 if: steps.checkout1.outcome == 'failure' uses: actions/checkout@v6 + with: + fetch-depth: 0 continue-on-error: true - name: Sleep before final checkout @@ -47,6 +52,8 @@ jobs: - name: Checkout code (final attempt) if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure' uses: actions/checkout@v6 + with: + fetch-depth: 0 - name: Verify checkout success if: success() diff --git a/.github/workflows/ascend-build-and-test.yml b/.github/workflows/ascend-build-and-test.yml index ee502b37e..a7fb914a3 100644 --- a/.github/workflows/ascend-build-and-test.yml +++ b/.github/workflows/ascend-build-and-test.yml @@ -5,6 +5,7 @@ on: branches: [ "triton_v3.2.x" ] pull_request: branches: [ "triton_v3.2.x" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -17,6 +18,8 @@ jobs: - name: Checkout code (attempt 1) id: checkout1 uses: actions/checkout@v6 + with: + fetch-depth: 0 continue-on-error: true - name: Sleep before checkout2 @@ -29,6 +32,8 @@ jobs: id: checkout2 if: steps.checkout1.outcome == 'failure' uses: actions/checkout@v6 + with: + fetch-depth: 0 continue-on-error: true - name: Sleep before final checkout @@ -40,6 +45,8 @@ jobs: - name: Checkout code (final attempt) if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure' uses: actions/checkout@v6 + with: + fetch-depth: 0 - name: Verify checkout success if: success() @@ -82,3 +89,24 @@ jobs: python3 third_party/ascend/examples/tutorials/13-matrix-multiplication-optimized-flagtree.py python3 third_party/ascend/examples/tutorials/13-matrix-multiplication-optimized.py python3 third_party/ascend/examples/tutorials/14-accuracy-comparison.py + python3 python/test/ops/01_vector_add/01_vector_add.py + python3 python/test/ops/abs/abs.py + python3 python/test/ops/addmm/addmm.py + python3 python/test/ops/addmm/addmm_ascend.py + python3 python/test/ops/amax/amax.py + python3 python/test/ops/amax/amax_ascend_perf.py + python3 python/test/ops/apply_rotary_pos_emb/apply_rotary_pos_emb.py + python3 python/test/ops/apply_rotary_pos_emb/apply_rotary_pos_emb_ascend.py + python3 python/test/ops/argmin/argmin.py + python3 python/test/ops/argmin/argmin_ascend_perf.py + python3 python/test/ops/bmm/bmm_ascend.py + python3 python/test/ops/cumsum/cumsum.py + python3 python/test/ops/min_dim/min_dim.py + python3 python/test/ops/min_dim/min_dim_ascend_perf.py + python3 python/test/ops/sum_dim/sum_dim.py + python3 python/test/ops/varmean/var_mean_ascend.py + python3 -m pytest third_party/ascend/examples/pytest_ut --ignore=third_party/ascend/examples/pytest_ut/test_index_select.py \ + --ignore=third_party/ascend/examples/pytest_ut/test_linearize_permute.py \ + --ignore=third_party/ascend/examples/pytest_ut/test_logical_and.py \ + --ignore=third_party/ascend/examples/pytest_ut/test_logical_or.py \ + --ignore=third_party/ascend/examples/pytest_ut/test_triton_unified_attention.py diff --git a/.github/workflows/cambricon-build-and-test.yml b/.github/workflows/cambricon-build-and-test.yml index b101d5114..286fc598d 100644 --- a/.github/workflows/cambricon-build-and-test.yml +++ b/.github/workflows/cambricon-build-and-test.yml @@ -5,6 +5,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/enflame-build-and-test.yml b/.github/workflows/enflame-build-and-test.yml new file mode 100644 index 000000000..e62b9ab39 --- /dev/null +++ b/.github/workflows/enflame-build-and-test.yml @@ -0,0 +1,82 @@ +name: Enflame-Build-And-Test + +on: + push: + branches: [ "triton_v3.3.x" ] + pull_request: + branches: [ "triton_v3.3.x" ] + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + enflame-build-and-test: + runs-on: enflame + if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }} + 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: Checkout code (attempt 1) + id: checkout1 + uses: actions/checkout@v6 + with: + fetch-depth: 0 + continue-on-error: true + + - name: Sleep before checkout2 + if: steps.checkout1.outcome == 'failure' + run: | + echo "First checkout attempt failed. Sleeping for 120 seconds before retry..." + sleep 120 + + - name: Checkout code (attempt 2) + id: checkout2 + if: steps.checkout1.outcome == 'failure' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + continue-on-error: true + + - name: Sleep before final checkout + if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure' + run: | + echo "Second checkout attempt failed. Sleeping for 180 seconds before final retry..." + sleep 180 + + - name: Checkout code (final attempt) + if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Verify checkout success + if: success() + run: echo "Checkout completed successfully" + + - name: Check if only docs files changed + id: check_files + uses: ./.github/actions/check-docs-only + + - name: FlagTree Build on Enflame + if: steps.check_files.outputs.only_docs_changed != 'true' + shell: bash + run: | + set -x + pip uninstall -y triton + pip uninstall -y triton_gcu + export FLAGTREE_BACKEND=enflame + cd python + MAX_JOBS=32 python3 -m pip install . --no-build-isolation + + - name: FlagTree Test on Enflame + if: steps.check_files.outputs.only_docs_changed != 'true' + shell: bash + run: | + set -x + python3 -m pytest -s third_party/enflame/python/test/unit diff --git a/.github/workflows/hcu-build-and-test.yml b/.github/workflows/hcu-build-and-test.yml index 1b603a7a4..6a0605ef1 100644 --- a/.github/workflows/hcu-build-and-test.yml +++ b/.github/workflows/hcu-build-and-test.yml @@ -5,6 +5,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/hopper-build-and-test.yml b/.github/workflows/hopper-build-and-test.yml new file mode 100644 index 000000000..7df12b7eb --- /dev/null +++ b/.github/workflows/hopper-build-and-test.yml @@ -0,0 +1,159 @@ +name: Hopper-Build-And-Test + +on: + schedule: + - cron: '0 21 * * *' + push: + branches: [ "triton_v3.4.x", "triton_v3.5.x" ] + pull_request: + branches: [ "triton_v3.4.x", "triton_v3.5.x" ] + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + hopper-build-and-test: + runs-on: hopper + if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }} + 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: Checkout code (attempt 1) + id: checkout1 + uses: actions/checkout@v6 + with: + fetch-depth: 0 + continue-on-error: true + + - name: Sleep before checkout2 + if: steps.checkout1.outcome == 'failure' + run: | + echo "First checkout attempt failed. Sleeping for 120 seconds before retry..." + sleep 120 + + - name: Checkout code (attempt 2) + id: checkout2 + if: steps.checkout1.outcome == 'failure' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + continue-on-error: true + + - name: Sleep before final checkout + if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure' + run: | + echo "Second checkout attempt failed. Sleeping for 180 seconds before final retry..." + sleep 180 + + - name: Checkout code (final attempt) + if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Verify checkout success + if: success() + run: echo "Checkout completed successfully" + + - name: Check if only docs files changed + id: check_files + uses: ./.github/actions/check-docs-only + + - 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: FlagTree Build on NVidia (triton_v3.4.x branch) + if: ${{ steps.check_files.outputs.only_docs_changed != 'true' && env.TARGET_BRANCH == 'triton_v3.4.x' }} + shell: bash + run: | + set -x + pip uninstall -y triton + source ~/env-3.4.sh + MAX_JOBS=32 python3 -m pip install . --no-build-isolation + + - name: FlagTree Build on NVidia (triton_v3.5.x branch) + if: ${{ steps.check_files.outputs.only_docs_changed != 'true' && env.TARGET_BRANCH == 'triton_v3.5.x' }} + shell: bash + run: | + set -x + pip uninstall -y triton + source ~/env-3.5.sh + MAX_JOBS=32 python3 -m pip install . --no-build-isolation + + - name: FlagTree Test on NVidia (triton_v3.4.x branch) + if: ${{ steps.check_files.outputs.only_docs_changed != 'true' && env.TARGET_BRANCH == 'triton_v3.4.x' }} + shell: bash + run: | + set -x + # 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 \ + --ignore=python/test/unit/language/test_line_info.py + python3 -m pytest -s python/test/unit/runtime + if [ -d "python/test/operators" ]; then + python3 -m pytest -s python/test/operators + fi + + - name: FlagTree Test on NVidia (triton_v3.5.x branch) + if: ${{ steps.check_files.outputs.only_docs_changed != 'true' && env.TARGET_BRANCH == 'triton_v3.5.x' }} + 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 + # 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 \ + --ignore=python/test/unit/language/test_line_info.py + 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-sparse-mla.py + # python unit test + python3 -m pytest -s python/test/tle/integration + python3 -m pytest -s python/test/tle/unit + # flagtree hints + # python tutorials + python3 python/tutorials/hints/01/01-vector-add.py --only_unit_test + # python3 python/tutorials/hints/02/02-fused-softmax.py --only_unit_test + python3 python/tutorials/hints/03/03-matrix-multiplication.py --only_unit_test + python3 python/tutorials/hints/04/04-low-memory-dropout.py --only_unit_test + python3 python/tutorials/hints/05/05-layer-norm.py --only_unit_test + python3 python/tutorials/hints/06/06-fused-attention.py --only_unit_test + python3 python/tutorials/hints/07/07-extern-functions.py --only_unit_test + python3 python/tutorials/hints/08/08-grouped-gemm.py --only_unit_test + python3 python/tutorials/hints/11/11-programmatic-dependent-launch.py --only_unit_test + # flagtree tle raw + # python3 python/tutorials/tle/raw/01-vector-add.py + # python3 python/tutorials/tle/raw/02-fused-softmax.py + # python3 python/tutorials/tle/raw/03-matrix-multiplication.py diff --git a/.github/workflows/iluvatar-build-and-test.yml b/.github/workflows/iluvatar-build-and-test.yml index c06df3ac0..f140472a4 100644 --- a/.github/workflows/iluvatar-build-and-test.yml +++ b/.github/workflows/iluvatar-build-and-test.yml @@ -5,6 +5,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -79,7 +80,7 @@ jobs: run: | set -x source ~/env.sh - python3 -m pytest -s third_party/iluvatar/python/test/unit + CUDA_VISIBLE_DEVICES=15 python3 -m pytest -s third_party/iluvatar/python/test/unit ./python/build/cmake.linux-x86_64-cpython-3.10/bin/triton-opt --pass-pipeline='builtin.module(convert-triton-to-tritongpu{target="cuda:CC" num-warps=4 threads-per-warp=32 num-ctas=1})' ./test/bin/iluvatar/add_kernel.ttir ./python/build/cmake.linux-x86_64-cpython-3.10/bin/triton-opt --convert-arith-to-llvm ./test/bin/iluvatar/add_kernel.ttgir cd python/tutorials diff --git a/.github/workflows/metax-build-and-test.yml b/.github/workflows/metax-build-and-test.yml index 28f471fc0..0a4786b55 100644 --- a/.github/workflows/metax-build-and-test.yml +++ b/.github/workflows/metax-build-and-test.yml @@ -5,6 +5,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/mthreads-build-and-test.yml b/.github/workflows/mthreads-build-and-test.yml index c2b4feb43..f8948efcc 100644 --- a/.github/workflows/mthreads-build-and-test.yml +++ b/.github/workflows/mthreads-build-and-test.yml @@ -5,6 +5,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/nv-build-and-test.yml b/.github/workflows/nv-build-and-test.yml index 0b3c4706b..956f3a213 100644 --- a/.github/workflows/nv-build-and-test.yml +++ b/.github/workflows/nv-build-and-test.yml @@ -7,6 +7,7 @@ on: branches: [ "main", "triton_v3.2.x", "triton_v3.3.x", "triton_v3.4.x", "triton_v3.5.x" ] pull_request: branches: [ "main", "triton_v3.2.x", "triton_v3.3.x", "triton_v3.4.x", "triton_v3.5.x" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/sunrise-build-and-test.yml b/.github/workflows/sunrise-build-and-test.yml new file mode 100644 index 000000000..8faef21b9 --- /dev/null +++ b/.github/workflows/sunrise-build-and-test.yml @@ -0,0 +1,81 @@ +name: Sunrise-Build-And-Test + +on: + push: + branches: [ "triton_v3.4.x" ] + pull_request: + branches: [ "triton_v3.4.x" ] + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + sunrise-build-and-test: + runs-on: sunrise + if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }} + 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: Checkout code (attempt 1) + id: checkout1 + uses: actions/checkout@v6 + with: + fetch-depth: 0 + continue-on-error: true + + - name: Sleep before checkout2 + if: steps.checkout1.outcome == 'failure' + run: | + echo "First checkout attempt failed. Sleeping for 120 seconds before retry..." + sleep 120 + + - name: Checkout code (attempt 2) + id: checkout2 + if: steps.checkout1.outcome == 'failure' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + continue-on-error: true + + - name: Sleep before final checkout + if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure' + run: | + echo "Second checkout attempt failed. Sleeping for 180 seconds before final retry..." + sleep 180 + + - name: Checkout code (final attempt) + if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Verify checkout success + if: success() + run: echo "Checkout completed successfully" + + - name: Check if only docs files changed + id: check_files + uses: ./.github/actions/check-docs-only + + - name: FlagTree Build on Sunrise + if: steps.check_files.outputs.only_docs_changed != 'true' + shell: bash + run: | + set -x + pip uninstall -y triton + source third_party/sunrise/script/docker_sunrise_env.sh ~/.flagtree/sunrise/sunrise_llvm21_dev_release + export FLAGTREE_BACKEND=sunrise + MAX_JOBS=32 python3 -m pip install . --no-build-isolation + + - name: FlagTree Test on Sunrise + if: steps.check_files.outputs.only_docs_changed != 'true' + shell: bash + run: | + set -x + python3 third_party/sunrise/python/test_examples/vector-add.py diff --git a/.github/workflows/tsingmicro-build-and-test.yml b/.github/workflows/tsingmicro-build-and-test.yml index 687ce2f3e..1ed1788a0 100644 --- a/.github/workflows/tsingmicro-build-and-test.yml +++ b/.github/workflows/tsingmicro-build-and-test.yml @@ -5,6 +5,7 @@ on: branches: [ "triton_v3.3.x" ] pull_request: branches: [ "triton_v3.3.x" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -15,9 +16,17 @@ jobs: runs-on: tsingmicro if: ${{ github.repository == 'FlagTree/flagtree' || github.repository == 'flagos-ai/flagtree' }} 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: Checkout code (attempt 1) id: checkout1 uses: actions/checkout@v6 + with: + fetch-depth: 0 continue-on-error: true - name: Sleep before checkout2 @@ -30,6 +39,8 @@ jobs: id: checkout2 if: steps.checkout1.outcome == 'failure' uses: actions/checkout@v6 + with: + fetch-depth: 0 continue-on-error: true - name: Sleep before final checkout @@ -41,6 +52,8 @@ jobs: - name: Checkout code (final attempt) if: steps.checkout1.outcome == 'failure' && steps.checkout2.outcome == 'failure' uses: actions/checkout@v6 + with: + fetch-depth: 0 - name: Verify checkout success if: success() @@ -69,3 +82,24 @@ jobs: source ~/env.sh python3.11 -c 'import triton; print(triton.__path__)' /usr/local/lib/python3.11/dist-packages/triton/backends/tsingmicro/bin/tsingmicro-opt --version + export TX8_DEPS_ROOT=~/.flagtree/tsingmicro/tx8_deps + export LLVM_SYSPATH=~/.flagtree/tsingmicro/tsingmicro-llvm21-glibc2.30-glibcxx3.4.28-python3.10-x64 + export LLVM_BINARY_DIR=${LLVM_SYSPATH}/bin + export PYTHONPATH=${LLVM_SYSPATH}/python_packages/mlir_core:$PYTHONPATH + export LD_LIBRARY_PATH=$TX8_DEPS_ROOT/lib:$LD_LIBRARY_PATH + + cd third_party/tsingmicro/examples + python3 bare_matmul_autotune.py >result-bare_matmul_autotune.txt + python3 embedding.py >result-embedding.txt + python3 mult_ir.py >result-mult_ir.txt + python3 profile_matmul.py >result-profile_matmul.txt + python3 quant_gptq.py >result-quant_gptq.txt + python3 test_cos.py >result-test_cos.txt + python3 test_embedding.py >result-test_embedding.txt + python3 test_flip.py >result-test_flip.txt + python3 test_layernorm.py >result-test_layernorm.txt + python3 test_matmul.py >result-test_matmul.txt + python3 test_print.py >result-test_print.txt + python3 test_softmax.py >result-test_softmax.txt + python3 test_vec_add.py >result-test_vec_add.txt + python3 time1.py >result-time1.txt diff --git a/.github/workflows/xpu-build-and-test.yml b/.github/workflows/xpu-build-and-test.yml index efe6b66c7..4fc4c78e7 100644 --- a/.github/workflows/xpu-build-and-test.yml +++ b/.github/workflows/xpu-build-and-test.yml @@ -6,6 +6,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}