Repository navigation
Conversation
somuai
requested review from
hanming-lu,
hebiao064,
yizhang2077 and
yuan-luo
as code owners
November 5, 2026 16:40
4 of 5 tasks
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
Fixes #48593
When attempting to capture full prefill CUDA graphs (
--cuda-graph-config '{"prefill": {"backend": "full"}}') for hybrid linear attention models (e.g., Mamba2, GDN, KDA, NemotronH, GraniteMoe), the engine crashes during capture initialization with:Root Cause
cuda_graph_setup.py,PrefillCudaGraphRunnerrunscapture()beforeDecodeCudaGraphRunneris constructed.self.state_indices_listis only allocated and populated insideinit_cuda_graph_state(), which is called exclusively byDecodeCudaGraphRunner.PrefillCudaGraphRunnernever callsinit_cuda_graph_state().python/sglang/srt/arg_groups/cuda_graph_hook.py,disable_full_prefill_cudagraph_if_incompatible()had an empty rule list (rules = []), so hybrid linear attention models were never filtered out during configuration compatibility resolution.--cuda-graph-config '{"prefill": {"backend": "full"}}',validate_cuda_graph_config()did not check architecture compatibility.Modifications
python/sglang/srt/arg_groups/cuda_graph_hook.py:disable_full_prefill_cudagraph_if_incompatible()to checkmambaish_config(model_config_of(server_args)). When detected during compatibility resolution, it logs a warning and disables the prefill CUDA graph.validate_cuda_graph_config(): if an operator explicitly locks full prefill CUDA graph on a hybrid linear attention model, it raises a descriptiveValueErrorbefore engine capture begins.python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py:_replay_metadata()to verifystate_indices_listbounds, raising an explicitRuntimeErrorif an uninitialized replay is ever invoked.test/registered/unit/server_args/test_server_args.py:TestHybridLinearPrefillCudaGraphPolicycovering:Accuracy Tests
N/A: Configuration validation and runtime defensive bounds checks; no alterations to model tensor outputs or numeric kernels.
Speed Tests and Profiling
N/A: Prevents initialization crash during full prefill CUDA graph capture.
Checklist
CI States
Latest PR Test (Base): ❌ Run #42066902800
Latest PR Test (Extra): ❌ Run #42066902358
Latest PR Test (AMD ROCm 10): ❌ Run #42066902499
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: