Skip to content

Commit cfcbfca

Browse files
committed
Merge remote-tracking branch 'flagos-upstream/main' into Kunlun-dev
# Conflicts: # .github/workflows/all_tests_kunlun.yml
2 parents d087f1d + dea7cd6 commit cfcbfca

23 files changed

Lines changed: 1086 additions & 6 deletions

File tree

.github/configs/ascend.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
hardware_name: ascend
55
display_name: 'Huawei Ascend NPU'
6+
checkout_submodules: recursive
67

78
# CI image for the Ascend environment
89
ci_image: harbor.baai.ac.cn/flagos-dev/transformerengine-fl:85c2523-ascend-dev

.github/configs/hygon.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Hygon DCU / DTK configuration for TransformerEngine-FL plugin QA.
2+
3+
hardware_name: hygon
4+
display_name: 'Hygon DCU (DTK)'
5+
checkout_submodules: 'false'
6+
7+
ci_image: harbor.baai.ac.cn/flagos-dev/transformerengine-fl:manual-20260717-hygon-dev
8+
9+
runner_labels:
10+
- hg-8g-cicd-te
11+
12+
container_volumes:
13+
- /opt/hyhal:/opt/hyhal
14+
15+
container_options: >-
16+
--privileged
17+
--ipc=host
18+
--shm-size=100g
19+
--ulimit memlock=-1
20+
--ulimit stack=67108864
21+
--user root
22+
--device=/dev/kfd
23+
--device=/dev/dri
24+
--group-add video
25+
26+
setup_script: .github/scripts/setup_hygon.sh
27+
28+
coverage:
29+
enabled: true
30+
required: false
31+
python: python3
32+
sources:
33+
- transformer_engine
34+
include:
35+
- transformer_engine/pytorch/*
36+
- transformer_engine/debug/*
37+
- transformer_engine/plugin/*
38+
omit:
39+
- '*/setup.py'
40+
- '*/transformer_engine/plugin/core/_build_config.py'
41+
42+
unit_test_matrix:
43+
- name: pytorch_debug
44+
runner: script
45+
path: tests/plugin/backend/hygon/run_native.sh
46+
args: [debug]
47+
env:
48+
XML_LOG_DIR: logs/L0_pytorch_debug_unittest-hygon
49+
50+
- name: pytorch_unittest
51+
runner: script
52+
path: tests/plugin/backend/hygon/run_native.sh
53+
args: [unittest]
54+
env:
55+
XML_LOG_DIR: logs/L0_pytorch_unittest-hygon
56+
57+
- name: pytorch_distributed_unittest
58+
runner: script
59+
path: tests/plugin/backend/hygon/run_native.sh
60+
args: [distributed]
61+
env:
62+
XML_LOG_DIR: logs/L1_pytorch_distributed_unittest-hygon
63+
64+
- name: pytorch_onnx_unittest
65+
runner: script
66+
path: tests/plugin/backend/hygon/run_native.sh
67+
args: [onnx]
68+
env:
69+
XML_LOG_DIR: logs/L1_pytorch_onnx_unittest-hygon
70+
71+
integration_test_matrix:
72+
- name: pytorch_mcore_integration
73+
path: tests/plugin/backend/hygon/run_integration.sh
74+
75+
device_types:
76+
- bw1000

.github/configs/metax.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
hardware_name: metax
66
display_name: 'Metax Tests'
7-
checkout_submodules: 'false'
7+
checkout_submodules: recursive
88

99
# CI image for Metax dev env
1010
# ci_image: localhost:5000/megatron-lm-with-te:v1

.github/configs/musa.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# MooreThreads MUSA Hardware Configuration for TransformerEngine-FL
2+
3+
hardware_name: mthreads
4+
display_name: 'MooreThreads MUSA Tests'
5+
checkout_submodules: recursive
6+
7+
# CI image for MooreThreads MUSA dev env
8+
ci_image: harbor.baai.ac.cn/flagos-dev/transformerengine-fl:f826afe-musa-dev
9+
10+
# Runner labels for self-hosted MooreThreads node
11+
# Adjust this label to match the actual GitHub Actions runner label.
12+
runner_labels:
13+
- mt-8g-cicd-te
14+
15+
# Container volumes
16+
container_volumes:
17+
- /dev/dri:/dev/dri
18+
- /home/flagscale_cicd/flask/static:/workspace/report
19+
20+
# Container options
21+
container_options: >-
22+
--runtime=mthreads
23+
--ipc=host
24+
--privileged=true
25+
--shm-size=100gb
26+
--ulimit memlock=-1
27+
--ulimit stack=67108864
28+
--user root
29+
--group-add video
30+
-e PLATFORM=mthreads
31+
-e MTHREADS_VISIBLE_DEVICES=all
32+
-e MTHREADS_DRIVER_CAPABILITIES=all
33+
-e MUSA_HOME=/usr/local/musa
34+
-e PIP_NO_INDEX=1
35+
-e PIP_DISABLE_PIP_VERSION_CHECK=1
36+
-e LD_LIBRARY_PATH=/usr/lib:/usr/lib/x86_64-linux-gnu:/usr/local/musa/lib:/usr/local/openmpi/lib:$LD_LIBRARY_PATH
37+
38+
# Platform-specific environment setup script
39+
setup_script: .github/scripts/setup_musa.sh
40+
41+
# Device types to run tests on
42+
device_types:
43+
- s5000
44+
45+
coverage:
46+
enabled: true
47+
required: false
48+
python: python3
49+
sources:
50+
- transformer_engine
51+
include:
52+
- transformer_engine/pytorch/*
53+
- transformer_engine/debug/*
54+
- transformer_engine/plugin/*
55+
omit:
56+
- '*/setup.py'
57+
- '*/transformer_engine/plugin/core/_build_config.py'
58+
59+
# MUSA launchers keep platform-specific selection outside shared QA scripts.
60+
unit_test_matrix:
61+
- name: pytorch_debug
62+
runner: script
63+
path: tests/plugin/backend/musa/run_native_tests.sh
64+
- name: pytorch_unittest
65+
runner: script
66+
path: tests/plugin/backend/musa/run_native_tests.sh
67+
- name: pytorch_distributed_utils
68+
runner: script
69+
path: tests/plugin/backend/musa/run_native_tests.sh
70+
- name: pytorch_onnx_unittest
71+
runner: script
72+
path: tests/plugin/backend/musa/run_native_tests.sh
73+
74+
integration_test_matrix:
75+
- name: pytorch_mcore_integration
76+
path: tests/integration/musa/run_mcore.sh

.github/scripts/setup_hygon.sh

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
#!/usr/bin/env bash
2+
# Hygon/DTK environment setup for TransformerEngine-FL plugin QA.
3+
set -euo pipefail
4+
5+
WORKSPACE="${GITHUB_WORKSPACE:-$(pwd)}"
6+
7+
echo "===== Load Hygon/DTK runtime environment ====="
8+
source "$WORKSPACE/tests/plugin/backend/hygon/set_env.sh"
9+
10+
# Hygon CI is a reference-backend baseline. Force the selection policy here so
11+
# inherited shell state cannot silently fall back to FlagOS.
12+
export TE_FL_SKIP_CUDA=1
13+
export TE_FL_PREFER=reference
14+
export NVTE_FRAMEWORK=pytorch
15+
export NVTE_FLASH_ATTN=0
16+
export NVTE_FUSED_ATTN=0
17+
export NVTE_UNFUSED_ATTN=1
18+
export NVTE_UnfusedDPA_Emulate_FP8=1
19+
20+
echo "===== Verify Hygon device visibility ====="
21+
if [ "${HYGON_REQUIRE_DEVICE:-1}" = "1" ] && ! command -v hy-smi >/dev/null 2>&1; then
22+
echo "ERROR: hy-smi is unavailable in the Hygon CI image" >&2
23+
exit 1
24+
elif command -v hy-smi >/dev/null 2>&1; then
25+
hy-smi
26+
else
27+
echo "WARNING: hy-smi is unavailable; device verification is disabled"
28+
fi
29+
30+
echo "===== Verify Python runtime ====="
31+
"$PYTHON_BIN" - <<'PY'
32+
import os
33+
import sys
34+
35+
print("python:", sys.executable)
36+
print("version:", sys.version)
37+
38+
try:
39+
import torch
40+
except ModuleNotFoundError as exc:
41+
raise SystemExit(f"PyTorch is required in the Hygon CI image: {exc}") from exc
42+
43+
print("torch:", torch.__version__)
44+
45+
if os.environ.get("HYGON_REQUIRE_DEVICE", "1") == "1":
46+
if not torch.cuda.is_available():
47+
raise SystemExit("Hygon DCU is not visible through torch.cuda")
48+
49+
device_count = torch.cuda.device_count()
50+
if device_count < 1:
51+
raise SystemExit("torch.cuda reports zero Hygon devices")
52+
53+
device = torch.device("cuda")
54+
lhs = torch.ones((2, 2), device=device)
55+
rhs = torch.full((2, 2), 2.0, device=device)
56+
result = lhs @ rhs
57+
if not torch.allclose(result.cpu(), torch.full((2, 2), 4.0)):
58+
raise SystemExit("Hygon DCU matrix-multiplication smoke test failed")
59+
60+
print("cuda_device_count:", device_count)
61+
print("cuda_device_name:", torch.cuda.get_device_name(0))
62+
print("matmul_smoke: passed")
63+
PY
64+
65+
echo "===== Verify reference backend selection ====="
66+
"$PYTHON_BIN" - <<'PY'
67+
from transformer_engine.plugin.core import get_manager
68+
69+
manager = get_manager()
70+
selected_impl = manager.get_selected_impl_id("generic_gemm")
71+
if selected_impl != "reference.torch":
72+
raise SystemExit(
73+
f"Expected generic_gemm to use reference.torch, selected {selected_impl!r}"
74+
)
75+
print("generic_gemm_impl:", selected_impl)
76+
PY
77+
78+
echo "===== Install Hygon QA dependencies ====="
79+
if [ "${HYGON_SKIP_DEP_INSTALL:-0}" = "1" ]; then
80+
echo "Skipping Python dependency installation because HYGON_SKIP_DEP_INSTALL=1"
81+
else
82+
missing_modules=()
83+
for module_name in pytest expecttest coverage pytest_cov; do
84+
if ! "$PYTHON_BIN" -c "import importlib; importlib.import_module('$module_name')" >/dev/null 2>&1; then
85+
missing_modules+=("$module_name")
86+
fi
87+
done
88+
89+
if [ "${#missing_modules[@]}" -gt 0 ]; then
90+
echo "Missing Hygon QA modules: ${missing_modules[*]}"
91+
"$PYTHON_BIN" -m pip install pytest==8.2.1 expecttest coverage pytest-cov
92+
else
93+
echo "Hygon QA dependencies are already available in the image"
94+
fi
95+
96+
# ONNX dependencies are installed only by the ONNX test group.
97+
fi
98+
99+
"$PYTHON_BIN" -c "import coverage, pytest_cov; print('coverage dependencies: ready')"
100+
101+
if [ "${HYGON_INSTALL_TE:-0}" = "1" ]; then
102+
echo "===== Install TransformerEngine-FL Python layer ====="
103+
cd "$WORKSPACE"
104+
TE_FL_SKIP_CUDA=1 "$PYTHON_BIN" setup.py install
105+
else
106+
echo "Skipping TransformerEngine-FL install; tests run from source via PYTHONPATH"
107+
fi
108+
109+
if [ -n "${GITHUB_ENV:-}" ]; then
110+
{
111+
echo "PATH=$PATH"
112+
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}"
113+
echo "PYTHONPATH=$WORKSPACE${PYTHONPATH:+:$PYTHONPATH}"
114+
echo "TE_PATH=$WORKSPACE"
115+
echo "XML_LOG_DIR=$WORKSPACE/logs"
116+
echo "PLATFORM=$PLATFORM"
117+
echo "TE_FL_SKIP_CUDA=$TE_FL_SKIP_CUDA"
118+
echo "TE_FL_PREFER=$TE_FL_PREFER"
119+
echo "NVTE_FRAMEWORK=$NVTE_FRAMEWORK"
120+
echo "PYTHON_BIN=$PYTHON_BIN"
121+
echo "NVTE_FLASH_ATTN=$NVTE_FLASH_ATTN"
122+
echo "NVTE_FUSED_ATTN=$NVTE_FUSED_ATTN"
123+
echo "NVTE_UNFUSED_ATTN=$NVTE_UNFUSED_ATTN"
124+
echo "NVTE_UnfusedDPA_Emulate_FP8=$NVTE_UnfusedDPA_Emulate_FP8"
125+
echo "HYGON_REQUIRE_DEVICE=${HYGON_REQUIRE_DEVICE:-1}"
126+
} >> "$GITHUB_ENV"
127+
fi
128+
129+
echo "===== Hygon environment setup complete ====="

0 commit comments

Comments
 (0)