Skip to content

feat(gemm_a8w8_blockscale_bpreshuffle): cold-cache retune triton routing for DeepSeek MLA decode-M#4264

Merged
valarLip merged 1 commit into
mainfrom
cold-cache-triton-routing-mla-a8w8
Jul 16, 2026
Merged

feat(gemm_a8w8_blockscale_bpreshuffle): cold-cache retune triton routing for DeepSeek MLA decode-M#4264
valarLip merged 1 commit into
mainfrom
cold-cache-triton-routing-mla-a8w8

Conversation

@valarLip

Copy link
Copy Markdown
Collaborator

Summary

Cold-cache re-tune of the a8w8 blockscale B-preshuffle GEMM triton routing for
DeepSeek MLA decode-M shapes on gfx950 (MI355X), plus a test harness that can
actually measure triton, and a units fix in the tuned CSVs.

The routing decisions in #4202 were made with an in-process timing harness that
wrapped the call in a no-arg lambda, which defeats perftest's arg-rotation
cache-busting → every iteration hit a hot L2 → optimistic numbers and, worse,
cold-cache-suboptimal configs. This PR re-measures everything cache-rotated
(tensors passed positionally so perftest rotates the weights) and validates every
change end-to-end through the op-test dispatch.

Changes

1. op_tests/test_gemm_a8w8_blockscale.py — measure triton

  • Add a run_triton path + triton us/TFLOPS/TB/s/err and triton/ck columns so
    the harness times triton alongside ck (dispatch) and asm. Previously triton was
    never exercised unless a CSV row already routed to it.
  • Remove the -m choices=[...] allowlist so arbitrary decode M (e.g. 48, 80) can be
    benchmarked; the default M list is unchanged.
  • Triton column fails loud (no try/except swallow) like the ck/asm columns; when
    ck_preshuffle=False the triton columns are simply omitted (pandas NaN-fills).

2. wqkv_a (N=2048, K=7168) — fix #4202 regression

The #4202 triton configs for wqkv_a were hot-cache tuned (BLOCK_SIZE_M=4/8,
NUM_KSPLIT=4) and are slower than asm cold-cache (13–16µs vs ~10–13µs) — i.e.
#4202 was a regression on this shape as-shipped. Re-tuned cold-cache
(BLOCK_SIZE_M=16, NUM_KSPLIT=8, num_stages=3) → triton now wins 9–16% at
M≤32, and routing extended to M∈{1,2,4,8,16,32,48,64,80,128} (all err=0).

3. wo_b (N=7168) — new triton routing

wo_b was not in #4202. RowParallelLinear(o_groups·o_lora_rank=16384, dim=7168):

  • tp1 (K=16384): route M≤64 → triton (M≤32 win 11–15%, M=64 tie, err=0).
  • tp4 (K=4096): route M=1..32 → triton (win 9–28%); new tuned JSON added.
  • tp8 (K=2048): unchanged — triton loses (shallow K, ck/asm already optimal).

Pattern: triton's split-K advantage scales with K depth (tp1 > tp4 > tp8).

4. Tuned CSVs — unify bw column to TB/s

The bw column mixed units: asm/ck/cktile rows in GB/s (~600–4400), triton rows in
TB/s (~1–5). Converted all asm/ck/cktile rows to TB/s so the column is internally
consistent. us (which drives routing/dedup) and tflops were already consistent.

Not changed (verified correct cold-cache)

Test plan

  • Every routed shape re-run through op_tests/test_gemm_a8w8_blockscale.py
    --ck_preshuffle 1; dispatch (ck column) now runs triton for routed M with
    err=0 and matches the standalone triton column.
  • Config lookup (get_CKGEMM_config) confirms libtype per M for every shape.
  • CSV merge still loads (no duplicate (gfx,cu_num,M,N,K) keys).
  • CI: Standard + Triton on MI35X.

…ing for DeepSeek MLA decode-M

Re-measure a8w8 blockscale B-preshuffle triton routing cache-rotated (the #4202
tuning used a no-arg lambda that defeated perftest arg-rotation -> hot-cache
optimistic + suboptimal configs), and validate end-to-end via the op-test.

- op-test: add run_triton + triton columns; drop -m choices allowlist; fail-loud
- wqkv_a (N=2048,K=7168): fix #4202 hot-cache regression (BM4/8,KSPLIT4 -> BM16,
  KSPLIT8,stages3); route M in {1,2,4,8,16,32,48,64,80,128}, all err=0
- wo_b (N=7168): new routing tp1 K=16384 M<=64, tp4 K=4096 M<=32 (+new JSON);
  tp8 K=2048 unchanged (triton loses on shallow K)
- tuned CSVs: unify bw column to TB/s (asm/ck/cktile rows were GB/s)
- wq_b unchanged: #4202 routing verified correct cold-cache
@valarLip
valarLip requested a review from a team July 16, 2026 14:45
@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 4264 --add-label <label>

@valarLip
valarLip merged commit 45ef6f3 into main Jul 16, 2026
32 checks passed
@valarLip
valarLip deleted the cold-cache-triton-routing-mla-a8w8 branch July 16, 2026 15:25
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.

1 participant