perf(glm52): batch TP4 prefill execution#759
Draft
xiaguan wants to merge 1 commit into
Draft
Conversation
Signed-off-by: JinYan Su <751080330@qq.com>
xiaguan
force-pushed
the
perf/glm52-tp4-prefill
branch
from
July 24, 2026 19:59
c8844dc to
fea9271
Compare
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.
Summary
Speed up the native GLM-5.2 FP8 TP4 prefill-only request path by batching routed-expert work and increasing the outer prefill tile from 32 to 512 rows.
The previous implementation launched the FP8 projection chain separately for every active expert. On a 1K prompt this made prefill roughly 24 seconds and dominated the entire request. This change:
This PR deliberately does not change startup loading. The remaining large performance gap is the padded 512-row MoE execution itself; closing it requires a deployable fused-MoE backend that can consume most or all of the 16K prefill chunk directly.
Performance
Single request, greedy one-token boundary output, concurrency 1, prefix-cache misses, 16K chunking, one 4×GB300 host. Values are mean TTFT.
The 1K path is 13.3× faster than the merged implementation. Moving from the validated 256-row point to 512 rows improved TTFT by another 4.9% at 1K, 5.8% at 4K, and 3.5% at 16K. A 1024-row experiment faulted and is not used.
The final 512-row startup preflight passes on all four ranks. Post-build free VRAM is 84.0 GiB per rank with
--max-model-len 131136and--glm52-prefill-chunk-size 16384.Nsight Systems attributes the remaining request GPU time primarily to FP8 CUTLASS GEMM (65.4%); NCCL is 9.0% and sparse attention is 1.0%. The new weighted reduction is about 0.3% of the request trace. A temporary 256×9-route microbenchmark measured 12.1 µs per launch; Nsight Compute measured 85.3% achieved occupancy. The temporary benchmark was not committed.
Validation
cargo build --release -p openinfer-server --features glm52cargo test -p openinfer-glm52 --lib— 78 passed, 17 ignoredcargo fmt --all -- --checkcargo clippy -p openinfer-kernels --features glm52 --lib -- -D warningsgit diff --checkAffected-crate strict Clippy still reports existing lints outside this diff in the GLM-5.2 crate (remote match arms, scheduler boolean parameters, and an existing topology match).