Skip to content

[Perf] [AMD] dsv4: optional e8m0 mxscale GEMM for dense 128x128 fp8 linears (6/8) - #44007

Merged
HaiShaw merged 8 commits into
sgl-project:mainfrom
HaiShaw:amd/dsv4-dense-fp8-mxscale
Oct 16, 2026
Merged

HaiShaw merged 8 commits into
sgl-project:mainfrom
HaiShaw:amd/dsv4-dense-fp8-mxscale

Conversation

@kkHuang-amd

@kkHuang-amd kkHuang-amd commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

DeepSeek-V4's dense block-fp8 weight scales are powers of two, so the dense linears can run on aiter's e8m0 mxscale bpreshuffle GEMM on gfx950, which is faster than the fp32-scale GEMM for a set of shapes.

Depends on: ROCm/aiter#5896 (in aiter main, needs the aiter pin bump in #44035).

Modifications

  • Whitelisted (N, K) dense linears get an e8m0 copy of their weight scale at load and run the e8m0 GEMM; other shapes and non-power-of-two scales stay on fp32 (SGLANG_DSV4_DENSE_MXSCALE, default off; SGLANG_DSV4_DENSE_MXSCALE_SHAPES, default built-in list).
  • Fused input_norm / q_norm producers emit ue8m0 scales when every consumer uses the e8m0 GEMM, so no launch is added.
  • Stays off with a warning when the installed aiter has no e8m0 bpreshuffle dispatch; tests skip there.

Accuracy Tests

GSM8K: main 0.953 -> 0.951 with SGLANG_DSV4_DENSE_MXSCALE=1 (aiter 02575f1c3a).

Speed Tests and Profiling

8K in / 1K out, DP8 attention + EAGLE, median ITL off -> on: c16 6.78 -> 6.68 ms (-1.5%), c64 9.80 -> 9.16 ms (-6.5%). Output throughput is within run-to-run noise (about 5%).

Co-authored-by: @AMD-yanfeiwang

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ⏳ Run #38880154756
Latest PR Test (Extra): ⏳ Run #38880154341
Latest PR Test (AMD ROCm 10): ⏳ Run #38880154739

Duyi-Wang and others added 2 commits October 13, 2026 05:31
… 128x128 fp8 linears

SGLANG_DSV4_DENSE_MXSCALE=1 (default off) routes the DeepSeek-V4 dense
block-fp8 linears (wqkv_a, wq_b, wo_b, indexer wq_b, DSpark main_proj, ...)
on gfx950 from the fp32-scale CK/asm/triton bpreshuffle GEMM to aiter's
e8m0 mxscale bpreshuffle GEMM (flydsl, dsv4 mxscale tuned rows).

- load: the (16,16)-preshuffled weight is shared; whitelisted (N, K)
  (SGLANG_DSV4_DENSE_MXSCALE_SHAPES, default = shapes that win in the
  cold-weight microbench) get an e8m0 copy of their power-of-two 128x128
  scale (N*K/16384 bytes); non-power-of-two scales stay on fp32.
- activations: ue8m0 per-1x128 quant (aiter per_group_quant_hip) inside the
  linear; the fused input_norm / q_norm producers switch to a Triton
  RMSNorm + ue8m0 quant kernel when every consumer runs the e8m0 GEMM, so
  no extra launch is added.
- fp32-scaled operands still take the fp32 GEMM; an e8m0 operand into a
  linear without an e8m0 scale raises.
Older aiter (e.g. the current e7d2453f pin) has no e8m0 dispatch in
gemm_a8w8_blockscale_bpreshuffle and silently treats the e8m0 bytes as fp32
scales. set_dense_mxscale() now keeps the fp32-scale GEMM with a warning when
the installed aiter lacks get_mxscale_bpreshuffle_config, and the unit test
skips there.
@Duyi-Wang Duyi-Wang removed the run-ci-extra CI: also run the extra suite (requires run-ci) label Oct 15, 2026
@kkHuang-amd kkHuang-amd added the run-ci-extra CI: also run the extra suite (requires run-ci) label Oct 15, 2026
@kkHuang-amd kkHuang-amd changed the title [AMD][DSV4][6/8] optional e8m0 mxscale GEMM for dense 128x128 fp8 linears [Perf] [AMD] dsv4: optional e8m0 mxscale GEMM for dense 128x128 fp8 linears (6/8) Oct 16, 2026

@HaiShaw HaiShaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIP, gfx95 specific

@HaiShaw
HaiShaw merged commit 42eb556 into sgl-project:main Oct 16, 2026
74 of 141 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

amd deepseek jit-kernel run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants