Skip to content

Commit 85aaced

Browse files
[DO NOT MERGE] experimental: profile M3 MI355X conc 4/8 with vllm#45639 patch
Profiling counterpart of the #45639 sweep PR: capture Perfetto torch traces for MiniMax-M3 MXFP8 on MI355X (TP8, conc 4 and 8) with vllm-project/vllm#45639 (AITER fused all-reduce + Gemma-RMSNorm) applied in-place. - Reuses the label-triggered profile.yml (add the 'profile-enabled' label; it reads .github/profile-target.env and emits one trace per (conc, tp)). - profile-target.env -> minimaxm3arf-fp8-mi355x-vllm, conc 4 8 (the #45639 recipe). - minimaxm3arf_fp8_mi355x.sh: adds the --profiler-config PROFILE gate so the recipe emits a torch trace under PROFILE=1, on top of applying the #45639 diff in-place (idempotent + hard-fail) and the AITER fusion serve flags. Built on the #45639 recipe/config/patch (#1770); both are DO NOT MERGE. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent e0c9ce5 commit 85aaced

3 files changed

Lines changed: 101 additions & 7 deletions

File tree

‎.github/profile-target.env‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Target for the label-triggered Profile workflow (.github/workflows/profile.yml).
2+
# When a PR carries the 'profile-enabled' label, that workflow profiles this
3+
# config-key and emits a Perfetto trace per (concurrency, tp) (artifact + relay
4+
# link in the run summary). CONC is space-separated; the workflow runs one job
5+
# per (conc, tp) — i.e. both TP4 and TP8 at each conc.
6+
#
7+
# Experiment: MiniMax-M3 MXFP8 on MI355X with vllm-project/vllm#45639 (AITER AR +
8+
# Gemma-RMS fusion) applied in-place; single-node vLLM, TP8, conc 4 and 8.
9+
CONFIG_KEY=minimaxm3arf-fp8-mi355x-vllm
10+
CONFIG_FILE=.github/configs/amd-master.yaml
11+
CONC=4 8

‎.github/workflows/profile.yml‎

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ on:
2626
description: "Ref (branch/sha) to checkout"
2727
required: false
2828
type: string
29+
# Label-triggered profiling: add the 'profile-enabled' label to a PR and this
30+
# workflow profiles the target declared in .github/profile-target.env
31+
# (CONFIG_KEY / CONFIG_FILE / CONC), emitting a Perfetto trace as an artifact
32+
# plus a relay link. Gated in the get-jobs `if` below so only labelled PRs run.
33+
pull_request:
34+
types: [labeled, synchronize, reopened]
2935

3036
permissions:
3137
contents: read
@@ -40,26 +46,68 @@ env:
4046

4147
jobs:
4248
get-jobs:
49+
# Run for manual dispatch, or for a PR carrying the 'profile-enabled' label.
50+
if: >-
51+
${{ github.event_name == 'workflow_dispatch' ||
52+
(github.event_name == 'pull_request' &&
53+
contains(github.event.pull_request.labels.*.name, 'profile-enabled')) }}
4354
runs-on: ubuntu-latest
4455
outputs:
4556
filtered-matrix: ${{ steps.filter.outputs.filtered }}
4657
count: ${{ steps.filter.outputs.count }}
58+
ref: ${{ steps.preref.outputs.ref }}
59+
moe-debug: ${{ steps.target.outputs.moe_debug }}
4760
steps:
61+
- name: Resolve checkout ref
62+
id: preref
63+
run: |
64+
if [ "${{ github.event_name }}" = "pull_request" ]; then
65+
echo "ref=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
66+
else
67+
echo "ref=${{ inputs.ref || github.sha }}" >> "$GITHUB_OUTPUT"
68+
fi
69+
4870
- name: Checkout code
4971
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5072
with:
51-
ref: ${{ inputs.ref || github.sha }}
73+
ref: ${{ steps.preref.outputs.ref }}
74+
75+
- name: Resolve profile target (dispatch inputs or PR target file)
76+
id: target
77+
run: |
78+
set -euo pipefail
79+
if [ "${{ github.event_name }}" = "pull_request" ]; then
80+
f=.github/profile-target.env
81+
if [ ! -f "$f" ]; then
82+
echo "::error::$f is required for label-triggered profiling" >&2
83+
exit 1
84+
fi
85+
ck=$(grep -E '^CONFIG_KEY=' "$f" | head -1 | cut -d= -f2-)
86+
cf=$(grep -E '^CONFIG_FILE=' "$f" | head -1 | cut -d= -f2-)
87+
cc=$(grep -E '^CONC=' "$f" | head -1 | cut -d= -f2-)
88+
md=$(grep -E '^MOE_DEBUG=' "$f" | head -1 | cut -d= -f2- || true)
89+
if [ -z "$ck" ]; then echo "::error::CONFIG_KEY missing in $f" >&2; exit 1; fi
90+
echo "config_key=${ck}" >> "$GITHUB_OUTPUT"
91+
echo "config_file=${cf:-.github/configs/nvidia-master.yaml}" >> "$GITHUB_OUTPUT"
92+
echo "conc=${cc:-64}" >> "$GITHUB_OUTPUT"
93+
echo "moe_debug=${md:-false}" >> "$GITHUB_OUTPUT"
94+
else
95+
echo "config_key=${{ inputs.config-key }}" >> "$GITHUB_OUTPUT"
96+
echo "config_file=${{ inputs.config-file }}" >> "$GITHUB_OUTPUT"
97+
echo "conc=${{ inputs.conc }}" >> "$GITHUB_OUTPUT"
98+
echo "moe_debug=${{ inputs.moe-debug }}" >> "$GITHUB_OUTPUT"
99+
fi
52100
53101
- id: gen
54102
name: Generate matrix via script
55103
run: |
56104
pip install pydantic
57-
CLI_ARGS="test-config --config-files ${{ inputs.config-file }} --config-keys ${{ inputs.config-key }} --conc ${{ inputs.conc }}"
105+
CLI_ARGS="test-config --config-files ${{ steps.target.outputs.config_file }} --config-keys ${{ steps.target.outputs.config_key }} --conc ${{ steps.target.outputs.conc }}"
58106
CONFIG_JSON=$(python3 ${GITHUB_WORKSPACE}/utils/matrix_logic/generate_sweep_configs.py $CLI_ARGS)
59107
echo "raw=$CONFIG_JSON" >> $GITHUB_OUTPUT
60108
61109
- id: filter
62-
name: Take first generated job
110+
name: Select one job per concurrency
63111
shell: python
64112
run: |
65113
import json, os, sys
@@ -78,7 +126,16 @@ jobs:
78126
f.write("filtered=[]\ncount=0\n")
79127
raise SystemExit(1)
80128
81-
filt = data[:1]
129+
# One job per (concurrency, tp): the first config generated for each
130+
# (conc, tp) pair — i.e. the leading 1k1k search-space row of each TP —
131+
# ordered by (conc, tp). This profiles both TP4 and TP8 at every conc.
132+
# A single conc/tp still yields one job (backward compatible).
133+
by_key = {}
134+
for job in data:
135+
k = (job.get("conc"), job.get("tp"))
136+
if k not in by_key:
137+
by_key[k] = job
138+
filt = [by_key[k] for k in sorted(by_key)]
82139
83140
out = json.dumps(filt)
84141
print(out)
@@ -115,8 +172,14 @@ jobs:
115172
CONC: ${{ matrix.config.conc }}
116173
SPEC_DECODING: ${{ matrix.config.spec-decoding }}
117174
DISAGG: ${{ matrix.config.disagg }}
175+
# The single-node launchers resolve the recipe path as
176+
# benchmarks/single_node/${SCENARIO_SUBDIR}<exp>_<prec>_<hw>.sh and run
177+
# under `set -u`; the sweep's benchmark-tmpl.yml sets this, so profile.yml
178+
# must too. Profiling is fixed-seq-len (mi325x/mi300x launchers don't
179+
# default it the way mi355x does).
180+
SCENARIO_SUBDIR: fixed_seq_len/
118181
MOE_DEBUG: '0'
119-
MOE_DEBUG_LOG: ${{ (inputs.moe-debug) && '/workspace/moe_debug.tp0.log' || '' }}
182+
MOE_DEBUG_LOG: ${{ needs.get-jobs.outputs.moe-debug == 'true' && '/workspace/moe_debug.tp0.log' || '' }}
120183
steps:
121184
- name: Resource cleanup
122185
run: |
@@ -145,7 +208,7 @@ jobs:
145208
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
146209
with:
147210
fetch-depth: 0
148-
ref: ${{ inputs.ref || github.sha }}
211+
ref: ${{ needs.get-jobs.outputs.ref }}
149212
clean: false
150213

151214
- name: Launch + Profile (single-node sglang/vllm)
@@ -261,7 +324,17 @@ jobs:
261324
git config user.email "github-actions@github.com"
262325
git add -A
263326
git commit -m "Add profile: ${GITHUB_SHA} ${{ matrix.config['exp-name'] }} tp${{ matrix.config.tp }} ep${{ matrix.config.ep || 1 }} conc${{ matrix.config.conc }}" || echo "Nothing to commit"
264-
git push
327+
# Parallel matrix jobs (one per conc) all push to this same repo, so a
328+
# plain push races and is rejected non-fast-forward. Rebase onto the
329+
# latest remote and retry with jitter until it lands.
330+
for attempt in 1 2 3 4 5 6 7 8; do
331+
if git push; then break; fi
332+
echo "push rejected (attempt ${attempt}); rebasing on origin/master"
333+
git fetch origin master --quiet
334+
git rebase origin/master
335+
if [ "$attempt" = 8 ]; then echo "push failed after ${attempt} attempts" >&2; exit 1; fi
336+
sleep $(( (RANDOM % 6) + 2 ))
337+
done
265338
STORAGE_SHA="$(git rev-parse HEAD)"
266339
popd >/dev/null
267340

‎benchmarks/single_node/fixed_seq_len/minimaxm3arf_fp8_mi355x.sh‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,19 @@ fi
8080

8181
start_gpu_monitor
8282

83+
# When PROFILE=1 (profile.yml), arm vLLM's torch profiler via --profiler-config.
84+
# This minimax-m3 image's vLLM does NOT honour the VLLM_TORCH_PROFILER_DIR env
85+
# var, so the serve flag is what makes /start_profile emit a trace. Write to the
86+
# dir benchmark_lib's relay scans (VLLM_TORCH_PROFILER_DIR, default /workspace/).
87+
PROFILE_ARGS=()
88+
if [ "${PROFILE:-}" = "1" ]; then
89+
PROFILE_ARGS=(--profiler-config "{\"profiler\": \"torch\", \"torch_profiler_dir\": \"${VLLM_TORCH_PROFILER_DIR:-/workspace/}\"}")
90+
fi
91+
8392
set -x
8493
vllm serve "$MODEL" --port "$PORT" \
8594
"${PARALLEL_ARGS[@]}" \
95+
"${PROFILE_ARGS[@]}" \
8696
--block-size 128 \
8797
--no-enable-prefix-caching \
8898
--language-model-only \

0 commit comments

Comments
 (0)