Skip to content

[GEMM][Qwen3.8] Tune TP2 MTP router with Opus and hipBLASLt - #13

Merged
sammysun0711 merged 2 commits into
qwen38-flash-next-devfrom
moe_router_gemm
Dec 1, 2026
Merged

sammysun0711 merged 2 commits into
qwen38-flash-next-devfrom
moe_router_gemm

Conversation

@apinge

@apinge apinge commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

With TP2 EAGLE/MTP steps=3, topk=1, draft_tokens=4, target verify executes four token rows per graph request slot. Concurrency up to 32 reaches router M72–128, where the existing BF16 router configs stop at M64 and dispatch falls back to Torch.

Add measured configs for the BF16 router projection (N=512, K=2560, gfx942 / 80 CU): Opus 10305 at M72/M80 and hipBLASLt solution 90312 at M88/M96/M104/M112/M120/M128. Preserve the existing Opus choices through M64.

Results

Paired HIP graph measurements on physical GPU2/GPU3, using the 48 actual checkpoint router weights and generated BF16 activations. Each GPU ran three BCCB/CBBC/BCCB rounds, six samples per backend, 100 replays per sample, and 48 GEMMs per graph. Values are the mean of the two GPU medians, in microseconds per complete tgemm.mm call.

Verify M Selected kernel Baseline µs Selected µs Improvement
72 Opus 10305 9.9212 5.4297 45.27%
80 Opus 10305 9.9503 5.4372 45.36%
88 hipBLASLt 90312 9.9812 8.0215 19.63%
96 hipBLASLt 90312 9.7794 7.9046 19.17%
104 hipBLASLt 90312 10.5719 8.0048 24.28%
112 hipBLASLt 90312 10.4458 8.0400 23.03%
120 hipBLASLt 90312 9.9881 8.0571 19.33%
128 hipBLASLt 90312 9.8073 7.9444 18.99%

All accepted changes improve in every round on both GPUs. The other 12 verify buckets retain their baseline Opus dispatch. The five WKC variants and the hipBLASLt candidate were evaluated across all 20 verify shapes; all 240 candidate/GPU/shape numerical checks passed against FP32 reference with rtol=0.02, atol=0.02 and finite outputs.

Coverage and validation

  • 56 exact-M baseline guard rows protect the other integers in M65–128 from padded-M lookup. Their timing/error/performance fields are empty because they preserve baseline rather than record a benchmark.
  • Normal default-loader audit of M1–256: exactly the eight measured M change; the other 248 retain baseline backend/solution.
  • python3 -m unittest op_tests.tuning_tests.test_config_shape_collision -v: 14 tests passed.
  • The committed reproduction CLI was checked on M72/M128 through normal CSV loading; Black and Ruff checks passed.
  • Includes the measured model configuration and a standalone checkpoint-weight graph benchmark. Detailed documentation and raw benchmark data are archived outside this PR.

Measured on MI308X gfx942 / 80 CU, PyTorch 2.12.0+rocm7.14.0.git6bbd260, HIP 7.14.60850, libhipblaslt.so.1.4. Solution 90312 is tied to this tested library; revalidate IDs when changing hipBLASLt. The upstream checkout was used as a solution-search tool, while final comparisons and configs use this fork.

These are router operator measurements. Full serving TPOT has not been measured, and the 48-router graph omits the attention, expert and communication work between layers. BF16 outputs are tolerance-equivalent rather than guaranteed bit-identical.

Reproduce

The benchmark now requires explicit --baseline-csv and --candidate-csv paths. From the repository root, extract the baseline config from the tested base commit and combine it with the new router table:

git show 1cf62092f39fac89d9cdf54e2dc8978cbb4591f2:aiter/configs/model_configs/qwen3_8_flash_next_tp2_decode_bf16_tuned_gemm.csv > /tmp/qwen38_router_baseline.csv
HIP_VISIBLE_DEVICES=2,3 CUDA_VISIBLE_DEVICES=2,3 \
PYTHONPATH="$PWD" GPU_ARCHS=gfx942 \
python3 op_tests/bench_qwen38_mtp_router_gemm.py \
  --model-path /path/to/Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16 \
  --baseline-csv /tmp/qwen38_router_baseline.csv \
  --candidate-csv "/tmp/qwen38_router_baseline.csv:aiter/configs/model_configs/qwen3_8_flash_next_tp2_mtp_router_bf16_tuned_gemm.csv" \
  --rounds 3 --replays 100 --output /tmp/qwen38_router_graph.json

@apinge
apinge requested a review from sammysun0711 November 26, 2026 02:07
@apinge
apinge marked this pull request as draft November 26, 2026 02:08
@sammysun0711

sammysun0711 commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

PR #13 test update - Qwen3.8 Flash TP2, 12K input, concurrency 1 on PTL MI308X

This PR focus on TP2 MTP with MOE Router,
shared sglang base: (PR #117, compare with AITER PR PR12 Qwen3.8 TP2 Base and MTP Performance and Accuracy within run-to-run variance.

Results

The reference columns use the Each change compares the local run with its corresponding reference mode. Latency metrics are in milliseconds. Accuracy changes are in percentage points.

Metric PR12 Base PR13 Change PR12 MTP PR13 Change
GSM8K score 98.5% 98.5% 0.0 pp 97.5% 98.5% +1.0 pp
Mean time to first token (TTFT) 516.560 Unreported — 546.631 554.71 +1.5%
Median TTFT 513.294 518.79 +1.1% 544.859 546.35 +0.3%
Mean time per output token (TPOT) 6.745 6.63 −1.7% 3.130 3.18 +1.6%
Mean end-to-end latency per request 2,870.487 2,834.30 −1.3% 1,638.901 1,663.36 +1.5%
Output throughput (tokens/s) 121.897 123.43 +1.3% 213.464 210.32 −1.5%
Request throughput (requests/s) 0.3483 0.3526 +1.3% 0.6099 0.6009 −1.5%
Mean speculative accept length — — — 3.519 3.54 +0.6%

Single FP8 hipblaslt gemm with concurrency 32, target verify M=32 * 4 (Qlen) = 128.
Screenshot 2026-12-01 200501

Single targets verify path use 36 layers, each layer use run 1 gemm for MOE gate, average latency is 7.776us:
image

It is consistent with tuning table:

Verify M Selected kernel Baseline µs Selected µs Improvement
128 hipBLASLt 90312 9.8073 7.9444 18.99%

@sammysun0711
sammysun0711 merged commit 0882d4f into qwen38-flash-next-dev Dec 1, 2026
1 check failed
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.

2 participants