Skip to content

Commit aaf34a8

Browse files
committed
refactor: adopt modern InfiniCore execution
1 parent 270feb3 commit aaf34a8

455 files changed

Lines changed: 48728 additions & 28431 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/ci_config_nvidia.yaml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
repo:
2+
url: https://github.com/InfiniTensor/InfiniLM.git
3+
branch: main
4+
5+
github:
6+
status_context_prefix: "ci/infinilm"
7+
8+
platforms:
9+
nvidia:
10+
image:
11+
dockerfile: images/nvidia/
12+
build_args:
13+
BASE_IMAGE: nvcr.io/nvidia/pytorch:25.12-py3
14+
CUDA_ARCH: sm_80,sm_86,sm_89,sm_90
15+
APT_MIRROR: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
16+
PIP_INDEX_URL: https://pypi.org/simple
17+
InfiniCore_BRANCH: __Branch_Name__
18+
docker_args:
19+
- "--user=root"
20+
- "--network=host"
21+
- "--privileged"
22+
- "--cap-add=ALL"
23+
- "--pid=host"
24+
- "--ipc=host"
25+
- "--workdir=/workspace"
26+
volumes:
27+
- /data:/data
28+
- /data-aisoft:/data-aisoft
29+
- /data-aisoft/artifacts/CI_nvidia_test/__WORKSPACE__:/artifacts
30+
setup: pip install .[dev] --no-build-isolation
31+
jobs:
32+
gpu_inferencetest:
33+
type: inferencetest
34+
resources:
35+
ngpus: [1, 4]
36+
gpu_style: nvidia
37+
shm_size: 64g
38+
timeout: 3600
39+
stages:
40+
- name: test
41+
run: python InfiniLM/examples/test_infer.py --device nvidia --model=/data-aisoft/mechdancer/models/9g_8b_thinking/
42+
gpu_benchtest:
43+
type: benchtest
44+
resources:
45+
gpu_style: nvidia
46+
shm_size: 64g
47+
timeout: 3600
48+
env:
49+
TEST_PARAM: ['default']
50+
stages:
51+
- name: test
52+
run: python InfiniLM/examples/bench.py --device nvidia --model=/data-aisoft/mechdancer/models/9g_8b_thinking/ --input-len=256,1024 --output-len=256,1024 --batch-size=8 <TEST_PARAM>
53+
gpu_accuracytest:
54+
type: accuracytest
55+
resources:
56+
gpu_style: nvidia
57+
shm_size: 64g
58+
timeout: 3600
59+
env:
60+
TEST_PARAM: ['--bench mmlu']
61+
stages:
62+
- name: test
63+
run: python InfiniLM/test/bench/test_benchmark.py --device nvidia --model /data-aisoft/mechdancer/models/9g_8b_thinking/ --bench mmlu --backend cpp --max-new-tokens 5 --cache-dir /data-aisoft/pepe/datasets/ --split=val <TEST_PARAM>
64+
gpu_servicetest:
65+
type: servicetest
66+
resources:
67+
shm_size: 64g
68+
env:
69+
MODEL_LIST: 9g_8b_thinking
70+
ENGINE: InfiniLM
71+
TEST_PARAM: ['default']
72+
stages:
73+
- name: test
74+
run: python InfiniLM/scripts/test_perf.py --verbose

‎.github/workflows/ci_test.yml‎

Lines changed: 61 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,78 @@
1-
name: CI
2-
3-
on:
4-
pull_request:
5-
push:
6-
paths-ignore:
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
paths-ignore:
77
- "**.md"
88
- "LICENSE"
99
workflow_dispatch:
10-
inputs:
11-
infinicore_branch:
12-
description: "InfiniCore Branch Name"
13-
required: false
14-
default: "main"
15-
type: string
1610

1711
jobs:
18-
check-format:
19-
name: Check Format
12+
refactor-host:
13+
name: Build and CLI host behavior
2014
runs-on: ubuntu-latest
2115
steps:
22-
- name: checkout code
23-
uses: actions/checkout@v4
16+
- uses: actions/checkout@v4
2417
with:
25-
fetch-depth: 0
26-
27-
- name: Install format dependencies
18+
submodules: recursive
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
- name: Install host test dependency
23+
run: python -m pip install numpy==2.3.5
24+
- name: Run selected host checks
2825
run: |
29-
python -m pip install clang-format==21.1.8 black ruff==0.15.20 colorama
26+
python -m unittest discover -s test/scripts -p "test_build_infini_stack.py" -v
27+
python -m unittest discover -s test/scripts -p "test_base_config_device_detection.py" -v
3028
31-
- name: Check Format
32-
run: |
33-
if [ "${{ github.event_name }}" = "pull_request" ]; then
34-
python3 scripts/format.py --ref "origin/${{ github.base_ref }}" --check
35-
elif [ "${{ github.event_name }}" = "push" ] && [ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]; then
36-
python3 scripts/format.py --ref "${{ github.event.before }}" --check
37-
else
29+
check-format:
30+
name: Check Format
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: checkout code
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Install format dependencies
39+
run: |
40+
python -m pip install clang-format==21.1.8 black ruff==0.15.20 colorama
41+
42+
- name: Check Format
43+
run: |
44+
if [ "${{ github.event_name }}" = "pull_request" ]; then
45+
python3 scripts/format.py --ref "origin/${{ github.base_ref }}" --check
46+
elif [ "${{ github.event_name }}" = "push" ] && [ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]; then
47+
python3 scripts/format.py --ref "${{ github.event.before }}" --check
48+
else
3849
python3 scripts/format.py --ref origin/main --check
3950
fi
4051
52+
dependency-identity:
53+
if: github.event_name == 'workflow_dispatch'
54+
runs-on: ubuntu-latest
55+
outputs:
56+
infinicore_sha: ${{ steps.core.outputs.sha }}
57+
steps:
58+
- uses: actions/checkout@v4
59+
with:
60+
submodules: recursive
61+
- id: core
62+
shell: bash
63+
run: |
64+
expected=$(git ls-tree HEAD third_party/InfiniCore | awk '$1==160000 {print $3}')
65+
actual=$(git -C third_party/InfiniCore rev-parse HEAD)
66+
test -n "$expected" && test "$actual" = "$expected"
67+
git submodule status --recursive | awk '/^[+-U]/ {bad=1} END {exit bad}'
68+
printf 'sha=%s\n' "$actual" >> "$GITHUB_OUTPUT"
69+
4170
ci:
4271
if: github.event_name == 'workflow_dispatch'
43-
needs: check-format
44-
uses: InfiniTensor/ci/.github/workflows/infinilm-ci.yml@infiniCore_ci
72+
needs: [check-format, dependency-identity]
73+
uses: InfiniTensor/ci/.github/workflows/infinilm-ci.yml@refactor/adopt-modern-infini-stack
4574
with:
46-
config_path: .github/ci_config.yaml
47-
ci_ref: infiniCore_ci
48-
infinicore_branch: ${{ github.event.inputs.infinicore_branch || 'main' }}
75+
config_path: .github/ci_config_nvidia.yaml
76+
ci_ref: refactor/adopt-modern-infini-stack
77+
infinicore_branch: ${{ needs.dependency-identity.outputs.infinicore_sha }}
4978
secrets: inherit

‎.gitignore‎

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
1-
# Xmake cache
2-
.xmake/
3-
build/
4-
python/infinilm/lib/*.so
5-
6-
# MacOS Cache
7-
.DS_Store
8-
9-
# Vscode
10-
.vscode/
11-
1+
# Xmake cache
2+
.xmake/
3+
build/
4+
python/infinilm/lib/*.so
5+
6+
# MacOS Cache
7+
.DS_Store
8+
9+
# Vscode
10+
.vscode/
11+
1212
*.sh
1313
model_weight/
14-
15-
# Python
16-
__pycache__/
17-
*.egg-info/
18-
19-
# Log
20-
*.log
21-
22-
# Cache
23-
.cache/
24-
14+
15+
# Python
16+
__pycache__/
17+
*.egg-info/
18+
19+
# Log
20+
*.log
21+
22+
# Cache
23+
.cache/
24+
2525
# JSON
2626
*.json
27-
28-
#GGUF
29-
*.gguf
30-
31-
# txt
32-
*.txt
33-
34-
*.http
35-
36-
*.nsys-rep
27+
!scripts/configs/infiniops_ops_nvidia_greedy.json
28+
!scripts/configs/infiniops_ops_nvidia_attention.json
29+
!scripts/configs/infiniops_ops_nvidia_dense_greedy_torch_free.json
30+
!scripts/configs/infiniops_ops_nvidia_dense_sampling_torch_free.json
31+
!scripts/configs/infiniops_ops_nvidia_dense_sampling_layernorm_torch_free.json
32+
33+
#GGUF
34+
*.gguf
35+
36+
# txt
37+
*.txt
38+
39+
*.http
40+
41+
*.nsys-rep

‎.gitmodules‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "third_party/json"]
55
path = third_party/json
66
url = https://github.com/nlohmann/json.git
7+
[submodule "third_party/InfiniCore"]
8+
path = third_party/InfiniCore
9+
url = https://github.com/InfiniTensor/InfiniCore.git

‎CONTRIBUTING.md‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,29 @@ Existing branch names may use the legacy format `issue/###`, followed by a suffi
5858

5959
# Development Guide
6060

61-
Refer to [ReadMe](README.md) and [Adapt New Models](MODELS.md)
61+
Refer to [ReadMe](README.md) and [Adapt New Models](MODELS.md).
62+
63+
Run the migrated stack-builder unit tests with:
64+
65+
```shell
66+
python -m unittest test/scripts/test_build_infini_stack.py -v
67+
```
68+
69+
Check the Core-backed build commands without creating build output:
70+
71+
```shell
72+
python scripts/build_infini_stack.py --infinicore-root ../InfiniCore --dry-run --jobs 1 --cuda-arch sm_80
73+
```
74+
75+
Run the static migration contracts with:
76+
77+
```shell
78+
python -m unittest discover -s test/static -p "test_*.py" -v
79+
```
80+
81+
Native stack changes must be validated in the owning component repository
82+
first. After validation, update the corresponding submodule pin in InfiniCore
83+
before validating InfiniLM.
6284

6385
## Troubleshooting
6486

0 commit comments

Comments
 (0)