[DeepGemm] Add a flag for fast warmup#18111
Conversation
Summary of ChangesHello @Fridge003, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new configuration option to optimize the DeepGEMM kernel precompilation process. By enabling a 'fast warmup' flag, users can significantly reduce the initial startup time of the system, which is particularly beneficial for development or testing environments where quick iteration is desired. While this optimization comes with a potential compromise in peak runtime performance, it offers a valuable trade-off for specific use cases, allowing for quicker system readiness at the cost of potential runtime efficiency. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new flag SGLANG_JIT_DEEPGEMM_FAST_WARMUP to significantly reduce the warmup time for DeepGEMM by precompiling a smaller, sampled set of kernels. The changes include adding the environment variable, updating documentation, and implementing the fast warmup logic. The implementation is mostly correct, but I have a couple of suggestions to improve robustness and user experience. I've also noted a minor documentation fix for other environment variables. Overall, this is a valuable addition for improving developer iteration speed.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/tag-and-rerun-ci |
|
/tag-and-rerun-ci |
## Background When deploying DeepSeek-V4-Flash with TP>=2 and CUDA graph enabled, the server fails to start due to NCCL timeout. The root cause: 1. During CUDA graph capture warmup, Rank 0 blocks for minutes compiling all M values (1..16384) via DeepGEMM JIT, while other ranks finish their GEMM quickly and wait at all-reduce. 2. NCCL has a default 30-minute timeout. With the full M list, Rank 0 compilation takes 5-10+ minutes per kernel type, easily exceeding the timeout when 6 kernel types are compiled sequentially. Without CUDA graph, single-request decode TPOT is ~133ms/tok regardless of context length (kernel launch overhead dominates). With CUDA graph, single-request decode TPOT drops to ~22ms/tok (~6x improvement). So enabling CUDA graph is critical for decode performance. ## What FAST_WARMUP does Ported from main branch (PR sgl-project#18111), this feature reduces the M list from ~16384 to ~2560 values: - M=1..1024: all compiled (covers decode batch sizes completely) - M=1025..max_prefill_bs: logarithmic sampling (step doubles each range) e.g. step 2 for [1024,2048), step 4 for [2048,4096), etc. This reduces Rank 0 compilation time from ~5-10min to ~90s, avoiding the NCCL timeout. Total cold start with CUDA graph: ~5.5min. Tradeoff: some prefill M values may not be pre-compiled, causing one-time JIT delay on first encounter. Decode is unaffected since all M<=1024 are always compiled. ## Changes - compile_utils.py: Add _FAST_WARMUP path in update_deep_gemm_config() with sampled M list generation; add nullcontext/is_musa imports; refactor deep_gemm_execution_hook to plain function returning context manager (MUSA compat); add hasattr guards for get_compile_mode/set_compile_mode (older DeepGEMM compat); defer _BUILTIN_M_LIST init to update_deep_gemm_config() - environ.py: Add SGLANG_JIT_DEEPGEMM_FAST_WARMUP (EnvBool, default False) and SGLANG_DEEPGEMM_SANITY_CHECK (EnvBool, default False) - entrypoint.py: Use envs.SGLANG_DEEPGEMM_SANITY_CHECK instead of get_bool_env_var; add ENABLE_JIT_DEEPGEMM guard in configure_deep_gemm_num_sms ## Usage SGLANG_JIT_DEEPGEMM_FAST_WARMUP=True python3 -m sglang.launch_server \ --model-path <model> --tp-size 4 --moe-runner-backend deep_gemm ... Signed-off-by: ruying.bupt <yingru@baidu.com>
Motivation
Add a flag
SGLANG_JIT_DEEPGEMM_FAST_WARMUP, which reduce the number of kernels to precompile during warmupModifications
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci