[Bugfix] Make GLM-5.3 kpool metadata graph-safe without prefix caching - #7
Conversation
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: andyluo7 <andy.luo@amd.com>
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: andyluo7 <andy.luo@amd.com>
|
/ci run |
|
Verified on 8× MI350X (gfx950): this fixes the CUDA-graph fault, and it is worth a lot more than a bugfix — graph-mode decode is 3.3× the eager throughput. You noted "CUDA graph-mode serving was not independently rerun". That is the exact configuration that was failing on our box (reported in vllm-project#53943), so here is that run. Setup: I removed a local kpool-warmup experiment of my own before this run, so the result is attributable to your two files alone. Fault: gone. Throughput (8 fixed short English prompts,
All requests completed in every run, zero faults, zero empty generations. Median latency at N=64 drops from 87.3 s to 26.1 s. Saturation is still Correctness spot checks after the load runs, both Two things worth noting for whoever picks this up:
Happy to re-run anything here, including GSM8K under graphs if an accuracy check alongside the perf number would help the review. |
Our own first inference died with CUDA_ERROR_ILLEGAL_ADDRESS (700) at DeepGEMM's handle.hpp:154, inside fp8_fp4_mqa_logits, reached from sparse_attn_indexer_kpool.py:523 by way of glm5next/nvidia/attention.py:392. Engine core dead, container restarting, on a fifteen-token prompt. It is a known defect in PR vllm-project#53906, reported on SM90 and confirmed on our exact configuration -- SM100 (B200), TP=4 -- and the reporter states these two commits resolve it there. Root cause per the PR: MambaHybridModelState's prepare_attn() does not forward input positions, so the kpool-tail metadata builder cannot construct the circular slot mapping; and the corrected mapping is returned from a temporary clone whose address full graph replay retains after the temporary is freed. The second is the illegal access. Pure Python -- four files, two of them tests, no CUDA -- so the image rebuild reuses every compiled layer. Note a discrepancy worth keeping: the B200 reporter describes the trigger as a KV cache exceeding index_topk=2048 tokens, with shorter prompts serving correctly. Ours crashed on fifteen tokens. The PR's own explanation is prompt-length independent, so read the threshold as that reporter's observation rather than the condition. Claude-Session: https://claude.ai/code/session_019Z67JT37vJqhsn7yMhJNv2
Purpose
This is a focused follow-up to vllm-project#53906 and the ROCm work
tracked in vllm-project#53943.
GLM-5.3-Flash uses
MambaHybridModelStatetogether with a one-block circularkpool tail. With prefix caching disabled, two shared metadata issues prevent
reliable graph execution on both CUDA and ROCm:
MambaHybridModelState.prepare_attn()does not forward the input positions,so the kpool-tail metadata builder cannot construct the circular slot
mapping.
graph replay retains that tensor address after the temporary tensor is
released, which can produce an illegal memory access.
This PR forwards positions and gives
KpoolTailMetadataBuilderpersistent,builder-owned output storage. It does not change attention kernels or platform
dispatch. The implementation is backend-neutral because both CUDA and ROCm use
the same kpool-tail metadata builder.
This does not duplicate another open PR. Searches for issue 53943, GLM-5.3
graph/kpool/positions, and kpool cudagraph fixes found no existing submission.
This change was prepared with OpenAI Codex assistance. The submitted diff and
validation evidence were reviewed by the human submitter before publication.
Test Plan
Hardware validation used 8x AMD Instinct MI355X (
gfx950), TP8, AITER,Triton MoE,
CUDAGraphMode.FULL_AND_PIECEWISE, disabled prefix caching, and arandom exact-1024-input/exact-1024-output workload with ignore-EOS enabled.
The regression tests exercise the shared metadata behavior, but CUDA graph-mode
serving was not independently rerun as part of this validation.
Test Result
14 passed, 3 skipped.tok/s, 13.558 ms mean TPOT.
total tok/s, 18.929 ms mean TPOT.
OOMs, engine deaths, HTTP 500s, tracebacks, retries, or JIT activity occurred
during either measured window.
The benchmark used base commit
142062f13d16bed254b5d97cc3d371fbd4f7790aplus exactly the two commits inthis PR.
Essential Elements of an Effective PR Description Checklist
issue.