Repository navigation
[GEMM] Add MI308X FP8 PTPC BPreshuffled GEMMs tuned config for Qwen - #14
Merged
sammysun0711 merged 6 commits intoDec 1, 2026
Conversation
- Tune 41 Qwen3.5-35B TP2 and 17 Qwen3.5-397B TP8 shapes with FlyDSL. - Tune six Qwen3.8-Flash-Next TP2 decode GEMMs at M=128 and M=256. - Update 19 shared GLM5 rows in place to avoid duplicate dispatch keys. Signed-off-by: Xiake Sun <[email protected]>
- Select faster CK kernels for 14 of 32 existing 397B block-scale shapes. - Cut latency by 9.3–9.7% in a replay with one call per shape. - Use operator-first filenames for the 35B and 397B packed PTPC tables. Signed-off-by: Xiake Sun <[email protected]>
apinge
self-requested a review
November 26, 2026 03:11
- Restore the upstream 397B block-scale selections. - Keep the 64 packed PTPC rows used by the target Qwen workloads. Signed-off-by: Xiake Sun <[email protected]>
- Restore four original CK rows whose replacement CSV latency increased. - Keep the other 60 packed PTPC tuning changes. - Preserve all dispatch keys and the remaining table contents. Signed-off-by: Xiake Sun <[email protected]>
- Select gfx942 FlyDSL tiles using all 48 checkpoint projection weights. - Validate BF16 and FP16 output across the inherited M=17–64 buckets. Signed-off-by: Xiake Sun <[email protected]>
- Cover 80 shapes from M=1 to 32768 for 35B TP2 and 397B TP8. - Add 20 MI308X dispatch entries and retune 15 existing selections. - Refresh four shared GLM5 timings and remove 14 non-power-of-two prefill overrides. Signed-off-by: Xiake Sun <[email protected]>
apinge
approved these changes
Dec 1, 2026
5 tasks
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.
Motivation
This PR tunes packed FP8 per-token/per-channel (PTPC) GEMMs for Qwen dense attention on AMD Instinct MI308X (
gfx942, 80 CUs). Across four tuned CSVs it adds 53 dispatch keys and replaces 29 existing GLM5 selections shared with Qwen3.5-35B TP2. Of the 82 changed shapes, 80 select FlyDSL and two select CK. Tuning CSVs · Packed FP8 tunerAll 82 shapes had lower median GEMM latency than the PR base with both rotating and reused weights. The table gives the median reduction across shapes, with the smallest and largest per-shape reductions in parentheses.
Eighty shapes cleared 3% in both modes. The two smaller rotating-weight gains were 2.79% at
(M,N,K) = (16,4608,2048)for 35B TP2 and 1.16% at(16,2560,4096)for 397B TP8.Qwen3.5 FP8 PTPC shapes
The tuner inputs cover all 16 powers of two from
M=1through32768at each of the five rank-local projection widths below. This gives 48 inputs for 35B TP2 and 32 for 397B TP8.Checkpoint layout and measured workload coverage
Qwen3.5-35B-A3B-PTPC-FP8[N,1]in_proj_qkvweight[8192,2048], scale[8192,1]Qwen3.5-397B-A17B-PTPC-FP8[N,1]in_proj_qkvweight[12288,4096], scale[12288,1]With
SGLANG_USE_AITER=1, SGLang converts E4M3 weights to FNUZ on gfx942, allocates FP32 channel scales and preshuffles weights in 16×16 tiles. The Qwen3.5 traces callaiter.gemm_a8w8_bpreshufflewith E4M3 FNUZ operands and FP32 scales shaped[M,1]for activations and[N,1]for weights. SGLang channel-scale loader · Packed PTPC linearThis PR target: dense attention projections account for 130 stored FP8 matrices on 35B and 195 on 397B before fusion and tensor-parallel sharding.
Non goal:
Per-shape PTPC results
The paired measurements compare the public
aiter.gemm_a8w8_bpreshuffleoperator against base1cf6209on GPU 1, using ROCm 7.14, PyTorch 2.12 and FlyDSL 0.3.2. Both modes callshuffle_weightbefore timing. Rotating mode cycles through distinct packed-weight buffers at the same shape. Reused mode repeatedly reads one buffer. The measurements use preshuffled E4M3 FNUZ inputs, FP32 scales and BF16 output. Base · PR headThe tables report median GPU time per GEMM in microseconds for rotating weights. Each percentage is the median of the paired latency reductions,
100 × (base − tuned) / base. The audit alternated run order and collected 40 or 70 pairs per shape per mode. Rotating runs used 32 buffers through M=256, eight through M=2048, four through M=8192 and two above that.Qwen3.5-35B-A3B TP2 · 45 changed shapes
Qwen3.5-397B-A17B TP8 · 29 changed shapes
Qwen3.8-Flash-Next TP2 · 8 changed shapes
Validation
rtol=0.01, atol=0.01.