-
Notifications
You must be signed in to change notification settings - Fork 13
Baselinerecord #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MingxuZh
wants to merge
29
commits into
main
Choose a base branch
from
baselinerecord
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Baselinerecord #42
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
8dda3e4
add moe-topk-softmax baseline
MingxuZh cbe74f4
Indentation modification
MingxuZh 911446a
fix pr-test-xpu.yml
MingxuZh 565985e
fix pr-test-xpu.yml
MingxuZh d53a143
Resolve workflow conflict
MingxuZh 152957c
fix baseline.json
MingxuZh 6002cdd
modify the format
MingxuZh c7534b2
remove bc dependency
MingxuZh e45d89f
Automatically modify baseline.json
MingxuZh 3d76992
enable PAT
MingxuZh 9e17bbb
install gh
MingxuZh 37521ef
fix repo url
MingxuZh 283bb2f
fix PAT error
MingxuZh 97723a8
bug fix
MingxuZh 3c251c9
gh auth login status
MingxuZh 847d3a2
modify pre-commit logic
MingxuZh 3fab2ed
denied to github-actions[bot] issue
MingxuZh f8e8efa
add write permission
MingxuZh 0755455
push -f
MingxuZh 0c87f28
remove gh --json
MingxuZh 0179a14
fix format issue
MingxuZh 8ab3b92
fix format issue
MingxuZh eb63746
fix format issue
MingxuZh b363d2f
modify baseline.json
MingxuZh cc17bc1
modify the order
MingxuZh 8342a80
modify the git order
MingxuZh da99ddd
Modify the logic for fetching changes to baseline.json
MingxuZh 16d32c6
fix baseline.json format
MingxuZh 643cb55
add perf label as a trigger condition
MingxuZh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,73 +1,135 @@ | ||
| name: PR Test (XPU) | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: pr-test-xpu-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci') | ||
| runs-on: sglang-pvc | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| - name: Build Docker image | ||
| run: | | ||
| docker build \ | ||
| --build-arg SG_LANG_KERNEL_BRANCH=${{ github.head_ref }} \ | ||
| --build-arg SG_LANG_KERNEL_REPO=${{ github.event.pull_request.head.repo.clone_url }} \ | ||
| --no-cache --progress=plain -f Dockerfile.xpu_kernel -t xpu_sglang:kernel . | ||
|
|
||
| - name: Run container | ||
| run: | | ||
| docker run -dt \ | ||
| --device /dev/dri/ \ | ||
| --name ci_sglang_xpu \ | ||
| -e HF_TOKEN=$(cat ~/huggingface_token.txt) \ | ||
| xpu_sglang:kernel | ||
|
|
||
| - name: Install Dependency | ||
| timeout-minutes: 20 | ||
| run: | | ||
| docker exec ci_sglang_xpu /miniforge3/envs/py3.10/bin/python3 -m pip install --upgrade pip | ||
| docker exec ci_sglang_xpu /miniforge3/envs/py3.10/bin/python3 -m pip install pytest expecttest ray huggingface_hub | ||
| docker exec ci_sglang_xpu /bin/bash -c '/miniforge3/envs/py3.10/bin/huggingface-cli login --token ${HF_TOKEN} ' | ||
| docker exec ci_sglang_xpu /bin/bash -c "ln -sf /miniforge3/envs/py3.10/bin/python3 /usr/bin/python3" | ||
|
|
||
| - name: Run Sglang Kernel Cases | ||
| timeout-minutes: 20 | ||
| run: | | ||
| docker exec -w /root/sglang ci_sglang_xpu \ | ||
| /bin/bash -c "cd /root/sglang/sgl-kernel-xpu/tests && python3 run_suite.py --suite per-commit " | ||
|
|
||
| - name: Run Sglang Kernel Benchmarks | ||
| timeout-minutes: 20 | ||
| run: | | ||
| docker exec -w /root/sglang ci_sglang_xpu \ | ||
| /bin/bash -c "cd /root/sglang/sgl-kernel-xpu/benchmark && python3 bench_flash_attn.py && python3 bench_moe_topk_softmax.py && python3 bench_fused_moe.py " | ||
|
|
||
| - name: Run E2E Bfloat16 tests | ||
| timeout-minutes: 20 | ||
| run: | | ||
| echo "[PlaceHolder for E2E Test...]" | ||
|
|
||
| - name: Run E2E Qunatization tests | ||
| timeout-minutes: 20 | ||
| run: | | ||
| echo "[PlaceHolder for E2E Test...]" | ||
|
|
||
| - name: Cleanup container | ||
| if: always() | ||
| run: | | ||
| docker rm -f ci_sglang_xpu || true | ||
| name: PR Test (XPU) | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: pr-test-xpu-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-ci') | ||
| permissions: write-all | ||
| runs-on: sglang-pvc | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| - name: Build Docker image | ||
| run: | | ||
| docker build \ | ||
| --build-arg SG_LANG_KERNEL_BRANCH=${{ github.head_ref }} \ | ||
| --build-arg SG_LANG_KERNEL_REPO=${{ github.event.pull_request.head.repo.clone_url }} \ | ||
| --no-cache --progress=plain -f Dockerfile.xpu_kernel -t xpu_sglang:kernel . | ||
|
|
||
| - name: Run container | ||
| run: | | ||
| docker run -dt \ | ||
| --device /dev/dri/ \ | ||
| --name ci_sglang_xpu \ | ||
| -e HF_TOKEN=$(cat ~/huggingface_token.txt) \ | ||
| xpu_sglang:kernel | ||
|
|
||
| - name: Install Dependency | ||
| timeout-minutes: 20 | ||
| run: | | ||
| docker exec ci_sglang_xpu /miniforge3/envs/py3.10/bin/python3 -m pip install --upgrade pip | ||
| docker exec ci_sglang_xpu /miniforge3/envs/py3.10/bin/python3 -m pip install pytest expecttest ray huggingface_hub | ||
| docker exec ci_sglang_xpu /bin/bash -c '/miniforge3/envs/py3.10/bin/huggingface-cli login --token ${HF_TOKEN} ' | ||
| docker exec ci_sglang_xpu /bin/bash -c "ln -sf /miniforge3/envs/py3.10/bin/python3 /usr/bin/python3" | ||
|
|
||
| - name: Run Sglang Kernel Cases | ||
| timeout-minutes: 20 | ||
| run: | | ||
| docker exec -w /root/sglang ci_sglang_xpu \ | ||
| /bin/bash -c "cd /root/sglang/sgl-kernel-xpu/tests && python3 run_suite.py --suite per-commit " | ||
|
|
||
| - name: Run Sglang Kernel Benchmarks | ||
| timeout-minutes: 20 | ||
| run: | | ||
| docker exec -w /root/sglang ci_sglang_xpu \ | ||
| /bin/bash -c "cd /root/sglang/sgl-kernel-xpu/benchmark && python3 bench_flash_attn.py 2>&1 | tee flash.log && python3 bench_moe_topk_softmax.py 2>&1 | tee moe.log" | ||
|
|
||
| - name: Copy logs from container | ||
| timeout-minutes: 20 | ||
| run: | | ||
| docker cp ci_sglang_xpu:/root/sglang/sgl-kernel-xpu/benchmark/moe.log ./moe.log | ||
| LATEST=$(awk '/topk-softmax-performance:/ {getline; getline; print $7}' moe.log) | ||
| echo "Latest=$LATEST" | ||
| BASELINE=$(python3 -c "import json; print(json.load(open('benchmark/baseline.json'))['bench_moe_topk_softmax_baseline'])") | ||
| echo "Baseline=$BASELINE" | ||
| if awk "BEGIN{exit !($LATEST > $BASELINE)}"; then | ||
| echo "Performance regression detected: $LATEST > $BASELINE" | ||
| exit 1 | ||
| else | ||
| echo "Performance OK: $LATEST <= $BASELINE" | ||
| python3 -c "import json; f=open('benchmark/baseline.json'); data=json.load(f); f.close(); data['bench_moe_topk_softmax_baseline']=float($LATEST); f=open('benchmark/baseline.json','w'); json.dump(data,f,indent=4); f.write('\n'); f.close()" | ||
| cat benchmark/baseline.json | ||
| echo "Baseline updated to: $LATEST" | ||
| fi | ||
|
|
||
| - name: Install GitHub CLI | ||
| if: contains(join(github.event.pull_request.labels.*.name, ','), 'perf') | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install -y gh | ||
|
|
||
| - name: Auto PR for baseline.json update | ||
| if: > | ||
| success() && | ||
| contains(join(github.event.pull_request.labels.*.name, ','), 'perf') | ||
| run: | | ||
| git checkout -b update-baseline-${GITHUB_RUN_ID} | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| git add benchmark/baseline.json | ||
| if command -v pre-commit >/dev/null 2>&1; then | ||
| pre-commit run --files benchmark/baseline.json || true | ||
| git add benchmark/baseline.json | ||
| fi | ||
| CHANGES=$(git diff --cached --numstat | wc -l) | ||
| if [ "$CHANGES" -eq 0 ]; then | ||
| echo "No changes in baseline.json, skipping PR creation." | ||
| exit 0 | ||
| else | ||
| git commit -m "Update baseline.json from CI benchmark" | ||
| echo "Detected changes in baseline.json: $(git diff --cached --stat)" | ||
| fi | ||
|
|
||
| echo "${{ secrets.PAT }}" | gh auth login --with-token || { echo "gh auth login failed"; exit 1; } | ||
| git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/sgl-project/sgl-kernel-xpu.git | ||
| git push -f https://${{ secrets.PAT }}@github.com/sgl-project/sgl-kernel-xpu.git update-baseline-${GITHUB_RUN_ID} | ||
|
|
||
| PR_URL=$(gh pr create \ | ||
| --repo sgl-project/sgl-kernel-xpu \ | ||
| --title "CI: Update baseline.json" \ | ||
| --body "$(printf 'Latest: %s\nPrevious: %s' "$LATEST" "$BASELINE")" \ | ||
| --base main \ | ||
| --head update-baseline-${GITHUB_RUN_ID} | ||
| ) | ||
|
|
||
| echo "PR created at $PR_URL" | ||
|
|
||
| - name: Run E2E Bfloat16 tests | ||
| timeout-minutes: 20 | ||
| run: | | ||
| echo "[PlaceHolder for E2E Test...]" | ||
|
|
||
| - name: Run E2E Qunatization tests | ||
| timeout-minutes: 20 | ||
| run: | | ||
| echo "[PlaceHolder for E2E Test...]" | ||
|
|
||
| - name: Cleanup container | ||
| if: always() | ||
| run: | | ||
| docker rm -f ci_sglang_xpu || true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "bench_moe_topk_softmax_baseline": 30.01 | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall this part be separated as a standalone scripts? I think there might be more complex logic here