Skip to content

[Fix] Correct an over-broad Relu2 exclusion from #9129, plus a differential.py gap - #9140

Merged
zufayu merged 2 commits into
ROCm:mainfrom
zufayu:fix-cktile-relu2-regression
Dec 3, 2026
Merged

zufayu merged 2 commits into
ROCm:mainfrom
zufayu:fix-cktile-relu2-regression

Conversation

@zufayu

@zufayu zufayu commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

#9129 (merged as 826369e, before these two commits landed) fixed a real bug in cktile_split_k — it had no activation check at all, so a half-prepacked or fp16-output ReLU2 call with a default split-K above 1 could get handed a CK-Tile split-K plan for a kernel that was never built. But the merged fix excluded ActivationType.Relu2 from cktile_split_k unconditionally, which is too broad and introduces a real regression: cktile_relu2 additionally requires arch == "gfx950", but legacy's own per_1x32 Relu2 guard does not gate on arch at all. A fully-supported Relu2 call (bf16, fully preshuffled, no scatter/activation-scales) on gfx942 still reaches legacy's real CK-Tile split-K path and gets a real plan from it — the merged fix now makes v2 decline that case too, disagreeing with legacy in the other direction.

Caught this via the full tests/moe_dispatch/differential.py --check (not just the targeted unit tests) after merge — see commit messages for the exact repro keys.

Changes

  1. aiter/moev2/segments/ck_tile.py: narrows the exclusion. cktile_split_k now excludes Relu2 only when cktile_relu2_instance_exists(p) is False (the non-arch-gated predicate: wrong output dtype, wrong activation/weight dtype, not fully preshuffled, or scatter/activation-scales) — exactly the set of configurations legacy's [CK] aiter#6643: relu2 for legacy ck_gemm_moe_2stages kernel #7139 guard rejects, regardless of arch. A fully-supported Relu2 call still reaches cktile_split_k on any arch, matching legacy.
  2. tests/moe_dispatch/differential.py: fixes a second, independent, pre-existing gap this surfaced — legacy_decline's mapping assumed any "CK 2-stage a16w4 is not ported" decline means legacy runs ck_moe_stage1. That stopped being true for Relu2 configs [CK] aiter#6643: relu2 for legacy ck_gemm_moe_2stages kernel #7139 makes legacy raise NotImplementedError for instead. This pre-dates both this PR and [Hotfix] Align ReLU2 dispatch with legacy and refresh snapshots #9129 (reproduced the identical mismatch for the plain unshuffled Relu2 variant, which cktile_split_k's existing any_shuffled check already excluded before any of this). legacy_decline now recognizes this case and returns None, which compare() already checks against the golden record's "error" field.

Verification

  • python tests/moe_dispatch/snapshot.py --check: identical on all 4 archs.
  • python tests/moe_dispatch/differential.py --check (full, all archs/keys, ~38 min): passed.
  • pytest tests/test_moev2_dispatch.py::test_a16w4_defaults: passes (the half-prepacked and fp16-output cases from [Hotfix] Align ReLU2 dispatch with legacy and refresh snapshots #9129's review are both still correctly excluded).
  • Directly verified three cases with cktile_split_k/cktile_relu2: the gfx942 regression case (now True again, matching legacy), the half-prepacked bug case (still False), and the fp16-output bug case (still False).

cc @qli88 (moev2 owner) and @valarLip (caught the issues in #9129's review that led here).

PR Self-Review

Reviewed revision

8134933

Behavior and intent

#9129 fixed the real underlying bug (no gate-only Relu2 split-K instance exists, but cktile_split_k had no check preventing it from claiming one) but overcorrected: excluding Relu2 from cktile_split_k unconditionally also excludes fully-supported Relu2 configs on archs other than gfx950, which legacy's own guard does not restrict by arch. This PR narrows that exclusion to the actual unsupported set, and separately fixes a differential-tooling assumption (legacy_decline's generic 2-stage mapping) that predates both this PR and #9129, which #7139 made stale for Relu2 specifically.

Validation and unverified scope

  • snapshot.py --check: identical on all 4 archs.
  • differential.py --check (full, all archs/keys): passed, ~38 minutes.
  • Direct calls to cktile_split_k/cktile_relu2 with three specific parameter sets (the regression, the half-prepacked bug, the fp16-output bug) confirmed each resolves correctly.
  • Not run on real GPU hardware (none available here) — all verification is the CPU-only dispatch-selection path.

PR-specific question

Why does legacy_decline need a cktile_relu2_instance_exists import at all, rather than inferring "legacy raises" purely from the decline reason string? Because the same "CK 2-stage a16w4 is not ported" reason covers both Relu2 calls legacy raises for and (unrelated to this PR) other a16w4 calls that genuinely run ck_moe_stage1 — the reason string alone does not distinguish them; only re-checking the actual problem's fields against the same condition the ranking table used to decline it does.

Changed op tests

None (no op_tests/ file changed; tests/moe_dispatch/differential.py is test infrastructure, not an op test, and no new test file was added since the existing test_dispatch_plans_match_legacy and test_a16w4_defaults already cover this).

@zufayu
zufayu requested a review from a team December 3, 2026 12:01
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Lightweight PR hygiene checks

🚦 Update: Heavy CI review gate:

  • 🔒 GPU-heavy PR CI is gated on the current PR review state.
  • ⏸️ Before the latest revision is approved, heavy workflows such as Aiter Test, Triton Test, Flash Attention Integration, and OPUS Test stop at the CI gate and do not consume GPU runners.
  • ▶️ After a non-author approves the current revision, the approval event can start the gated heavy workflows.
  • 🔁 Pushing a new commit invalidates the previous approval for CI purposes; the latest revision needs approval again before heavy CI runs.
  • 🏷️ ci:* labels select which extra tests to run, but labels do not bypass the review gate.
  • ✅ Pushes to main, scheduled runs, and manually dispatched workflows keep their normal behavior.

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
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 Radeon R9700 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 9140 --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.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

zufayu and others added 2 commits December 3, 2026 12:06
The full `differential.py --check` on the previous commit failed: excluding
Relu2 from `cktile_split_k` unconditionally was too broad. `cktile_relu2`
additionally requires `arch == "gfx950"`, but legacy's own per_1x32 Relu2
guard does not gate on arch at all -- a fully-supported Relu2 call (bf16,
fully preshuffled, no scatter/activation-scales) on gfx942 still reaches
legacy's real CK-Tile split-K path and gets a real plan from it. The
previous commit made v2 decline that case too, disagreeing with legacy in
the other direction: `grid|base|M=1|H=7168|I=256|E=256|k=8|Relu2|...`
(and several sibling grid variants) now declined when legacy still runs
them.

Narrowed the exclusion to match: `cktile_split_k` now excludes Relu2 only
when `cktile_relu2_instance_exists(p)` is False (the non-arch-gated
predicate -- wrong output dtype, wrong activation/weight dtype, not fully
preshuffled, or scatter/activation-scales), which is exactly the set of
configurations legacy's guard rejects. A fully-supported Relu2 call still
reaches `cktile_split_k` regardless of arch, matching legacy; only a call
`cktile_relu2_instance_exists` does not cover is excluded, regardless of
arch, closing the original bug for every arch rather than only gfx950.

Verified directly against three cases: the M=1/gfx942/fully-shuffled
regression case above (now True again, matching legacy), the
half-prepacked bug case (still False), and the fp16-output bug case
(still False). `snapshot.py --check` still identical on all 4 archs.
Full `differential.py --check` running in the background; will confirm
once it finishes rather than claim it passed before it has.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…2's decline

The full differential --check still failed after the previous commit, but
with a different, pre-existing problem: `legacy_decline`'s generic mapping
assumes any "CK 2-stage a16w4 is not ported" decline means legacy runs
`ck_moe_stage1`. That was true before ROCm#7139. After it, a per_1x32 Relu2
call this module's `a16w4_relu2` ranking entry declines for (the same
`cktile_relu2_instance_exists` condition the last two commits turned into
actual dispatch behavior) has legacy *raise* `NotImplementedError` instead
-- not reach `ck_moe_stage1` at all. The tool compared the wrong
expectation and reported every such key as a mismatch, independent of this
PR's dispatch fix (reproduced the same mismatch for the plain "unshuffled"
variant, whose decline through `cktile_split_k`'s `any_shuffled` check
predates this PR entirely).

`legacy_decline` now recognizes this one case and returns None (the
"legacy does not run a named 2-stage branch" result `compare()` already
checks against the golden record's "error" field) instead of the
`ck_moe_stage1` assumption.

Still verifying: full differential --check running in the background;
not claiming this passes until it finishes.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
yzhou103
yzhou103 previously approved these changes Dec 3, 2026
@aiter-bot

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision f4a82ae27f61 · 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 is the most important boundary or failure mode introduced by this change, and what evidence covers it?
  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.

@zufayu
zufayu merged commit 0b77f07 into ROCm:main Dec 3, 2026
103 checks passed
MengqingCao added a commit that referenced this pull request Dec 3, 2026
Picks up #9129 and #9140 (ReLU2 dispatch), which the red Standard Tests need.

Co-Authored-By: Claude <[email protected]>
MengqingCao added a commit to MengqingCao/aiter that referenced this pull request Dec 4, 2026
Picks up ROCm#9129 and ROCm#9140 (ReLU2 dispatch), which the red Standard Tests need.

Co-Authored-By: Claude <[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