name: PR Test - SGL Kernel on: workflow_call: inputs: sgl_kernel: required: true type: string rust_ext_artifact: description: 'Artifact of prebuilt Rust extension modules, from rust-ext-build. Empty, or a download that fails, falls back to the cache; a miss there compiles during install.' type: string default: '' runner_config: required: true type: string runs_on_map: required: true type: string git_ref: required: false type: string default: '' skip_pr_test_health_check: required: false type: boolean default: false # Workflow-level env is NOT inherited from the caller in reusable workflows. # The github context (including github.event_name) IS inherited from the caller. env: SGLANG_IS_IN_CI: true SGLANG_CUDA_COREDUMP: "1" PR_TEST_BYPASS_MAINTENANCE_ON_MAIN: ${{ github.ref == 'refs/heads/main' && 'true' || 'false' }} SKIP_PR_TEST_HEALTH_CHECK: ${{ inputs.skip_pr_test_health_check == true && 'true' || 'false' }} jobs: sgl-kernel-unit-test: runs-on: 1-gpu-h100 timeout-minutes: 240 steps: - uses: actions/checkout@v4 with: ref: ${{ inputs.git_ref || github.sha }} - uses: ./.github/actions/check-pr-test-health - uses: ./.github/actions/check-maintenance - name: Cleanup run: | ls -alh python/sglang/kernels/aot/dist || true rm -rf python/sglang/kernels/aot/dist/* || true - name: Download artifacts 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 run: | CUSTOM_BUILD_SGL_KERNEL=${{inputs.sgl_kernel}} bash scripts/ci/cuda/ci_install_dependency.sh diffusion - name: Run test timeout-minutes: 30 run: | cd python/sglang/kernels/aot pytest tests/ sgl-kernel-benchmark-test: runs-on: 1-gpu-h100 timeout-minutes: 240 steps: - uses: actions/checkout@v4 with: ref: ${{ inputs.git_ref || github.sha }} - uses: ./.github/actions/check-pr-test-health - uses: ./.github/actions/check-maintenance - name: Cleanup run: | ls -alh python/sglang/kernels/aot/dist || true rm -rf python/sglang/kernels/aot/dist/* || true - name: Download artifacts 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 run: | CUSTOM_BUILD_SGL_KERNEL=${{inputs.sgl_kernel}} bash scripts/ci/cuda/ci_install_dependency.sh - name: Run benchmark tests timeout-minutes: 45 run: | cd python/sglang/kernels/aot/benchmark echo "Running sgl-kernel benchmark tests in CI mode..." echo "CI environment variable: $CI" echo "GITHUB_ACTIONS environment variable: $GITHUB_ACTIONS" for bench_file in bench_*.py; do echo "Testing $bench_file..." timeout 60 python3 "$bench_file" || echo "Warning: $bench_file timed out or failed, continuing..." echo "Completed $bench_file" echo "---" done echo "All benchmark tests completed!" sgl-kernel-b200-test: runs-on: ${{ fromJson(inputs.runs_on_map)[inputs.runner_config] }} timeout-minutes: 240 steps: - uses: actions/checkout@v4 with: ref: ${{ inputs.git_ref || github.sha }} - uses: ./.github/actions/check-pr-test-health - uses: ./.github/actions/check-maintenance - name: Cleanup run: | ls -alh python/sglang/kernels/aot/dist || true rm -rf python/sglang/kernels/aot/dist/* || true - name: Download artifacts 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 run: | CUSTOM_BUILD_SGL_KERNEL=${{inputs.sgl_kernel}} bash scripts/ci/cuda/ci_install_dependency.sh diffusion - name: Run sgl-kernel unit tests on B200 timeout-minutes: 30 run: | cd python/sglang/kernels/aot pytest tests/ # Adding a single CUDA13 build-and-run check for the kernel # TODO: Add back this test when it can pass on CI # cuda13-kernel-build-check: # if: inputs.sgl_kernel == 'true' # runs-on: x64-cu13-kernel-tests # steps: # - uses: actions/checkout@v4 # - name: Cleanup # run: | # ls -alh python/sglang/kernels/aot/dist || true # rm -rf python/sglang/kernels/aot/dist/* || true # - name: Download CUDA 13.0 artifacts # uses: actions/download-artifact@v4 # with: # path: python/sglang/kernels/aot/dist/ # merge-multiple: true # pattern: wheel-python3.10-cuda* # - name: Install dependencies # run: | # CUSTOM_BUILD_SGL_KERNEL=${{inputs.sgl_kernel}} bash scripts/ci/cuda/ci_install_dependency.sh # - name: Run kernel unit tests # timeout-minutes: 30 # run: | # cd python/sglang/kernels/aot # pytest tests/