Skip to content

[CK] [JIT] [aiter] Clamp FP8 per_Token / per_Tensor SiLU on #7019's runtime swiglu_limit - #7361

Merged
yzhou103 merged 3 commits into
ROCm:mainfrom
jatseng-ai:ptpc-pertensor-swiglu-limit
Nov 16, 2026
Merged

yzhou103 merged 3 commits into
ROCm:mainfrom
jatseng-ai:ptpc-pertensor-swiglu-limit

Conversation

@jatseng-ai

@jatseng-ai jatseng-ai commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

FP8 per_Token and per_Tensor MoE with ActivationType.Silu now apply a finite positive swiglu_limit, clamped before SiLU (gate to ≤ L, up to [-L, L]), at any limit. On main the limit is accepted and silently ignored on these paths. This revision is rebased onto main after #7019 and reuses #7019's per_1x128 runtime-limit infrastructure instead of a separate module. [MEASURED] / [READ in source]

What this does

  • aiter/ops/moe_limits.py adds RUNTIME_SILU_LIMIT_QUANT_TYPES (per_1x128, per_Token, per_Tensor). The gates [HIP] [CK] [JIT] Enable swiglu_limit for FP8 per_1x128 blockscale MoE #7019 added for per_1x128 use it: get_2stage_cfgs, ck_moe_stage1, get_moe_stage_module / ck_moe_stage1_fwd, the gen_instances.py --runtime-swiglu-limit check, the prebuild variant list in moe_recipes.py, gemm_moe_tune.py --swiglu_limit, and the ck_moe_stage1 launcher check in gemm_moe_ck2stages.cu. [READ in source]
  • The non-blockscale CK stage-1 template (gemm_moe_ck2stages_common.cuh) already took RuntimeSwigluLimit and the limit from [HIP] [CK] [JIT] Enable swiglu_limit for FP8 per_1x128 blockscale MoE #7019 but did not pass them on. It now passes both to DeviceMoeGemm / MakeArgument, with the same TORCH_CHECKs as the blockscale template. The plain FP8 stage-1 heuristic dispatch (A8W8_gemm1_heuristic_dispatch, A16W16_A8W8_gemm1_gfx950_heuristic_dispatch) forwards the flag like the blockscale one. CK reads the limit only when RuntimeSwigluLimit is true, so SwiGLU OAI instances keep their constant. [READ in source]
  • A finite limit selects module_moe_ck2stages_abi2_f8_f8_preshuffle_on_b16_silu_{per_token,per_tensor}_mulWeightStage2_runtime_swiglu_limit, the same module family [HIP] [CK] [JIT] Enable swiglu_limit for FP8 per_1x128 blockscale MoE #7019 uses for per_1x128. None, 0.0 and +inf mean no clamp (normalize_swiglu_limit) and select the same kernel as an absent limit. [MEASURED]
  • get_2stage_cfgs now discards tuned rows that cannot clamp (ASM 1-stage, non-CK, split-K, non-_silu_) before a FlyDSL whole-graph row resolves; on main that check ran after the whole-graph return. For per_1x128 this only affects rows that could not clamp anyway. per_Token / per_Tensor additionally raise NotImplementedError for non-FP8 weights (e.g. int8 per_Token) and inter_dim % 128 != 0. [READ in source]
  • Tuned rows: aiter/configs/model_configs/a8w8_plain_tuned_swiglu_limit_fmoe_gfx942.csv (15 gfx942 per_Token rows, _tag=swiglu_limit=7) joins [HIP] [CK] [JIT] Enable swiglu_limit for FP8 per_1x128 blockscale MoE #7019's tuned_swiglu_limit_fmoe family, so AITER_CONFIG_FMOE_SWIGLU_LIMIT_FILE merges it and the config-collision family test checks it. Limits without a tagged row use the default config / heuristic, as for per_1x128. [READ in source]
  • No CK submodule change: [HIP] [CK] [JIT] Enable swiglu_limit for FP8 per_1x128 blockscale MoE #7019's pin f93c029e09 already contains RuntimeSwigluLimit for gridwise_moe_gemm. [READ in source]

Dropped from earlier revisions

The separate silulimit stage-1 module (aiter ActOP 5), the swiglustep 7.0-only fallback, ck_moe_has_runtime_swiglu_limit(), the CK bump to 5ec75ccf32, the private AITER_CONFIG_FMOE_SWIGLU_LIMIT loader, the reuse of the 7.0-tagged tile at other limits, and AITER_MOE_FORCE_CK2STAGE.

Testing

gfx942 MI300X 304 CU, head 510c02394 on main d6bda77fe, CK f93c029e09, FlyDSL 0.5.0:

  • The CI invocation AITER_MOE_2STAGE_CI_PROFILE=standard python3 op_tests/test_moe_2stage.py passes. It now runs two new FP8 per_Token / per_Tensor SiLU limit checks from run_plain_fp8_limit_cases(), on gfx942 and gfx950: [MEASURED]
    • test_plain_fp8_swiglu_limit (@benchmark, markdown summary): per_Token and per_Tensor × tokens 1 / 64 / 1024 × limit None / 0.0 / +inf / 1.0 / 7.0, model 2048 / inter 768 / 128 experts / top-8. fused_moe writes into a NaN-filled output and is timed with run_perftest, then graded against the fp32 torch reference with an asserted checkAllclose (rtol/atol 0.05; at most 0.39% outside on clamped cases, asserted ≤ 1%) and a maximum per-row relative L2 error (asserted < 0.05; at most 0.036 measured). Each clamped case must also differ from the unclamped reference (every row ≥ 1.09) and, at L=1, from clamp(SiLU(gate)) (every row ≥ 0.35). With the limit dropped from the fused_moe call, the first clamped case fails with 99.66% of elements outside tolerance.
    • test_plain_fp8_swiglu_limit_dispatch: a limit always dispatches non-split CK stage 1; 0.0 / +inf dispatch like an absent limit; an injected swiglu_limit=3 tagged row is used, and an incompatible one raises; raises for inter_dim 192, int8 per_Token and asm_stage1.
  • op_tests/test_moe_2stage.py -a silu -t 1 32 1024 -dim 2048,768 -e 128 -k 8 -sl 7, with -q 1 (per_Tensor) and -q 2 (per_Token): both pass, logits_diff 9.2e-6 – 1.8e-5. The same runs execute [HIP] [CK] [JIT] Enable swiglu_limit for FP8 per_1x128 blockscale MoE #7019's blockscale limit cases and guards: per_1x128 logits_diff 3.8e-6 – 1.4e-5, and 0.044 against the swapped-order reference, as before. test_swiglu_limit_guards now uses QuantType.No as the unsupported example, since per_Token is supported. [MEASURED]
  • op_tests/test_moe_a16w16_default_dispatch.py, op_tests/test_moe_per_tensor_a2_init.py, op_tests/tuning_tests/test_config_shape_collision.py: 97 passed, 34 skipped (gfx950-only), 2 subtests passed. [MEASURED]
  • Black and Ruff clean.

gfx950 MI355X 256 CU, head 510c02394 with the gate set to ("gfx942", "gfx950") (the code in b171fa95f), CK f93c029e09, FlyDSL 0.5.0, torch 2.14.1+rocm7.2 in a venv (not the CI image, which has torch 2.10.0), FP8 = float8_e4m3fn: [MEASURED]

  • The CI invocation passes, and all 30 sweep cases pass with thresholds unchanged. Clamped cases are at most 0.062% outside 0.05. The worst row error is 0.0365, on the stock unclamped per_Token ASM 1-stage path; clamped cases are at most 0.0068. Unclamped against clamped is ≥ 1.148 per row, and the L=1 swapped order is ≥ 0.344. Both …_silu_per_{token,tensor}_mulWeightStage2_runtime_swiglu_limit modules build and load. There are no gfx950 tagged rows, so clamped calls use the default heuristic tile, which is at most about 7% slower than the no-limit path at the same shape.
  • The gfx950 stage-1 template change is load-bearing. With {RuntimeSwigluLimit} removed from A16W16_A8W8_gemm1_gfx950_heuristic_dispatch, the runtime-limit module fails to import at the first clamped case (undefined symbol for the RuntimeSwigluLimit=false stage-1 instantiation).
  • With the limit dropped from the fused_moe call, the first clamped case fails with 99.85% of elements outside tolerance.
  • The legacy -q 1 / -q 2 sweep at -dim 2048,768, 4096,384 and 7168,256, -t 1 32 64 1024 4096 -e 128 -k 8, with -sl 7 and without, passes in all 12 runs. Clamped logits_diff is about 1e-5. Inter 384 takes the stage-2 K=128 path and 256 the K=256 path.
  • [HIP] [CK] [JIT] Enable swiglu_limit for FP8 per_1x128 blockscale MoE #7019's blockscale limit cases pass (logits_diff 3.4e-6 – 5.3e-6, swapped 0.044), and -q 5 … -sl 7 passes.
  • In the three related pytest files, the 34 gfx950-only tests ran: 26 passed and 8 failed. All 8 failures are test_gfx950_stage2_selects_k_tile, which predates this PR and does not use a limit. Under torch 2.14.1 the profiler trace keeps CK kernel names mangled, so its substring never matches. Decoding the mangled names shows the expected stage-2 tile in all 8 cases. CI runs this file as python3 <file>, and it has no __main__, so CI does not run these tests.
  • The injected kernel names in the dispatch check are now taken from the gfx950 instance list. On gfx950, FP8 instances use the TypeCast CDE op and an N=128 stage-2 tile. The stage-2 name assert was added after the gfx950 run. It was checked on gfx942, and on gfx950 only by get_2stage_cfgs with the arch reported as gfx950, not on hardware.

Earlier measurements (previous head, not re-run on this one)

The previous head bdb180896 ran the same CK RuntimeSwigluLimit epilogue through the silulimit module on CK 5ec75ccf32. On model 2048 / inter 768 / 128 experts / top-8, the stage-1 implied activation matched silu(L) at 7, 5 and 3 in all 30 clamped cells (per_Token and per_Tensor × 5 token counts). End to end (NorthMini, dummy fp8 weights, MI300X, 6 reps), it was +3.9% (10240-in/1024-out) and +10.7% (1024-in/1024-out) against Triton clamped at 7.0, and level with stock AITER without a limit. These numbers are from the earlier module and CK commit and are not claimed for this head. [MEASURED] on bdb180896

PR Self-Review

Reviewed revision

b171fa9

Behavior and intent

On main, a finite swiglu_limit with FP8 per_Token / per_Tensor SiLU MoE is silently ignored. This PR extends #7019's runtime SiLU limit from per_1x128 to per_Token / per_Tensor: same normalize_swiglu_limit semantics, same runtime_swiglu_limit module family, same tagged tuning file, and the non-blockscale CK template wired the way #7019 wired the blockscale one. Paths that cannot clamp raise. per_1x128 behaviour is unchanged except that a FlyDSL whole-graph row is now discarded under a limit instead of running unclamped.

Validation and unverified scope

  • gfx942 MI300X: the test results above. The -q 1 / -q 2 -sl 7 runs and the dispatch / a2_init / collision tests are from 25589d9d5. The commits since then change only op_tests/test_moe_2stage.py.
  • gfx950 MI355X: the results above, on 510c02394 with the gate enabled. PR CI runs on MI35X, so it now runs the new cases.
  • Unverified: gfx950 on the CI image's torch 2.10.0, and the gfx950 stage-2 name assert on hardware (see above). Also unverified: real-weight serving, end-to-end throughput on this head, shapes outside the sweep and the legacy shapes listed above, and gfx942 for the legacy shapes 4096 / 384 and 7168 / 256.

PR-specific question

Only gfx942 per_Token has tagged tuned rows. Clamped per_Tensor calls, and every clamped call on gfx950, use the default CK heuristic tile. On gfx950 that tile is within about 7% of the no-limit path. Is that acceptable for now, or should those rows be tuned (gemm_moe_tune.py --swiglu_limit 7) in this PR?

Changed op tests

  • op_tests/test_moe_2stage.py: adds test_plain_fp8_swiglu_limit (numerical / perf sweep in the file's existing @benchmark flow, next to [HIP] [CK] [JIT] Enable swiglu_limit for FP8 per_1x128 blockscale MoE #7019's test_blockscale_swiglu_limit) and test_plain_fp8_swiglu_limit_dispatch, both run from the CI invocation on gfx942 and gfx950; _effective_swiglu_limit treats FP8 per_Token / per_Tensor SiLU as clamped for -sl runs; test_swiglu_limit_guards uses QuantType.No for the unsupported case, since per_Token is now supported. The earlier pytest-only op_tests/test_moe_ptpc_swiglu_limit.py is removed.

Made with Cursor

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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 gfx1201 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 7361 --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.

@aiter-bot

aiter-bot commented Nov 2, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision b171fa95f3e9 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

On `main`, a finite `swiglu_limit` with FP8 `per_Token` / `per_Tensor` SiLU MoE is silently ignored. This PR extends #7019's runtime SiLU limit from per_1x128 to per_Token / per_Tensor: same `normalize_swiglu_limit` semantics, same `runtime_swiglu_limit` module family, same tagged tuning file, and the non-blockscale CK template wired the way #7019 wired the blockscale one. Paths that cannot clamp raise. per_1x128 behaviour is unchanged except that a FlyDSL whole-graph row is now discarded under a limit instead of running unclamped.

Validation and unverified scope

- gfx942 MI300X: the test results above. The `-q 1` / `-q 2` `-sl 7` runs and the dispatch / a2_init / collision tests are from `25589d9d5`. The commits since then change only `op_tests/test_moe_2stage.py`.
- gfx950 MI355X: the results above, on `510c02394` with the gate enabled. PR CI runs on MI35X, so it now runs the new cases.
- **Unverified:** gfx950 on the CI image's torch 2.10.0, and the gfx950 stage-2 name assert on hardware (see above). Also unverified: real-weight serving, end-to-end throughput on this head, shapes outside the sweep and the legacy shapes listed above, and gfx942 for the legacy shapes 4096 / 384 and 7168 / 256.

PR-specific question

Only gfx942 per_Token has tagged tuned rows. Clamped per_Tensor calls, and every clamped call on gfx950, use the default CK heuristic tile. On gfx950 that tile is within about 7% of the no-limit path. Is that acceptable for now, or should those rows be tuned (`gemm_moe_tune.py --swiglu_limit 7`) in this PR?

Changed op tests

- `op_tests/test_moe_2stage.py`: adds `test_plain_fp8_swiglu_limit` (numerical / perf sweep in the file's existing `@benchmark` flow, next to #7019's `test_blockscale_swiglu_limit`) and `test_plain_fp8_swiglu_limit_dispatch`, both run from the CI invocation on gfx942 and gfx950; `_effective_swiglu_limit` treats FP8 per_Token / per_Tensor SiLU as clamped for `-sl` runs; `test_swiglu_limit_guards` uses `QuantType.No` for the unsupported case, since per_Token is now supported. The earlier pytest-only `op_tests/test_moe_ptpc_swiglu_limit.py` is removed.

Made with [Cursor](https://cursor.com)

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

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 jatseng-ai changed the title [Draft][aiter] Dispatch PTPC and per-tensor FP8 MoE to the clamping CK kernel [Draft][aiter] Clamp FP8 per_Token / per_Tensor SiLU before SiLU at any swiglu_limit Nov 3, 2026
@jatseng-ai
jatseng-ai force-pushed the ptpc-pertensor-swiglu-limit branch from 98b9d26 to bdb1808 Compare November 4, 2026 19:34
@jatseng-ai
jatseng-ai marked this pull request as ready for review November 4, 2026 23:50
@jatseng-ai
jatseng-ai requested a review from a team November 4, 2026 23:50
@github-actions github-actions Bot changed the title [Draft][aiter] Clamp FP8 per_Token / per_Tensor SiLU before SiLU at any swiglu_limit [HIP] [CK] [Draft][aiter] Clamp FP8 per_Token / per_Tensor SiLU before SiLU at any swiglu_limit Nov 4, 2026
@zufayu
zufayu requested a review from yzhou103 November 5, 2026 01:21
@jatseng-ai
jatseng-ai force-pushed the ptpc-pertensor-swiglu-limit branch from bdb1808 to b325833 Compare November 9, 2026 18:09
@jatseng-ai

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (1eab5ae12, which includes #6552). No conflicts. The CK submodule stays at 5ec75ccf32.

  • The previous red run was infrastructure: build_aiter_wheels (3.12) could not pull rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_release_2.10.0 (Docker Hub 429 Too Many Requests), so the GPU suite never ran and the gate failed on the missing wheel. This push re-runs it.
  • New commit b3258334f fixes a regression on earlier heads. fused_moe and fused_moe_2stages rewrote None / 0.0 / +inf to None for every backend, and FlyDSL SwiGLU reads None as 7.0, so a +inf caller started clamping at 7.0. Now only the limit forwarded to CK and ASM stage 1 is normalized, and every other backend gets the caller's value as on main. test_other_backends_receive_caller_limit covers it.
  • gfx942 (MI300X), head b3258334f: op_tests/test_moe_ptpc_swiglu_limit.py 89 passed; op_tests/test_moe_a16w16_default_dispatch.py 60 passed, 34 skipped (gfx950-only). ruff 0.16.0 and black are clean.

@jatseng-ai jatseng-ai changed the title [HIP] [CK] [Draft][aiter] Clamp FP8 per_Token / per_Tensor SiLU before SiLU at any swiglu_limit [HIP] [CK] [aiter] Clamp FP8 per_Token / per_Tensor SiLU before SiLU at any swiglu_limit Nov 9, 2026
@jatseng-ai
jatseng-ai force-pushed the ptpc-pertensor-swiglu-limit branch from b325833 to f332c2b Compare November 10, 2026 18:37
@jatseng-ai

Copy link
Copy Markdown
Contributor Author

@yzhou103 could you review this when you have a chance?

It adds swiglu_limit for fp8 per_Token / per_Tensor SiLU on the CK 2-stage path. The clamp runs before SiLU through CK RuntimeSwigluLimit, so one stage-1 kernel serves any limit. Other quant types and backends receive the caller's swiglu_limit unchanged. The head f332c2ba5 is rebased on current main.

CI on this head: Black, Ruff, Check Repository Dependency, C++ interface (MI300X, MI35X), OPUS, and Triton pass. The Aiter Test Gate failed because build_aiter_wheels (3.12) could not pull rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_release_2.10.0. The mirror.gcr.io pull succeeded, but the Docker Hub digest check returned 429, so docker_pull_with_retry.sh did not use the mirror (job). The GPU tests did not run. A re-run of the failed jobs needs repository admin rights.

@jatseng-ai
jatseng-ai force-pushed the ptpc-pertensor-swiglu-limit branch from f332c2b to 0661db5 Compare November 11, 2026 17:13
… runtime limit

Reuse the per_1x128 runtime SiLU limit from ROCm#7019 for FP8 per_Token and
per_Tensor instead of a separate silulimit / swiglustep stage1 module.

- RUNTIME_SILU_LIMIT_QUANT_TYPES in moe_limits lists per_1x128, per_Token
  and per_Tensor; the dispatch, module, codegen, prebuild and tuner gates
  use it.
- The non-blockscale CK stage1 template passes RuntimeSwigluLimit and the
  limit to DeviceMoeGemm, with the same checks as the blockscale one, and
  the plain FP8 heuristic dispatch forwards the flag.
- get_2stage_cfgs discards tuned rows that cannot clamp before a FlyDSL
  whole-graph row resolves. per_Token / per_Tensor also require FP8 and
  inter_dim % 128 == 0.
- The gfx942 per_Token rows tuned at swiglu_limit=7 move into the
  tuned_swiglu_limit_fmoe family.

Signed-off-by: jatseng-ai <[email protected]>
Co-authored-by: Cursor <[email protected]>
@jatseng-ai
jatseng-ai force-pushed the ptpc-pertensor-swiglu-limit branch from 0661db5 to 25589d9 Compare November 12, 2026 06:11
@github-actions github-actions Bot changed the title [HIP] [CK] [aiter] Clamp FP8 per_Token / per_Tensor SiLU before SiLU at any swiglu_limit [CK] [JIT] [aiter] Clamp FP8 per_Token / per_Tensor SiLU before SiLU at any swiglu_limit Nov 12, 2026
@github-actions github-actions Bot added JIT and removed HIP labels Nov 12, 2026
@jatseng-ai jatseng-ai changed the title [CK] [JIT] [aiter] Clamp FP8 per_Token / per_Tensor SiLU before SiLU at any swiglu_limit [HIP] [CK] [aiter] Clamp FP8 per_Token / per_Tensor SiLU on #7019's runtime swiglu_limit Nov 12, 2026
Comment thread op_tests/test_moe_ptpc_swiglu_limit.py Resolved
Comment thread op_tests/test_moe_ptpc_swiglu_limit.py Resolved
@jatseng-ai

Copy link
Copy Markdown
Contributor Author

@yzhou103 thanks for the pointer. I've rebased #7361 onto latest main (after #7019) and reworked it to reuse #7019's runtime swiglu_limit infrastructure: normalize_swiglu_limit, the RuntimeSwigluLimit CK modules, the tuned_swiglu_limit_fmoe config family/tags, and its tuned-config filtering. The PR now just extends those paths to FP8 per_Token and per_Tensor; there's no CK bump. All the new and existing swiglu-limit tests pass, and #7019's per_1x128 results are unchanged. New head is 25589d9, and the PR description is updated. Could you take another look when you have a chance?

Replace the pytest-only test_moe_ptpc_swiglu_limit.py with a @benchmark
sweep (run_perftest, asserted checkAllclose and per-row error against the
fp32 torch reference, us/TFLOPS/TB/s/err, markdown summary) and a dispatch
check with an injected tagged row, both run by the standard CI invocation.

Co-authored-by: Cursor <[email protected]>
@github-actions github-actions Bot changed the title [HIP] [CK] [aiter] Clamp FP8 per_Token / per_Tensor SiLU on #7019's runtime swiglu_limit [CK] [JIT] [aiter] Clamp FP8 per_Token / per_Tensor SiLU on #7019's runtime swiglu_limit Nov 13, 2026
Add gfx950 to _PLAIN_FP8_LIMIT_GFX so the numerical sweep and the
dispatch/guard checks run on MI35x. The dispatch check's injected tagged
row uses the gfx950 stage-1 and stage-2 instance names (TypeCast CDE op,
N=128 stage-2 tile) on gfx950, and also asserts the stage-2 name.

Co-authored-by: Cursor <[email protected]>
@yzhou103
yzhou103 merged commit e393136 into ROCm:main Nov 16, 2026
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.
eppaneamd added a commit that referenced this pull request Nov 20, 2026
#7361 extended the runtime SiLU clamp to FP8 per_Token and per_Tensor and
moved the dispatch check. Keep its behaviour for those types (non-split,
ksplit 0) and keep CK split-K under a limit for per_1x128 only, the one type
with a split-K stage 1 that clamps in silu_and_mul after the reduction.

Signed-off-by: Rony Leppänen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jatseng-ai

Copy link
Copy Markdown
Contributor Author

The MI300X red after this merged is not a defect in this PR. Do not revert it (#8294 is already closed).

Two follow-ups, both in #8353: (1) CK-capable clamped per-token SiLU was hitting the gfx942 FlyDSL default (stage1=None); (2) the tuned limit-7 MulABScale names were missing from the dual-arch wheel. The CSV and runtime-limit clamp from this PR stay. We are not retuning those gfx942 M=16 rows, and #8353 does not wait on #7589.

zufayu added a commit to jatseng-ai/aiter that referenced this pull request Nov 24, 2026
A clamped per-token SiLU that CK can apply (FP8, inter_dim a multiple of
128) fell through to the gfx942 FlyDSL whole-graph default. That backend's
batch-1 and decode epilogues clamp BF16 activations, so the result misses
the per-token reference, and its metadata has stage1=None -- the
AttributeError in run 44408312107.

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
With the routing above fixed, MI300X shard 5 fails one case later: at 304
CUs, per-token limit 7 uses the tuned gfx942 MulABScale rows from ROCm#7361.
ci:mi300x prebuilds with GPU_ARCHS=gfx942;gfx950 and get_gfx() returns
only the last entry, so the wheel never built those instances -- "Unknown
or incompatible CK MoE kernel". Limit 1.0 has no tuned row, takes the
gfx950 heuristic, and passes.

_instance_arches() is get_gfx() plus any other MoE target in GPU_ARCHS, so
the lookup carries every arch's instances. _kernels_for_arch() holds the
per-arch call pair and the generator body keeps the shape it has on main.
gfx942-only tiles are instantiated for the host and the gfx942 device pass
and left out of the gfx950 one, guarded whenever both targets are built.
Heuristic dispatch still follows get_gfx(); this only widens the lookup.

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 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]>
zufayu added a commit that referenced this pull request Nov 24, 2026
…ship its gfx942 instances, and de-flake split-K graph replay (#8531)

Three independent failures a CI run hits:

- MI300X shard 5 crashed with AttributeError: 'NoneType' object has no attribute 'keywords'. A clamped per-token FP8 SiLU on gfx942 took the FlyDSL whole-graph default, whose metadata has stage1=None. Keep that default only where CK rejects the shape (inter_dim not a multiple of 128).
- With routing fixed, a 304-CU limit-7 call selects the tuned gfx942 256x16...MulABScale row from #7361, which a GPU_ARCHS=gfx942;gfx950 wheel never built: Unknown or incompatible CK MoE kernel. Emit every built arch's CK MoE instance list into the lookup; heuristic dispatch still follows get_gfx().
- MI35X shard 6 flaked on test_flydsl_hgemm's bit-exact split-K graph replay. BF16 output with split_k > 1 accumulates via BufferAtomicPkAdd, so the result is atomic-order dependent (#8374). Accept one BF16 ULP there only, with a finiteness check and a guard that the replay did not reuse the captured input.

Supersedes #8353 and #8351.

Fixes #8334
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants