Repository navigation
[Config] [Tuning] Qwen3.8-Flash-Next TP4 prefill BF16 GEMMs on MI308X (gfx942, 80 CU) - #7204
Conversation
… CU) 37 large-M shapes (M 2048..65536) of the MTP drafter, the final HC mixer and the PLE projections that fell back to torch (aten::mm, as low as 60 TFLOPS for [M,10240]x[10240,320]); hipBLASLt solutions from gradlib gemm_tuner.py.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
There was a problem hiding this comment.
🔵 Needs a closer look
Static checks passed, but correctness and performance of the 37 hardware-specific hipBLASLt solution selections remain unverified without an exact-head GPU validation report from gfx942 hardware with 80 CUs.
No open issues 🎉
What changed in this PR
Adds BF16 GEMM tuning data for Qwen3.8-Flash-Next TP4 prefill on MI308X (gfx942, 80 CUs), using the existing model-config merge mechanism without changing code.
Changes:
- Adds 37 hipBLASLt solutions covering nine projection shapes and M buckets from 2048 to 65536.
- Targets tuned-table misses that otherwise fall back to PyTorch; the PR reports a 2.6% geometric-mean serving throughput improvement.
| File | Description |
|---|---|
aiter/configs/model_configs/qwen38_flash_next_tp4_prefill_bf16_tuned_gemm.csv |
Adds model-specific BF16 GEMM solutions, kernel metadata, and tuning measurements. |
Review effort: Balanced
ZLkanyo009
left a comment
There was a problem hiding this comment.
LGTM, approving. I checked the table mechanically:
- The header matches
bf16_tuned_gemm.csv. - All 37 keys are unique and are all gfx942 / 80 CU hipBLASLt entries with
err_ratio0. - None of the keys collide with
bf16_tuned_gemm.csvor any of the other 27model_configs/*bf16_tuned_gemm.csvtables, so the model-config merge stays unambiguous. - The nine (N, K) shapes line up with the Qwen3.8-Flash-Next TP4 prefill projections.
Since it only adds a model-specific table, it's safe to merge independently of the ATOM PRs.
|
@valar-cop Come and check this out. |
This comment has been minimized.
This comment has been minimized.
Review follow-up: a pinned hipBLASLt solidx is tied to the hipBLASLt build and can fault or pick an unrelated kernel when the library is updated. Retuned the same 37 keys with csrc/gemm_a16w16/gemm_a16w16_tune.py (no --with-hipblaslt): 24 rows now use aiter OPUS kernels, 13 rows stay on torch native where nothing beats it.
|
@ZLkanyo009 your approval was dismissed by the new push (4578a2f). The table now uses OPUS and torch native instead of pinned hipBLASLt solutions, following @demonsan's review. The keys are the same 37 and there are still no collisions with the other BF16 tables on current |

Summary
This adds
aiter/configs/model_configs/qwen38_flash_next_tp4_prefill_bf16_tuned_gemm.csv: 37 BF16 GEMM rows for gfx942 with 80 CUs (MI308X), covering the large-M prefill shapes of Qwen3.8-Flash-Next served at TP4 with MTP. Like the other files undermodel_configs/, it is picked up by the existing merge inAITER_CONFIG.get_config_file. No code changes.The table uses no hipBLASLt solutions. 24 rows use aiter OPUS kernels and 13 rows stay on
torch(native) because nothing beat it there. The first revision pinned hipBLASLt solution indices. Following review, it was retuned without them, because a pinnedsolidxis tied to the hipBLASLt build and can fault or pick an unrelated kernel when CI images update hipBLASLt.Without these rows the shapes miss the tuned table (the existing
qwen38_flash_next_bf16_tuned_gemm.csvhas no rows for them) and fall back totorch(aten::mm). Torch picks poor kernels for some of them:[16384,10240]x[10240,320]takes 1.83 ms on torch and 0.84 ms with the OPUS row.The shapes come from the MTP drafter (
fc_hidden2560 x 2560, which runs over all four streams and therefore reaches 4T rows; QKV 3584 x 2560; HC 320 x 10240), the final HC mixer, and the PLE projections.The M buckets follow
getPaddedM, the tuned-table lookup rule (gl=1: M > 8192 with N > 4096 maps to 8192, otherwise the next power of two). Tuned withcsrc/gemm_a16w16/gemm_a16w16_tune.py --mp 4 --shape_grouped(no--with-hipblaslt; candidates asm, opus, triton, torch) on MI308X, ROCm 7.2.4. All selected rows haveerr_ratio0.Kernel time
Production-op benchmark (
gemm_a16w16_tune.py --run_config), same container and GPUs for all three columns, sum over the 37 shapes:The largest wins over torch are
[16384,10240]x[10240,320](1830 -> 838 us),[16384,2560]x[2560,3584](3153 -> 1342 us) and[16384,2560]x[2560,320](478 -> 219 us). On the 2560- and 10240-wide GEMMs OPUS is on par with or faster than the hipBLASLt solutions; it gives up some time on N = 320 at M = 16384 and on the small-N / K = 160 shapes.Results
4x MI308X (GPUs 4-7), TP4 / EP4 Qwen3.8-Flash-Next-PTPC-FP8, image
atom-sglang:qwen38-flash-next-20261102-full(aiter0c8a7a59c, ROCm 7.2.4, SGLang v0.5.20 + ATOM), BF16 KV, MTP on (EAGLE 2 steps), radix cache on and flushed (#cached-token= 0 in every measured run).sglang.bench_servingrandom, OSL 1, ~800K input tokens per case, mean of r1 and r2 after a discarded r0. One fresh container per column, run back to back.r1 / r2 differ by at most 2.6% (hipBLASLt), 4.4% (this table) and 6.5% (no table), so the 0.4% between this table and the hipBLASLt revision is within run-to-run noise.
GSM8K 400 (
run_eval, chat, thinking off): 0.9725 without the table, 0.975 with it (0.9725 with the hipBLASLt revision). The change only selects GEMM kernels; dtypes are unchanged.Deploying into a prebuilt image
module_deepgemm_opuscompiles only the OPUS kernel ids referenced by the tuned CSVs at build time (gen_instances.py --tune_files ...). A from-source or JIT build of aiter picks this table up automatically. In an image whose OPUS module was built before this file was added, dropping in the CSV alone makes the first lookup fail withopus_gemm_a16w16_launch: kid 3 is not compiled in the current OPUS module. Removeaiter/jit/module_deepgemm_opus.soandaiter/jit/build/module_deepgemm_opusso it rebuilds (about 15 s). After that rebuild, all 37 shapes run throughtgemm.mmwith max relative error 7.1e-3 against an FP32 reference.PR Self-Review
Reviewed revision
4578a2febBehavior and intent
This adds 37 BF16 GEMM rows for gfx942 with 80 CUs under
aiter/configs/model_configs/: 24 OPUS rows and 13torchrows, with no hipBLASLt. With them, the large-M prefill GEMMs of Qwen3.8-Flash-Next at TP4 (MTP drafter, final HC mixer, PLE) use OPUS kernels where those beat torch, and stay on torch native elsewhere. Without them, these keys are not in any tuned table andtgemmfalls back totorch(aten::mm). No code changes.Validation and unverified scope
Validated:
atom-sglang:qwen38-flash-next-20261102-fullimage (aiter0c8a7a59c) with the OPUS module rebuilt,get_GEMM_A16W16_configreturns the new rows (for example(16384, 320, 10240)->opusopus_gemm_gfx942_512x128x128x64_2x4_16x16x16_0x0x0). All 37 shapes run throughtgemm.mmagainst an FP32 reference.Unverified:
main.cu_num=80.PR-specific question
The rows are consumed by exactly 37 keys:
(gfx942, 80, M, N, K, bias=False, bf16, bf16, scaleAB=False, bpreshuffle=False)for the (N, K) pairs and M buckets listed above. M is thegetPaddedMbucket, and lookup is an exact key match. None of the 37 keys exists in any BF16 tuned file onmain; this was checked againstconfigs/bf16_tuned_gemm.csvand everymodel_configs/*bf16_tuned_gemm*.csv. So every other shape keeps the solution it had before. The OPUS kernel ids used here also entermodule_deepgemm_opusthrough its--tune_filesglob.Changed op tests
None.
Related: ROCm/ATOM#2834, ROCm/ATOM#2847.