ci: compute matrix partition counts from est_time (#25193)
This commit is contained in:
@@ -32,12 +32,8 @@ on:
|
||||
value: ${{ jobs.run.outputs.jit_kernel }}
|
||||
multimodal_gen:
|
||||
value: ${{ jobs.run.outputs.multimodal_gen }}
|
||||
max_parallel:
|
||||
value: ${{ jobs.run.outputs.max_parallel }}
|
||||
max_parallel_small:
|
||||
value: ${{ jobs.run.outputs.max_parallel_small }}
|
||||
max_parallel_2gpu:
|
||||
value: ${{ jobs.run.outputs.max_parallel_2gpu }}
|
||||
partitions:
|
||||
value: ${{ jobs.run.outputs.partitions }}
|
||||
b200_runner:
|
||||
value: ${{ jobs.run.outputs.b200_runner }}
|
||||
enable_retry:
|
||||
@@ -63,9 +59,7 @@ jobs:
|
||||
sgl_kernel_raw: ${{ steps.filter-api.outputs.sgl_kernel || steps.filter.outputs.sgl_kernel }}
|
||||
jit_kernel: ${{ steps.filter-api.outputs.jit_kernel || steps.filter.outputs.jit_kernel || steps.run-mode.outputs.run_all_tests }}
|
||||
multimodal_gen: ${{ steps.filter-api.outputs.multimodal_gen || steps.filter.outputs.multimodal_gen || steps.run-mode.outputs.run_all_tests }}
|
||||
max_parallel: ${{ steps.set-parallel.outputs.max_parallel }}
|
||||
max_parallel_small: ${{ steps.set-parallel.outputs.max_parallel_small }}
|
||||
max_parallel_2gpu: ${{ steps.set-parallel.outputs.max_parallel_2gpu }}
|
||||
partitions: ${{ steps.partitions.outputs.partitions }}
|
||||
b200_runner: ${{ steps.set-runner.outputs.b200_runner }}
|
||||
enable_retry: ${{ steps.set-retry.outputs.enable_retry }}
|
||||
continue_on_error: ${{ steps.set-continue-on-error.outputs.continue_on_error }}
|
||||
@@ -198,22 +192,29 @@ jobs:
|
||||
echo "multimodal_gen=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Set max-parallel based on run type
|
||||
id: set-parallel
|
||||
- name: Determine full-parallel mode
|
||||
id: parallel-mode
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
# Determine if this run gets full parallelism (scheduled / high priority)
|
||||
# `full=true` lifts the matrix-fanout throttle so each suite's
|
||||
# max_parallel = size. Conditions (matching the prior set-parallel
|
||||
# step exactly):
|
||||
# 1. Scheduled cron run.
|
||||
# 2. pull_request event with the `high priority` label.
|
||||
# 3. workflow_dispatch with target_stage set (i.e. /rerun-stage)
|
||||
# whose underlying PR carries `high priority`. The labels
|
||||
# aren't on the dispatch payload, so look them up via API:
|
||||
# try SHA -> /pulls (works for fork PRs), fall back to
|
||||
# branch name -> gh pr list (works for non-fork PRs).
|
||||
FULL=false
|
||||
if [[ "${{ github.event_name }}" == "schedule" ]]; then
|
||||
FULL=true
|
||||
echo "Scheduled run detected, using full parallelism"
|
||||
echo "Scheduled run -> full parallelism"
|
||||
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ contains(github.event.pull_request.labels.*.name, 'high priority') }}" == "true" ]]; then
|
||||
FULL=true
|
||||
echo "High priority PR detected, using full parallelism"
|
||||
echo "high priority PR -> full parallelism"
|
||||
elif [[ -n "${{ inputs.target_stage }}" ]]; then
|
||||
# /rerun-stage (workflow_dispatch): query PR labels via GitHub API
|
||||
# Try SHA lookup first (fork PRs), fallback to branch name (non-fork PRs)
|
||||
LABELS=""
|
||||
PR_HEAD_SHA="${{ inputs.pr_head_sha }}"
|
||||
if [[ -n "$PR_HEAD_SHA" ]]; then
|
||||
@@ -224,28 +225,25 @@ jobs:
|
||||
LABELS=$(gh pr list --head "${{ github.ref_name }}" --repo "${{ github.repository }}" \
|
||||
--json labels --jq '.[0].labels[].name' 2>/dev/null || true)
|
||||
fi
|
||||
echo "PR labels: ${LABELS:-"(none)"}"
|
||||
echo "PR labels (via API): ${LABELS:-"(none)"}"
|
||||
if echo "$LABELS" | grep -Fxq "high priority"; then
|
||||
FULL=true
|
||||
echo "High priority PR detected via API (/rerun-stage), using full parallelism"
|
||||
echo "high priority PR (via API) -> full parallelism"
|
||||
fi
|
||||
fi
|
||||
echo "full=$FULL" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Set max-parallel for each runner type
|
||||
# 1-gpu-h100: 14 partitions, 1-gpu-5090: 8 partitions, 2-gpu-h100: 4 partitions
|
||||
if [[ "$FULL" == "true" ]]; then
|
||||
LEVEL=full
|
||||
echo "max_parallel=14" >> $GITHUB_OUTPUT
|
||||
echo "max_parallel_small=8" >> $GITHUB_OUTPUT
|
||||
echo "max_parallel_2gpu=4" >> $GITHUB_OUTPUT
|
||||
else
|
||||
LEVEL=low
|
||||
echo "max_parallel=3" >> $GITHUB_OUTPUT
|
||||
echo "max_parallel_small=3" >> $GITHUB_OUTPUT
|
||||
echo "max_parallel_2gpu=2" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
echo "parallel_level=$LEVEL" >> $GITHUB_OUTPUT
|
||||
echo "Parallelism level: $LEVEL"
|
||||
- name: Compute partitions
|
||||
id: partitions
|
||||
run: |
|
||||
# Emit a single JSON output `partitions` keyed by suite name with
|
||||
# {size, arr, max_parallel} fields per suite. Replaces the prior
|
||||
# full/low max-parallel presets; `--full-parallel` keeps the
|
||||
# `high priority` PR / scheduled cron escape hatch.
|
||||
# See scripts/ci/utils/compute_partitions.py.
|
||||
python3 scripts/ci/utils/compute_partitions.py \
|
||||
--full-parallel ${{ steps.parallel-mode.outputs.full }} \
|
||||
>> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set B200 runner tag
|
||||
id: set-runner
|
||||
@@ -318,7 +316,6 @@ jobs:
|
||||
echo "| multimodal_gen | ${{ steps.filter-api.outputs.multimodal_gen || steps.filter.outputs.multimodal_gen || steps.run-mode.outputs.run_all_tests }} |"
|
||||
echo "| target_stage | ${{ inputs.target_stage || '(none)' }} |"
|
||||
echo "| detection_method | ${{ inputs.target_stage && 'GitHub API' || 'dorny/paths-filter' }} |"
|
||||
echo "| max_parallel | ${{ steps.set-parallel.outputs.parallel_level }} (h100=${{ steps.set-parallel.outputs.max_parallel }}, 5090=${{ steps.set-parallel.outputs.max_parallel_small }}, 2gpu=${{ steps.set-parallel.outputs.max_parallel_2gpu }}) |"
|
||||
echo "| b200_runner | ${{ steps.set-runner.outputs.b200_runner }} |"
|
||||
echo "| enable_retry | ${{ steps.set-retry.outputs.enable_retry }} |"
|
||||
echo "| continue_on_error | ${{ steps.set-continue-on-error.outputs.continue_on_error }} |"
|
||||
|
||||
Reference in New Issue
Block a user