Repository navigation
[Fix] Correct an over-broad Relu2 exclusion from #9129, plus a differential.py gap - #9140
Conversation
🏷️ CI GuideRuns automatically on every PR:
🚦 Update: Heavy CI review gate:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
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]>
8134933 to
f4a82ae
Compare
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 |
Picks up #9129 and #9140 (ReLU2 dispatch), which the red Standard Tests need. Co-Authored-By: Claude <[email protected]>
Picks up ROCm#9129 and ROCm#9140 (ReLU2 dispatch), which the red Standard Tests need. Co-Authored-By: Claude <[email protected]>
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 excludedActivationType.Relu2fromcktile_split_kunconditionally, which is too broad and introduces a real regression:cktile_relu2additionally requiresarch == "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
aiter/moev2/segments/ck_tile.py: narrows the exclusion.cktile_split_know excludes Relu2 only whencktile_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 reachescktile_split_kon any arch, matching legacy.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 runsck_moe_stage1. That stopped being true for Relu2 configs [CK] aiter#6643: relu2 for legacy ck_gemm_moe_2stages kernel #7139 makes legacy raiseNotImplementedErrorfor instead. This pre-dates both this PR and [Hotfix] Align ReLU2 dispatch with legacy and refresh snapshots #9129 (reproduced the identical mismatch for the plainunshuffledRelu2 variant, whichcktile_split_k's existingany_shuffledcheck already excluded before any of this).legacy_declinenow recognizes this case and returnsNone, whichcompare()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).cktile_split_k/cktile_relu2: the gfx942 regression case (nowTrueagain, matching legacy), the half-prepacked bug case (stillFalse), and the fp16-output bug case (stillFalse).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_khad no check preventing it from claiming one) but overcorrected: excluding Relu2 fromcktile_split_kunconditionally 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.cktile_split_k/cktile_relu2with three specific parameter sets (the regression, the half-prepacked bug, the fp16-output bug) confirmed each resolves correctly.PR-specific question
Why does
legacy_declineneed acktile_relu2_instance_existsimport 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 runck_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.pyis test infrastructure, not an op test, and no new test file was added since the existingtest_dispatch_plans_match_legacyandtest_a16w4_defaultsalready cover this).