Skip to content

[FlyDSL] AOT: prebuild the fused-quant entry of the batched mxscale GEMM - #8702

Merged
coderfeli merged 2 commits into
mainfrom
fix/flydsl-aot-bmm-fused-quant
Nov 26, 2026
Merged

coderfeli merged 2 commits into
mainfrom
fix/flydsl-aot-bmm-fused-quant

Conversation

@coderfeli

Copy link
Copy Markdown
Collaborator

Problem

ATOM's DeepSeek-V4.1 accuracy job on gfx950 logs, for every model runner:

[FlyDSL AOT] bmm_a8w8_mxscale_gfx950: no prebuilt entry in .../flydsl_aot/<digest>/bmm_a8w8_mxscale_gfx950 for ((('constexprs', (1024, 4096, 2, 64, 128, 256, 1, 4, 4, 1, True, True, 2, 32, 32, 32, True, False, False, 0, True)),), device(...)); tracing it on the JIT path.

16 distinct keys x 8 GPUs, all B=2, N=1024, K=4096, 32x32 w_scale, and all with fuse_quant_out=True. Nothing fails (a miss traces on the JIT path), but each process pays the compiles at warmup.

Cause

The batched table has two public entries: batched_gemm_a8w8_mxscale_bpreshuffle (bf16) and batched_gemm_a8w8_mxscale_bpreshuffle_fused_quant (#8101). fuse_quant_out is a Constexpr, so the fused entry launches another kernel of the same tuned row. aiter/aot/flydsl/gemm.py replayed only the bf16 entry, so no fused kernel was ever prebuilt. --check could not see it either: it checks only what the replay itself requests.

Fix

Replay the fused entry as a caller-side variant of each batched row, as _variants already does for the output dtype of the FP32 blockscale GEMMs. The fused entry runs FlyDSL at an OPUS row as well (the runner's own pick), so those rows get the variant too; they still get no bf16 job.

Verification

  • Replaying the B=2 / 32x32 gfx950 fused jobs as the prebuild does (row ends plus bisection, identify only) requests all 16 keys the ATOM job missed (16/16).
  • New test_batched_rows_replay_the_fused_quant_entry_too; tests/test_flydsl_aot_replay.py: 30 passed.
  • Not run: the full python -m aiter.aot.flydsl.gemm build with compilation.

Cost

Identify-only count over the gfx950 rows of dsv4_batched_gemm_a8w8_blockscale_mxscale_bpreshuffle_tuned.csv (row ends plus bisection): the bf16 jobs request 202 distinct bmm_a8w8_mxscale_gfx950 launchers; the fused variant adds 192 (95 for 128x128 w_scale, 97 for 32x32), 16 to 21 per (B, w_scale block). On gfx1250 the fused variant requests 5 kernels at the 32x32 rows' own M; the 20 128x128 rows have no fused epilogue there and are reported as [SKIP].

Open question for review: ATOM calls the fused entry for DeepSeek-V4.1 (32x32) only. Restricting the variant to 32x32 rows would halve the added kernels, at the price of restating a caller's choice in the AOT module.

🤖 Generated with Claude Code

The batched table has two public entries: batched_gemm_a8w8_mxscale_bpreshuffle
(bf16) and its _fused_quant twin, which fuses the output's group-32 MXFP8 quant
into the epilogue. fuse_quant_out is a Constexpr, so the twin is another kernel
of the same row, and the replay only called the bf16 entry: every fused launch
missed the cache and traced on the JIT path (DeepSeek-V4.1 wo_a on gfx950).

Replay the fused entry as a variant of each batched row. It runs FlyDSL at an
OPUS row as well (the runner's own pick), so those rows get the variant too.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@coderfeli
coderfeli requested a review from a team November 25, 2026 16:08
@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 8702 --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 25, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 4a4ee8d20af0 · 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 — 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

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

Co-Authored-By: Claude Fable 5.2 <[email protected]>

@solinzby1 solinzby1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zufayu
zufayu requested review from aoli26 and xytpai November 26, 2026 02:47
@coderfeli
coderfeli merged commit 9fe009c into main Nov 26, 2026
60 checks passed
@coderfeli
coderfeli deleted the fix/flydsl-aot-bmm-fused-quant branch November 26, 2026 06:36
vedenev-amd added a commit that referenced this pull request Nov 26, 2026
…again; keep main's fused-quant and FlyDSL-only AOT variants alongside the decode strided_a variant.

The one conflict was in _variants of aiter/aot/flydsl/gemm.py, where main (#8702) added the batched GEMM fused-quant entry and the rule that non-FlyDSL rows have no variant, and this branch added the strided_a variant for decode rows with M > 1. Decode rows are FlyDSL rows, so both apply: the AOT replay of the Kimi-K3 bf16 CSV still lists all 154 decode rows, with a strided_a job for each M > 1 row.

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

4 participants