Skip to content

[CK] Emit both gfx942 and gfx950 MoE instances in a dual-arch build - #8397

Closed
jatseng-ai wants to merge 1 commit into
ROCm:mainfrom
jatseng-ai:ck-moe-multiarch-instances
Closed

jatseng-ai wants to merge 1 commit into
ROCm:mainfrom
jatseng-ai:ck-moe-multiarch-instances

Conversation

@jatseng-ai

Copy link
Copy Markdown
Contributor

Summary

  • A GPU_ARCHS=gfx942;gfx950 wheel calls get_gfx(), which returns only the last entry. CK MoE codegen then emits the gfx950 instance list and drops the gfx942 MulABScale instances.
  • Tuned rows still name those gfx942 instances. On MI300X that is RuntimeError: Unknown or incompatible CK MoE kernel: moe_ck2stages_gemm1_256x16x64x256_1x4_MulABScale_... for per-token SiLU limit 7.0, the row in a8w8_plain_tuned_swiglu_limit_fmoe_gfx942.csv. Limit 1.0 has no row, takes the gfx950 heuristic, and passes, because those instances already run on gfx942.
  • Emit both arch lists into the lookup. The heuristic stays on get_gfx(). gfx942-only tiles are instantiated for the host and the gfx942 device pass, and left out of the gfx950 device pass. A tuned row still wins, and the configurable limit stays.

This is the CI failure that showed up on #8353 after the dispatch crash was fixed. #8353 keeps CK-capable clamped calls on CK. This PR makes the tuned CK kernel exist in the dual-arch wheel.

Test plan

  • pytest op_tests/test_moe_ck_codegen_arches.py (no GPU, no hipcc). Both GPU_ARCHS orders put every kernel name from the gfx942 swiglu-limit CSV in the lookup, plus a gfx950 TypeCast tile. The heuristic element op follows the last arch. GPU_ARCHS=gfx942 does not gain gfx950 names or the device guard.
  • Dual-arch hipcc build of the per-token SiLU runtime-limit module (GPU_ARCHS=gfx942;gfx950) and test_plain_fp8_swiglu_limit on MI300X. The gfx942-only tiles were not compiled here.

PR Self-Review

Reviewed revision

1351bf1

Behavior and intent

A dual-arch CK MoE prebuild now contains the gfx942 instance list as well as the gfx950 list. get_gfx() still selects the heuristic, so an untuned call dispatches exactly as before. Tuned CSV rows that name a gfx942 MulABScale kernel find that kernel in the lookup instead of raising Unknown or incompatible CK MoE kernel. The existing behavior is insufficient because ci:mi300x prebuilds with GPU_ARCHS=gfx942;gfx950 and get_gfx() keeps only gfx950, so those tuned rows cannot run from the wheel.

Validation and unverified scope

Validated with pytest op_tests/test_moe_ck_codegen_arches.py on the codegen output only, no GPU and no hipcc. It checks GPU_ARCHS=gfx942;gfx950 and gfx950;gfx942 against a8w8_plain_tuned_swiglu_limit_fmoe_gfx942.csv, and checks that a gfx942-only build is unchanged.

Not validated: a dual-arch hipcc compile of the new gfx942-only instances, and the numerical test_plain_fp8_swiglu_limit run on MI300X. The guard assumes those tiles compile for gfx942 and do not need to compile for gfx950.

PR-specific question

What behavior would each changed op test fail on before this PR, and why is that coverage not already provided by an existing canonical test?

test_moe_ck_codegen_arches.py fails before this PR because the generated lookup for GPU_ARCHS=gfx942;gfx950 does not contain the gfx942 MulABScale names from the tuned swiglu-limit CSV. test_plain_fp8_swiglu_limit hits the same miss only after a dual-arch wheel is built and only on the tuned limit, so it does not guard the codegen itself. This test runs gen_instances with no GPU and fails on the missing name directly.

Changed op tests

op_tests/test_moe_ck_codegen_arches.py covers the dual-arch lookup, the heuristic element op, and the gfx942-only device guard. It is not redundant with test_plain_fp8_swiglu_limit: that test needs the prebuilt module and a GPU, and the crash only appears once dispatch gets past stage1 is None. This test checks the generated sources for both GPU_ARCHS orders without compiling.

Made with Cursor

get_gfx() returns the last GPU_ARCHS entry, so a gfx942;gfx950 wheel
dropped the gfx942 MulABScale instances that tuned swiglu_limit rows name.

Co-authored-by: Cursor <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

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 8397 --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.

@aiter-bot

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 1351bf191c77 · 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. Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching 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 — validation answer must explicitly state what remains unverified (or say none with a reason)

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

@jatseng-ai

Copy link
Copy Markdown
Contributor Author

Closing this in favor of #8353. The codegen commit is now f0e28ecae on that branch, rebased onto current main together with the routing fix. The two diffs do not overlap. Landing them separately leaves MI300X CI red either way, so they go in as one PR.

@jatseng-ai jatseng-ai closed this Nov 20, 2026
@jatseng-ai jatseng-ai reopened this Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

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 8397 --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.

@jatseng-ai

Copy link
Copy Markdown
Contributor Author

Closing again. This codegen change is already on #8353. The reopen was only a way to retrigger the old Actions run, and that run is no longer needed.

@jatseng-ai jatseng-ai closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants