bugfix: fix padded decode cuda graph metadata.#1939
Merged
zhang-minchao merged 2 commits intoJul 14, 2026
Conversation
- align persistent sequence capacity with graph token buckets - pad FlashInfer decode metadata consistently in fast and fallback paths - cover 100-to-112 capture and replay behavior
- apply the decode no-padding policy to persistent sequence capacity - keep prefill graph bucket padding enabled - cover 100-token no-padding capture and replay
XuZhang99
approved these changes
Jul 14, 2026
JimHsiung
approved these changes
Jul 14, 2026
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.
Description
Native C++ decode CUDA graphs normally pad the token/query batch to reusable graph buckets. With
max_seqs_per_batch=100, padding mode executes a 112-row graph. Before this fix, FlashInfer decode metadata still described only the 100 real sequences, so capture could complete but replay could access metadata out of bounds and surface a CUDA illegal-memory-access error (or a later NCCL failure under TP2).This was previously hidden when
enable_graph_mode_decode_no_padding=true: decode used the exact runtime batch size and never entered the100 -> 112padding path. This PR now supports both modes explicitly and aligns the CUDA bucket policy withAclGraphExecutorImpl:100 -> 100);100 -> 112);0, and settingpaged_kv_last_page_lento1;-1, soreshape_paged_cacheskips them instead of writing to real slot0;100 -> 112, no-padding decode100 -> 100, and prefill piecewise graphs with the decode no-padding flag enabled.The FlashInfer plan/decode invocation itself is unchanged. Padding and persistent graph inputs remain owned by
CudaGraphExecutorImpl.Related Issues
None.
Change Type
Pull Request Checklist
Thank you for contributing to xLLM. Before requesting review, please make sure the following items are complete.
PR Title and Commit Messages
<type>: <subject>.Pre-commit Checks
pre-commitby runningpip install pre-commitor an equivalent command.pre-commit install.pre-commit run --all-filesand fixed any reported issues.Self Review
.agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.mainbranch.Build and Test Coverage
python setup.py build testhas passed on a CUDA machine.python setup.py build testhas passed on an NPU machine.python setup.py build testhas passed on an MLU machine.CUDA validation was run inside
zmc-xllm-cuda-x86:python setup.py test --test-name cuda_graph_executor_test: 11/11 tests passed;python setup.py test: 684/684 executed tests passed (2 randomized fused-sampler tests skipped; disabled tests were not run).Real C++ graph service sweeps also passed at TP1 and TP2 for batches
1 2 3 5 7 8 13 16 31 47 100, with input length 1024 and output length 256. Both service configurations enabled:enable_graph=true;enable_graph_vmm_pool=true;enable_prefill_piecewise_graph=true;max_tokens_for_graph_mode=1024.The full sweep passed in both decode modes:
enable_graph_mode_decode_no_padding=false, including100 -> 112;enable_graph_mode_decode_no_padding=true, including exact batch 100.No CUDA illegal-memory-access or in-request NCCL failure occurred. The TP2 no-padding log contains a TCPStore heartbeat warning only after the completed sweep, when the test harness intentionally stopped rank 0 before rank 1.
Reviewer Notes
Please focus review on:
enable_graph_mode_decode_no_padding;The service runs used idle GPUs at test start, but latency measurements are not used as performance conclusions.