Skip to content

Feat/flydsl mxfp4 gemm - #3941

Closed
lizamd wants to merge 2 commits into
ROCm:mainfrom
lizamd:feat/flydsl-mxfp4-gemm
Closed

lizamd wants to merge 2 commits into
ROCm:mainfrom
lizamd:feat/flydsl-mxfp4-gemm

Conversation

@lizamd

@lizamd lizamd commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

FlyDSL has a dense preshuffle GEMM for a8w8 and an a4w4 path for MoE stages, but no dense MXFP4 (a4w4) entrypoint. The fp4 kernel already exists (compile_preshuffle_gemm_a8(in_dtype="fp4"), CDNA4 mfma_scale_f32_16x16x128_f8f6f4); this PR exposes it as a dense op. No new GPU kernel.

Technical Details

  • aiter/ops/flydsl/gemm_kernels.py: flydsl_preshuffle_gemm_a8 accepts packed MXFP4 (in_dtype="fp4"; recovers logical K from the K/2 packed dim; byte-views fp4 for the pointer path).
  • aiter/ops/gemm_op_a4w4.py: new gemm_a4w4_bpreshuffle_flydsl, mirroring gemm_a8w8_bpreshuffle_flydsl. Caller supplies quantized/preshuffled operands (per_1x32_f4_quant_hip, shuffle_weight, e8m0_shuffle) and tiling via config["kernelName"].
  • aiter/ops/flydsl/gemm_tune/flydsl_gemm_a4w4_bpreshuffle_tune.py: staged tuning harness (tile → waves_per_eu/cshuffle → preload).

Format: OCP MXFP4 — E2M1 packed 2/byte, one E8M0 scale per 32-element K block.

Test Plan

Compare the dense op to an fp32-dequantized reference on MI355X (gfx950) across square M=N=K ∈ {1024,2048,4096,8192,16384}; report relerr + cosine.

Test Result

gfx950: relerr 0.0014 / cosine 1.0000, flat across all shapes. Residual = intrinsic MXFP4 quant noise. Tuned throughput competitive with asm gemm_a4w4.

Submission Checklist

  • Follows existing FlyDSL op conventions
  • Correctness verified on gfx950
  • CI / maintainer review pending

doudoumi and others added 2 commits June 26, 2026 00:04
Expose a dense MXFP4 GEMM through the FlyDSL preshuffle path, mirroring
gemm_a8w8_bpreshuffle_flydsl. The underlying kernel (compile_preshuffle_gemm_a8,
in_dtype=fp4 -> CDNA4 mfma_scale_f32_16x16x128_f8f6f4) already existed; this
wires up the dense entrypoint that was previously only available for a8w8 and
for the a4w4 MoE stages.

- flydsl_preshuffle_gemm_a8: accept packed MXFP4 inputs (E2M1 x2 + E8M0
  per-32 block scales); recover logical K from the K/2-wide packed last dim.
- gemm_a4w4_bpreshuffle_flydsl: public op; caller supplies quantized/preshuffled
  operands (per_1x32_f4_quant_hip / shuffle_weight / e8m0_shuffle) and tiling
  via config[kernelName].

Verified on MI355X (gfx950): relerr 0.0014 / cosine 1.0000 vs an fp32
dequantized reference across square M=N=K in {1024..16384}.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Staged search (tile -> waves_per_eu/cshuffle -> preload depth) over the
FlyDSL fp4 preshuffle GEMM, reporting best TFLOP/s per square shape.
Companion to gemm_a4w4_bpreshuffle_flydsl.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@lizamd
lizamd requested a review from a team June 26, 2026 00:32
@github-actions

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:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 3941 --add-label <label>

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

No activity for 15 days, so this is now labelled stale. A push or a comment clears it; keep-open exempts it.

@github-actions github-actions Bot added the stale The PR hasn't been updated in 2 weeks label Oct 7, 2026
@zufayu

zufayu commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Closing due to inactivity: no pushes, reviews, or comments for 105 days. This is housekeeping, not a judgement on the change — if you want to continue this work, comment here and we'll reopen, or open a fresh PR rebased on the latest main.

@zufayu zufayu closed this Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale The PR hasn't been updated in 2 weeks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants