Repository navigation
[FlyDSL] [CI] Moev2 pr2 - #8912
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
There was a problem hiding this comment.
🟡 Changes recommended
A critical race between route lookup and reload can repopulate _ROUTES with an obsolete path, causing later calls to keep returning an inactive route.
1 open issue
What changed in this PR
Extends the opt-in MoE v2 migration from #8255 to the remaining single-GPU formats, with cached routing and broader validation. No paths are enabled by default; the shared FlyDSL synchronization fix also affects legacy execution.
Changes:
- Adds format-specific paths, kernel segments, and buffer compatibility checks.
- Caches routing decisions and expands coverage, ranking, and cache-consistency checks.
- Shares additional legacy helpers and fixes FlyDSL asynchronous-copy ordering and bounds.
| File | Description |
|---|---|
tests/test_moev2_switch.py |
Tests entry gating, registrations, graduation, and legacy hooks. |
tests/test_moev2_ranking.py |
Expands ranking checks across formats and legacy fallbacks. |
tests/test_moev2_coverage.py |
Tests coverage classification and segment reachability. |
tests/moe_dispatch/ranking_checks.py |
Checks path-specific ranking, including shared experts. |
tests/moe_dispatch/known_declines.py |
Records accepted legacy fallbacks and their reasons. |
tests/moe_dispatch/keys.py |
Expands the dispatch grid with formats and feature variants. |
tests/moe_dispatch/hibernating.py |
Defines test references for otherwise-unused segments. |
tests/moe_dispatch/gpu_suites.py |
Defaults GPU suites to cache-check mode. |
tests/moe_dispatch/coverage_checks.py |
Adds coverage reports and segment reachability checks. |
tests/conftest.py |
Defaults tests to cache-consistency checking. |
op_tests/test_moe_scatter_reduce.py |
Updates the scratch-cache patch target after relocation. |
aiter/ops/flydsl/kernels/mixed_moe_gemm_2stage_common.py |
Fixes asynchronous-copy waits, ordering, and K-wave bounds. |
aiter/moev2/segments/whole_graph.py |
Expands whole-graph capabilities and declares input requirements. |
aiter/moev2/segments/sort.py |
Adds auxiliary, FLAT, and fused sort/quant support. |
aiter/moev2/segments/quant.py |
Adds MXFP4/MXFP8 quantization and buffer contracts. |
aiter/moev2/segments/opus.py |
Adds Opus stage segments and tuned-row validation. |
aiter/moev2/segments/defaults.py |
Adds quantization-specific block-size and split-K defaults. |
aiter/moev2/segments/ck.py |
Expands CK formats and tuned-row restrictions. |
aiter/moev2/segments/base.py |
Defines segment reachability, boundaries, and launch contracts. |
aiter/moev2/paths.py |
Adds cached routing and entry-specific activation gates. |
aiter/moev2/migration/mxfp8.py |
Registers the MXFP8 activation/weight path. |
aiter/moev2/migration/a8w8_ptok.py |
Registers per-token FP8, int8, and packed-int4 support. |
aiter/moev2/migration/a8w8_pt.py |
Adds int8 support and adopts shared dispatch logic. |
aiter/moev2/migration/a8w8_blockscale.py |
Registers block-scaled FP8 support. |
aiter/moev2/migration/a8w4.py |
Registers MXFP8 activations with MXFP4 weights. |
aiter/moev2/migration/a4w4.py |
Registers MXFP4 activation/weight support. |
aiter/moev2/migration/a16wi4.py |
Registers BF16 activations with grouped int4 weights. |
aiter/moev2/migration/a16w4.py |
Registers BF16 activations with MXFP4 weights. |
aiter/moev2/migration/a16w16.py |
Registers unquantized BF16/FP16 support. |
aiter/moev2/hooks.py |
Propagates legacy benchmark and fused-sort controls. |
aiter/moev2/dispatch/tuned.py |
Shares the stage-2 FP8 table and exposes lookup tiers. |
aiter/moev2/dispatch/plan.py |
Adds segment lookup by starting operation. |
aiter/moev2/dispatch/overrides.py |
Adds dispatch switches for newly supported paths. |
aiter/moev2/dispatch/kernel_names.py |
Exposes the CK-Tile alias constant. |
aiter/moev2/dispatch/coverage.py |
Classifies resolutions and checks segment reachability. |
aiter/moev2/dispatch/buf.py |
Adds buffer-format and layout compatibility checks. |
aiter/moev2/api.py |
Adds shared-expert call conversion and dispatch metadata. |
aiter/aot/flydsl/moe.py |
Updates the relocated scratch-helper patch target. |
.github/split-test-times/aiter.tsv |
Adds timing estimates for MoE dispatch test sharding. |
Review effort: Balanced
WAITING ON AUTHORPR Self-ReviewRevision 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
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
There was a problem hiding this comment.
🔵 Needs a closer look
The shared FlyDSL synchronization change affects legacy execution, and its async-copy ordering and k-wave bounds need maintainer review and exact-head GPU validation beyond the earlier-revision evidence and CPU-simulated gfx942 coverage supplied.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The shared legacy/FHMoE async-copy synchronization change needs kernel-owner review because wait-count ordering and head-matched gfx942 GPU correctness and performance remain unverified.
No open issues 🎉
Review effort: Balanced
CI: all red shards are infra failures — no test failedI went through all 7 failed shards of the Aiter Test run (46478108406):
Nothing in this PR failed a test; the gate just propagated the infra failures. No fix needed on your side for the CI itself — the fresh run from your next push supersedes it. What's needed before merge1. Rebase onto current main. main is 58 commits ahead of your base 2. Port #6987 (FlyDSL MoE RMSNorm,
3. Reconcile #8550 ( 4. Re-run the CPU gates (snapshot / differential / coverage / key+ranking, all 4 archs) after the port, then push — the fresh CI run replaces the current red. On the diff itself I have no blocking findings: the moved functions are byte-identical to legacy, the re-export seam is complete, and the |
Unquantized bf16/fp16 fused_moe calls (QuantType.No) can run through
aiter.moev2 when enabled with AITER_MOEV2=a16w16 (or on). The path is not
graduated: by default every call still runs the legacy code.
Behavior claim:
- Legacy dispatch is unchanged. The CPU dispatch snapshot of legacy
fused_moe is identical on gfx942, gfx942_cu80, gfx950 and gfx1201,
including the new QuantType.No feature variants, which are byte-identical
to ones generated with the upstream base's aiter package.
- When a16w16 runs a call in v2, it makes the same choices as legacy:
same kernels, parameters and inputs, same log lines and exceptions, and
the same outputs within legacy's own run-to-run noise (see Tests).
- a8w8_pt keeps its choices. It no longer takes g1u0 weights, which now
run on legacy (see Known differences).
- Both paths decline what they do not reproduce, and those calls run on
legacy: herd_topk, deterministic=True, a registered presort, a
clamping swiglu_limit (None, 0 and inf do not clamp), beta or
linear_beta, bias, global scales, padding, scatter, caller-chosen
activation dtypes, AITER_ONLINE_TUNE,
g1u0 weights, and a call whose second lookup after the sort would raise
or be declined.
What changed:
- migration/a16w16.py: path a16w16. It claims QuantType.No calls with
g1u1 bf16/fp16 3D weights on gfx942/gfx950, Silu or Gelu, separated
gate/up. Its segments are sort, quant, CK stage 1/2 and whole graph.
- migration/local.py: what the single-GPU paths share. That is the
common claims checks, the per-key cached resolve, the log-only second
lookup after the sort, run and dispatch_record. a8w8_pt now uses it.
The check phase 2 added to a8w8_pt moves here, so every local path
declines a call whose second lookup would raise or be declined, and
says so under AITER_MOE_EXPLAIN=1.
- Path.takes(problem): the dispatch keys a path runs. One segment (CK)
serves several formats, and takes keeps one path from taking another
path's keys. Dispatch, the CPU differential and the ranking checks use
it.
- CK stage 1/2 and the whole graph accept bf16 and fp16, one capability
per dtype. CK stage 1 is g1u1 only, since it always reads w1 as gate and
up (N = w1.size(1) / 2).
- Ranking:
- an a16w16 entry: the get_2stage_cfgs CK default branch;
- named boolean predicates in when(...). fmoe_1stage tests a copy of the
keys of legacy fused_moe_1stage_dict, current with upstream (it has
the gfx950 SwiGLU per_1x32 keys), and a test checks the copy;
- regions that hand their problems back to legacy (legacy="...").
The shipped table uses neither predicates nor legacy regions yet. When
the resolver declines, it says why: no entry applies, a legacy region,
or no listed structure is feasible.
- Dispatch snapshot: QuantType.No keys also get the feature variants
(FEATURE_QUANT_TYPES), and the goldens are regenerated.
- README: rows for local.py and a16w16.py (to be removed), plus the
updated descriptions of paths, ranking, resolver, CK and the tests.
- Tests:
- claims, takes and their agreement on key fields;
- g1u0 not claimed;
- the second-lookup declines, now through the shared dispatch;
- feature variants of QuantType.No keys are legacy calls;
- predicates and legacy regions;
- gpu_differential.py gains a16w16 cases and per-path synthetic rows.
Known differences and limits:
- g1u0 calls run on legacy. Legacy's CK 2-stage gives wrong output for
g1u0 (the stage-1 kernel reads w1 as gate and up), so v2 has nothing to
match. The QuantType.No keys of fused_moe_1stage_dict are all g1u0, so
legacy's default 1-stage ASM fmoe branch stays on legacy too. For
a8w8_pt this drops 544 / 751 / 544 keys on gfx942 / gfx942_cu80 /
gfx950 that phase 2 claimed, all of them the g1u0 feature variants;
it gains none.
- gfx942-only parts are checked only by the CPU differential: the
impl__flydsl_gfx942 tuned rows and the gfx942-only suites. gfx1201
bf16 rows stay on legacy.
Tests:
- CPU: tests/test_moev2_*.py and test_moe_dispatch_snapshot.py, 100
passed.
- CPU gates, on all 4 archs, 0 problems:
- differential.py: a16w16 8000 / 11,724 / 8084 and a8w8_pt 5984 /
8280 / 5984 keys on gfx942 / gfx942_cu80 / gfx950 (none on gfx1201);
- key_checks.py: 181,478 keys, 27,963 tuned rows;
- ranking_checks.py: 51,828 ranked keys, both entries reached.
- GPU differential, gfx950, 0 problems, each also with AITER_USE_NT=1
and AITER_BYPASS_TUNE_CONFIG=1:
- a16w16: 21 default and shipped-tuned cases, and 69 with a synthetic
table of bf16 CK rows;
- a8w8_pt: 15 cases, and 63 with its synthetic table.
- GPU suites, gfx950, AITER_MOEV2=off vs on (both paths):
test_moe_2stage -q 0 and -q 1 (--no-flydsl-csv), test_moe.py,
test_moe_per_tensor_a2_init, test_moe_sorting, test_moe_ep,
test_moe_local_expert_ids and test_moe_dp_share_expert. Same exit codes
and the same verdict for every check, except two swiglu_limit=7.0
checks of test_moe_2stage -q 0 (per-token and per-tensor fp8, which run
on legacy in both modes). Their verdicts also change between two runs
with AITER_MOEV2=off (1 or 2 of 2048 elements past the tolerance).
- black and ruff (0.16.0) clean.
Ported onto main (which holds the squashed phases 0-2, PR 8255):
- local.py carries PR 8255's a8w8_pt code: why_not reasons, the clamps
helper, w1/w2 global scales unsupported, the live arch only, and the
preview prologue that declines before copying anything. Both paths
set why_not and supported_archs and have the ownership NOTE.
- gpu_differential.py keeps PR 8255's variant, raise and gfx942 cu80
cases; the a8w8_pt g1u0 variant is dropped (no longer claimed).
- The golden delta equals the original step's exactly. The key counts
and GPU results above are from the original base. On this base: CPU
tests 133 passed; differential a16w16 8712 / 12,773 / 8803 and
a8w8_pt 6528 / 9031 / 6528 keys on gfx942 / gfx942_cu80 / gfx950;
key_checks, ranking_checks and snapshot --check, 0 problems. The GPU
differential is rerun at the end of the port.
Co-authored-by: Cursor <[email protected]>
…raduated)
fp8 per-token (QuantType.per_Token) and fp8 1x128 blockscale
(QuantType.per_1x128, and per_128x128, which legacy remaps to it)
fused_moe calls can run through aiter.moev2 when enabled with
AITER_MOEV2=a8w8_ptok / a8w8_blockscale (or on). Neither path is
graduated: by default every call still runs the legacy code.
Behavior claim:
- Legacy dispatch is unchanged. The CPU dispatch snapshot of legacy
fused_moe is identical on gfx942, gfx942_cu80, gfx950 and gfx1201,
including the new per_Token and per_1x128 feature variants, which are
byte-identical to ones generated with the upstream base's aiter package.
- When either path runs a call in v2, it makes the same choices as
legacy: same kernels, parameters and inputs, same log lines and
exceptions, and the same outputs within legacy's own run-to-run noise.
The exceptions are two legacy ASM stage 1 kernel families that are not
repeatable even legacy against legacy (see Known differences).
- Calls legacy runs on 1-stage ASM are handed back to legacy: the default
1-stage regions of both formats, and 1-stage tuned rows. So is what the
shared local checks decline (herd_topk, deterministic=True, a
registered presort, a clamping swiglu_limit, beta, linear_beta, bias,
global scales, padding, scatter, caller-chosen activation dtypes,
AITER_ONLINE_TUNE, g1u0, and a call whose second lookup after the
sort would raise or be declined).
- a8w8_pt and a16w16 keep their keys and choices.
What changed:
- migration/a8w8_ptok.py: path a8w8_ptok. It claims per-token calls with
g1u1 fp8 3D weights (the arch's fp8) on gfx942/gfx950, Silu or Gelu,
separated gate/up. These resolve to CK 2-stage, ASM stage 1 + CK
stage 2, or the FlyDSL gfx942 whole graph. int8 and int4 weights stay
on legacy.
- migration/a8w8_blockscale.py: path a8w8_blockscale, the same checks for
per_1x128 / per_128x128. These resolve to CK 2-stage (with the 1x128
block_m and split-K defaults) or asm.stage1_1x128 + CK stage 2.
- segments/asm.py: asm.stage1_1x128, the ASM stage 1 that writes the
quantized intermediate and its fp32 scales into one buffer. It covers
GEMM1 and the intermediate quant, and asks for the a1 scale transposed.
The per-tensor ASM stage 1 also takes per-token fp8.
- execute/executor.py: a stage 1 that covers the intermediate quant gets
its own buffer and splits its output into the GEMM2 inputs, as legacy
does. segments/quant.py: the a1 quant can write the scale transposed.
- CK stage 1/2 accept per-token and 1x128 fp8; the whole graph accepts
per-token fp8.
- segments/defaults.py: default_block_m / default_ksplit, the legacy
default branch's 2-stage block_m and split-K per quant type.
- Ranking:
- entries fp8_per_token and fp8_blockscale. Their legacy regions are
the 1-stage branches of get_2stage_cfgs, with the thresholds as
written; everything else ranks CK 2-stage;
- predicates inter_dim_128 and blockscale_1stage_kernel (the kernel
library's fmoe_fp8_blockscale_g1u1_has_kernel, which legacy calls);
- when() tests its conditions in the order written, so the kernel
library is asked only where legacy asks it;
- FMOE_1STAGE_KEYS reads fp8 as the arch's dtypes.fp8 when looked up,
as legacy does.
- The resolver finds stage segments by the op they cover rather than by
name (MoePlan.starting). local.why_not takes a set of quant types.
overrides.xbf16 reads AITER_XBFLOAT16 where legacy reads it.
- Dispatch snapshot: per_Token and per_1x128 keys also get the feature
variants (FEATURE_QUANT_TYPES), and the goldens are regenerated.
- README: rows for a8w8_ptok.py and a8w8_blockscale.py (to be removed),
plus the updated descriptions of plan, ranking, resolver, overrides,
quant, CK, ASM, defaults, executor, the differential and the tests.
- Tests:
- claims and takes of both paths;
- the per-token 1-stage hand-back, the 1x128 block_m and split-K
defaults, a tuned ASM 1x128 row running the packed stage 1, and the
packed buffer splitting like legacy;
- when() evaluation order;
- feature variants of per_Token and per_1x128 keys are legacy calls;
- the CPU differential counts 1-stage hand-backs separately;
- gpu_differential.py gains cases for both paths (shapes with shipped
gfx950 rows among them) and, for a8w8_blockscale, synthetic rows that
swap the arch's ASM 1x128 stage 1 into its CK rows.
Known differences and limits:
- Two legacy ASM stage 1 families give different outputs for identical
inputs on gfx950, legacy against legacy, on main and on the older base
this work started from. The GPU differential reports them (they are
not excused):
- per-token fmoe_stage1_bf16_pertokenFp8_g1u1_64x128_2tg_pf3 and
_32x128_3tg_pf2 at the shipped 5120/1536 E40 top8 and E41 top10
rows: output garbage up to 1e34 in some runs;
- the 1x128 fmoe_stage1_bf16_pertokenFp8_blockscale_g1u1_* family,
which only the synthetic table runs on gfx950 (shipped ASM 1x128 rows
are gfx942 only): stage 1 output differs on every run.
- Upstream's tuned lookup now falls back to rows tuned for another
activation, except CK 2-stage and MXFP4 rows. The shipped gfx950
4096/384 E128 top8 1x128 Silu rows are 1-stage at 4 to 128 tokens, so a
Gelu call there runs 1-stage on legacy (and is handed back). The GPU
differential's Gelu case for that shape therefore moves from 32 tokens
to 2, which still runs the CK split-K default.
- gfx942-only parts are checked only by the CPU differential: the ASM
1x128 rows and the impl__flydsl_gfx942 rows.
Tests:
- CPU: tests/test_moev2_*.py and test_moe_dispatch_snapshot.py, 112
tests, 111 passed. test_outputs_match_legacy[a8w8_ptok] fails on the
per-token legacy race above.
- CPU gates, on all 4 archs, 0 problems:
- differential.py: a8w8_ptok 3657 / 6724 / 3061 and a8w8_blockscale
5523 / 7583 / 6154 keys on gfx942 / gfx942_cu80 / gfx950, with 2375 /
3357 / 4111 and 1529 / 605 / 4256 keys handed back as 1-stage;
a16w16 and a8w8_pt unchanged (none on gfx1201);
- key_checks.py: 323,445 keys, 51,639 tuned rows;
- ranking_checks.py: 104,820 ranked keys, every entry and region
reached.
- GPU differential, gfx950, shipped tables, AITER_USE_NT=1 and
--synth-table:
- a8w8_ptok: 22 cases (70 with the synthetic table); the only
problems are 2 of the per-token race cases in each mode;
- a8w8_blockscale: 20 cases, 0 problems; with the synthetic table, 64
of 136 pass and all 72 failures run the ASM 1x128 family;
- with AITER_BYPASS_TUNE_CONFIG=1, legacy runs 6 per-token and 4
blockscale cases on 1-stage ASM, and v2 hands them back; the rest
pass;
- a16w16 and a8w8_pt: 0 problems in every mode.
- GPU suites, gfx950, AITER_MOEV2=off vs on (all four paths):
test_moe_2stage -q 2, -q 3 and -q 5 (--no-flydsl-csv), test_moe_tkw1,
test_moe_blockscale, test_moe_sorting, test_moe_ep,
test_moe_local_expert_ids and test_moe_dp_share_expert. Same exit codes
and the same verdict for every check, except three that run on legacy
in both modes and also change between two AITER_MOEV2=off runs: the
per-tensor swiglu_limit=7.0 check of test_moe_2stage -q 3 and -q 5, and
the first check of test_moe_tkw1 (its 1-stage tkw1 ASM kernel, which
fails or warns on every run).
- black and ruff (0.16.0) clean.
Ported onto main (which holds the squashed phases 0-2, PR 8255, and
step 3.1):
- Both new paths set why_not and supported_archs and carry the
ownership NOTE; like a8w8_pt they claim swiglu_limit None, 0 and inf
(legacy reads them as no clamp for every format).
- differential.py keeps PR 8255's compare_launches (the 1-ulp and
legacy-spread tolerance, whole-graph launches, a second legacy run)
and adds this step's 2-stage guard, 1-stage hand-backs and output
check. gpu_differential.py keeps PR 8255's rule that a case where
legacy and v2 both raise fails unless listed in _RAISES; this step's
"both raise" pass is not taken. New GPU cases: output=, a
non-contiguous input and swiglu_limit 0 / inf for both new paths.
- The fused_moe.py note on get_2stage_cfgs points at the README's path
list instead of naming per-tensor fp8.
- Goldens regenerated. gfx950 and gfx1201 get exactly this step's
delta; on gfx942 and gfx942_cu80, 125 / 223 of the new swiglu_limit=7
per-token variant lines differ from the original step's: upstream
ROCm#8531 keeps clamped SiLU on CK where the old base chose the FlyDSL
whole graph, and PR 8255 records whole-graph plans structurally.
- The counts and GPU results above are from the original base. On this
base: CPU tests 143 passed (the GPU-only ones skip); differential
a8w8_ptok 3979 / 7355 / 3329 and a8w8_blockscale 6012 / 8265 / 6682
keys on gfx942 / gfx942_cu80 / gfx950, with 2601 / 3624 / 4486 and
1673 / 664 / 4644 handed back as 1-stage; key_checks, ranking_checks
and snapshot --check, 0 problems. The GPU differential is rerun at the
end of the port.
Co-authored-by: Cursor <[email protected]>
No new paths. The int8 and int4-weight formats join the paths that
already own their scale layout:
- a8w8_pt takes int8 per-tensor weights;
- a8w8_ptok takes int8 per-token weights, and int4 weights packed eight to
a uint32 with fp8 activations.
No path is graduated: by default every call still runs the legacy code.
Behavior claim:
- Legacy dispatch is unchanged. The dispatch snapshot grid gains the fp8 x
uint32 per-token combination (272 keys per arch, 2992 with their feature
variants; additions only). The snapshot is identical on gfx942,
gfx942_cu80, gfx950 and gfx1201 to one generated with the upstream
base's aiter package.
- When either path runs an int8 or int4 call in v2, it makes the same
choices as legacy: same kernels, parameters and inputs, same log lines
and exceptions, and the same outputs within legacy's own run-to-run
noise. One int8 case is the exception (see Known differences).
- int8 calls with doweight_stage1 stay on legacy. No ASM int8 stage 1
kernel applies the routing weights, so legacy raises in the kernel
lookup, and still does.
- A format added to a path later stays behind AITER_MOEV2 once the path
graduates, until it passes its own gate (Path.graduated_claims).
What changed:
- CK segments accept the int8 and fp8 x int4 instances gen_instances.py
builds. asm.stage1 accepts int8 without doweight_stage1 (the get_cfg
kernel tables have no int8 kernel with it).
- Ranking: entries int8_per_token, int8_per_tensor and int4_per_token,
following the legacy default branch:
- int8 runs ASM stage 1 + CK stage 2 (int8 is not in the CK branch's
weight list), with block_m rounded up to a CK stage 2 size;
- int8 per-token keeps legacy's 1-stage branch above 32 tokens as a
legacy region;
- int4 runs CK 2-stage.
- migration/local.py: claims require w2 to have w1's dtype, and leave int8
with doweight_stage1 to legacy (in claims and in the key-level check,
so claims and takes agree).
- paths.py: Path.graduated_claims(call). When the path runs by default, it
claims only the calls this also accepts; None accepts all.
- Dispatch snapshot: the fp8 x uint32 per-token grid combination, and the
goldens are regenerated.
- README: the paths, CK, ASM and path rows describe the new formats.
- Tests:
- int8 and int4 claims, including mixed w1/w2 dtypes and int8 with
doweight_stage1;
- a8w8_pt runs only when enabled;
- int8 defaults run ASM stage 1 and int4 runs CK;
- the ASM int8 stage 1 has no doweight_stage1 kernel;
- gpu_differential.py builds int8 and int4 weights and adds their
cases.
Known differences and limits:
- Left on legacy: per-token torch.int4 weights (the a16wi4 path, a later
step) and per-tensor uint32.
- The int8 per-tensor Gelu GPU case (32 tokens, 4096/384, E128 top8) runs
the default ASM stage 1 fmoe_stage1_bf16_pertokenInt8_g1u1_32x128_3tg_pf3,
whose output differs between two legacy runs (in 2 of 3 pairs; final
outputs within 0.016). On the older base this work started from,
legacy raised in CK stage 2 for this call, so the case passed there.
The GPU differential reports it in every mode.
- The other ASM stage 1 kernels that are not repeatable legacy against
legacy (step 3.2) still show up: the per-token fp8 race cases, and,
with the synthetic table, two int8 per-tensor cases that legacy has
already been seen to get wrong in some runs.
- gfx942-only parts are checked only by the CPU differential.
Tests:
- CPU: tests/test_moev2_*.py and test_moe_dispatch_snapshot.py, 119
tests, 117 passed. test_outputs_match_legacy[a8w8_pt] and [a8w8_ptok]
fail on the legacy ASM stage 1 cases above.
- CPU gates, on all 4 archs, 0 problems:
- differential.py: a8w8_pt 7480 / 9787 / 7480 and a8w8_ptok 5817 /
8884 / 6189 keys on gfx942 / gfx942_cu80 / gfx950, with 3343 / 4325 /
4111 per-token keys handed back as 1-stage; a16w16 and
a8w8_blockscale unchanged (none on gfx1201);
- key_checks.py: 335,413 keys, 51,639 tuned rows;
- ranking_checks.py: 118,703 ranked keys, 7 entries, every region
reached.
- GPU differential, gfx950, shipped tables, AITER_USE_NT=1,
AITER_BYPASS_TUNE_CONFIG=1 and --synth-table:
- a8w8_pt: 23 cases (9 int8), 72 with the synthetic table. The only
problem is the int8 Gelu case above in each mode; with the synthetic
table, also the int8 (64, 7168, 256, E256, top8) case, whose two legacy
runs differed by 4e36;
- a8w8_ptok: 40 cases (18 int8 or int4), 88 with the synthetic table.
The only problems are 2 per-token fp8 race cases in each mode, and in
bypass mode the 6 fp8 cases legacy runs on 1-stage ASM, which v2 hands
back;
- a16w16 and a8w8_blockscale: as in step 3.2.
- GPU suites, gfx950, AITER_MOEV2=off vs on (all paths):
test_moe_2stage -q 1, -q 2 and -q 3 (--no-flydsl-csv),
test_moe_per_tensor_a2_init, test_moe_tkw1, test_moe_sorting,
test_moe_ep, test_moe_local_expert_ids and test_moe_dp_share_expert.
Same exit codes and the same verdict for every check, except checks
that run on legacy in both modes and also change between two
AITER_MOEV2=off runs: the per-token and per-tensor swiglu_limit=7.0
checks of test_moe_2stage -q 2 and -q 3, and the first check of
test_moe_tkw1 (its 1-stage tkw1 ASM kernel).
- black and ruff (0.16.0) clean.
Ported onto main (which holds the squashed phases 0-2, PR 8255, and
steps 3.1-3.2):
- local.why_not gives reasons for the new declines (int8 weights with
doweight_stage1, w2 dtype differing from w1); both paths keep why_not
and supported_archs.
- route_to_v2 applies graduated_claims and still logs refusals under
AITER_MOE_EXPLAIN, now also "a format not graduated yet" when only
the graduation gate turns a call away (tested in
test_moev2_switch.py).
- gpu_differential.py case tuples: field 10 is the weight format, field
11 a dict of options; PR 8255's input variants move to
{"variant": name} (case_variant), and a test rejects the old form.
- The golden delta equals the original step's exactly. The counts and
GPU results above are from the original base, where a case that
raised the same error on legacy and v2 passed; PR 8255 fails such a
case unless listed in _RAISES. On this base: CPU tests 150 passed (the
GPU-only ones skip); differential a8w8_pt 8160 / 10,675 / 8160 and
a8w8_ptok 6323 / 9699 / 6729 keys on gfx942 / gfx942_cu80 / gfx950;
key_checks, ranking_checks and snapshot --check, 0 problems. The GPU
differential is rerun at the end of the port.
Co-authored-by: Cursor <[email protected]>
…bute and method (not graduated) Behavior claim: - Documentation only. No code path, dispatch result, log line or default value changes. No path graduates. What changed: - segments/base.py: the Segment docstring is the reference for segment authors. Attributes are grouped by who reads them: identity and dispatch (name, prefixes, covers, capabilities, reach), plan parameters (structure_params, rank_local_params), and runtime and collective behavior (stateful, zero_tokens_ok, hints, output_lifetime, lossy_values, default_lossy). Each says what it means and who reads it; each attribute line gets a one-line comment. The methods are listed by purpose, with the ones every segment implements. - segments/flydsl.py, segments/mxmoe.py: the module docstrings point at mxfp4.py and flydsl_fhmoe.py, where the segments that run these kernels live. Known differences and limits: - The plan parameters and the runtime and collective attributes are declared, but nothing reads them yet (the tuner and MoeEngine will); the docstring says so. Today block_m is a plan field, not read from structure_params. - default_params is not called by the resolver yet. Tests: - black and ruff clean. - pytest CPU (test_moev2_coverage, test_moev2_switch, test_moev2_dispatch): 155 passed. Ported onto main (which holds the squashed phases 0-2, PR 8255, and steps 3.1-3.9 with the earlier follow-ups): - segments/base.py applies unchanged. - segments/flydsl.py and segments/mxmoe.py: the new sentence goes before PR 8255's NOTE banner in each module docstring; the segments it names are where it says on this base; flydsl.py also names mxmoe.gemm2, which runs flydsl_moe2_layout_* kernels. - Corrected for this base (review): sort and quant segments implement run, not build; the ranking table, hibernating.py and the executor read `name` (the known-decline list does not); only reject_reason is called by the resolver, and a segment overriding it or accepts cannot end a ranking region (ranking._shape_free); default_params is not called yet; block_m is MoePlan.params, copied to MOEMetadata; the hooks read off specific segments (flat, default_xbf16, transpose_a1_scale, out_buffer, split_out) are listed. The attribute lines keep PR 8255's form without comments (the docstring is the reference), and MoeEngine is "planned" rather than "phase 4". The README segments/base.py row mentions the docstring. - On this base: goldens unchanged; CPU tests 217 passed, 10 skipped (the GPU-only ones); differential, coverage report, key_checks, ranking_checks and snapshot --check identical to the previous commit (0 problems, by default and under AITER_BYPASS_TUNE_CONFIG=1 and AITER_XBFLOAT16=1). Co-authored-by: Cursor <[email protected]>
…Tile alias bias, FHMoE logs, differential) (not graduated)
Behavior claim:
- A v2 path no longer raises or drops a bias where legacy runs, and no
longer logs before a decline, in the cases below. Every other dispatch
result, log line and default is unchanged. No path graduates; every
path still runs only with AITER_MOEV2=<path>.
What changed:
- local.py: the MXMOE fallback's block size check ("No fallback backend
supports block_size_M=...") ran after the inline-sort fallback too. It
tested whether `_exclude_mxmoe` was in the kwargs, which
api.dispatch_key always sets (False); it now tests the value. Before,
an a4w4 call on a shipped BM16 inline-sort row that the call cannot run
(weights not marked is_shuffled, or a non-contiguous tensor) logged the
warning and the fallback lookup, then raised TypeError (block_size_M
unset) or NotImplementedError (pinned and different); legacy runs it.
- local.py: the lookup after the sort is log-only again. Legacy passes
`_metadata_transform=lambda _: metadata` into fused_moe_2stages, so
`_use_fhmoe_wrappers` never sees that lookup; the FHMoE consistency
check (`_check_fhmoe`) now runs on the first lookup and each MXFP4
fallback only.
- ck_tile.py: after an alias kernelName1 (swiglu_mxfp4_bf16_cktile),
cktile.gemm2 takes the key's stage 2 bias whichever CK-Tile stage 2
the row names, as legacy's CK-Tile branches do. A row with a real `cktile_*`
kernelName2 dropped bias2 before. Only custom tables have such rows.
- fhmoe.py: a call with a1_scale, a2_scale or num_local_tokens (key
features the FHMoE segments do not declare) is declined before the
dedicated-table capability probes, which log; before, v2 logged the
probe lines, declined, and legacy logged them again.
- differential.py: a key declined only by the lookup after the sort was
skipped without comparison (compare_fhmoe crashed on it). It is now a
decline with that lookup's reason, checked against known_declines.py.
Under AITER_BYPASS_TUNE_CONFIG=1 this adds 11 gfx950 a4w4
exclude_mxmoe keys (3584/384 E896 top16 SiTUv2), all under the known
"a bypassed tuned row turns the MXMOE fallback off" entry.
- known_declines.py: the SiTUv2 CK-Tile/CK entry's explanation names
every way past the MXMOE fallback (AITER_BYPASS_TUNE_CONFIG,
AITER_MXMOE_FALLBACK=0, a shape it rejects).
- migration/a8w4.py docstring: `cktile_*` kernelName1 rows decline.
- Tests: the inline-sort fallback runs without a block size check (with
block_size_M unset and pinned); the fallback test uses dispatch_key's
real kwargs; the alias row keeps the stage 2 bias; FHMoE declines
these calls before the contract and the probes. README rows updated.
Known differences and limits:
- v2 and legacy keep separate dispatch caches, so a key v2 serves on one
call and legacy on another (a presort registered on some calls only)
logs its dispatch line once per side.
- gpu_suites.py --compare does not check that v2 ran any call.
- The known entries for per_1x32 activation scales and 1-stage Gelu
rows are broader than their cause (declines only).
- Whole-graph gfx942 rows import aiter.fused_moe at run time.
- coverage.classify still counts a key declined only by the lookup after
the sort as "plan".
Tests:
- black and ruff clean. Dispatch goldens regenerated: identical to the
pristine base on every arch.
- CPU differential, ranking and key checks: unchanged, 0 problems on
every arch. Under AITER_BYPASS_TUNE_CONFIG=1 and AITER_XBFLOAT16=1:
0 problems; gfx950 bypass known total 37057 -> 37068 (the 11 keys
above), the rest unchanged.
- pytest CPU: 186 passed; the 4 failures are known
test_outputs_match_legacy cases (a4w4, a8w4, a8w8_pt, a8w8_ptok).
After the last differential.py change: test_moev2_dispatch.py 122
passed, the harness tests 9 passed.
- New tests fail without their fix (TypeError on the inline-sort
fallback; stage2_has_bias False on the alias row).
- GPU differential (default, synth, nt, bypass) of a16w4, a16wi4,
a4w4, a8w4, mxfp8, fhmoe: a16w4, a16wi4 and fhmoe 0 problems (fhmoe
synth stops on the missing fhmoe synth rows, as before); a4w4, a8w4
and mxfp8 only the known MXFP4 sort races (todo 5.14), the a8w4 w3
race (5.22) and the JIT build races of modules that never build
(5.20; 0 problems run alone).
Ported onto main (which holds the squashed phases 0-2, PR 8255, and
steps 3.1-3.9 with the earlier follow-ups). Parts this base already
has, kept as they are:
- The lookup after the sort is already log-only: the follow-up 3 port
fixed it (be371c8), with the same docstring and README wording.
- FHMoE: fhmoe.why_not already refuses a1_scale, a2_scale and
num_local_tokens when the call is claimed (step 3.7 port), before
run, the contract and the probes, and a test covers it; the run
check and its test are not added. The README fhmoe.py row says the
call is not claimed.
- differential.py is unchanged: the step 3.9 port's v2_decline already
gives a decline of the lookup after the sort its reason and checks
it against known_declines.py (op and fhmoe entries), with the same 11
gfx950 a4w4 keys under AITER_BYPASS_TUNE_CONFIG=1.
Taken from this commit: the _exclude_mxmoe value check, the CK-Tile
alias stage 2 bias, the known_declines.py wording, the README rows for
ck_tile.py and differential.py, and the tests (the fallback test keeps
this base's preview/prepared-call checks). Both new tests fail without
their fix (TypeError on the inline-sort fallback; stage2_has_bias
False on the alias row).
Corrected in the port:
- migration/a8w4.py: the follow-up 1 port's docstring said a cktile_*
kernelName1 row declines only when its stage 2 is not CK-Tile. Every
such row declines (cktile.gemm1 owns only the alias). The 15
cktile_a8w4_bm32 rows of gptoss_fp8fp4_tuned_fmoe.csv lose the lookup
to other rows of their keys, so no shipped key changes.
- README: the ck_tile.py row says "whichever CK-Tile stage 2" (an alias
row with another stage 2 declines); the fhmoe.py row also names
doweight_stage1 and says the probes are v2's.
- The inline-sort part of the fallback test also checks the log lines.
On this base: goldens unchanged; CPU tests 218 passed, 10 skipped (the
GPU-only ones); differential the same as the follow-up 4 port (claims
and known counts, by default, under AITER_BYPASS_TUNE_CONFIG=1 and
under AITER_XBFLOAT16=1), 0 problems; coverage report, key_checks,
ranking_checks and snapshot --check 0 problems. The GPU differential
is rerun at the end of the port.
Co-authored-by: Cursor <[email protected]>
…docstrings (not graduated) Review round over the 15 ported step 3 commits. - ck.py: a tuned row with an empty kernelName1 on weights outside legacy's CK list (bf16, fp16, uint32, fp4x2, fp8; or 1x128 with doweight_stage1), i.e. int8, is declined: legacy runs ASM stage 1 for it with block_m rounded to a CK stage 2 size, v2 ran CK stage 1. Not under AITER_BYPASS_TUNE_CONFIG, where the row is ignored. No shipped tuned table has such a row. - differential.py: NaN-aware output compare, bit-exact compare for bitwise=True, legacy run-to-run noise capped at 16 ulps of the peak, the second legacy run used as a noise reference only when its sort buffers match, kernel_bench_callable restored, known entries matching no decline listed on all-arch runs. - gpu_differential.py: where legacy raises, v2 must raise the same error, running or declining the call (as on moev2_official); `_RAISES` variants still need v2 to run and raise. These cases print as RAIS and are counted, with a warning for each after a failed JIT build. Caches cleared before the warm-up; unexpected comparison errors fail the case. - fused_moe.py: re-exports of names moved out of it restored. - coverage.classify resolves with emit_on_raise=False. - Docstrings of the a16w4, a8w4, mxfp8, a16wi4, fhmoe paths, local._dispatch and quant._keeps_bf16 match the code; README lists the coverage, ranking and key checks. - .github/split-test-times/aiter.tsv: measured times of the moev2 test files. Co-authored-by: Cursor <[email protected]>
…sort order, MXFP4 fallback cache (not graduated)
Behavior claim:
- No path graduates; every path still runs only with AITER_MOEV2=<path>.
The v2 dispatch results, log lines and defaults are unchanged. The FlyDSL
mixed stage 1 kernel (legacy and v2 share it) no longer races on its
async LDS copy.
What changed:
- mixed_moe_gemm_2stage_common.py (compile_mixed_moe_gemm1_common), async
A copy:
- Nothing kept the compiler from moving interleaved_half's scale and B
loads above or between its async copies. The wait before the K-loop
barrier was a raw s_waitcnt that SIInsertWaitcnts does not see, and
its count was not the number of loads issued after the copy, so waves
could read stale LDS. Seen as about 3 in 10 wrong a8w4 runs of
(64, 7168, 3072, E24, top6). A sched_barrier now follows the copy,
and the barrier waits vmcnt(async_loads_after_copy), counted from
the same loads the half issues. Heterogeneous B keeps vmcnt(0); the
non-async path is unchanged.
- With k_wave > 1, the copy guard compared the group-relative K offset
with k_dim instead of klen. With an odd number of K tiles per wave
group (55 shipped rows), the last half copied one tile past the group
into a buffer that the k-wave reduction overwrites. The guard now
compares with klen. At k_wave 1 the ISA is byte-identical.
- Stage 1 times unchanged within noise. 100 relaunches of each of 10
recorded kernels are bitwise equal.
- local.py: run resolves the MXFP4 fallbacks through the mxfp4_fallbacks
cache (keyed like dispatch, plus block_size_M) instead of on every call
(todo 5.130).
- differential.py:
- Sorted rows compare by (token, slot), so the order inside an expert
may differ (a4w4 and a8w4 sorts claim positions with atomics). The
sort layout itself must still match: num_valid_ids, padding positions
and each (token, slot)'s expert.
- The reverse sort buffer and the caller's weight scales compare whole.
- Native a4w4 stage 2 scales compare in sorted order; the ASM 1x128
stage 1 buffer compares rows and scales in their own dtypes.
- After a stage 1 legacy does not repeat (_unrepeatable_stage1), the
integer tensors quantized from its output get legacy's own spread.
Stage 1's inputs and num_valid_ids stay bitwise.
- gpu_differential.py:
- Only a failure that may be legacy noise is rerun; a v2 race must not
pass on a lucky run.
- Only legacy modules known never to build may fail to build.
- Running out of GPU memory is reported and fails the run.
- tests: unit tests for each harness rule above, and one for resolving
the a4w4 fallbacks once per key.
Co-authored-by: Cursor <[email protected]>
…ignature (not graduated)
Behavior claim:
- No path graduates; every path still runs only with AITER_MOEV2=<path>.
The cache returns exactly the decisions computed afresh. Every dispatch
result, log line and default is unchanged; legacy calls pay nothing.
With AITER_MOEV2 unset, no entry hook builds a call.
Why: v2 decided every call afresh. route_to_v2 ran every active path's
why_not, and LocalDispatch.run built the dispatch key twice. That cost
1.3% to 2% of vLLM prefill throughput on the MXFP4/MXFP8 paths, and up to
8% of Mixtral eager decode (todo 5.130).
What changed:
- dispatch/call_cache.py (new): signature(call, entry), a standalone
function. It projects each entry parameter by its class in PARAMS:
- VALUE: by value;
- PRESENT: whether it is None;
- WEIGHT: dtype, shape and tags;
- ROWS: shape, with the token count bucketed by get_padded_M;
- EXEC: not at all.
It adds what the decision also reads: the activation dtype, arch, CU
count, AITER_ONLINE_TUNE, AITER_MOE_EXPLAIN, the presort registration
and legacy's grouped gfx1250 branch. A parameter missing from PARAMS
turns the cache off for that entry, with a warning.
- AITER_MOEV2_CALL_CACHE, read on every call: unset or 1 caches, 0
decides every call afresh, check decides every hit afresh as well and
raises CallCacheMismatch where the two differ. The tests (conftest) and
both GPU harnesses run with check.
- paths.py: route_to_v2 caches the chosen path, or none, per signature,
and hands the signature to the path in the call. paths.reload() and so
tuned.clear_cache() clear the cache.
- local.py: run splits into _decide (pure, cached per signature and
forced arguments) and _execute, the per-call steps that a cached and a
fresh decision share: prologue, fallback warnings, block-size checks
and the launch. The first execution of a decision logs its lookup, as
legacy logs it once per key.
- Host trims, results unchanged:
- The entry hooks build the call only where a path is active at that
entry (any_active(entry)).
- resolve_activation_dtype is memoized on its inputs and the variables
it reads (ACTIVATION_ENV).
- legacy_globals returns a shared no-op context when there is nothing
to set.
- The grouped_moe_gfx1250 import is cached.
- Tests: tests/test_moev2_call_cache.py (17) covers:
- every entry parameter has a class, and each class is keyed as
declared;
- one signature gives one decision under perturbations;
- every variable the decision reads per call is in the signature;
- check mode, the kill switch and declines.
run_differential runs each v2 call twice, the second from the cache.
The switch tests pin the entry hooks.
- README: where to add what a decision newly reads.
Measured (gfx950):
- route_to_v2 hit about 8.4 us in a micro benchmark.
- vLLM prefill, cache vs off, all within +-0.9%: dsv41 a8w4 and a4w4,
minimax_mxfp8, each at tp4 and tp4ep. Without the cache these were
-1.3% to -2.0%.
- DSv4-Pro tp8ep +2.6%.
- CPU suites pass. gpu_suites --compare on all 10 paths in check mode
raised no CallCacheMismatch. GSM8K equals off.
Co-authored-by: Cursor <[email protected]>
…Cm#8669, ROCm#7172) (not graduated) Main changed the legacy MoE path that v2 mirrors; v2 follows: - ROCm#7611 intermediate_pad: the 1-stage ASM segment passes the layout's intermediate_pad to fused_moe_1stage, and a padded MXFP4 Silu/Gelu call without a row uses the FLAT/EMSORT 1-stage row tuned at the logical width, logging the legacy line. - ROCm#8211 gfx942 MXFP8 x MXFP4 SiTUv2 1-stage ASM: the SiTUv2 discard on preshuffled weights spares that kernel's rows, a row of it the call cannot run (activation, per-expert bias, stage2_scatter) is discarded with the legacy warning, and calls whose w1 / w1_scale are tagged a8w4_gfx942_layout stay on legacy (the tag is in the call-cache signature). - ROCm#8669 AITER_FLYDSL_STAGE2_FP8=1: the stage2 FP8 table's row replaces the main row unless it is of a smaller token tier (tuned.stage2_fp8_table, tuned.lookup_with_tier). - ROCm#7172 run_mxfp4 does not allocate the stage 1 output for a fused-quant stage 1. Tests cover each branch against legacy; the README and docstrings are updated. Co-authored-by: Cursor <[email protected]>
…not graduated) Fixes from an independent review of the port: - The gfx942 MXFP8 x MXFP4 1-stage discard applies to plain ASM rows only, like the 1-stage activation and SwiGLU OAI discards: for a row that also names a stage 2, legacy checks its CK-Tile / Opus discards first, so v2 declines it. - The AITER_FLYDSL_STAGE2_FP8=1 table is read through legacy's cfg_2stages_stage2_fp8 (tuned.share_stage2_fp8_table), as the default table is through cfg_2stages. - coverage.classify / row_status use resolver.select_row (was _select_row), so they see the stage2 FP8 and logical-width rows. - test_main_legacy_rows_against_legacy compares v2 with legacy get_2stage_cfgs (records and log lines): a shipped padded FLAT row (v2 declines: no segment takes padding), the shipped stage2 FP8 rows at 8192..131072 tokens and against a main row of a larger tier, and a gfx942 MXFP8 row with bias. The MXFP8 and padded tests check more cases. - README and docstrings: padded calls are declined; the FP8 table is shared. Co-authored-by: Cursor <[email protected]>
…(not graduated) A route miss that overlapped reload() put its result into _ROUTES after reload() had cleared it: a thread paused in path A's claims while another replaced A with B at the same entry left A cached, so later calls with that signature kept running A with only B active. route_to_v2 now reads _generation before _route and puts the entry only if it is unchanged, under _lock, as active() publishes the selection. The dispatch decisions live in the route entry, so an unpublished entry's decisions serve only its call. Co-authored-by: Cursor <[email protected]>
…ROCm#6987, ROCm#6529, ROCm#8939, ROCm#8550, ROCm#8966) (not graduated) Ports what landed on main since this PR's base into its copies of the legacy dispatch. ROCm#6987 (FlyDSL MoE post-GEMM2 RMSNorm): v2 declines a call passing post_gemm2_rms_weight (_UNSUPPORTED_ARGS, and fhmoe_call's unsupported list), so the legacy pipeline applies the norm. op_call raises legacy's ValueError when the weight and the stage2_scatter combine disagree. The call cache classifies the weight (PRESENT) and eps/zero_centered (EXEC); FHMoE's _OP_DEFAULTS gains the three defaults. ROCm#6529 (a16w4 row guards): mxfp4_row_rejection discards a flydsl_moe1_abf16_ row for bias or interleaved gate/up, and a flydsl_moe1_abf16_wfp4_ row for activations other than Swiglu/SiTUv2 or a caller block_size_M other than the row's block_m, in legacy's order and with its warnings. dispatch_key passes block_size_M as _fused_moe_impl now does; the relookup takes the first lookup's block size unless the caller pinned one, as fused_moe_2stages does. block_size_M is a launch extra every capability accepts. The dispatch keys gain a block_size_M=64 feature variant; goldens updated (the bias and interleave variants of 255 tuned a16w4 rows per main, plus the new variant). ROCm#8939 (untuned FlyDSL report once per shape): the heuristic FlyDSL, MXMOE and a16wi4 fallback lines are UntunedFallback, emitted as legacy's _warn_untuned_flydsl. The differential compares each key from a fresh report state on both sides. ROCm#8966 (block_size_M=0 on direct calls): the prologue reads 0 as unset, as _fused_moe_impl now does. ROCm#6247 (gfx942 a8w4 stage 1): v2 declines weights tagged a8w4_gfx942_layout, which the `_g942` stage 1 requires, so its fused_moe_2stages handling stays legacy's; the decline's docstring names both kernels. (The wrapper's in_dtype/x_layout pass-through went into step 3.4, which moves the wrapper.) ROCm#8550 (stage 1 A LDS-DMA wait): its count now serves only the path without the async copy, whose wait is this PR's async_loads_after_copy; comment updated. On gfx950, stage 1 relaunched 100 times with filled allocations is bitwise stable on main's DSv4.1 t32x128x256 gui fp8 keys and this PR's a8w4 repro (pre-ROCm#8550 main: 37 of 99 differ), within 1% of ROCm#8550 alone. CPU gates on gfx942, gfx942_cu80, gfx950 and gfx1201: snapshot identical, differential 0 problems (also AITER_BYPASS_TUNE_CONFIG=1, AITER_FLYDSL_FORCE=0), key, ranking and coverage checks pass; tests/test_moev2_*.py 260 passed. Co-authored-by: Cursor <[email protected]>
zufayu
left a comment
There was a problem hiding this comment.
Approved.
Verified before approving:
- #6987 port (post-GEMM2 RMSNorm): checked all places —
local.py_UNSUPPORTED_ARGSnow declinespost_gemm2_rms_weight,api.pypasses the three params through and raises legacy's ValueError on a weight/combine disagreement,fhmoe_call's unsupported list, call-cache classifies the weight PRESENT and eps/zero_centered EXEC,fhmoe_OP_DEFAULTSgains the three defaults. - #8550 reconciliation: the stage-1 wait now serves only the path without the async copy, with the bitwise validation rerun on the merged kernel (100 relaunches, stable; pre-#8550 main 37/99 differ).
- CPU gates on gfx942/gfx942_cu80/gfx950/gfx1201: snapshot identical, differential 0, key/ranking/coverage pass.
- CI green: all 8 MI35X shards pass. The one red shard was a topk segfault in code this PR never touches (passed on rerun; the a8w8 asm checkAllclose lines are pre-existing log noise, identical on main).
Nice work porting the full backlog (#6529/#8939/#8966/#6247 included).
…rential runs Legacy and v2 report an untuned FlyDSL fallback once per shape (ROCm#8939). gpu_differential runs a legacy warm-up before the compared legacy and v2 runs, so the warm-up consumed legacy's report and the compared logs differed by that line. _clear_dispatch_caches() now also forgets both sides' reports, as the CPU differential does per key. Co-authored-by: Cursor <[email protected]>
Conflicts: - aiter/moev2 (ROCm#8912 moved the per-path second lookup into migration/local.LocalDispatch): main's a8w8_pt taken as is; this branch's 3584 tier moved into local.py the way it lived in a8w8_pt (the second lookup keys on api.tuned_token, and a tier token without a row for the shape resolves at its bucket). api.problem_from_key keeps main's fhmoe argument and this branch's tier fallback. - aiter/fused_moe.py: main imports _FUSED_DECODE_SORT_QUANT_* from moev2; this branch's row-strided quant switch and helper kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts with #8912 (moev2 PR2) and #7139 (relu2): - aiter/fused_moe.py: keep main's _warn_untuned_flydsl, its updated moev2 note and the stage2 FP8 table shared with moev2 (_stage2_fp8_cfg_2stages, share_stage2_fp8_table). Keep this branch's undecorated _get_2stage_cfgs behind the per-CU-count cache (_get_2stage_cfgs_per_cu), so _get_2stage_cfgs_cache_clear stays _get_2stage_cfgs_per_cu.cache_clear. The stage2 FP8 lookup goes through _lookup_cfg, so it gets the full-chip CU fallback too. - aiter/moev2/segments/defaults.py: keep main's default_block_m and default_ksplit; get_ksplit stays the uncached wrapper of the CU-count-keyed _ksplit. Co-authored-by: Claude <[email protected]> Signed-off-by: Andreas Karatzas <[email protected]>
Conflict in aiter/moev2/dispatch/tuned.py: main (#8912) made lookup() a wrapper of the new lookup_with_tier(), which also returns the token tier the row was found at (the resolver uses it to decide whether the AITER_FLYDSL_STAGE2_FP8=1 row replaces the default row). The token x get_tuned_cu_nums() CU fallback loop of this branch now lives in lookup_with_tier(), so lookup(), the stage2 FP8 lookup and the tier comparison all see the full-chip rows on a partition. On a miss it returns the last tier tried, as on main. The partition test also checks the returned tier. Co-authored-by: Claude <[email protected]> Signed-off-by: Andreas Karatzas <[email protected]>

Title:
[MoE] moev2 step 3: the remaining single-GPU paths, coverage gates and a per-call decision cache (not graduated)Summary
This PR continues the moev2 migration that #8255 started. #8255 added the framework and one path,
a8w8_pt. This PR ports every other single-GPUfused_moeformat to v2:a16w16: bf16/fp16, unquantized;a8w8_ptok: fp8 per-token;a8w8_blockscale: fp8, 1x128 activations and 128x128 weight blocks;a4w4: MXFP4 x MXFP4;a16w4: bf16 x MXFP4;a16wi4: bf16 x int4 in 1x32 groups;a8w4: MXFP8 x MXFP4;mxfp8: MXFP8 x MXFP8;fhmoe:fhmoe_, with the shared expert as the last row.a8w8_ptanda8w8_ptok.Nothing changes by default. Paths run only when enabled with
AITER_MOEV2. No path is graduated, so with the variable unset oroff, every call runs the legacy code.There is one exception: a race fix in the FlyDSL mixed stage 1 kernel (
mixed_moe_gemm_2stage_common.py). Legacy and v2 share that kernel, so legacy gets the fix too. See "Breaking Changes".The branch is on
main333b78da1(64 files, +15,721/−3,454). About 2,400 of those lines are legacy code moving out offused_moe.pyandfhmoe.pyintoaiter/moev2; legacy imports it back. The 20 commits:52ee10db8to7ca86aba9, 10 commits): one commit per format or capability, then the coverage report and the graduation gates.84111cc6d,28c792f1e,7e004dcdb,e337faa06,35c4db468):Segment.reachreplacestuned_only;Segmentreference docstring.528dd4548,b4ea67694):kernelName1;57e38f682).be0783898, and its review fixes inf8f6b76b7): [ASM] [HIP] [MoE] Run the FLAT and EMSORT MXFP4 fmoe tiles on padded intermediate widths #7611, [ASM] [HIP] gfx942: 1-stage ASM MXFP4 x MXFP8 SiTUv2 MoE kernel for M ≥ 1024 #8211, [CK] [FlyDSL] [JIT] [MoE] Add a stage2 FP8 row table for AITER_FLYDSL_STAGE2_FP8=1 #8669 and [MoE] Skip unused intermediate allocation for fused stage-1 quantization #7172 changed legacy code that v2 mirrors. See "Port of main's legacy MoE changes".aiter/moev2/README.mdlists every file, its purpose, and whether it stays or goes when legacy is retired.Motivation
#8255 describes the motivation. Legacy dispatch and execution form one monolith that serves every quant type, and v2 splits it into parts that can be migrated one workload family at a time.
With this PR, every single-GPU format has a v2 path. Each path claims only the calls it reproduces exactly and hands every other call back to the unchanged legacy code. The gates added here are what a path must pass before it graduates (see "Rollout").
How to enable and roll back
The paths are
a8w8_pt,a16w16,a8w8_ptok,a8w8_blockscale,a4w4,a16w4,a16wi4,a8w4,mxfp8andfhmoe. The first nine hookfused_moe_;fhmoehooksfhmoe_.Changes
Paths and formats (steps 3.1 to 3.7)
a16w16:migration/local.pyholds what the single-GPU paths share: the common claims checks, the per-key cached resolve, the log-only second lookup after the sort,runanddispatch_record.a8w8_ptnow uses it.Path.takes(problem)names the dispatch keys a path runs. One segment, CK, serves several formats, so this keeps one path from taking another's keys.legacy="...").a8w8_ptok,a8w8_blockscale:asm.stage1_1x128, the ASM stage 1 that writes the quantized intermediate and its scales into one buffer. The executor splits that buffer into the stage 2 inputs, as legacy does.block_mand split-K per quant type, insegments/defaults.py.a8w8_pttakes int8 per-tensor weights.a8w8_ptoktakes int8 per-token weights, and int4 weights packed inuint32with fp8 activations.Path.graduated_claimskeeps a format added to a graduated path behindAITER_MOEV2until that format passes its own gate.Segment.reads,Buf.mismatch).a4w4:a16w4,a16wi4,a8w4,mxfp8, and the rest ofa4w4(Swiglu, SiTUv2, bias, activation parameters, padding, CK-Tile):executor.run_mxfp4follows everyper_1x32branch of_fused_moe_implandfused_moe_2stages.asm.fmoe_1stagebuilds legacy'sfused_moe_1stagecall: kernel name, activation, xbf16, FLAT mode andexpert_mask.sort.flatis legacy's pass-through for the FLAT modes.fhmoe:_fhmoe_implgets the same v2 hook asfused_moe_. Thefhmoe_op schema is unchanged.Coverage and graduation gates (steps 3.8, 3.9 and the follow-ups)
dispatch/coverage.pyandcoverage_checks.py, in CI on every simulated arch:known_declines.pylists it.Segment.reach:ranked: in a ranking entry;tuned: only through tuned rows, and some shipped row must run it;hibernating: added before anything runs it, and must name its GPU test.tests/moe_dispatch/known_declines.py.gpu_suites.py --comparefails where v2 fails and legacy passes, for a path that isn't implemented, and when no suite runs on the arch.Legacy code moved, not copied
v2 never imports legacy. Legacy code that v2 reuses moves into
aiter/moev2, verbatim (AST-identical), andfused_moe.py/fhmoe.pyimport it back, so both sides run the same objects. This PR moves:segments/flydsl.py,segments/mxmoe.pyandsegments/sort.py;segments/ck_tile.py;segments/flydsl.py;_opus_stage2_fp8_enabledtosegments/opus.py;fused_moe_1stage,_ASM_ACT_TAGand_retarget_asm_activationtosegments/asm.py;_moe_prepare_unsorted_inputtosegments/sort.py;segments/flydsl_fhmoe.py.Every name importable from
aiter.fused_moeandaiter.fhmoebefore this PR still is.executor.run_mxfp4,executor.run_one_stage, the resolver and the ranking table are copies, as in #8255. The CPU differential and the GPU differential fail on any drift.Review fixes
compile_mixed_moe_gemm1_common, async A copy), shared with legacy:interleaved_half's scale and B loads above its async copies. The wait before the K-loop barrier was a raws_waitcntwith a count lower than the number of loads issued after the copy, so waves could read stale LDS. It showed as about 3 in 10 wrong a8w4 runs of (64, 7168, 3072, E24, top6).sched_barriernow follows the copy.vmcnt(async_loads_after_copy), counted from the loads the half issues.k_wave > 1, the guard compared the group-relative K offset withk_diminstead ofklen. With an odd number of K tiles per wave group (55 shipped rows), the last half copied one tile past the group, into a buffer the k-wave reduction overwrites.k_wave1 the ISA is byte-identical, and stage 1 times are unchanged within noise.kernelName1are declined: legacy runs ASM stage 1 there, and v2 ran CK. No shipped table has such a row._use_fhmoe_wrappersconsistency check to the same lookups legacy checks. An a4w4 inline-sort fallback no longer runs the MXMOE block-size check.Per-call decision cache (
aiter/moev2/dispatch/call_cache.py)v2 used to decide every call afresh:
route_to_v2ran every active path'swhy_not, andLocalDispatch.runbuilt the dispatch key twice. Now:signature(call, entry)is a standalone function. It keys each parameter offused_moe/fused_moe_/fhmoe_by its declared class:get_padded_M;It adds what the decision also reads: the activation dtype, arch, CU count,
AITER_ONLINE_TUNE,AITER_MOE_EXPLAIN, a registered presort, and legacy's grouped gfx1250 branch.What is cached:
route_to_v2caches the chosen path per signature.LocalDispatch.runsplits into_decide, which is pure and cached, and_execute, the per-call steps (prologue, warnings, block-size checks, launch). A hit and a miss share_execute.AITER_MOEV2_CALL_CACHE, read on every call:0turns it off;checkdecides every hit afresh and raises on a difference. The tests and both GPU harnesses run withcheck.Unclassified parameters: a new entry parameter missing from the class table turns the cache off at that entry, with a warning.
Host trims:
resolve_activation_dtypeis memoized on its inputs and the variables it reads.Not paid by default: with
AITER_MOEV2unset, no entry hook builds a call.Port of main's legacy MoE changes
Rebasing onto
main333b78da1brought in five legacy MoE changes; v2 follows four of them:intermediate_pad:intermediate_padtofused_moe_1stage, as legacy does on every 1-stage plan.w1/w1_scaleare taggeda8w4_gfx942_layoutstay on legacy. The tag is part of the call-cache signature.AITER_FLYDSL_STAGE2_FP8=1: the stage 2 FP8 table's row replaces the main row unless it is of a smaller token tier (tuned.lookup_with_tier). v2 reads that table through legacy'scfg_2stages_stage2_fp8, as it already shares the main table.run_mxfp4doesn't allocate the stage 1 output for a fused-quant stage 1.sort.py) has no legacy caller, so there was nothing to port.test_main_legacy_rows_against_legacycompares legacy'sget_2stage_cfgswith v2'sdispatch_record, records and logs, on a shipped padded FLAT row, the shipped stage 2 FP8 rows at 8,192 to 131,072 tokens and a gfx942 MXFP8 row with bias. The CPU differential is at 0 problems on all four archs, with and withoutAITER_FLYDSL_STAGE2_FP8=1.Rollout
The graduation criteria and the opt-in period are as in #8255. A path graduates per arch, and per CU count where the tuned tables differ, once these pass on that hardware:
gpu_suites.py --compare;This PR graduates nothing.
Performance
vLLM 0.32.1rc1,
vllm bench throughputwith random prompts, total tokens/s, MI350X (gfx950).AITER_MOEV2=off.AITER_MOEV2=onfor the big models (every path), and the one path for Mixtral (a16w16,a8w8_ptok,a8w8_blockscale).VLLM_ENABLE_V1_MULTIPROCESSING=0). With the engine core in its own process, it starts stepping before all 64 prompts are added, so the timed prefill splits differently from run to run. That moves decode throughput by up to 10% in both modes. In-process, the timed prefill is one batch every run.be0783898; the graph decode cells and one prefill cell were rerun onf8f6b76b7. The review fixes inf8f6b76b7change no dispatch of the shipped tables (the snapshot, differential and coverage outputs are identical).Big models, torch.compile + CUDA graphs:
Mixtral-8x7B-Instruct (bf16, vLLM online FP8 per-channel and per-block):
† Eager decode is host-bound and swings with CPython's frame-stack allocation, not only with v2's cost (below).
Prefill and graph-mode decode are at parity.
Eager decode. The kernels and device time are the same as legacy's; the step is host-bound, so these cells measure host time.
a16w16 is faster on v2: with EP, legacy's sort costs 137 µs per call against v2's 89 µs.
The a8w8 cells swing with CPython 3.12's frame-stack chunks. Python frames live in 16 KiB chunks. A call whose frame doesn't fit maps a new chunk, and its return unmaps it. If a call on the hot path sits on a chunk boundary, every call pays an
mmap/munmappair (about 2.5 µs). Where the boundaries fall depends on the whole stack under the MoE call: vLLM's process layout and the MoE frames of each mode. Counted in each process that runs the model (16 KiB pairs per run):(One run per mode, so the gap column is noisier than the tables above.)
So the sign of the a8w8 eager cells follows the stack layout rather than the code: TP1 blockscale is +3.0% in the default layout and −3.5% in-process. The a8w8_ptok TP2 + EP gap (−1.8%) is not explained by this: v2 has fewer pairs, and its
fused_moecall is not slower (256 µs against legacy's 263 µs). The rest of the step is unaccounted for.Host time per call. The first throughput run showed v2 behind where the host is the bottleneck, by −2.5% to −5.4%. Two fixes in this PR:
fused_moeper run is:Kernel level:
AITER_MOEV2=on python3 tests/moe_dispatch/perf_baseline.py --checkagainstgolden/perf_gfx950.json(recorded with legacy) exits 0 onbe0783898: no case is more than 10% slower.Testing
MI250X is not a target for these formats. MI300X (gfx942) is covered by CPU simulation only; see "Validation and unverified scope". GPU testing was on MI350X (gfx950).
f8f6b76b7; GPU rows onbe0783898, the head before the review fixes, which change no shipped-table dispatch)tests/test_moev2_*.py,tests/test_moe_dispatch_snapshot.py; call cache incheckmode)AITER_FLYDSL_STAGE2_FP8=1on gfx942 and gfx950tests/test_moev2_call_cache.py)resolve_activation_dtypereads; check mode raises on a missing input; the kill switch is read per call; an unclassified new parameter turns the cache off at its entrycheckmode (gpu_differential.py --path P,--synth-tablefor the CK paths; each v2 case runs twice)CallCacheMismatchon any path. 0 problems on a16w16 (+synth), a8w8_blockscale (+synth), a4w4, a16w4, a8w4, mxfp8 and fhmoe. Cases that raise on both compare the errors; the only build failures are the known MX per_1x32 CK modules. 0 problems also on the synth tables of a8w8_pt and a8w8_ptok. The remaining problems are cases where two legacy runs differ, so v2 can't be validated there: a8w8_pt, the int8 per-tensor Gelu case (legacy's ASM int8 stage 1, known since step 3.3; in 10 reruns it fails 7 times on this head and 9 times on the head before the rebase, mostly as "legacy output not repeatable"); a8w8_ptok, 2 cases (legacy's ASM per-token fp8 stage 1 intermittently writes 1e31 to 1e38); a16wi4, the fp16 casegpu_suites.py --path P --compare, every path, call cache incheckmode)CallCacheMismatch.op_tests/test_moe_sorting.pyfails in both modes: an Opus sort mismatch at one token withexpert_maskandpadding_extra, not v2. Off and v2 pass and fail the same suites with the samecheckAllclosecounts, exceptswiglu_limit=7.0checks of the per-token / per-tensor fp8 runs, which flip between pass and warning in both directions (they flip between legacy runs too)4b5f3526a, rebased as57e38f682). Mixtral bf16 / fp8 per-tensor / per-channel / per-block, DSv4.1-Flash a8w4 and a4w4, MiniMax-M3 MXFP4, plus dummy-weight DSv4-Pro, MiniMax-M3-MXFP8 and gpt-oss-120b; TP and TP + EP, eager and graphscheckmode: DSv4.1 TP4 eager 0.9022 strict (legacy 0.9022 / 0.9030), Mixtral fp8 per-channel TP1 eager 0.6346 (legacy 0.6315 / 0.6171); no mismatch, and the same ops and arguments as legacy at every token countk_wave4 cases bitwise equal over 200 replays, before and after, at the same stage 1 time. (64, 7168, 3072, E24, top6) a8w4: 30 of 30 ok (about 3 in 10 failed before)Documentation
The feature is opt-in and not graduated, so the user guide is unchanged.
aiter/moev2/README.mddocuments:AITER_MOEV2_CALL_CACHE;Dependencies
Breaking Changes
None for callers: with
AITER_MOEV2unset, every call runs the legacy code, and every name importable fromaiter.fused_moeandaiter.fhmoestill is.For code that patches moved names: assigning a moved name on
aiter.fused_moeoraiter.fhmoeno longer reaches the code that uses it. Assign it where it now lives (see "Legacy code moved"). For example,_STAGE2_SCRATCHnow lives inaiter.moev2.segments.flydsl;aiter/aot/flydsl/moe.pyandop_tests/test_moe_scatter_reduce.pyare updated.The FlyDSL mixed stage 1 race fix changes the kernel's code for legacy too:
sched_barrierand an exact barrier wait.k_wave > 1kernels with an odd tile count per group drop one stray copy.FlyDSL's cache key hashes the source, so cached binaries rebuild.
Known differences from legacy
Multi-arch
GPU_ARCHS: v2 chooses kernels by the device (deliberate)chip_infoasks runtime dispatch to useget_gfx_runtime()(the device).get_gfx()followsGPU_ARCHSand, when that lists several archs, returns the last one. So on a GPU that is not the last entry, the two differ: for example, aGPU_ARCHS="gfx942;gfx950"source build run on an MI300X withGPU_ARCHSstill set. Installed wheels withoutGPU_ARCHSset, and CI test runs (the test script sets it to the detected arch), don't hit this.Legacy MoE reads
get_gfx()at runtime sites. Where v2 stands:fused_moe_1stage_dict.get(get_gfx())c6fb48e9d, "use the runtime GPU for path claims", made the claims)get_gfx()get_gfx()on purpose:local.legacy_grouped_gfx1250andexecutor.a16w4_unsupportedpredict legacy's choice; v2 declines and legacy runs the callget_gfx()get_gfx(), copied (executor.run_one_stage;routing/topk.pyis shared): not fixed, same as legacyherd_topkgfx1250 checksget_gfx()herd_topkcallNo check covers this: the CPU differential simulates one arch at a time, and the GPU runs use single-arch builds.
Fix plan, a later behavior change on both sides (step 7.1, or a standalone PR with the legacy MoE owners):
get_gfx()read of legacy MoE (the sites above and the sharedrouting/topk.py) toget_gfx_runtime().get_gfx(), and CPU tests that patchget_gfx()to another arch and check that legacy and v2 dispatch as they do without it.gpu_suites.py --comparegive the same results under a multi-archGPU_ARCHSwhose last entry is not the device as withGPU_ARCHSunset.Calls v2 declines (legacy runs them unchanged)
Every decline of a call legacy runs is counted and must match an entry in
tests/moe_dispatch/known_declines.py. Each entry gives the reason, why, and its todo. Counts on the snapshot grid (mostly its feature-variant keys): gfx942 10,291, gfx942_cu80 10,573, gfx950 26,903, all on the list; gfx1201 0. The main groups:w1as gate and up, so its output is wrong and v2 has nothing to match.herd_topk,deterministic=True, a registered presort;AITER_ONLINE_TUNE;a8w4_gfx942_layout, [ASM] [HIP] gfx942: 1-stage ASM MXFP4 x MXFP8 SiTUv2 MoE kernel for M ≥ 1024 #8211).per_1x32calls with caller activation scales ornum_local_tokens;doweight_stage1;exclude_mxmoeor Gelu calls;AITER_BYPASS_TUNE_CONFIG=1: the a4w4 SiTUv2 CK-Tile/CK branch and the MXMOE fallback that a bypassed row turns off.Other differences
AITER_BYPASS_TUNE_CONFIG=1with an OpuskernelName2row, legacy adds the row's route-bucket fields to the 1-stage, CK and ASM metadata; v2 does not. Only custom tables have those columns.test_presorted_moe_hook.op_tests/test_moe_2stage.py::test_presorted_moe_hookcounts sorts by patchingfused_moe.moe_sorting, which v2 doesn't call through. UnderAITER_MOEV2=on, its own-sort call runs on v2 and fails that assertion. Calls with a registered presort stay on legacy.Known limits
op_tests/test_moe_sorting.pyfails at one token withexpert_maskandpadding_extra, on clean legacy too.fused_moe_prepare_stage2/fused_moe_run_stage2) calls_fused_moe_impldirectly, so it runs legacy even withAITER_MOEV2set.PR Self-Review
Reviewed revision
f8f6b76
Behavior and intent
Default behavior doesn't change: with
AITER_MOEV2unset oroff, every call still uses the legacyfused_moe/fhmoe_path, and no entry hook builds a call.The PR adds explicitly enabled v2 paths for every remaining single-GPU MoE format. It also adds the CI gates a path must pass before it graduates, and a per-call decision cache that keeps v2's host time per call at or below legacy's. Each path claims only the calls it reproduces exactly, and hands every other call to legacy.
Three changes are visible to legacy:
aiter/moev2and imported back. They are AST-identical, and every public name still resolves._fhmoe_implgets the same opt-in hook asfused_moe_.Validation and unverified scope
Validated on
f8f6b76b7, CPU:AITER_FLYDSL_STAGE2_FP8=1.Validated on
be0783898(the review fixes inf8f6b76b7change no shipped-table dispatch), gfx950 (MI350X), with JIT modules rebuilt and CK at the submodule commit:gpu_suites.py --comparegive the results above, for every path, with the call cache incheckmode;AITER_MOEV2=on python3 tests/moe_dispatch/perf_baseline.py --check: exit 0;f8f6b76b7).Unverified:
vLLM accuracy after the rebase. The GSM8K runs above are on the head before it (
4b5f3526a). The rebase changed the MoE code only by main's legacy changes and their port, which the CPU differential and the GPU differential cover.gfx942 on a GPU, both cu304 (MI300X/MI325X) and cu80 (MI308X). The gfx942-only parts have run in CPU simulation only: the ASM 1x128 rows, the FlyDSL whole-graph rows, and the gfx942 suites. There is no gfx942 perf baseline yet.
SGLang and ATOM end-to-end runs.
Multi-arch
GPU_ARCHSbuilds (see "Known differences").PR-specific question
The new configuration, the paths and the call cache, is consumed only when
AITER_MOEV2names a path, and then only by the calls that path claims. A path claims a call only if:Path.takesaccepts the dispatch key;Every other call is declined to legacy before anything is logged or copied.
Unrelated shapes keep their prior selection, for these reasons:
checkmode across the tests, both GPU harnesses and the vLLM accuracy runs.Changed op tests
op_tests/test_moe_scatter_reduce.py:test_stage2_scratch_never_shares_live_memorypatches_STAGE2_SCRATCHonaiter.moev2.segments.flydsl, where the scratch now lives. Patched onaiter.fused_moe, it would no longer reach the scratch, and the test would check nothing. The coverage is unchanged.