Add SGLang CUDA crash API logging inspired by FlashInfer#20910
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 |
merrymercy
requested changes
Mar 20, 2026
Collaborator
Author
|
/tag-and-rerun-ci |
merrymercy
requested changes
Mar 20, 2026
| @@ -0,0 +1,657 @@ | |||
| --- | |||
| name: debug-cuda-crash | |||
| description: Tutorial for debugging CUDA crashes in SGLang using kernel API logging | |||
Contributor
There was a problem hiding this comment.
This should be telling when to call the skill.
e.g.
description: Call this skill when you need debug CUDA crashes using kernel API logging.
| ): | ||
| return norm_infer_native(x, weight, bias, eps, is_rms_norm, out) | ||
|
|
||
| @maybe_wrap_jit_kernel_debug(op_name="jit_kernel.diffusion.triton.rms_norm_fn") |
Contributor
There was a problem hiding this comment.
why do we need to manually give it a name? It should be able to auto infer the op name
|
|
||
|
|
||
| @maybe_wrap_jit_kernel_debug( | ||
| op_name="jit_kernel.diffusion.triton.fuse_residual_layernorm_scale_shift_gate_select01_kernel" |
Contributor
There was a problem hiding this comment.
this is too tedious. The decorator should auto infer the name
| tl.store(out2_row + offsets2, out2, mask=mask2) | ||
|
|
||
|
|
||
| @debug_kernel_api(op_name="MiniMaxM2.rms_sumsq_serial") |
Contributor
There was a problem hiding this comment.
it should auto infer.
The decorator can look at the file name and function name.
Collaborator
Author
|
/tag-and-rerun-ci |
merrymercy
approved these changes
Mar 22, 2026
OrangeRedeng
pushed a commit
to OrangeRedeng/sglang
that referenced
this pull request
Mar 22, 2026
0-693
pushed a commit
to 0-693/sglang
that referenced
this pull request
Mar 25, 2026
dutsc
pushed a commit
to dutsc/sglang
that referenced
this pull request
Mar 30, 2026
JustinTong0323
pushed a commit
to JustinTong0323/sglang
that referenced
this pull request
Apr 7, 2026
yhyang201
pushed a commit
to yhyang201/sglang
that referenced
this pull request
Apr 22, 2026
empty-quiver
added a commit
to empty-quiver/sglang-turboquant
that referenced
this pull request
Apr 28, 2026
The patched __init__.py imports maybe_wrap_debug_kernel from sgl_kernel.debug_utils for the SGLANG_KERNEL_API_LOGLEVEL machinery. This file exists in upstream sgl-kernel feature branches (PR sgl-project#20910) but never landed on the kvcache-ai fork's main. The old PyPI-installed sglang-kt 0.6.1 image happened to bundle it; our source build does not. Drop a verbatim copy from PR sgl-project#20910 (BBuf/Xiaoyu Zhang) into the in-tree sgl-kernel source so the wheel we build packages it. Without this file the source-built sgl-kernel raises ModuleNotFoundError at import time.
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
This PR adds SGLang-native API-level CUDA crash logging for LLM and diffusion kernel call boundaries.
The implementation is inspired by FlashInfer's API logging utility:
https://github.com/flashinfer-ai/flashinfer/blob/main/flashinfer/api_logging.py
This version keeps the scope focused on crash debugging and level-10 dump capture. Replay-related code was intentionally not included so the implementation stays smaller and aligned with the actual SGLang debugging workflow.
Also add a skill to debug cuda crash like flashinfer.
Modifications
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci