Conversation
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Zheng Cai <8370601+zigzagcai@users.noreply.github.com>
4 tasks
Owner
|
short context optimization is not very useful |
Author
Hi @ZJY0516 Thank you for your reply! I understand that short context scenarios are not very useful, but it just fills in the gaps in the benefits of short context scenarios on NV (I see there already exist short context path for AMD) and has some benefit in |
Author
|
Update: I close the PR #11, since this optmization is limited to short context length, which is not very useful in real-world scenarios. |
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.
[Kernel][Perf] Skip GLM-5.3 sparse indexing for short contexts
Purpose
GLM-5.3-Flash uses a 2,048-token sparse-attention index budget. When the full
causal context is at most 2,048 tokens, sparse scoring selects every token and
the paged-MQA logits, top-k, and pool-expansion work is unnecessary.
This change:
ROCm;
stride-aware Triton causal-index fill; and
This is a three-file performance delta stacked on vllm-project#53906. It targets
ZJY0516/vllm:glm-release, whose head is the exact parent of this PR at36bb3795b258e1b773cee5c2b725d9b8346b0c8d. It can therefore be reviewed andtested independently while vllm-project#53906 remains open. After vllm-project#53906 lands, this
commit can be rebased and retargeted to upstream
mainwithout carrying themodel-support diff.
Trace and kernel evidence
The baseline GLM sparse-indexer trace contains paged-MQA logits, persistent
top-k, pool/tail expansion, and metadata kernels even when every causal token
fits in the 2,048-token budget. A focused torch profile shows that the legacy
causal fill itself launches five CUDA kernels; the candidate launches one.
H200, PyTorch 2.13.0+cu130, CUPTI 13.3.1, CUDA graph timing, cold L2, seeded
inputs, preallocated outputs, and alternating arm order:
Reproduce with:
After rebasing to the current vllm-project#53906 head, the focused suite still reported 10
passed and mypy passed. A fresh H200 run measured 7.59x, 7.00x, 6.85x, and
6.60x speedups for 1, 96, 512, and 1,536 rows respectively.
Matched serving A/B
Configuration: 4x H200, TP4, MTP-5, BF16 KV cache, CUDA graphs, 8,192 max
batched tokens, 512 input / 256 output, concurrency 16, 32 requests,
temperature=0, andignore_eos. Each arm used one excluded stabilizer and 10measured runs. All 640 measured requests succeeded without illegal memory
access.
MTP acceptance correlates with throughput in both arms. An OLS ablation that
controls for acceptance rate still estimates a +6.145% throughput effect
(
p=0.00550). The adjusted TPOT effect is not significant, so throughput isthe primary claim and no independent TPOT improvement is claimed.
Correctness and model evaluation
The CUDA test covers widths below, equal to, and above one 2,048-element tile,
as well as non-contiguous row and position strides. CPU tests continue to cover
the exact short-context predicate and sparse-context fallback.
The shortcut changes floating-point reduction order by returning ascending
causal indices instead of relevance-ordered indices, so a model evaluation was
run rather than assuming output identity. Using vLLM's GSM8K evaluator with
200 questions, 5-shot prompting, greedy sampling, 256 max output tokens, and
concurrency 16:
Commands run:
Duplicate-work check
Open-PR searches were refreshed on 2026-08-30 in both
vllm-project/vllmandZJY0516/vllmforGLM-5.3 sparse indexer,short context sparse indexer,causal indices Triton, andNVIDIA causal index fill. No exact duplicate was found.There is no linked issue, so an issue-number lookup and the corresponding
<issue_number> in:bodysearch are not applicable.shortcut but does not enable or fuse the NVIDIA path.
removes short-context decode scoring and fuses causal-index materialization;
the execution regimes and implementations are distinct.
ZJY0516/vllm[Bugfix] Make GLM-5.3 kpool metadata graph-safe without prefix caching #7 fixes kpool graph-metadata lifetime, and [Bugfix] Reject invalid GLM kpool indices #8 rejects invalidkpool indices. [Bugfix] Reject invalid GLM kpool indices #8 touches the same implementation file but does not alter the
short-context predicate or causal fill; both fixes are orthogonal.
AI assistance and human accountability
AI assistance was used for profiling, implementation, benchmarking, tests,
statistical analysis, and drafting this description.
understands the implementation and evidence, and can defend the change end
to end.
reported tests, serving A/B, and model evaluation artifacts.
The PR should be rebased and retargeted to upstream
mainafter vllm-project#53906 lands.