Introduce CUDA graph debug mode with breakable CUDA graph#19102
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Collaborator
Author
|
/tag-and-rerun-ci |
ch-wan
reviewed
Feb 21, 2026
Collaborator
ch-wan
left a comment
There was a problem hiding this comment.
Left some minor comments. Also, can we also apply --debug-cuda-graph to piecewise cuda graph?
BBuf
reviewed
Mar 20, 2026
BBuf
reviewed
Mar 20, 2026
BBuf
reviewed
Mar 20, 2026
Collaborator
|
Can #20910 solve the debug issue you encountered? |
5 tasks
- Fix shared mutable ContextVar default ([] -> None) to prevent cross-context leaks - Fix structured output writeback with _copy_output for dataclasses/dicts/tensors - Fix replay no-break path using destroyed graph handle (last_graph -> last_graph_exec) - Add thread-safe wait_stream hook with lock + refcount - Add graph exec cleanup in __del__ to prevent GPU resource leaks - Add HIP/ROCm guards in server_args and cuda_graph_runner - Add clear error messages for missing cuda-python and incompatible modes - Rename non_graph -> eager_on_graph, BreakableCUDAGraphContext -> BreakableCUDAGraphCapture - Add __init__.py for breakable_cuda_graph package - Add unit tests (11 tests covering capture/replay, breaks, _copy_output, break_graph) - Add documentation (docs/advanced_features/breakable_cuda_graph.md) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pyc96
pushed a commit
to pyc96/sglang
that referenced
this pull request
Apr 14, 2026
…t#19102) Co-authored-by: Cheng Wan <54331508+ch-wan@users.noreply.github.com> Co-authored-by: Cheng Wan <chwan@rice.edu> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
yhyang201
pushed a commit
to yhyang201/sglang
that referenced
this pull request
Apr 22, 2026
…t#19102) Co-authored-by: Cheng Wan <54331508+ch-wan@users.noreply.github.com> Co-authored-by: Cheng Wan <chwan@rice.edu>
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.
Introduce Breakable CUDA Graph — a lightweight mechanism to insert graph breaks into CUDA graph capture. Marked operations run eagerly between captured graph segments, while the rest stays graph-captured.
CUDA graph debug mode
# Debug mode: all ops run eagerly through graph capture/replay path python -m sglang.launch_server --model meta-llama/Llama-3-8B --debug-cuda-graphBreakable CUDA graph
when enable
SGLANG_USE_BREAKABLE_CUDA_GRAPH, the decode graph is breakable. The overhead is minimal if no graph break inserted.