Repository navigation
[Perf] [AMD] GLM5.3: Add opt-in PTPC FP8 KDA projections on gfx950 - #38764
Open
Raiden-Makoto wants to merge 1 commit into
Open
Raiden-Makoto wants to merge 1 commit into
Raiden-Makoto wants to merge 1 commit into
Conversation
4 of 5 tasks
Raiden-Makoto
force-pushed
the
RM/glm53-flash-kda-ptpc
branch
3 times, most recently
from
September 11, 2026 21:02
b0b8c59 to
9cb10f8
Compare
Raiden-Makoto
force-pushed
the
RM/glm53-flash-kda-ptpc
branch
7 times, most recently
from
September 14, 2026 18:09
6fe5ca3 to
8b27e6d
Compare
Raiden-Makoto
marked this pull request as ready for review
September 15, 2026 17:27
Raiden-Makoto
requested review from
Alisehen,
AniZpZ,
BBuf,
DarkSharpness,
Edwardf0t1,
FlamingoPg,
HaiShaw,
OrangeRedeng,
b8zhong,
celve,
ch-wan,
hebiao064,
mmangkad,
yizhang2077 and
yuan-luo
as code owners
September 15, 2026 17:27
JackChuang
added a commit
to JackChuang/sglang
that referenced
this pull request
Oct 27, 2026
sgl-project#38764 (AMD gfx950) adds this name for the same switch: the same module names and the same rule that qkv_proj, f_a_proj and g_a_proj go together. One name gives users and the cookbook one switch on both vendors.
Contributor
|
please rerun failed CI @Raiden-Makoto |
Raiden-Makoto
force-pushed
the
RM/glm53-flash-kda-ptpc
branch
from
October 27, 2026 16:04
1d33eed to
c8c963c
Compare
Contributor
Author
|
/tag-and-rerun-ci |
1 similar comment
Contributor
Author
|
/tag-and-rerun-ci |
Contributor
Author
|
Please prioritize merging this PR ASAP. It has been open for nearly two months, and I cannot keep resolving new conflicts against main every few days because it is still waiting to be merged. |
Raiden-Makoto
added a commit
to Raiden-Makoto/squidward
that referenced
this pull request
Nov 2, 2026
Port sgl-project#44416's HIP gate/top-k onto sgl-project#44994's TopK.routing_inputs(), keep sgl-project#41615's aiter_sparse_mla routing beside the ROCm DCP path, keep sgl-project#44659's HIP guard and sgl-project#38764's conv tuning, and take main's fp32 correction-bias routing that supersedes sgl-project#44415's copy.
This was referenced Nov 17, 2026
Contributor
Author
|
Please prioritize merging this PR ASAP. It has been open for over two months, and I cannot keep resolving new conflicts against main every few days because it is still waiting to be merged. |
This was referenced Nov 24, 2026
HaiShaw
reviewed
Nov 28, 2026
HaiShaw
left a comment
Collaborator
There was a problem hiding this comment.
@Raiden-Makoto conflict to solve
Add an opt-in gfx950 per-token/per-channel FP8 path for GLM-5.3 KDA projections. Preserve fused BF16 decode and fallback behavior, use no-copy packed qkv/f/g outputs for measured prefill windows, and fuse gated RMSNorm with output quantization.
Raiden-Makoto
force-pushed
the
RM/glm53-flash-kda-ptpc
branch
from
November 28, 2026 18:43
c8c963c to
3a27f4a
Compare
Contributor
Author
|
|
Open
5 tasks done
Collaborator
|
/approve-ci |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
GLM-5.3-Flash keeps its KDA qkv, low-rank f/g, beta, and output projections in BF16. The PTPC path repacks selected weights to per-channel FP8 and quantizes activations per token, but
o_projpreviously required a separate BF16 gated RMSNorm output followed by a standalone quantization kernel.This change adds an opt-in no-copy packed PTPC prefill path while preserving the upstream fused BF16 projection modules for decode. Prefill uses one FP8
[qkv | f_a | g_a]GEMM plus BF16 beta and passes qkv/beta/fg directly to their consumers without reconstructing the fused output; decode remains one fused GEMM.Modifications
SGLANG_OPT_GLM53_KDA_PTPC_MODULESselector and reject it unless AITER is active on gfx950.UnquantizedLinearMethodtensor-in/tensor-out for every other model and backend.fused_qkvbfg_a_projandfused_bfg_a_projconstruction instead of unfusing projections when PTPC is selected.[qkv | f_a | g_a]into one FP8 weight, quantizehidden_statesonce, and return qkv/beta/fg views directly without a full-width output concatenation.M=4096-16384, TP8M=8192-16384.ValueErrorinstead of a bare lookup failure.o_proj.Enable with:
Accuracy Tests
Focused validation passed 17 CPU contracts and 3 gfx950 projection tests. Coverage includes TP4/TP8 no-copy packed projection shapes, decode BF16 parity, prefill PTPC numerics, selector/backend failures, supported-layout errors, crossover boundaries, retained BF16 weights, finite outputs, and CUDA-graph capture.
Full GLM-5.3-Flash TP8 GSM8K on snapshot
03eb5366286afd40d2221b1d9c63a6dd1ba4832e: 1,319 examples, 1,200 evaluator threads, 4,096 maximum output tokens, thinking enabled, temperature 1.0, top-p 0.95, sampling seed unset.qkv_proj,f_a_proj,g_a_proj,o_projSpeed Tests and Profiling
Environment:
gfx950)rocm/sgl-dev:v0.5.19-rocm724-mi35x-20260910zai-org/GLM-5.3-Flash, snapshot03eb5366286afd40d2221b1d9c63a6dd1ba4832ee8a2d9d2abNo-copy packed first-stage latency
Real GLM-5.3-Flash checkpoint weights. Decode compares the same fused BF16 GEMM with the selector unset/set; prefill compares fused BF16 against one packed qkv/f/g PTPC GEMM plus BF16 beta, returning views without fused-output reconstruction.
Decode retains one fused BF16 projection launch. Shapes outside the enabled prefill window stay on fused BF16.
Fused o-path latency
Complete path is gated RMSNorm plus output projection. The candidate replaces the BF16 norm output and standalone quantization with the fused bridge:
Every enabled TP/M cell beat the complete BF16 path. TP4 keeps BF16 below 256 tokens because intermediate small-batch shapes were neutral or slower.
End-to-end serving
GLM-5.3-Flash snapshot
03eb5366286afd40d2221b1d9c63a6dd1ba4832e, TP4, random 8K input / 1K output. Both arms use the same source and differ only by the PTPC selector.A. BF16 fused projections — selector unset:
B. No-copy packed PTPC —
qkv_proj,f_a_proj,g_a_proj,o_proj(delta versus BF16 fused projections):No-copy packed PTPC improves TTFT by 2.18-2.38%, ITL by 0.05-0.57%, E2E latency by 0.20-0.96%, and output throughput by 0.20-0.92% across the complete TP4 matrix.
TP8 end-to-end serving
GLM-5.3-Flash TP8, 131,072 context, random 8K input / 1K output. The first concurrency-4 run in each repetition is the warmup; the tables average the two measured runs per concurrency. Both arms use source
05fcea11c0and differ only by the PTPC selector.A. BF16 fused projections — selector unset:
B. No-copy packed PTPC —
qkv_proj,f_a_proj,g_a_proj,o_proj(delta versus BF16 fused projections):No-copy packed PTPC improves TP8 TTFT by 0.37-1.01%, ITL by 0.19-0.63%, E2E latency by 0.24-0.74%, and output throughput by 0.24-0.75% across the complete matrix.
Checklist
Scoped syntax, isort, Ruff, Ruff format, codespell, registered-test validation, and
git diff --checkpass.CI States
Latest PR Test (Base): ❌ Run #46177366084
Latest PR Test (Extra): ⊘ Skipped -- add the
run-ci-nv-extralabel to opt in.Latest PR Test (AMD ROCm 10): ❌ Run #46177367642
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: