Skip to content

[FlyDSL] [gfx1250] Pass arg_scale_out on every cached launch_gemm_a8w8 launch - #7920

Merged
coderfeli merged 2 commits into
mainfrom
xiaobingsuper/flydsl-gfx1250-a8w8-cached-arg-scale-out
Nov 13, 2026
Merged

coderfeli merged 2 commits into
mainfrom
xiaobingsuper/flydsl-gfx1250-a8w8-cached-arg-scale-out

Conversation

@XiaobingSuper

@XiaobingSuper XiaobingSuper commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix IndexError: tuple index out of range on the second launch of the gfx1250 FlyDSL launch_gemm_a8w8 wrappers. It breaks DeepSeek-V4-Pro on main during CUDA graph capture (layers.1.attn wqkv_a).

Motivation

#7178 appended a defaulted runtime pointer, arg_scale_out, to launch_gemm_a8w8. _run_compiled sends only the first launch of a specialization through flyc.compile, which applies signature defaults. Every later launch calls the cached CompiledFunction, which applies no defaults: it reads each runtime argument by signature index from the positional tuple. arg_scale_out is parameter 31, and three wrappers stop earlier:

Wrapper Positional args Second launch on main
dense mxfp8_128 / mxfp8_32 (mxfp8_bpreshuffle_gemm_gfx1250.py, non compute-bound) 29 IndexError
ptpc (bpreshuffle_gemm_gfx1250.py) 31 IndexError
batched mxfp8_128 (batched_gemm_a8w8_gfx1250.py) 27 IndexError

The batched mxfp8_32 wrapper, the one #7178 changed, already passes arg_scale_out. DeepSeek-V4-Pro on main, all four ranks:

atom/models/deepseek_v4/__init__.py:2136 _attn_pre: qkv_a = self.wqkv_a(x)
aiter/ops/gemm_op_a8w8.py:1622 gemm_a8w8_blockscale_bpreshuffle
aiter/ops/flydsl/mxfp8_bpreshuffle_gemm_gfx1250.py:411 -> kernels/tensor_shim.py:336 (cf(*args))
IndexError: tuple index out of range

Changes

The three wrappers now pass the trailing b_scale_32x32 / k_tail constexprs and arg_scale_out explicitly, as the batched mxfp8_32 wrapper does. The pointer is Out and is not read without fuse_quant_out. Constexpr values and specialization keys do not change, so the kernels, and the FlyDSL AOT cache built for them, stay the same.

No other @flyc.jit launcher in aiter/ops/flydsl has a defaulted runtime parameter that a caller leaves out.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

On MI455X (gfx1250), in rocm/fw-bringup-mlperf:gfx1250-atom-20261111 with ATOM main 373a27fb and aiter main 40565597 (FlyDSL 0.5.0):

Check main this PR
python3 op_tests/test_gemm_a8w8_mxfp8_bpreshuffle.py IndexError pass
python3 op_tests/test_flydsl_batched_gemm.py IndexError pass (fused-quant check 0 mismatches)
test_batched_gemm_a8w8_mxscale_bpreshuffle.py, test_gemm_group32_interface.py, test_bmm_a8w8_fused_quant_supported.py, test_gemm_host_dispatch_cache.py pass pass
FlyDSL GEMM AOT (python3 -m aiter.aot.flydsl.gemm, gfx1250 rows of the DeepSeek-V4 dense mxfp8_128 / mxfp8_32 / batched mxfp8_128 tables and the MiniMax-M3 ptpc table) 28 kernels the same 28 cache keys; --check against the cache built from main passes
DeepSeek-V4-Pro server (455-CI-recipe.md: DP4 attention + EP4 MoE, CUDA graphs) IndexError while capturing bs=512 bs=512/256/128 capture; bs=64 then hits a separate #7655 compile regression, fixed in #7924. With #7924, all 15 sizes capture; GSM8K 3-shot flexible-extract 0.9469, strict-match 0.9477

Existing tests already cover the fix: the first two fail on gfx1250 without it, so this PR adds no test. A standalone run that launches each of the four wrappers twice also matches a dequantized torch reference (cosine 0.999999) on both launches.

Black and Ruff (0.16.0) pass.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed: no public API changes.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None.

PR Self-Review

Reviewed revision

ed35fe7fba46f1433ed2fcd6658c9e2d0e09dcb8

Behavior and intent

Second and later launches of the dense mxfp8_128 / mxfp8_32, ptpc and batched mxfp8_128 gfx1250 GEMMs get every runtime argument and run the kernel the first launch compiled. Before, they raised IndexError. The first launch and the kernels are unchanged.

Validation and unverified scope

See Testing. MI250X and MI300X were not tested because all changed wrappers are gfx1250-only. DeepSeek-V4-Pro also needs #7924 to finish CUDA graph capture.

PR-specific question

op_tests/test_gemm_a8w8_mxfp8_bpreshuffle.py and op_tests/test_flydsl_batched_gemm.py fail on gfx1250 without this PR and pass with it.

Changed op tests

None.

…8 launch

#7178 appended the defaulted runtime pointer arg_scale_out to
launch_gemm_a8w8. Only the first launch of a specialization goes through
flyc.compile, which applies signature defaults; later launches call the
cached CompiledFunction positionally, and it reads each runtime argument
by its signature index. The dense mxfp8_128 / mxfp8_32, ptpc and batched
mxfp8_128 wrappers stop before arg_scale_out, so their second launch
raised IndexError: tuple index out of range (DeepSeek-V4-Pro wqkv_a
during CUDA graph capture).

Pass the trailing b_scale_32x32 / k_tail constexprs and arg_scale_out
explicitly, as the batched mxfp8_32 wrapper already does, and cover each
wrapper's cached second launch in test_gemm_host_dispatch_cache.py.

Co-authored-by: Cursor <[email protected]>
@XiaobingSuper
XiaobingSuper requested review from a team and a balanced review from Copilot November 13, 2026 07:32

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@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 7920 --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.

test_gemm_a8w8_mxfp8_bpreshuffle.py and test_flydsl_batched_gemm.py already
fail on gfx1250 without the fix.

Co-authored-by: Cursor <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 07:44

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@aiter-bot

aiter-bot commented Nov 13, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision ed35fe7fba46 · 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 — PR-specific question is too short to show concrete reasoning (13 units; need 14)
  • FAIL — validation answer must name a command, result, or evidence link

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

@aoli26 aoli26 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

@xudoyuan

Copy link
Copy Markdown
Contributor

LGTM. The missing parameters have been filled in.

@coderfeli
coderfeli merged commit 0d8cff9 into main Nov 13, 2026
@coderfeli
coderfeli deleted the xiaobingsuper/flydsl-gfx1250-a8w8-cached-arg-scale-out branch November 13, 2026 11:18
aoli26 added a commit that referenced this pull request Nov 14, 2026
Resolve the memory-path _launch_gemm_a8w8 call in the mxfp8 dense runner by
keeping main's k_tail and arg_scale_out (#7920) and passing w_scale_32x32 as
b_scale_32x32.
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.

6 participants