Skip to content

[FlyDSL] gfx942 MoE: offset and clamp fixes, num_local_tokens, clamped-SiLU default, V4.1-Flash rows - #7820

Merged
HaonanWang98 merged 3 commits into
mainfrom
hwang/flydsl-gfx942-moe-fixes
Nov 16, 2026
Merged

HaonanWang98 merged 3 commits into
mainfrom
hwang/flydsl-gfx942-moe-fixes

Conversation

@HaonanWang98

@HaonanWang98 HaonanWang98 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

DeepSeek-V4.1-Flash on MI308X (ROCm/ATOM#3102) runs its routed experts as per-token FP8 with swiglu_limit through fused_moe, on the gfx942 FlyDSL backend.

Changes

  • gfx9 FP8 MoE fixes. The expert weight offset is computed in 64 bits (at V4.1-Flash TP4 it wrapped past 2^31 bytes and experts >= 365 came out NaN), and the SiLU path applies swiglu_limit.
  • num_local_tokens. The gfx942 backend takes it: moe_sorting on the sorted paths, the batch-1 kernels read it themselves, and a per-tensor activation scale reads only the rows before it. With it, fused_moe keeps a FlyDSL row only for the clamped SiLU; other activations keep the default heuristics.
  • Clamped-SiLU default. On gfx942 per-token FP8 with an active swiglu_limit and no FlyDSL row in use, fused_moe runs the FlyDSL backend at a token-count default (fused_moe_gfx942.default_config) instead of the 1-stage kernel, which cannot apply the clamp.
  • Configs: FlyDSL a8w8 bpreshuffle rows for V4.1-Flash TP4's per-channel FP8 dense GEMMs on gfx942 (80 CU). Its MoE needs no rows: the clamped-SiLU default picks the tuned configs.

Testing (MI308X)

  • op_tests/test_flydsl_moe_gfx942.py passes, including the local_tokens cases (batch-1, decode, prefill; per-token and per-tensor; stale padding rows that must not run), V4.1-Flash's MoE shape clamped with a row count, and the dispatch checks (kept rows, the clamped-SiLU default, bypass, EP).
  • op_tests/test_gemm_a8w8_bpreshuffle_pad_k.py passes.
  • V4.1-Flash TP4 through ATOM's fused_moe path (routed experts and dense GEMMs in per-channel FP8): GSM8K 3-shot, full set, 0.923, and 0.929 with DSpark.

@HaonanWang98
HaonanWang98 requested a review from a team November 11, 2026 10:00
@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 7820 --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

aiter-bot commented Nov 11, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision ad0d5e208eb2 · 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 exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
  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 — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/test_flydsl_moe_gfx942.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

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

@HaonanWang98
HaonanWang98 force-pushed the hwang/flydsl-gfx942-moe-fixes branch from 9c9c929 to da57bed Compare November 12, 2026 04:06
@HaonanWang98 HaonanWang98 changed the title [FlyDSL] gfx9 FP8 MoE: 64-bit expert offsets, clamp the SiLU path [FlyDSL] gfx942 MoE: 64-bit expert offsets, SiLU clamp, num_local_tokens Nov 12, 2026
@HaonanWang98 HaonanWang98 changed the title [FlyDSL] gfx942 MoE: 64-bit expert offsets, SiLU clamp, num_local_tokens [FlyDSL] gfx942 MoE: offset and clamp fixes, num_local_tokens, clamped-SiLU default, V4.1-Flash rows Nov 12, 2026
@HaonanWang98
HaonanWang98 force-pushed the hwang/flydsl-gfx942-moe-fixes branch from efe3ecc to 7bec3c6 Compare November 16, 2026 03:35
ATOM runs the V4.1 DSpark draft with its shared expert unfused (128
experts, top-3), so the 129-expert/top-4 rows never match. The 1-stage
kernel cannot apply swiglu_limit (it raises); say so in the comment.
…back; tests

- Down's per-tensor activation scale reads only the rows before
  num_local_tokens: sorting's padding routes write a padding row.
- With AITER_BYPASS_TUNE_CONFIG a clamped SiLU still takes the FlyDSL default.
- Drop dsv41_fp8_ptpc_tuned_fmoe.csv: its rows equal the clamped-SiLU default.
- Op test: the dispatch check asserts the chosen kernel; local_tokens padding
  keeps real expert ids and must not run (zero rows, and prefill equals the
  valid rows alone); V4.1-Flash's MoE shape, clamped with a row count.
@HaonanWang98
HaonanWang98 merged commit 02fd412 into main Nov 16, 2026
@HaonanWang98
HaonanWang98 deleted the hwang/flydsl-gfx942-moe-fixes branch November 16, 2026 13:47
HaonanWang98 added a commit that referenced this pull request Nov 18, 2026
…nd (#8178)

#7361's guard ran before #7820's gfx942 FlyDSL path, so a clamped per-token
FP8 SiLU at an inter_dim that is not a multiple of 128 raised (DeepSeek-V4.1-Flash
TP4 on MI308X, inter_dim 576) and tuned impl__flydsl_gfx942__ rows were dropped,
although that backend applies the clamp. Keep those rows, and check the CK limits
only when no FlyDSL backend takes the call.
ZhiweiYan-96 added a commit to ROCm/ATOM that referenced this pull request Nov 19, 2026
TP4 MI308X launch with DSpark (block 5), the radix cache, decode / verify
/ draft CUDA graphs up to 64 requests, the overlap scheduler and prefill
token graphs; the aiter requirement on gfx942 (ROCm/aiter#7820, the
clamped per-token FP8 MoE that 3102 routes V4.1's experts through); the
kill switches for the prefill paths; optional prefill admission
coalescing (--min-free-slots-delay) with its measured trade-off;
measured wall time, TTFT and TPOT against native ATOM DSpark with prefix
caching on GSM8K (shared 8-shot and cold 3-shot, c32/48/64), random
4096-token prompts and long documents, with a re-check on 3102 at
1119304. It also documents the radix cache's environment variables,
read by the plugin (atom/plugin/sglang/deepseek_v41_envs.py), and that #7820
has to sit on an aiter main with #7407 (get_mla_sparse_prefill_v41_backend).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zufayu added a commit to jatseng-ai/aiter that referenced this pull request Nov 24, 2026
On gfx942 a clamped per-token FP8 SiLU that CK can clamp (FP8, inter_dim a
multiple of 128) is routed to the FlyDSL whole-graph default from ROCm#7820 /
ROCm#8178. That backend's metadata has stage1=None, so
test_plain_fp8_swiglu_limit_dispatch, which reads md.stage1.keywords,
crashes with AttributeError: 'NoneType' object has no attribute 'keywords'
-- MI300X shard 5 on main, most recently run 45246107786.

The route is also the wrong one for these calls: the whole-graph backend
clamps the BF16 activations it reads, a different quantization point from
the per-token path the call and the tuned rows from ROCm#7361 ask for. (The
accuracy claim in ROCm#8334 about that backend is retracted; it is accurate
against its own reference, see ROCm#8350.)

Keep the whole-graph default only where CK rejects the shape (inter_dim
not a multiple of 128, including V4.1-Flash at 576). The new predicate is
the same one the NotImplementedError gate below uses, which is what
defines what CK's runtime-limit stage-1 accepts. A tuned
impl__flydsl_gfx942__ row still wins. This does not revert ROCm#7361.

Fixes ROCm#8334

Co-authored-by: Cursor <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zufayu added a commit to jatseng-ai/aiter that referenced this pull request Nov 24, 2026
On gfx942 a clamped per-token FP8 SiLU that CK can clamp (FP8, inter_dim a
multiple of 128) is routed to the FlyDSL whole-graph default from ROCm#7820 /
ROCm#8178. That backend's metadata has stage1=None, so
test_plain_fp8_swiglu_limit_dispatch, which reads md.stage1.keywords,
crashes with AttributeError: 'NoneType' object has no attribute 'keywords'
-- MI300X shard 5 on main, most recently run 45246107786.

The route is also the wrong one for these calls: the whole-graph backend
clamps the BF16 activations it reads, a different quantization point from
the per-token path the call and the tuned rows from ROCm#7361 ask for. (The
accuracy claim in ROCm#8334 about that backend is retracted; it is accurate
against its own reference, see ROCm#8350.)

Keep the whole-graph default only where CK rejects the shape (inter_dim
not a multiple of 128, including V4.1-Flash at 576). The new predicate is
the same one the NotImplementedError gate below uses, which is what
defines what CK's runtime-limit stage-1 accepts. A tuned
impl__flydsl_gfx942__ row still wins. This does not revert ROCm#7361.

Fixes ROCm#8334

Co-authored-by: Cursor <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zufayu added a commit that referenced this pull request Nov 24, 2026
On gfx942 a clamped per-token FP8 SiLU that CK can clamp (FP8, inter_dim a
multiple of 128) is routed to the FlyDSL whole-graph default from #7820 /
#8178. That backend's metadata has stage1=None, so
test_plain_fp8_swiglu_limit_dispatch, which reads md.stage1.keywords,
crashes with AttributeError: 'NoneType' object has no attribute 'keywords'
-- MI300X shard 5 on main, most recently run 45246107786.

The route is also the wrong one for these calls: the whole-graph backend
clamps the BF16 activations it reads, a different quantization point from
the per-token path the call and the tuned rows from #7361 ask for. (The
accuracy claim in #8334 about that backend is retracted; it is accurate
against its own reference, see #8350.)

Keep the whole-graph default only where CK rejects the shape (inter_dim
not a multiple of 128, including V4.1-Flash at 576). The new predicate is
the same one the NotImplementedError gate below uses, which is what
defines what CK's runtime-limit stage-1 accepts. A tuned
impl__flydsl_gfx942__ row still wins. This does not revert #7361.

Fixes #8334

Co-authored-by: Cursor <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.

3 participants