under test, not sure no errors

This commit is contained in:
root
2026-09-02 07:03:56 +00:00
commit 43c43b491c
4211 changed files with 1013777 additions and 0 deletions

1
upstream_ref/xllm/.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1 @@
/xllm/ @yq33victor @liutongxuan @walsonyang @RobbieLeung @JimHsiung @DongheJin @XuZhang99

View File

@@ -0,0 +1,45 @@
<!-- Copyright 2025 JD.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this project except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
[English](./CONTRIBUTING.md) | [中文](./CONTRIBUTING_zh.md)
# Contribute to xLLM
+ Write / translate / fix our documentation
+ Raise questions / Answer questions
+ Provide demos, examples or test cases
+ Give suggestions or other comments
+ Paticipate in [issues](https://github.com/xxx/xLLM/issues) or [discussions](https://github.com/xxx/xLLM/discussions)
+ Pull requests
+ Sharing related research / application
+ Any other ways to improve xLLM
For developers who want to contribute to our code, here is the guidance:
## 1. Choose an issue to contribute
+ Issues with label `PR welcome`, which means:
+ A reproducible bug
+ A function in plan
## 2. Install environment for development
+ We strongly suggest you to read our **[Document](http://xxx/docs/)** before developing
+ For setting environment, please check our **[Readme file](/README.md)**
## 3. Build our project
+ You could run our demo to check whether the requirements are successfully installed:
## 4. Test
After the PR is submitted, we will format and test the code.
Our tests are still far from perfect, so you are welcomed to add tests to our project!

View File

@@ -0,0 +1,48 @@
<!-- Copyright 2025 JD.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this project except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
[English](./CONTRIBUTING.md) | [中文](./CONTRIBUTING_zh.md)
# xLLM 贡献指南
xLLM致力于为每一位用户和开发者提供开放的XX因此无论您是XX开发者还是专注于XX用户我们都欢迎您参与我们的项目。
您可以通过以下方法为项目作出贡献:
+ 撰写/翻译/修改文档
+ 提出或回答问题
+ 提供使用或测试样例
+ 提供建议或其他评论
+ 参与[issues](https://github.com/xxx/xLLM/issues) 或[discussions](https://github.com/xxx/xLLM/discussions)
+ 提交Pull request
+ 分享相关研究或应用场景
+ 其他任何对xLLM的帮助
如果您希望参与xLLM的开发请参考以下提示
## 1. 选择参与贡献的issue
+ 您可以选择带有`PR welcome`标签的issue包括:
+ 可复现的bug
+ 计划实现的功能
## 2. 配置开发环境
+ 在开发之前,可以参考我们的 **[文档](http://xxx/docs/)**
+ 关于环境配置,参见 **[Readme file](/README.md)**
## 3. 项目构建和运行
+ 您可以运行如下样例:
## 4. 测试
在pr提交之后我们会对代码进行格式化及进一步测试。
我们的测试目前还很不完善,因此欢迎开发者为测试作出贡献!

View File

@@ -0,0 +1,28 @@
name: 🐛 Bug report
description: Raise an issue here if you find a bug.
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: >
#### Before submitting an issue, please make sure the issue hasn't been already addressed. please search: [existing issues](https://github.com/jd-opensource/xllm/issues).
- type: textarea
attributes:
label: Your environment
description: |
Please provide what the environment you are running.
validations:
required: true
- type: textarea
attributes:
label: 🐛 Describe the bug
description: |
Please provide a clear and concise description of what the bug is.
validations:
required: true
- type: markdown
attributes:
value: >
Thanks for report the bug!

View File

@@ -0,0 +1,31 @@
name: 🚀 Feature request
description: Submit a request for a new feature
title: "[Feature]: "
labels: ["feature"]
body:
- type: markdown
attributes:
value: >
#### Before submitting an issue, please make sure the issue hasn't been already addressed. please search: [existing issues](https://github.com/jd-opensource/xllm/issues).
- type: textarea
attributes:
label: 🚀 The motivation and feature
description: >
A clear and concise description of the feature proposal. Please outline the motivation for the proposal.
validations:
required: true
- type: textarea
attributes:
label: Alternatives
description: >
A description of any alternative solutions or features you've considered, if any.
- type: textarea
attributes:
label: Additional context
description: >
Add any other context or screenshots about the feature request.
- type: markdown
attributes:
value: >
Thanks for contributing 🎉!

View File

@@ -0,0 +1,21 @@
name: ❓ Question
description: Submit a question
title: "[Question]: "
labels: ["question"]
body:
- type: markdown
attributes:
value: >
#### Before submitting an issue, please make sure the issue hasn't been already addressed. please search: [existing issues](https://github.com/jd-opensource/xllm/issues).
- type: textarea
attributes:
label: ❓ Describe the question
description: |
Please provide a clear and concise description of your question.
validations:
required: true
- type: markdown
attributes:
value: >
Thanks for contributing 🎉!

View File

@@ -0,0 +1,122 @@
name: xLLM Build x86_64 CUDA
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- '.github/**'
- 'cibuild/**'
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
paths-ignore:
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request_review:
types: [submitted]
paths:
- '.github/**.yaml'
- 'cibuild/**.sh'
- 'setup.py'
- 'examples/generate.py'
env:
JOBNAME: xllm-x86_64-cuda-cibuild-${{ github.run_id }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
# need to review code first when sensitive files are modified.
check-sensitive:
runs-on: [self-hosted]
outputs:
requires_approval: ${{ steps.check_sensitive.outputs.requires_approval }}
do_build: ${{ steps.decide.outputs.do_build }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure we can compare commits
- name: Install jq
run: yum install -y jq
- name: Check if sensitive files were changed
id: check_sensitive
run: |
sensitive_files=(
".github/**.yaml"
"cibuild/**.sh"
"setup.py"
)
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
requires_approval="false"
while IFS= read -r changed_file; do
[[ -z "$changed_file" ]] && continue
for pattern in "${sensitive_files[@]}"; do
if [[ "$changed_file" == $pattern ]]; then
requires_approval="true"
break 2
fi
done
done < <(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}")
echo "requires_approval=$requires_approval" >> $GITHUB_OUTPUT
- name: Decide whether to check build
id: decide
run: |
event="${{ github.event_name }}"
if [[ "$event" == "workflow_dispatch" || "$event" == "push" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
elif [[ "$event" == "pull_request" ]]; then
if [ "${{ steps.check_sensitive.outputs.requires_approval }}" == "true" ]; then
echo "do_build=false" >> $GITHUB_OUTPUT
else
echo "do_build=true" >> $GITHUB_OUTPUT
fi
elif [[ "$event" == "pull_request_review" ]]; then
# Since pull_request_review now only triggers when sensitive files are modified,
# we only need to check if the review is approved
if [[ "${{ github.event.review.state }}" == "approved" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
build:
needs: check-sensitive
if: >
(github.event_name == 'workflow_dispatch' || github.event_name == 'push') ||
needs.check-sensitive.outputs.do_build == 'true'
runs-on: [self-hosted]
steps:
- name: Checkout Code
timeout-minutes: 5
uses: actions/checkout@v4
with:
submodules: true
- name: Build
if: ${{ success() }}
timeout-minutes: 60
run: |
chmod +x ./cibuild/build_cuda.sh
bash cibuild/build_cuda.sh 'pip install pre-commit -i https://pypi.tuna.tsinghua.edu.cn/simple; python setup.py build --device cuda'

View File

@@ -0,0 +1,122 @@
name: xLLM Build x86_64 ILU
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- '.github/**'
- 'cibuild/**'
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
paths-ignore:
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request_review:
types: [submitted]
paths:
- '.github/**.yaml'
- 'cibuild/**.sh'
- 'setup.py'
- 'examples/generate.py'
env:
JOBNAME: xllm-x86_64-ilu-cibuild-${{ github.run_id }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
# need to review code first when sensitive files are modified.
check-sensitive:
runs-on: [self-hosted]
outputs:
requires_approval: ${{ steps.check_sensitive.outputs.requires_approval }}
do_build: ${{ steps.decide.outputs.do_build }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure we can compare commits
- name: Install jq
run: yum install -y jq
- name: Check if sensitive files were changed
id: check_sensitive
run: |
sensitive_files=(
".github/**.yaml"
"cibuild/**.sh"
"setup.py"
)
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
requires_approval="false"
while IFS= read -r changed_file; do
[[ -z "$changed_file" ]] && continue
for pattern in "${sensitive_files[@]}"; do
if [[ "$changed_file" == $pattern ]]; then
requires_approval="true"
break 2
fi
done
done < <(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}")
echo "requires_approval=$requires_approval" >> $GITHUB_OUTPUT
- name: Decide whether to check build
id: decide
run: |
event="${{ github.event_name }}"
if [[ "$event" == "workflow_dispatch" || "$event" == "push" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
elif [[ "$event" == "pull_request" ]]; then
if [ "${{ steps.check_sensitive.outputs.requires_approval }}" == "true" ]; then
echo "do_build=false" >> $GITHUB_OUTPUT
else
echo "do_build=true" >> $GITHUB_OUTPUT
fi
elif [[ "$event" == "pull_request_review" ]]; then
# Since pull_request_review now only triggers when sensitive files are modified,
# we only need to check if the review is approved
if [[ "${{ github.event.review.state }}" == "approved" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
build:
needs: check-sensitive
if: >
(github.event_name == 'workflow_dispatch' || github.event_name == 'push') ||
needs.check-sensitive.outputs.do_build == 'true'
runs-on: [self-hosted]
steps:
- name: Checkout Code
timeout-minutes: 5
uses: actions/checkout@v4
with:
submodules: true
- name: Build
if: ${{ success() }}
timeout-minutes: 60
run: |
chmod +x ./cibuild/build_ilu.sh
bash cibuild/build_ilu.sh 'pip3 install pre-commit -i https://pypi.tuna.tsinghua.edu.cn/simple && python setup.py build --device ilu'

View File

@@ -0,0 +1,122 @@
name: xLLM Build x86_64 MLU
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- '.github/**'
- 'cibuild/**'
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
paths-ignore:
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request_review:
types: [submitted]
paths:
- '.github/**.yaml'
- 'cibuild/**.sh'
- 'setup.py'
- 'examples/generate.py'
env:
JOBNAME: xllm-x86_64-mlu-cibuild-${{ github.run_id }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
# need to review code first when sensitive files are modified.
check-sensitive:
runs-on: [self-hosted]
outputs:
requires_approval: ${{ steps.check_sensitive.outputs.requires_approval }}
do_build: ${{ steps.decide.outputs.do_build }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure we can compare commits
- name: Install jq
run: yum install -y jq
- name: Check if sensitive files were changed
id: check_sensitive
run: |
sensitive_files=(
".github/**.yaml"
"cibuild/**.sh"
"setup.py"
)
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
requires_approval="false"
while IFS= read -r changed_file; do
[[ -z "$changed_file" ]] && continue
for pattern in "${sensitive_files[@]}"; do
if [[ "$changed_file" == $pattern ]]; then
requires_approval="true"
break 2
fi
done
done < <(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}")
echo "requires_approval=$requires_approval" >> $GITHUB_OUTPUT
- name: Decide whether to check build
id: decide
run: |
event="${{ github.event_name }}"
if [[ "$event" == "workflow_dispatch" || "$event" == "push" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
elif [[ "$event" == "pull_request" ]]; then
if [ "${{ steps.check_sensitive.outputs.requires_approval }}" == "true" ]; then
echo "do_build=false" >> $GITHUB_OUTPUT
else
echo "do_build=true" >> $GITHUB_OUTPUT
fi
elif [[ "$event" == "pull_request_review" ]]; then
# Since pull_request_review now only triggers when sensitive files are modified,
# we only need to check if the review is approved
if [[ "${{ github.event.review.state }}" == "approved" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
build:
needs: check-sensitive
if: >
(github.event_name == 'workflow_dispatch' || github.event_name == 'push') ||
needs.check-sensitive.outputs.do_build == 'true'
runs-on: [self-hosted]
steps:
- name: Checkout Code
timeout-minutes: 5
uses: actions/checkout@v4
with:
submodules: true
- name: Build
if: ${{ success() }}
timeout-minutes: 60
run: |
chmod +x ./cibuild/build_mlu.sh
bash cibuild/build_mlu.sh 'pip install pre-commit -i https://pypi.tuna.tsinghua.edu.cn/simple; python setup.py build --device mlu'

View File

@@ -0,0 +1,136 @@
name: xLLM Build x86_64 NPU
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- '.github/**'
- 'cibuild/**'
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
paths-ignore:
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
- '*.md'
- '*.txt'
- '*.yml'
pull_request_review:
types: [submitted]
paths:
- '.github/**.yaml'
- 'cibuild/**.sh'
- 'setup.py'
- 'examples/generate.py'
env:
JOBNAME: xllm-x86_64-npu-cibuild-${{ github.run_id }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
# need to review code first when sensitive files are modified.
check-sensitive:
runs-on: [self-hosted]
outputs:
requires_approval: ${{ steps.check_sensitive.outputs.requires_approval }}
do_build: ${{ steps.decide.outputs.do_build }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure we can compare commits
- name: Install jq
run: yum install -y jq
- name: Check if sensitive files were changed
id: check_sensitive
run: |
sensitive_files=(
".github/**.yaml"
"cibuild/**.sh"
"setup.py"
"examples/generate.py"
)
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
requires_approval="false"
while IFS= read -r changed_file; do
[[ -z "$changed_file" ]] && continue
for pattern in "${sensitive_files[@]}"; do
if [[ "$changed_file" == $pattern ]]; then
requires_approval="true"
break 2
fi
done
done < <(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}")
echo "requires_approval=$requires_approval" >> $GITHUB_OUTPUT
- name: Decide whether to check build
id: decide
run: |
event="${{ github.event_name }}"
if [[ "$event" == "workflow_dispatch" || "$event" == "push" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
elif [[ "$event" == "pull_request" ]]; then
if [ "${{ steps.check_sensitive.outputs.requires_approval }}" == "true" ]; then
echo "do_build=false" >> $GITHUB_OUTPUT
else
echo "do_build=true" >> $GITHUB_OUTPUT
fi
elif [[ "$event" == "pull_request_review" ]]; then
# Since pull_request_review now only triggers when sensitive files are modified,
# we only need to check if the review is approved
if [[ "${{ github.event.review.state }}" == "approved" ]]; then
echo "do_build=true" >> $GITHUB_OUTPUT
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
else
echo "do_build=false" >> $GITHUB_OUTPUT
fi
build:
needs: check-sensitive
if: >
(github.event_name == 'workflow_dispatch' || github.event_name == 'push') ||
needs.check-sensitive.outputs.do_build == 'true'
runs-on: [self-hosted]
steps:
- name: Prepare submodule checkout
run: |
git config --global url."https://gitcode.com/xLLM-AI/tvm".insteadOf "https://github.com/TileLang/tvm"
git config --global url."https://gitcode.com/xLLM-AI/composable_kernel".insteadOf "https://github.com/ROCm/composable_kernel"
git config --global url."https://gitcode.com/xLLM-AI/cutlass".insteadOf "https://github.com/NVIDIA/cutlass"
if [ -d .git/modules ]; then
find .git/modules -type f -name '*.lock' -print -delete || true
fi
rm -rf .git/modules/third_party/tilelang-ascend
rm -rf third_party/tilelang-ascend
- name: Checkout Code
timeout-minutes: 5
uses: actions/checkout@v4
with:
clean: true
submodules: recursive
- name: Build
if: ${{ success() }}
timeout-minutes: 60
run: |
chmod +x ./cibuild/build_npu.sh
bash cibuild/build_npu.sh 'pip install pre-commit -i https://pypi.tuna.tsinghua.edu.cn/simple; python setup.py bdist_wheel; pip install dist/* --force-reinstall; python examples/generate.py --model="/export/home/models/Qwen2-7B-Instruct" --devices="npu:7"'

View File

@@ -0,0 +1,104 @@
name: CheckFormat
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- '.github/**'
- 'cibuild/**'
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
paths-ignore:
- '.github/**'
- 'cibuild/**'
- 'cmake/**'
- 'docs/**'
- 'third_party/**'
- 'tools/**'
jobs:
format-check:
runs-on: [self-hosted]
steps:
- name: Install clang-format
run: |
pip install clang-format==20.1.6
clang-format --version
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine base commit for comparison
id: get_base_commit
run: |
# pull_request action
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "base_commit=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT
else
# push action
echo "base_commit=${{ github.sha }}~1" >> $GITHUB_OUTPUT
fi
- name: Verify clang-format configuration
run: |
if [ ! -f ".clang-format" ]; then
echo "❌ .clang-format file not found in repository root"
exit 1
fi
clang-format --style=file --dump-config > /dev/null || {
echo "❌ .clang-format file has invalid format"
exit 1
}
- name: Check code format
shell: /usr/bin/bash {0}
run: |
BASE_COMMIT="${{ steps.get_base_commit.outputs.base_commit }}"
CLANG_FORMAT_FILE="$(pwd)/.clang-format"
# ignore path
IGNORED_PATHS=(
"^.github/.*"
"^cibuild/.*"
"^cmake/.*"
"^docs/.*"
"^third_party/.*"
"^tools/.*"
)
# igonore files
FILES=$(git diff --name-only "$BASE_COMMIT" -- '*.c' '*.h' '*.cc' '*.cp' '*.cpp' '*.c++' '*.cxx' '*.hh' '*.hpp' '*.hxx' '*.inc' '*.cu' '*.cuh' | \
grep -v -E "$(IFS=\|; echo "${IGNORED_PATHS[*]}")")
if [ -z "$FILES" ]; then
echo "✅ No files to check (all excluded)"
exit 0
fi
# run clang-format
diff=$(git-clang-format \
--style=file:"$CLANG_FORMAT_FILE" \
--extensions="c,h,cc,cp,cpp,c++,cxx,hh,hpp,hxx,inc,cu,cuh" \
--commit "$BASE_COMMIT" \
--diff \
-- $FILES)
# check diff
if [ "$diff" = "no modified files to format" ] || [ "$diff" = "clang-format did not modify any files" ]; then
echo "✅ Code format is correct"
exit 0
fi
printf "\n❌ You have introduced coding style breakages.\n"
printf "\n\033[1mSuggested changes:\n\n"
echo "$diff"
exit 1