Skip to content

feat(gemm): Muse Spark pooler gemm_n4096_k8192 at 24 m in 581-896 - #219

Merged
RuibinCheung merged 1 commit into
mainfrom
fanxingran/muse-gemm-pooler-2
Nov 18, 2026
Merged

RuibinCheung merged 1 commit into
mainfrom
fanxingran/muse-gemm-pooler-2

Conversation

@fanxingran

Copy link
Copy Markdown
Collaborator

Why

#110 added FlyDSL kernels for Muse Spark's MoE pooler (gemm_n4096_k8192) and unpooler (gemm_n8192_k4096), and #112 routes Muse's F.linear there. #110 covers only the pooler's small m, up to 248. At higher concurrency the pooler runs at m 581-1024, where AKLR has no kernel. This adds a second pooler schema for those m. It is the same kernel plus an m-fastest tile order.

Scope

Tradeoffs

The pooler and unpooler at m 192-576 were also tried on hipBLASLt solutions pinned by index through AITER's _hipb_mm. They are not in this PR. Such a kernel has no FlyDSL, and kernel.requires cannot name hipBLASLt (#168), so its measurements would not be tied to the library that produced them. The minimal change would be a hipblaslt toolchain that requires can pin. That is a separate PR.

Verification

Environment: head 09bfd06d; MI355X x8, lmsysorg/sglang:v0.5.22-rocm10-mi35x, ROCm 10.0 / HIP 7.15, torch 2.11, Triton 3.8.0, FlyDSL 0.3.2, AITER dbd8bf5 (CI's); also FlyDSL 0.3.4.1 (the image's) for the build check
Gate overrides: none (FLYDSL_RUNTIME_ENABLE_CACHE=0)

Kernels

python -m aklr validate --base origin/main --stages audit,bench on this head:

contract baseline measured accuracy (bound) speedup
gemm n4096 k8192 aiter.tuned_gemm.gemm_a16w16 24/24 24/24 1.053 – 1.123 (geomean 1.084)
  • The 24 m reached 1.05 in every run: three runs of the 54-m file (CI's FlyDSL 0.3.2, separate GPUs) and the run on this head.
  • With FlyDSL 0.3.4.1 the kernel also builds and passes accuracy at all 54 m; the 24 kept m measure 1.057 – 1.142.

Per m:

  • aiter and AKLR are this head's bench medians (CUDA graph, L2 flushed per call).
  • "vs aiter" is the published speedup (lower bound), then the three earlier runs.
  • F.linear, which vLLM runs there, is on the same timer, best of 3, with the kernel called directly.
  • Errors are against an fp64 product, with weights ~N(0, 1/k).
  • "nondet" counts outputs that differ bitwise over 10 repeat calls.
m aiter (us) AKLR (us) vs aiter earlier runs F.linear (us) AKLR, same timer (us) vs F.linear max err AKLR / F.linear / aiter nondet
581 64.6 58.4 1.104 1.100 / 1.104 / 1.100 58.5 57.5 1.02 0.0155 / 0.0155 / 0.0255 0
630 66.6 59.8 1.114 1.118 / 1.111 / 1.116 65.9 60.1 1.10 0.0154 / 0.0154 / 0.0258 0
632 67.1 59.7 1.123 1.115 / 1.115 / 1.120 64.8 60.3 1.07 0.0156 / 0.0156 / 0.0266 0
640 66.9 59.8 1.118 1.119 / 1.123 / 1.119 63.6 59.7 1.07 0.0156 / 0.0156 / 0.0268 0
728 64.4 59.9 1.074 1.064 / 1.062 / 1.068 65.6 60.2 1.09 0.0155 / 0.0155 / 0.0250 0
735 64.5 59.9 1.076 1.085 / 1.075 / 1.068 65.5 60.3 1.09 0.0155 / 0.0155 / 0.0301 0
742 65.1 60.7 1.072 1.075 / 1.071 / 1.078 66.3 60.8 1.09 0.0153 / 0.0153 / 0.0260 0
744 65.3 60.7 1.074 1.092 / 1.083 / 1.075 66.8 60.8 1.10 0.0156 / 0.0156 / 0.0298 0
752 66.1 61.0 1.083 1.137 / 1.142 / 1.084 66.9 61.2 1.09 0.0156 / 0.0156 / 0.0261 0
756 66.2 61.1 1.084 1.082 / 1.081 / 1.084 67.4 61.0 1.10 0.0154 / 0.0154 / 0.0256 0
763 66.9 61.1 1.095 1.092 / 1.095 / 1.094 67.9 61.9 1.10 0.0154 / 0.0154 / 0.0237 0
768 66.8 61.2 1.090 1.090 / 1.093 / 1.091 68.5 61.5 1.11 0.0156 / 0.0156 / 0.0255 0
826 66.0 60.3 1.093 1.056 / 1.055 / 1.075 66.5 60.1 1.11 0.0156 / 0.0156 / 0.0287 0
832 66.5 60.5 1.099 1.069 / 1.074 / 1.069 66.3 60.5 1.10 0.0156 / 0.0156 / 0.0297 0
861 66.1 62.1 1.063 1.053 / 1.061 / 1.056 64.5 61.2 1.05 0.0156 / 0.0156 / 0.0282 0
864 65.8 62.4 1.053 1.068 / 1.060 / 1.057 64.4 62.1 1.04 0.0156 / 0.0156 / 0.0288 0
872 67.3 63.0 1.068 1.063 / 1.067 / 1.066 64.5 62.3 1.04 0.0155 / 0.0155 / 0.0258 0
875 67.9 63.9 1.062 1.093 / 1.074 / 1.072 64.9 62.2 1.04 0.0156 / 0.0156 / 0.0247 0
880 68.2 63.5 1.075 1.070 / 1.073 / 1.071 64.8 62.5 1.04 0.0156 / 0.0156 / 0.0287 0
882 68.8 64.0 1.073 1.102 / 1.085 / 1.082 65.3 62.5 1.04 0.0155 / 0.0155 / 0.0235 0
888 68.6 63.2 1.085 1.076 / 1.079 / 1.077 65.2 62.8 1.04 0.0156 / 0.0156 / 0.0259 0
889 68.8 63.8 1.076 1.092 / 1.094 / 1.083 65.4 62.7 1.04 0.0156 / 0.0156 / 0.0264 0
893 69.5 63.5 1.092 1.078 / 1.076 / 1.080 65.4 63.0 1.04 0.0154 / 0.0154 / 0.0269 0
896 67.2 63.0 1.067 1.074 / 1.073 / 1.069 64.7 62.6 1.03 0.0156 / 0.0156 / 0.0298 0
  • Against F.linear: 1.02 – 1.11 (geomean 1.07). It is under 1.05 at m 581 and 864 – 896, where F.linear is within a few percent of AITER's time.
  • Numerics: at every m the kernel's max error and SQNR against fp64 equal F.linear's (55.6 dB), and its output is bitwise deterministic. AITER here gets 52.2 dB, with about 1.7x the max error.
  • Dispatch, through the gemm api with this head's measurements:
Validation log
$ python -m aklr validate --base origin/main --stages audit,bench --devices 0 aklr/ops/gemm/impls/flydsl/gemm_n4096_k8192/7a428a598c4bf79d.json
validate: 2026-11-16, head 09bfd06d8e66, base bd4c1778fba0, MI355X gfx950 x1
audit: passed, findings: 0, 0:00:01
bench: 2 batches (1 schemas), 24 workloads, 1 devices
bench: 1/2 passed flydsl/gemm_n4096_k8192/7a428a59: 12 wl, speedup 1.05x-1.10x, acc ok
bench: 2/2 passed flydsl/gemm_n4096_k8192/7a428a59: 12 wl, speedup 1.07x-1.12x, acc ok
bench:   outcome                         workloads
bench:   passed                                 24
bench:   speedup  best 1.12x, median 1.08x, worst 1.05x  (workloads with a speedup value)
bench:   accuracy FAIL 0, ok 24, not measured 0
bench: passed, findings: 0, 0:03:59
validation passed

Code

No code changes; a schema file only.

  • python -m aklr export check: passed.
  • pre-commit on the changed file: passed.
  • pytest tests/ops/test_contracts.py tests/plugins tests/ops/test_reference.py tests/core/runtime/test_dispatch.py -k "gemm or test_contracts or plugins or dispatch" (GPU): 221 passed, 19 skipped, identical to origin/main.

Not run

  • CI validation of this head (needs ci:gpu).
  • End to end: recommended, not required, for kernels of an existing op (docs/acceptance_criteria.md).

Risk

Affects: gemm_n4096_k8192 (Muse Spark's pooler) at the 24 listed m.
If wrong: wrong pooler output in Muse Spark's MoE at those m, or slower than AITER. m 861 and 864 measured 1.053 in one run each, so CI may put one under 1.05; that m is then not served.
Undo: [email protected], or git revert.

@kyle-256

Copy link
Copy Markdown
Collaborator

please rebase main

A second gemm_n4096_k8192 schema for the m the pooler runs at above 512: the padded
CUDA graph token counts of DSpark decode and mixed prefill steps at higher concurrency.
Same kernel as the existing schema plus an m-fastest tile order for "big" rows; m
513-1024 use a 128x256 tile, split-K 2 with the last-split fold, m-fastest, so the
tiles sharing a B column block run together on one XCD. Pins flydsl>=0.3.2.

Of 54 candidate m, the 24 that reach 1.05x over aiter in three bench runs are kept.
@zhenhuang12
zhenhuang12 force-pushed the fanxingran/muse-gemm-pooler-2 branch from 09bfd06 to cc629f7 Compare November 18, 2026 01:55
@RuibinCheung
RuibinCheung merged commit 802e058 into main Nov 18, 2026
17 checks passed

This branch was previously deployed

1 inactive deployment
gpu-trusted — cc629f73 Deployed Nov 18, 2026 by zhenhuang12 via prepare-gpu / prepare #1025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants