Skip to content

[GEMM] Add gemm_a8w8_blockscale_group32_supported - #8086

Merged
valarLip merged 2 commits into
mainfrom
hwang/group32-gemm-supported
Nov 17, 2026
Merged

valarLip merged 2 commits into
mainfrom
hwang/group32-gemm-supported

Conversation

@HaonanWang98

@HaonanWang98 HaonanWang98 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds gemm_a8w8_blockscale_group32_supported(w_scale_block, bpreshuffle=False) to aiter/ops/gemm_op_a8w8.py. It reports whether this arch has a group32 (E8M0) GEMM for a weight layout, so callers stop matching arch names. ATOM's native group32 FP8 linears will use it to decide when to fall back to BF16 (ROCm/ATOM#3102).

  • Row-major weight: the gate of the Triton gemm_a8w8_blockscale_group32 (gfx950).
  • (16, 16)-preshuffled weight: bmm_a8w8_mxfp8_supported, the check gemm_a8w8_blockscale_bpreshuffle uses to route group32 scales.

No dispatch change.

Test

On hardware, gfx942 returns False for 1x32 and 32x32 in both layouts. gfx950 returns True for all four.

Whether this arch has a group32 GEMM for a weight layout: the Triton
group32 GEMM's arch for a row-major weight (its assert now asks the same
function), bmm_a8w8_mxfp8_supported for a (16, 16)-preshuffled one, as
gemm_a8w8_blockscale_bpreshuffle routes group32 scales.
@HaonanWang98
HaonanWang98 requested a review from a team November 17, 2026 07:22
@github-actions github-actions Bot changed the title [GEMM] Add gemm_a8w8_blockscale_group32_supported [Triton/Gluon] [GEMM] Add gemm_a8w8_blockscale_group32_supported Nov 17, 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 8086 --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 17, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 53c93bef5bd0 · 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.

The row-major branch states the Triton group32 GEMM's gfx950 gate itself;
the Triton module and its test are main's again.
@github-actions github-actions Bot changed the title [Triton/Gluon] [GEMM] Add gemm_a8w8_blockscale_group32_supported [GEMM] Add gemm_a8w8_blockscale_group32_supported Nov 17, 2026
@valarLip
valarLip merged commit ff2f0ce into main Nov 17, 2026
@valarLip
valarLip deleted the hwang/group32-gemm-supported branch November 17, 2026 08:17
HaonanWang98 added a commit to ROCm/ATOM that referenced this pull request Nov 17, 2026
native_group32_runs_bf16 asks gemm_a8w8_blockscale_group32_supported for a
32x32 weight in the layout weight_is_stored_preshuffled keeps, instead of
matching the arch name.
HaonanWang98 added a commit to ROCm/ATOM that referenced this pull request Nov 19, 2026
…he AITER floor

- A native W4A8 linear no longer calls native_group32_runs_bf16.
- Docs: native group32 FP8 linears need ROCm/aiter#8086 on every arch (the
  V4.1 performance guide, ATOM_GROUP32_WEIGHT_PRESHUFFLE, the MiniMax-M3
  recipe, native_quant_linear); MXFP4 sources are never streamed, and a
  Linear refuses one.
HaonanWang98 added a commit to ROCm/ATOM that referenced this pull request Nov 19, 2026
* feat(dsv41): DeepSeek-V4.1-Flash on MI308X (gfx942)

Runs the FP4PTPC checkpoint on gfx942, with and without DSpark: per-channel FP8 dense linears and shared expert (fused into FusedMoE's shared slot), routed experts converted from FP4 to per-channel FP8 at load and run on AITER's FlyDSL fused_moe with swiglu_limit, native group32 layers in BF16, gfx942 FP8 index formats, CSA decode split-KV and DSpark on gfx94x.

* dsv41: require the FP4PTPC recipe; guard the BF16 fallback

FP4PTPC without its routed experts converted to per-channel FP8 is refused with the recipe; the BF16 fallback asserts it gets no x_scale; the a8w4 attention test's take() mock returns what it is given.

* dsv4: a BF16 shared-expert w2 takes the unfused activation

The fused clamp-act-mul quantizes w2's input for a native group32 w2; where that w2 runs in BF16 (gfx942 at TP1/TP2) it must not.

* dsv41: the FP4PTPC recipe needs a routed-expert layer pattern

make_v4_quant_config converts the routed experts only on a layer pattern; a global ptpc_fp8 spec leaves them MXFP4.

* dsv41: third review round

The DP+EP guard reads Config.enable_expert_parallel; a native group32 linear records its BF16 fallback once (runs_bf16) and callers gate on it; Fp8MoEMethod takes fnuz_fixup; the FP4 online source reuses dequant_fp4_e2m1; the FP4PTPC recipe check uses online_pattern_spec; tests for CSA split-KV vs unsplit, the padded-source trim, the DP+EP guard and the fp4ptpc compile key.

* tests: skip the FP4PTPC recipe test without AITER

Its QuantizationConfig resolves AITER's QuantType; the non-GPU CI has no AITER.

* dsv41: per-expert trim test; comments for the BF16 fallback

The per-expert online-quant loop gets the padded MXFP4 source case; comments on wo_a, the native group32 weight and the shared-expert copy say what runs_bf16 and FNUZ do.

* dsv41: the loader asks the built FusedMoE; no getattr defenses

V4.1 models answer the loader's shared-expert rename from the FusedMoE they built (fuses_shared_expert), in place of a moe_quant_config probe; FusedMoEMethodBase declares need_normalize_e4m3fn_to_e4m3fnuz; MoE._fuse_shared_into_routed is read directly; the FP4PTPC recipe check also needs FP8.

* dsv41: V4.1 publishes quant_config; PTPC shared staging is its own class

- The V4.1 backbone and DSpark draft expose their MoE quant config as
  `quant_config`, which the loader's shared-expert rename already reads
  (as V4's); `fuses_shared_expert` and its loader hunk go.
- A `runs_bf16` linear returns on every `process_weights_after_loading`.
- `Config.compute_hash` loses the `fp4ptpc` factor: the text-config field
  is keyed by `_hf_architecture_factor` already.
- `PtpcSharedStaging` takes the per-channel FP8 shared expert;
  `Mxfp8SharedIntoMxfp4` and the MiniMax tests are main's again.
- `QueryRows.take` passes a None scale through; the BF16-Q branches go.
- Tests: the draft's BF16 `project_context`, the MXFP4 hidden-pad/bias
  refusal, a None-scale take.

* moe: rename the shared-expert staging instead of splitting it

`Mxfp8SharedIntoMxfp4` (which also stages the per-channel FP8 shared
expert with `ptpc`) becomes `SharedExpertStaging` in
`fused_moe/shared_expert_staging.py`; `PtpcSharedStaging` goes. The
`--load_dummy` return applies to the PTPC staging only. The PTPC tests use
the MiniMax test's FusedMoE stand-in.

* dsv41: read shared_expert_staging directly; test the quant_config contract

- FusedMoE.weight_loader reads the declared `shared_expert_staging`; the
  rollout test double declares it too.
- A test that the backbone and the draft publish `quant_config` and that
  the loader's `_fuse_shared_expert` asks with it; the comments say so.
- DualRMSNormPerToken overrides only the launch: the reshape, allocation
  and return are DualRMSNormBF16's.

* linear: ask AITER whether a group32 GEMM exists (needs ROCm/aiter#8086)

native_group32_runs_bf16 asks gemm_a8w8_blockscale_group32_supported for a
32x32 weight in the layout weight_is_stored_preshuffled keeps, instead of
matching the arch name.

* dsv41: a BF16 main_proj takes the joined DSpark taps unquantized

Main's in-place tap quantization (#3131) handed the draft's main_proj FP8
taps also where it runs in BF16 (gfx94x), which refuses them.

* dsv41: test the BF16 wo_a projection and the BF16 context-KV fallback

- `_project_out` with a BF16 `wo_a`: inverse RoPE and the strided bmm
  against the CPU rotation and a grouped einsum (GPU, two groups).
- `_context_kv_fusion` keeps BF16 shards per stage.
- `_project_taps`' docstring covers the BF16 `main_proj`.

* dsv41: the _project_out docstring covers the BF16 wo_a

* dsv41: FP4PTPC review fixes: fused-act scale layout, streaming, loader hook, validation, docs

- Expert: the fused clamp-act-mul only for a w2 that reads its group32 or
  1x128 x_scale; a per-channel w2 quantizes its own input.
- A per-channel shared expert is not staged into streamed routed experts, and
  FP4PTPC refuses ATOM_ONLINE_QUANT_STREAMING up front.
- A runs_bf16 weight keeps weight_loader_process.
- validate_fp4ptpc_recipe checks every layer; online quantization of the
  native checkpoint is refused again.
- _project_out calls the RoPE module; paged_2src shares paged_decode's
  _cu_count and returns one split for an empty step.
- The draft's wkv_shard view stays out of _modules.
- Recipe: gfx942 (MI308X) section and the AITER pin; MXFP4 sources in the
  online quantization docs.

* dsv41 recipe: the BF16 fallback's memory per GPU at TP4

* dsv41: refuse the FP4PTPC layouts that are not run; MXFP4 linears stay refused

- V4.1's MoE refuses an FP4PTPC layer whose shared expert did not fuse, and
  the draft refuses unconverted routed experts; this replaces
  validate_fp4ptpc_recipe. Expert parallel and data parallel are refused.
- A Linear refuses an MXFP4 online source, as before; only MoE experts
  convert from MXFP4. MXFP4 sources are not streamed, as before.
- Recipe: the AITER pin is ROCm/aiter#8178's merge commit.

* linear: only FP8 native linears ask AITER's group32 query; document the AITER floor

- A native W4A8 linear no longer calls native_group32_runs_bf16.
- Docs: native group32 FP8 linears need ROCm/aiter#8086 on every arch (the
  V4.1 performance guide, ATOM_GROUP32_WEIGHT_PRESHUFFLE, the MiniMax-M3
  recipe, native_quant_linear); MXFP4 sources are never streamed, and a
  Linear refuses one.
ZhiweiYan-96 added a commit to ROCm/ATOM that referenced this pull request Nov 19, 2026
3102 (since 3f109db) builds the DSpark draft's block-32 FP8 linears through
aiter's gemm_a8w8_blockscale_group32_supported (ROCm/aiter#8086); an aiter
without it fails the draft with an ImportError. #7820, #7407 and #8086 are
all merged, so state the requirement as an aiter main at ff2f0ce27 or later,
and name the validated aiter: the #7820 head 7bec3c672 with #8086's function
added (False on gfx942: the BF16 fallback, as before).

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants