Skip to content

[CI] [MLA] test_mla_v4_nm: make the script perf sweep opt-in - #7321

Merged
zufayu merged 2 commits into
mainfrom
liyjiang/mla_v4_nm_perf_sweep_opt_in
Nov 4, 2026
Merged

zufayu merged 2 commits into
mainfrom
liyjiang/mla_v4_nm_perf_sweep_opt_in

Conversation

@liyjiang

@liyjiang liyjiang commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When CI runs python3 op_tests/test_mla_v4_nm.py with no arguments, the script launches the full perf sweep: 10 batch sizes x 6 kv lengths, and for each shape it times ref / asm kernel / asm total at 50 iters each. This took ~2000 s in CI, against a timing estimate of ~870 s.

This PR makes only the sweep opt-in:

  • --full-sweep runs the full sweep (same default shape lists as before).
  • An explicit -b / -c / -q sweeps just that subset.
  • With no arguments, the script prints a skip notice and exits 0, so standard CI no longer runs the sweep.

Unchanged: the gfx950 guard, the --oob-worker subprocess entry points, all pytest tests, and the CI script aiter_test.sh.

PR Self-Review

Reviewed revision

4943058

Behavior and intent

Only the __main__ script driver of op_tests/test_mla_v4_nm.py changes. Before this PR, a bare python3 op_tests/test_mla_v4_nm.py (how .github/scripts/aiter_test.sh runs op_tests) always ran the full perf sweep over 60 shapes. Each shape runs an accuracy check plus three 50-iteration perf timings. That is a benchmarking workload, not a CI check: it took ~2000 s in CI (run 41382065915) against the ~870 s estimate in .github/split-test-times/aiter.tsv, which unbalances the shard.

After this PR, the sweep runs only when asked for explicitly: --full-sweep for the full default grid, or any explicit -b / -c / -q for a subset. A bare invocation prints a skip notice and exits 0. The default shape lists, the sweep loop, the perf summary and the exit-1-on-failure behavior are all unchanged. The gfx950 guard and the --oob-worker entry points, which the pytest OOB tests launch as subprocesses, are untouched.

Validation and unverified scope

Hardware: MI350 (gfx950), single GPU (HIP_VISIBLE_DEVICES=6), aiter dev container, clean worktree at this revision.

  • python3 op_tests/test_mla_v4_nm.py: prints the skip notice, exit 0, 4 s wall.
  • python3 op_tests/test_mla_v4_nm.py -b 2 -c 256 --iters 5: runs accuracy + perf for that shape, prints the perf summary, exit 0.
  • python3 op_tests/test_mla_v4_nm.py --help: shows --full-sweep and the defaults.
  • python3 -m pytest -q -p no:cacheprovider op_tests/test_mla_v4_nm.py: 50 passed.
  • black --check and ruff check (ruff 0.16.0, matching the CI pin): clean.

Unverified: I did not run --full-sweep end to end in this PR, because it executes the same loop over the same default lists that previously ran unconditionally. I also have not yet seen the new CI shard time for this file; it should drop from ~2000 s to a few seconds of import plus the skip.

PR-specific question

No test assertion was added or changed, so there is no behavior that fails before this PR and passes after it. The PR removes a CI cost, not a coverage gap. Correctness coverage for the v4 nm MLA kernel stays in the file's pytest suite (smoke / accuracy, determinism, kernarg, OOB). Those tests are unchanged and still pass. The perf sweep never contributed coverage beyond them for CI purposes: its accuracy checks run on the same kernel path, and its perf numbers are not asserted against any threshold.

Changed op tests

  • op_tests/test_mla_v4_nm.py: covers the gfx950 v4 nm MLA decode asm kernel (accuracy against the reference, determinism, kernarg layout, OOB guards via --oob-worker subprocesses), plus a manual perf-sweep driver. This PR changes only the driver's default: it becomes opt-in, so standard CI no longer runs a ~2000 s benchmark. Every pytest test and the worker entry points are byte-for-byte unchanged. The file is not redundant: it is the only op test for the v4 nm MLA asm kernel. No coverage is added or removed.

Running `python3 op_tests/test_mla_v4_nm.py` with no arguments (how
aiter_test.sh runs op_tests) launched the full perf sweep: 10 batches x
6 kv lengths, each timing ref / asm kernel / asm total for 50 iters.
That took ~2000 s in CI against an ~870 s timing estimate.

The sweep now runs only with --full-sweep, or with an explicit
-b / -c / -q to sweep a subset. With no arguments the script prints a
skip notice and exits 0. The gfx950 guard, the --oob-worker subprocess
paths used by the pytest OOB tests, the sweep defaults, and every
pytest test are unchanged.
@liyjiang
liyjiang requested review from a team and zufayu November 2, 2026 09:09
@aiter-bot

aiter-bot commented Nov 2, 2026 •

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision 8a67b4e289ef · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. What permissions and untrusted-input boundary does this CI change have, and can fork PR code or text reach a privileged execution path?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7321 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

zufayu
zufayu previously approved these changes Nov 2, 2026
@zufayu
zufayu requested a review from gyohuangxin November 2, 2026 09:19
@zufayu

zufayu commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Making the perf sweep opt-in is right, but as it stands this makes the file run nothing in standard CI, not just skip the sweep.

aiter_test.sh dispatches through pytest only for a fixed list:

tests/test_*.py
op_tests/test_fhmoe.py | op_tests/tuning_tests/test_fhmoe_tuner.py | op_tests/test_hipb_grouped_gemm.py
op_tests/test_flydsl_pa_decode.py

op_tests/test_mla_v4_nm.py is not in it, so CI runs python3 op_tests/test_mla_v4_nm.py. After this change that command takes the new early-exit path and returns 0, which means the smoke / determinism / kernarg suite the docstring points at never runs either — it only runs under pytest, and nothing invokes pytest on this file. A file recorded at 870s becomes a few seconds of import and stays green, with no signal that its tests stopped running.

Fix: add op_tests/test_mla_v4_nm.py to that pytest branch in aiter_test.sh, alongside test_fhmoe.py. The perf sweep still stays opt-in exactly as designed here, and the pytest suite keeps running.

This is not hypothetical — main already has several files in that state, where python3 <file> returns 0 having collected nothing:

file recorded time under pytest
test_gemm_group32_interface.py 4s 144 passed, 3 failed, 76 skipped
test_all2all_manager_lifecycle.py 4s 8 errors
test_concat_cache_mla_seg.py 4s 56 passed
test_moe_local_expert_ids.py 4s 2 passed (57s)

The tell is the recorded time: import torch plus import aiter measures 3.5s on a warm cache, so any entry at ~4s did nothing else. Whether those failures are real or environment-specific is a separate question, but nobody can know while the tests never execute.

Worth checking the same thing in the other opt-in PRs going out (#7318, #7331, #7323): if a file's default path can now exit without running cases, confirm how aiter_test.sh actually invokes it.

With the perf sweep opt-in, `python3 op_tests/test_mla_v4_nm.py` exits 0
without running anything, and the file's smoke / determinism / kernarg /
OOB suite only runs under pytest. Add the file to a pytest dispatch
branch so standard CI executes those 50 cases instead of reporting an
empty run as success.
@github-actions github-actions Bot changed the title [MLA] test_mla_v4_nm: make the script perf sweep opt-in [CI] [MLA] test_mla_v4_nm: make the script perf sweep opt-in Nov 3, 2026
@github-actions github-actions Bot added the CI label Nov 3, 2026
@zufayu

zufayu commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Correction to my earlier comment, and some numbers that change the stakes here.

Correction: I wrote that this change stops the pytest suite from running. That was wrong — those 29 test_ functions have never run in CI. __main__ does not call any of them, and the file is not in aiter_test.sh's pytest branch, so python3 <file> has only ever run the sweep. Nothing about that is this PR's doing.

What this PR does change is that the sweep stops running too, so the file goes from "sweep only" to "nothing at all", and returns 0 either way.

The file is bigger than the recorded time suggests. From two main runs on MI35X:

run 41372363913   2047.955s
run 41355396602   2277.748s

against 948s in .github/split-test-times/aiter.tsv — a factor of 2.2. So this is the second most expensive file in the suite by measured time, behind test_topk_per_row (~2226s) and ahead of test_gemm_a8w8 (~1900s before #7316). Whatever shape this lands in matters more than the recorded number implies.

Three ways to keep CI covering something, roughly in order of effort:

A. Add the file to the pytest branch in aiter_test.sh.

op_tests/test_fhmoe.py|op_tests/tuning_tests/test_fhmoe_tuner.py|op_tests/test_hipb_grouped_gemm.py|op_tests/test_mla_v4_nm.py)
    test_cmd=(timeout 60m python3 -m pytest -q "$file")

One line. The sweep stays opt-in exactly as designed here, and the 29 smoke / determinism / kernarg tests run in CI for the first time. Worth knowing they may not be green on first contact, since nothing has been running them — but that is the point of running them.

B. Have __main__ run a small default correctness set, with --full-sweep for the matrix. This is what #7318 and #7331 do, so it would keep this batch of PRs consistent. The 29 pytest functions still would not run.

C. Both.

A is the smallest change and the only one that adds coverage rather than just preserving it.

For context on why "returns 0 having run nothing" is worth avoiding specifically: main already has four files in that state, each recorded at 4s, each with real cases under pytest — test_gemm_group32_interface.py (144 passed, 3 failed, 76 skipped), test_all2all_manager_lifecycle.py (8 errors), test_concat_cache_mla_seg.py (56 passed), test_moe_local_expert_ids.py (2 passed, 57s). import torch plus import aiter measures 3.5s warm, so a 4s entry did nothing else. They are green in CI and have been for a while.

@zufayu
zufayu merged commit 7fda458 into main Nov 4, 2026
@zufayu
zufayu deleted the liyjiang/mla_v4_nm_perf_sweep_opt_in branch November 4, 2026 05:10
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
* [MLA] test_mla_v4_nm: make the script perf sweep opt-in

Running `python3 op_tests/test_mla_v4_nm.py` with no arguments (how
aiter_test.sh runs op_tests) launched the full perf sweep: 10 batches x
6 kv lengths, each timing ref / asm kernel / asm total for 50 iters.
That took ~2000 s in CI against an ~870 s timing estimate.

The sweep now runs only with --full-sweep, or with an explicit
-b / -c / -q to sweep a subset. With no arguments the script prints a
skip notice and exits 0. The gfx950 guard, the --oob-worker subprocess
paths used by the pytest OOB tests, the sweep defaults, and every
pytest test are unchanged.

* [CI] aiter_test.sh: run test_mla_v4_nm.py through pytest

With the perf sweep opt-in, `python3 op_tests/test_mla_v4_nm.py` exits 0
without running anything, and the file's smoke / determinism / kernarg /
OOB suite only runs under pytest. Add the file to a pytest dispatch
branch so standard CI executes those 50 cases instead of reporting an
empty run as success.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants