Skip to content

mrope cache-quant test: covering default set, full matrix behind --full - #7318

Merged
zufayu merged 1 commit into
mainfrom
test/mrope-cache-quant-ci-default
Nov 3, 2026
Merged

zufayu merged 1 commit into
mainfrom
test/mrope-cache-quant-ci-default

Conversation

@vorapolsiloai

@vorapolsiloai vorapolsiloai commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What

op_tests/test_fused_qk_norm_mrope_cache_quant.py now runs a 46-case covering set by default. The previous ~600-case matrix is unchanged and runs with --full (for a perf or nightly job).

Why

In standard CI the default entry point took 1131 s on MI355X (run 41382065915, shard 2/8, 602 cases). Each case costs about 1.9 s at any token count (1257 tok: 1.88 s, 127: 1.86 s, 3: 1.85 s), so the time is a fixed per-case cost (test setup and the perftest loops for kernel and torch reference) rather than kernel work. Fewer cases is the fix. Requested by @zufayu.

Section of the old default Cases Time
Strided vLLM KV layout 2 8 s
Full-rotary MRoPE 288 582 s
Plain RoPE 144 243 s
Partial-rotary RoPE 48 75 s
Partial-rotary MRoPE 96 171 s
GemmaRMSNorm MRoPE 24 49 s

Default set (46 cases)

The kernels are templated on <head_size, neox, interleaved, KV dtype> (MRoPE) and <head_size, neox, KV dtype> (RoPE); everything else is a runtime argument.

  • 36 cases, one per instantiation. The default runs every kernel instantiation the full matrix reaches, once each (24 MRoPE + 12 RoPE). Token count (3 / 127 / 1257) and head count (32 / 64) rotate across them, and every head size runs bf16 and fp8 KV with return-kv both on and off.
  • 10 feature and model cases:
    • the strided vLLM unified-attention KV view ([HIP] [kernel] mrope cache-quant: accept strided flash KV-cache view #4531), bf16 and fp8
    • partial rotary RoPE and MRoPE (Qwen3.5: head 256, rotary 64; head 128, rotary 32)
    • GemmaRMSNorm, including the Qwen3.6 full-attention layer and Qwen3.8-27B TP1 (24 q / 4 kv heads). Qwen3.8-27B is the only shape that isn't already in the matrix.

Every runtime value the full matrix uses (tokens, heads, return-kv, rotary dims, Gemma norm, strided layout) also appears in the default set.

Expected runtime is about 90 s (46 × ~1.9 s). This PR's own CI run gives the measured number.

How tested

  • Without a GPU, by stubbing the imports and recording the calls: the default path runs 46 cases reaching the same 36 kernel instantiations as --full, every mrope_section sums to rotary_dim / 2, and --full runs the same 602 cases as before.
  • __main__ exercised with stubbed GPU deps: no args runs 46 cases, --full runs 602, -t 513 --full runs 202, and a sweep-axis flag such as -t 513 without --full exits with an error instead of being silently ignored. -d / -m still apply to the default set (token counts are clamped to -m).
  • black and ruff 0.16.0 pass.
  • GPU correctness: this PR's CI.

.github/split-test-times/aiter.tsv still lists 1120 s for this file. I left it for the automated split-times update.

PR Self-Review

Reviewed revision

a7d523e

Behavior and intent

Running python op_tests/test_fused_qk_norm_mrope_cache_quant.py with no arguments now runs 46 cases instead of 602, and --full runs the old matrix unchanged. Before this PR, every standard CI run spent about 19 minutes on this one file (1131 s in run 41382065915), mostly re-running the same kernel instantiations at different token and head counts. The kernel and op code are not changed.

Validation and unverified scope

Validated without a GPU, by stubbing torch, triton and aiter and recording every call to test_mrope_3d_rms_set_kv_shuffle:

  • No arguments runs 46 cases, which reach all 36 kernel instantiations that --full reaches.
  • --full runs the same 602 cases as before.
  • Every mrope_section sums to rotary_dim / 2.
  • Every head size runs bf16 and fp8 KV with return-kv both on and off.
  • Sweep-axis flags without --full exit with code 2.
  • black and ruff 0.16.0 pass.

Checked against the kernel source: fused_mrope_rms_set_kv launches one warp per (token, head), so the new 24 q / 4 kv case is not limited by head count.

Unverified until this PR's standard CI runs on MI35X:

  • GPU numerics of the new Qwen3.8-27B 24 q / 4 kv case
  • the measured runtime of the default set (estimated ~90 s)

PR-specific question

Which regressions could the default set now miss that the old default caught? A bug that only shows at a particular combination of runtime arguments, for example fp8 KV with GPT-J style at 64 heads and 1257 tokens. Every compiled kernel instantiation still runs, and every runtime value appears at least once, so only cross-combinations of runtime arguments go untested. --full covers those and is meant for a perf or nightly job.

Changed op tests

  • op_tests/test_fused_qk_norm_mrope_cache_quant.py is the only test for fused_qk_norm_mrope_3d_cache_pts_quant_shuffle and fused_qk_norm_rope_cache_pts_quant_shuffle, so it is not redundant with any other test.
  • This PR changes how many cases it runs by default, not what it checks.
  • Its assertions are unchanged: checkAllclose against the torch reference, and a bit-exact comparison of the strided layout against the contiguous one.
  • It would still fail on any wrong q_out, k/v cache or returned k/v, in every kernel instantiation.

@vorapolsiloai
vorapolsiloai requested a review from a team November 2, 2026 08:48
@github-actions github-actions Bot changed the title [CI] mrope cache-quant test: 20-case default set, full matrix behind --full mrope cache-quant test: 20-case default set, full matrix behind --full Nov 2, 2026
@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 7318 --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.

@aiter-bot

aiter-bot commented Nov 2, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision a7d523e17770 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

Running `python op_tests/test_fused_qk_norm_mrope_cache_quant.py` with no arguments now runs 46 cases instead of 602, and `--full` runs the old matrix unchanged. Before this PR, every standard CI run spent about 19 minutes on this one file (1131 s in run 41382065915), mostly re-running the same kernel instantiations at different token and head counts. The kernel and op code are not changed.

Validation and unverified scope

Validated without a GPU, by stubbing torch, triton and aiter and recording every call to `test_mrope_3d_rms_set_kv_shuffle`:
- No arguments runs 46 cases, which reach all 36 kernel instantiations that `--full` reaches.
- `--full` runs the same 602 cases as before.
- Every `mrope_section` sums to `rotary_dim / 2`.
- Every head size runs bf16 and fp8 KV with return-kv both on and off.
- Sweep-axis flags without `--full` exit with code 2.
- black and ruff 0.16.0 pass.

Checked against the kernel source: `fused_mrope_rms_set_kv` launches one warp per (token, head), so the new 24 q / 4 kv case is not limited by head count.

Unverified until this PR's standard CI runs on MI35X:
- GPU numerics of the new Qwen3.8-27B 24 q / 4 kv case
- the measured runtime of the default set (estimated ~90 s)

PR-specific question

Which regressions could the default set now miss that the old default caught? A bug that only shows at a particular combination of runtime arguments, for example fp8 KV with GPT-J style at 64 heads and 1257 tokens. Every compiled kernel instantiation still runs, and every runtime value appears at least once, so only cross-combinations of runtime arguments go untested. `--full` covers those and is meant for a perf or nightly job.

Changed op tests

- `op_tests/test_fused_qk_norm_mrope_cache_quant.py` is the only test for `fused_qk_norm_mrope_3d_cache_pts_quant_shuffle` and `fused_qk_norm_rope_cache_pts_quant_shuffle`, so it is not redundant with any other test.
- This PR changes how many cases it runs by default, not what it checks.
- Its assertions are unchanged: `checkAllclose` against the torch reference, and a bit-exact comparison of the strided layout against the contiguous one.
- It would still fail on any wrong q_out, k/v cache or returned k/v, in every kernel instantiation.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

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

@vorapolsiloai vorapolsiloai changed the title mrope cache-quant test: 20-case default set, full matrix behind --full [CI] mrope cache-quant test: covering default set, full matrix behind --full Nov 2, 2026
@github-actions github-actions Bot changed the title [CI] mrope cache-quant test: covering default set, full matrix behind --full mrope cache-quant test: covering default set, full matrix behind --full Nov 2, 2026
… --full

The default entry point swept 602 cases (1131 s on MI355X standard CI,
run 41382065915). Each case costs ~1.9 s regardless of token count, so
the time is a fixed per-case cost rather than kernel work.

Run a 46-case covering set by default: one case per kernel instantiation
the full matrix reaches (<head_size, neox, interleaved, KV dtype> for
MRoPE, <head_size, neox, KV dtype> for RoPE), with token count, head
count and return-kv rotating so every head size runs bf16 and fp8 KV with
return-kv on and off, plus the strided vLLM KV view, partial-rotary
RoPE/MRoPE and GemmaRMSNorm cases (incl. Qwen3.8-27B TP1, 24 q / 4 kv).

The previous matrix is unchanged behind --full. Sweep-axis flags
(-n/-t/-hd/-hs/-i/-k) now error out without --full instead of being
silently ignored; -d/-m apply to both, and default token counts are
clamped to --max_positions.

Signed-off-by: Vorapol Assavasangthong <[email protected]>
@vorapolsiloai
vorapolsiloai force-pushed the test/mrope-cache-quant-ci-default branch from a55c48b to a7d523e Compare November 2, 2026 09:17
@zufayu

zufayu commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Checked the default covering set against the sweep it replaces — it holds up, and the split it makes is the right one: full cartesian on the dimensions that pick a kernel (head_size × neox × interleaved × kv_cache_dtype), rotation on the ones that only change shape.

Replaying the rotations over the 24 + 12 cases:

loop 1 (GQA, heads_kv=1):   head 32/64 -> 12 each,  token 3/127/1257 -> 8 each,
                            return_kv True/False -> 12 each,
                            all 6 (head_size, num_heads) pairs present
loop 2 (MHA, heads_kv=heads): head 32/64 -> 6 each, token 3/127/1257 -> 4 each

No value of any rotated axis is dropped, and head_size=64 keeps its own mrope_sections_dict entry. That matches what this file measured before: narrowing its token axis loses no parameter value at all — 602 cases become 402 — because only the combinations shrink. This PR turns that property into an explicit design instead of a side effect, which is the part worth keeping.

For reference, measured on an idle GPU with the baseline and the narrowed run back to back (rc=0 both):

MI355X (gfx950) MI308X (gfx942)
this file, full sweep 888s 1170s
token axis narrowed to [3, 1257] 562s 780s

Two things worth confirming before this lands:

  1. How aiter_test.sh invokes this file. It runs python3 <file> unless the path is in the pytest branch, and this one is not. As long as the default path still executes cases under __main__ that is fine — it is only a problem if a default run can return 0 without running anything, which is what [CI] [MLA] test_mla_v4_nm: make the script perf sweep opt-in #7321 currently does for test_mla_v4_nm.py.

  2. test_fused_qk_norm_rope_cache_quant.py is the other half of this pair and nobody has claimed it (1121s recorded). Its __main__ is not one sweep but roughly nine independent blocks, most of which hardcode their shapes and never read args.token — Qwen3.5 partial rotary, GLM 4.7, MiniMax TP1, Gemma4 weightless V-norm, the three-way paged-layout parity check. Narrowing the token axis alone leaves a fixed floor: an empty sweep (-t with no values) still takes 96s, of which import torch + import aiter is only 3.5s. The approach in this PR is what that file needs, applied to those blocks.

@zufayu
zufayu merged commit 5d1c14a into main Nov 3, 2026
@zufayu
zufayu deleted the test/mrope-cache-quant-ci-default branch November 3, 2026 03:22
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
… --full (ROCm#7318)

The default entry point swept 602 cases (1131 s on MI355X standard CI,
run 41382065915). Each case costs ~1.9 s regardless of token count, so
the time is a fixed per-case cost rather than kernel work.

Run a 46-case covering set by default: one case per kernel instantiation
the full matrix reaches (<head_size, neox, interleaved, KV dtype> for
MRoPE, <head_size, neox, KV dtype> for RoPE), with token count, head
count and return-kv rotating so every head size runs bf16 and fp8 KV with
return-kv on and off, plus the strided vLLM KV view, partial-rotary
RoPE/MRoPE and GemmaRMSNorm cases (incl. Qwen3.8-27B TP1, 24 q / 4 kv).

The previous matrix is unchanged behind --full. Sweep-axis flags
(-n/-t/-hd/-hs/-i/-k) now error out without --full instead of being
silently ignored; -d/-m apply to both, and default token counts are
clamped to --max_positions.

Signed-off-by: Vorapol Assavasangthong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants