[Feat] simulator: Add baseline collection and ML latency predictor training tools (#44299)

Co-authored-by: shijunyu.sjy <shijunyu.sjy@alibaba-inc.com>
Co-authored-by: baoyunong.byn <baoyunong.byn@alibaba-inc.com>
Co-authored-by: wangyi.wy <aaronwangyi0201@gmail.com>
This commit is contained in:
Ruiyan Ma
2026-10-20 13:02:33 +08:00
committed by GitHub
co-authored by shijunyu.sjy baoyunong.byn wangyi.wy
parent 43a896933e
commit 553836c164
20 changed files with 1182 additions and 74 deletions
@@ -130,6 +130,7 @@ jobs:
simulator:
- ".github/workflows/pr-test-extra.yml"
- ".github/workflows/_pr-test-simulator-cpu.yml"
- ".github/workflows/_pr-test-simulator-gpu.yml"
- "benchmark/simulator/**/!(*.md)"
- "tools/sglang-simulator/**/!(*.md)"
multimodal_gen:
+2 -1
View File
@@ -70,7 +70,7 @@ jobs:
run: |
uv pip install -e "python" --index-strategy unsafe-best-match --prerelease allow
uv pip install pytest
uv pip install -e "tools/sglang-simulator[aic]"
uv pip install "./tools/sglang-simulator[aic]"
- name: Prebuild HiCache native hash extension
timeout-minutes: 5
@@ -91,6 +91,7 @@ jobs:
PYTEST_ADDOPTS: "-s"
TORCH_EXTENSIONS_DIR: ${{ runner.temp }}/torch-extensions
run: |
OMP_NUM_THREADS=2 python3 -m pytest -q tools/sglang-simulator/test/test_train_latency_model.py
python3 -m pytest -q tools/sglang-simulator/test/test_simulation_sglang_runner.py
python3 -m pytest -q tools/sglang-simulator/test/test_simulation_sglang_serving.py
python3 -m pytest -q tools/sglang-simulator/test/test_simulation_cache_hit_ratio.py
@@ -0,0 +1,68 @@
name: PR Test SGLang Simulator (GPU)
on:
workflow_call:
inputs:
check_changes:
description: 'toJson(needs.check-changes.outputs).'
type: string
required: true
caller_inputs:
description: 'toJson(inputs) from the caller workflow.'
type: string
required: true
rust_ext_artifact:
description: 'Artifact of prebuilt Rust extension modules.'
type: string
default: ''
env:
SGLANG_IS_IN_CI: true
SKIP_PR_TEST_HEALTH_CHECK: ${{ (fromJson(inputs.caller_inputs).skip_pr_test_health_check || fromJson(inputs.caller_inputs).test_parallel_dispatch || fromJson(inputs.caller_inputs).run_all_tests) && 'true' || 'false' }}
PR_TEST_BYPASS_MAINTENANCE_ON_MAIN: ${{ github.ref == 'refs/heads/main' && 'true' || 'false' }}
USE_VENV: "1"
jobs:
run:
name: simulator-test-gpu
if: fromJson(inputs.check_changes).main_package == 'true' || fromJson(inputs.check_changes).simulator == 'true' || fromJson(inputs.check_changes).sgl_kernel == 'true'
runs-on: ${{ fromJson(fromJson(inputs.check_changes).runs_on_map)['1-gpu-small'] }}
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
ref: ${{ fromJson(inputs.caller_inputs).git_ref || github.sha }}
- uses: ./.github/actions/check-pr-test-health
- uses: ./.github/actions/check-maintenance
- name: Download kernel wheels
if: fromJson(inputs.check_changes).sgl_kernel == 'true'
uses: actions/download-artifact@v4
with:
path: python/sglang/kernels/aot/dist/
merge-multiple: true
pattern: wheel-python3.10-cuda*
- uses: ./.github/actions/download-rust-ext
with:
artifact_name: ${{ inputs.rust_ext_artifact }}
- name: Install dependencies
timeout-minutes: 20
env:
CUSTOM_BUILD_SGL_KERNEL: ${{ fromJson(inputs.check_changes).sgl_kernel }}
run: bash scripts/ci/cuda/ci_install_dependency.sh
- name: Test baseline collection
timeout-minutes: 10
env:
PYTEST_DISABLE_PLUGIN_AUTOLOAD: "1"
run: |
uv pip install "./tools/sglang-simulator"
python3 -m pytest -q tools/sglang-simulator/test/test_baseline_collection_sglang.py
- name: Cleanup venv
if: always()
run: bash scripts/ci/cuda/ci_cleanup_venv.sh
+10
View File
@@ -150,6 +150,15 @@ jobs:
rust_ext_artifact: ${{ needs.rust-ext-build.outputs.artifact_name }}
# No `secrets: inherit`: this hosted CPU job has no secret consumer.
simulator-test-gpu:
needs: [check-changes, call-gate, sgl-kernel-build-wheels, rust-ext-build]
if: ${{ !failure() && !cancelled() && needs.check-changes.result == 'success' && (needs.call-gate.result == 'success' || needs.call-gate.result == 'skipped') }}
uses: ./.github/workflows/_pr-test-simulator-gpu.yml
with:
check_changes: ${{ toJson(needs.check-changes.outputs) }}
caller_inputs: ${{ toJson(inputs) }}
rust_ext_artifact: ${{ needs.rust-ext-build.outputs.artifact_name }}
# =============================================== extra-a / extra-b ===============================================
# `name:` keeps the job names wait-for-jobs and check-pr-test-health match on.
extra-test:
@@ -191,6 +200,7 @@ jobs:
sgl-kernel-build-wheels,
rust-ext-build,
simulator-test-cpu,
simulator-test-gpu,
extra-test,
]
if: always()