[gfx950][FlyDSL] Add direct dense A4W4 MXFP4 GEMM - #4782
Draft
LiuYinfeng01 wants to merge 1 commit into
Draft
Conversation
Quantize BF16 activations inline and execute native scaled MXFP4 MFMA against packed E2M1 weights. Add dense BM16/BM64 and BK128 coverage while preserving the shared GEMM1 MoE path.
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a native gfx950 FlyDSL dense A4W4 GEMM that quantizes BF16 activations inline to MXFP4 and consumes packed E2M1 weights with E8M0 scales directly in scaled FP4 MFMA.
This is intentionally independent from #4772:
BF16 activation -> inline MXFP4 quant -> MXFP4 x MXFP4 MFMABF16 activation x decoded MXFP4 weight -> BF16 MFMAImplementation
prepare_gemm_a4w4_weight/flydsl_gemm_a4w4APIKernel microbenchmark
MI355X (gfx950), latest AITER main base
878d60d77. Median microseconds; speedup is versus existing Triton dynamic quant + A4W4. Weight preparation/JIT excluded.The direct output is numerically equal to the existing Triton A4W4 semantic path within the expected reduction-order error. Across these points, relative L2 was 2.42%-4.15% against the cached BF16/QDQ emulation reference, matching Triton's activation-quantization error.
The one measured crossover is
(N=8448,K=7168,M>=2048), where Triton is faster. The downstream vLLM integration uses a shape-aware Triton fallback for that region instead of forcing this kernel.ATT findings
Wave-state analysis guided the BK/BM choices:
(7168,4224,M=512), BM64/BK128: quant/decode was 4.95% of sampled latency; wait/barrier was 60.01%(8448,7168,M=512), BM64/BK256: quant/decode was 5.59%; VMEM was 23.01%; wait/barrier was 39.26%This indicates inline quantization is not the dominant cost; the remaining large-shape opportunity is load/wait scheduling.
Model validation
Kimi-K3, TP8, validation image
local/k3-direct-a4w4-validation:20260815:The experimental downstream hybrid retained Triton weights only for
(8448,7168,M>=2048). That duplicated 32,169,984 bytes per affected layer, or 2.786 GiB/rank across 93 layers; this is a downstream routing trade-off, not an allocation made by the AITER kernel itself.Validation
41 passed11 passed4.05e-06py_compile, andgit diff --checkScope